if (!env || !func)
return -1;
if (!env->me_txns) {
- return func("No reader locks\n", ctx);
+ return func("(no reader locks)\n", ctx);
}
rdrs = env->me_numreaders;
mr = env->me_txns->mti_readers;
return rc;
}
}
+ if (first) {
+ func("(no active readers)\n", ctx);
+ }
return 0;
}
/** @} */
static void usage(char *prog)
{
- fprintf(stderr, "usage: %s dbpath [-e] [-f[f[f]]] [-n] [-a|-s subdb] [-r]\n", prog);
+ fprintf(stderr, "usage: %s dbpath [-n] [-e] [-r] | [-f[f[f]]] [-a|-s subdb]\n", prog);
exit(EXIT_FAILURE);
}
* -s: print stat of only the named subDB
* -e: print env info
* -f: print freelist info
+ * -r: print reader info
* -n: use NOSUBDIR flag on env_open
* (default) print stat of only the main DB
*/
printf("mdb_env_open failed, error %d %s\n", rc, mdb_strerror(rc));
goto env_close;
}
- rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
- if (rc) {
- printf("mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
- goto env_close;
- }
if (envinfo) {
rc = mdb_env_stat(env, &mst);
if (rdrinfo) {
printf("Reader Table Status\n");
rc = mdb_reader_list(env, (MDB_msg_func *)fputs, stdout);
+ if (!(subname || alldbs || freinfo))
+ goto env_close;
+ }
+
+ rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
+ if (rc) {
+ printf("mdb_txn_begin failed, error %d %s\n", rc, mdb_strerror(rc));
+ goto env_close;
}
if (freinfo) {