diff --git a/mdbx.h b/mdbx.h index 90c1564c..b1da10a6 100644 --- a/mdbx.h +++ b/mdbx.h @@ -421,7 +421,7 @@ typedef enum MDB_cursor_op { /* Statistics for a database in the environment */ typedef struct MDBX_stat { unsigned ms_psize; /* Size of a database page. - This is currently the + This is currently the same for all databases. */ unsigned ms_depth; /* Depth (height) of the B-tree */ size_t ms_branch_pages; /* Number of internal (non-leaf) pages */ @@ -1184,8 +1184,8 @@ LIBMDBX_API int mdbx_dbi_open(MDB_txn *txn, const char *name, unsigned flags, * errors are: * - EINVAL - an invalid parameter was specified. */ -LIBMDBX_API int mdbx_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *stat, - size_t bytes); +LIBMDBX_API int mdbx_dbi_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *stat, + size_t bytes); /* Retrieve the DB flags for a database handle. * diff --git a/src/mdbx.c b/src/mdbx.c index fb3af0ed..bc503c2a 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -8700,7 +8700,7 @@ int __cold mdbx_env_get_fd(MDB_env *env, mdbx_filehandle_t *arg) { return MDB_SUCCESS; } -/** Common code for #mdbx_stat() and #mdbx_env_stat(). +/** Common code for #mdbx_dbi_stat() and #mdbx_env_stat(). * @param[in] env the environment to operate in. * @param[in] db the #MDB_db record containing the stats to return. * @param[out] arg the address of an #MDB_stat structure to receive the stats. @@ -8925,7 +8925,8 @@ int mdbx_dbi_open(MDB_txn *txn, const char *name, unsigned flags, return rc; } -int __cold mdbx_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *arg, size_t bytes) { +int __cold mdbx_dbi_stat(MDB_txn *txn, MDB_dbi dbi, MDBX_stat *arg, + size_t bytes) { if (unlikely(!arg || !txn)) return EINVAL; diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index 5122bedb..1aaaaff2 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -442,9 +442,9 @@ static int process_db(MDB_dbi dbi, char *name, visitor *handler, int silent) { return rc; } - rc = mdbx_stat(txn, dbi, &ms, sizeof(ms)); + rc = mdbx_dbi_stat(txn, dbi, &ms, sizeof(ms)); if (rc) { - error(" - mdbx_stat failed, error %d %s\n", rc, mdbx_strerror(rc)); + error(" - mdbx_dbi_stat failed, error %d %s\n", rc, mdbx_strerror(rc)); return rc; } diff --git a/src/tools/mdbx_dump.c b/src/tools/mdbx_dump.c index 79680fcb..c217c503 100644 --- a/src/tools/mdbx_dump.c +++ b/src/tools/mdbx_dump.c @@ -96,7 +96,7 @@ static int dumpit(MDB_txn *txn, MDB_dbi dbi, char *name) { if (rc) return rc; - rc = mdbx_stat(txn, dbi, &ms, sizeof(ms)); + rc = mdbx_dbi_stat(txn, dbi, &ms, sizeof(ms)); if (rc) return rc; diff --git a/src/tools/mdbx_stat.c b/src/tools/mdbx_stat.c index fb920a13..565d58bb 100644 --- a/src/tools/mdbx_stat.c +++ b/src/tools/mdbx_stat.c @@ -170,9 +170,10 @@ int main(int argc, char *argv[]) { mdbx_strerror(rc)); goto txn_abort; } - rc = mdbx_stat(txn, dbi, &mst, sizeof(mst)); + rc = mdbx_dbi_stat(txn, dbi, &mst, sizeof(mst)); if (rc) { - fprintf(stderr, "mdbx_stat failed, error %d %s\n", rc, mdbx_strerror(rc)); + fprintf(stderr, "mdbx_dbi_stat failed, error %d %s\n", rc, + mdbx_strerror(rc)); goto txn_abort; } prstat(&mst); @@ -248,9 +249,10 @@ int main(int argc, char *argv[]) { goto txn_abort; } - rc = mdbx_stat(txn, dbi, &mst, sizeof(mst)); + rc = mdbx_dbi_stat(txn, dbi, &mst, sizeof(mst)); if (rc) { - fprintf(stderr, "mdbx_stat failed, error %d %s\n", rc, mdbx_strerror(rc)); + fprintf(stderr, "mdbx_dbi_stat failed, error %d %s\n", rc, + mdbx_strerror(rc)); goto txn_abort; } printf("Status of %s\n", subname ? subname : "Main DB"); @@ -280,9 +282,9 @@ int main(int argc, char *argv[]) { free(str); if (rc) continue; - rc = mdbx_stat(txn, db2, &mst, sizeof(mst)); + rc = mdbx_dbi_stat(txn, db2, &mst, sizeof(mst)); if (rc) { - fprintf(stderr, "mdbx_stat failed, error %d %s\n", rc, + fprintf(stderr, "mdbx_dbi_stat failed, error %d %s\n", rc, mdbx_strerror(rc)); goto txn_abort; } diff --git a/test/test6.c b/test/test6.c index 6f14ce4e..e9d6dd3c 100644 --- a/test/test6.c +++ b/test/test6.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) { E(mdbx_drop(txn, dbi, 1)); E(mdbx_dbi_open(txn, "id6", MDB_CREATE | MDB_INTEGERKEY, &dbi)); E(mdbx_cursor_open(txn, dbi, &cursor)); - E(mdbx_stat(txn, dbi, &mst, sizeof(mst))); + E(mdbx_dbi_stat(txn, dbi, &mst, sizeof(mst))); sval = calloc(1, mst.ms_psize / 4); key.mv_size = sizeof(long); diff --git a/test/test_yota1.c b/test/test_yota1.c index 28744185..7d036f0f 100644 --- a/test/test_yota1.c +++ b/test/test_yota1.c @@ -203,7 +203,7 @@ static void get_db_stat(const char *db, int64_t *ms_branch_pages, LMDB_CHECK(mdbx_txn_begin(env, NULL, MDB_RDONLY, &txn)); LMDB_CHECK(mdbx_dbi_open(txn, db, MDB_CREATE, &dbi)); - LMDB_CHECK(mdbx_stat(txn, dbi, &stat, sizeof(stat))); + LMDB_CHECK(mdbx_dbi_stat(txn, dbi, &stat, sizeof(stat))); mdbx_txn_abort(txn); printf("%15s | %15ld | %5u | %10ld | %10ld | %11ld |\n", db, stat.ms_branch_pages, stat.ms_depth, stat.ms_entries, diff --git a/test/test_yota2.c b/test/test_yota2.c index 84cb0479..79c72880 100644 --- a/test/test_yota2.c +++ b/test/test_yota2.c @@ -230,7 +230,7 @@ static void get_db_stat(const char *db, int64_t *ms_branch_pages, LMDB_CHECK(mdbx_txn_begin(env, NULL, MDB_RDONLY, &txn)); LMDB_CHECK(mdbx_dbi_open(txn, db, MDB_CREATE, &dbi)); - LMDB_CHECK(mdbx_stat(txn, dbi, &stat, sizeof(stat))); + LMDB_CHECK(mdbx_dbi_stat(txn, dbi, &stat, sizeof(stat))); mdbx_txn_abort(txn); printf("%15s | %15ld | %5u | %10ld | %10ld | %11ld |\n", db, stat.ms_branch_pages, stat.ms_depth, stat.ms_entries,