printf(
" Page size: %u\n",
ms->ms_psize);
31printf(
" Tree depth: %u\n",
ms->ms_depth);
32printf(
" Branch pages: %"Z"u\n",
ms->ms_branch_pages);
33printf(
" Leaf pages: %"Z"u\n",
ms->ms_leaf_pages);
34printf(
" Overflow pages: %"Z"u\n",
ms->ms_overflow_pages);
35printf(
" Entries: %"Z"u\n",
ms->ms_entries);
40fprintf(stderr,
"usage: %s [-V] [-n] [-e] [-r[r]] [-f[f[f]]] [-a|-s subdb] dbpath\n",
prog);
44 int main(
intargc,
char*argv[])
52 char*
prog= argv[0];
55 intalldbs = 0, envinfo = 0, envflags = 0, freinfo = 0, rdrinfo = 0;
70 while((
i=
getopt(argc, argv,
"Vaefnrs:")) != EOF) {
109fprintf(stderr,
"mdb_env_create failed, error %d %s\n", rc,
mdb_strerror(rc));
119fprintf(stderr,
"mdb_env_open failed, error %d %s\n", rc,
mdb_strerror(rc));
126printf(
"Environment Info\n");
127printf(
" Map address: %p\n", mei.
me_mapaddr);
129printf(
" Page size: %u\n", mst.
ms_psize);
131printf(
" Number of pages used: %"Z"u\n", mei.
me_last_pgno+1);
134printf(
" Number of readers used: %u\n", mei.
me_numreaders);
138printf(
"Reader Table Status\n");
143printf(
" %d stale readers cleared.\n", dead);
146 if(!(
subname|| alldbs || freinfo))
152fprintf(stderr,
"mdb_txn_begin failed, error %d %s\n", rc,
mdb_strerror(rc));
159 size_tpages = 0, *iptr;
161printf(
"Freelist Status\n");
165fprintf(stderr,
"mdb_cursor_open failed, error %d %s\n", rc,
mdb_strerror(rc));
170fprintf(stderr,
"mdb_stat failed, error %d %s\n", rc,
mdb_strerror(rc));
175iptr =
data.mv_data;
182 for(
i= j,
prev= 1; --
i>= 0; ) {
185bad =
" [bad sequence]";
188 for(;
i>= span && iptr[
i-span] == pg; span++, pg++) ;
190printf(
" Transaction %"Z"u, %"Z"d pages, maxspan %"Z"d%s\n",
191*(
size_t*)
key.mv_data, j, span, bad);
193 for(--j; j >= 0; ) {
195 for(span=1; --j >= 0 && iptr[j] == pg+span; span++) ;
196printf(span>1 ?
" %9"Z"u[%"Z"d]\n":
" %9"Z"u\n",
203printf(
" Free pages: %"Z"u\n", pages);
208fprintf(stderr,
"mdb_open failed, error %d %s\n", rc,
mdb_strerror(rc));
214fprintf(stderr,
"mdb_stat failed, error %d %s\n", rc,
mdb_strerror(rc));
226fprintf(stderr,
"mdb_cursor_open failed, error %d %s\n", rc,
mdb_strerror(rc));
232 if(memchr(
key.mv_data,
'\0',
key.mv_size))
235memcpy(
str,
key.mv_data,
key.mv_size);
236 str[
key.mv_size] =
'\0';
239printf(
"Status of %s\n",
str);
244fprintf(stderr,
"mdb_stat failed, error %d %s\n", rc,
mdb_strerror(rc));
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * str(char *buf, int n)
#define MDB_VERSION_STRING
The full library version as a C string.
#define MDB_NOTFOUND
key/data pair not found (EOF)
#define MDB_SUCCESS
Successful result.
int() MDB_msg_func(const char *msg, void *ctx)
A callback function used to print a message from the library.
int mdb_env_info(MDB_env *env, MDB_envinfo *stat)
Return information about the LMDB environment.
int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode)
Open an environment handle.
int mdb_reader_check(MDB_env *env, int *dead)
Check for stale entries in the reader lock table.
void mdb_env_close(MDB_env *env)
Close the environment and release the memory map.
int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data, MDB_cursor_op op)
Retrieve by cursor.
void mdb_txn_abort(MDB_txn *txn)
Abandon all the operations of the transaction instead of saving them.
int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx)
Dump the entries in the reader lock table.
char * mdb_strerror(int err)
Return a string describing a given error code.
int mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor)
Create a cursor handle.
int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs)
Set the maximum number of named databases for the environment.
int mdb_env_create(MDB_env **env)
Create an LMDB environment handle.
#define mdb_open(txn, name, flags, dbi)
Compat with version <= 0.9.4, avoid clash with libmdb from MDB Tools project.
#define mdb_close(env, dbi)
Compat with version <= 0.9.4, avoid clash with libmdb from MDB Tools project.
void mdb_cursor_close(MDB_cursor *cursor)
Close a cursor handle.
int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn)
Create a transaction for use with the environment.
int mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *stat)
Retrieve statistics for a database.
int mdb_env_stat(MDB_env *env, MDB_stat *stat)
Return statistics about the LMDB environment.
@ MDB_NEXT_NODUP
Position at first data item of next key.
@ MDB_NEXT
Position at next data item.
#define MDB_NOSUBDIR
no environment directory
#define MDB_RDONLY
read only
unsigned int me_maxreaders
max reader slots in the environment
size_t me_mapsize
Size of the data memory map.
size_t me_last_txnid
ID of the last committed transaction.
unsigned int ms_psize
Size of a database page.
void * me_mapaddr
Address of map, if fixed.
unsigned int me_numreaders
max reader slots used in the environment
size_t me_last_pgno
ID of the last used page.
unsigned int MDB_dbi
A handle for an individual database in the DB environment.
int main(int argc, char *argv[])
static void prstat(MDB_stat *ms)
static void usage(char *prog)
static void env_close(MDB_env *env) noexcept
static void txn_abort(MDB_txn *txn) noexcept
const struct ncbi::grid::netcache::search::fields::KEY key
static SLJIT_INLINE sljit_ins ms(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Cursors are used for all DB operations.
The database environment.
Information about the environment.
Statistics for a database in the environment.
Generic structure used for passing keys and data in and out of the database.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4