mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 11:29:19 +08:00
mdbx-tools: cleanup tools from deprecated API.
Change-Id: Id1c64edfa7a470ad76f0499d1f58ec482458f8d6
This commit is contained in:
parent
d83de5bd09
commit
ed9d1a1542
@ -8112,7 +8112,7 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, const int lck_rc) {
|
||||
|
||||
if (!env->me_dbgeo.now) {
|
||||
/* set defaults if not configured */
|
||||
err = mdbx_env_set_mapsize(env, DEFAULT_MAPSIZE);
|
||||
err = mdbx_env_set_geometry(env, 0, -1, DEFAULT_MAPSIZE, -1, -1, -1);
|
||||
if (unlikely(err != MDBX_SUCCESS))
|
||||
return err;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ static int dumpit(MDBX_txn *txn, MDBX_dbi dbi, char *name) {
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
rc = mdbx_env_info(mdbx_txn_env(txn), &info, sizeof(info));
|
||||
rc = mdbx_env_info_ex(mdbx_txn_env(txn), txn, &info, sizeof(info));
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@ -124,7 +124,7 @@ static int dumpit(MDBX_txn *txn, MDBX_dbi dbi, char *name) {
|
||||
if (name)
|
||||
printf("database=%s\n", name);
|
||||
printf("type=btree\n");
|
||||
printf("mapsize=%" PRIu64 "\n", info.mi_mapsize);
|
||||
printf("mapsize=%" PRIu64 "\n", info.mi_geo.upper);
|
||||
printf("maxreaders=%u\n", info.mi_maxreaders);
|
||||
|
||||
for (i = 0; dbflags[i].bit; i++)
|
||||
|
@ -442,7 +442,13 @@ int main(int argc, char *argv[]) {
|
||||
mdbx_strerror(MDBX_TOO_LARGE));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mdbx_env_set_mapsize(env, (size_t)envinfo.mi_mapsize);
|
||||
rc = mdbx_env_set_geometry(env, 0, -1, (size_t)envinfo.mi_mapsize, -1, -1,
|
||||
-1);
|
||||
if (rc) {
|
||||
fprintf(stderr, "mdbx_env_set_geometry failed, error %d %s\n", rc,
|
||||
mdbx_strerror(rc));
|
||||
goto env_close;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MDBX_FIXEDMAP
|
||||
@ -457,7 +463,7 @@ int main(int argc, char *argv[]) {
|
||||
goto env_close;
|
||||
}
|
||||
|
||||
kbuf.iov_len = mdbx_env_get_maxkeysize(env);
|
||||
kbuf.iov_len = mdbx_env_get_maxvalsize_ex(env, MDBX_DUPSORT);
|
||||
if (kbuf.iov_len >= SIZE_MAX / 4) {
|
||||
fprintf(stderr, "mdbx_env_get_maxkeysize failed, returns %zu\n",
|
||||
kbuf.iov_len);
|
||||
|
@ -186,15 +186,22 @@ int main(int argc, char *argv[]) {
|
||||
goto env_close;
|
||||
}
|
||||
|
||||
rc = mdbx_txn_begin(env, NULL, MDBX_RDONLY, &txn);
|
||||
if (rc) {
|
||||
fprintf(stderr, "mdbx_txn_begin failed, error %d %s\n", rc,
|
||||
mdbx_strerror(rc));
|
||||
goto env_close;
|
||||
}
|
||||
|
||||
if (envinfo || freinfo) {
|
||||
(void)mdbx_env_info(env, &mei, sizeof(mei));
|
||||
(void)mdbx_env_info_ex(env, txn, &mei, sizeof(mei));
|
||||
} else {
|
||||
/* LY: zap warnings from gcc */
|
||||
memset(&mei, 0, sizeof(mei));
|
||||
}
|
||||
|
||||
if (envinfo) {
|
||||
(void)mdbx_env_stat(env, &mst, sizeof(mst));
|
||||
(void)mdbx_env_stat_ex(env, txn, &mst, sizeof(mst));
|
||||
printf("Environment Info\n");
|
||||
printf(" Pagesize: %u\n", mst.ms_psize);
|
||||
if (mei.mi_geo.lower != mei.mi_geo.upper) {
|
||||
@ -249,13 +256,6 @@ int main(int argc, char *argv[]) {
|
||||
goto env_close;
|
||||
}
|
||||
|
||||
rc = mdbx_txn_begin(env, NULL, MDBX_RDONLY, &txn);
|
||||
if (rc) {
|
||||
fprintf(stderr, "mdbx_txn_begin failed, error %d %s\n", rc,
|
||||
mdbx_strerror(rc));
|
||||
goto env_close;
|
||||
}
|
||||
|
||||
if (freinfo) {
|
||||
MDBX_cursor *cursor;
|
||||
MDBX_val key, data;
|
||||
|
Loading…
Reference in New Issue
Block a user