From e955d64ebf6182264527d235439025b985d34664 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Mon, 31 Aug 2015 23:19:35 +0300 Subject: [PATCH] lmdb: made mdb_load compatible with mdb_dump. Ignores 'duplicates=' and 'db_pagesize=', drops 'duplicates=' from mdb_dump and mdb_chk. Change-Id: I295d19c8382fee1d5779b047aec5220788e5dd9c --- mdb_chk.c | 2 -- mdb_dump.c | 3 --- mdb_load.c | 6 +++++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mdb_chk.c b/mdb_chk.c index 228bf133..42734c8d 100644 --- a/mdb_chk.c +++ b/mdb_chk.c @@ -366,8 +366,6 @@ static int process_db(MDB_dbi dbi, char *name, visitor *handler, int silent) if (! flags) print(" none"); else { - /* if (flags & MDB_DUPSORT) - print(" duplicates"); */ for (i=0; dbflags[i].bit; i++) if (flags & dbflags[i].bit) print(" %s", dbflags[i].name); diff --git a/mdb_dump.c b/mdb_dump.c index 66908ff5..118b746d 100644 --- a/mdb_dump.c +++ b/mdb_dump.c @@ -120,9 +120,6 @@ static int dumpit(MDB_txn *txn, MDB_dbi dbi, char *name) printf("mapaddr=%p\n", info.me_mapaddr); printf("maxreaders=%u\n", info.me_maxreaders); - if (flags & MDB_DUPSORT) - printf("duplicates=1\n"); - for (i=0; dbflags[i].bit; i++) if (flags & dbflags[i].bit) printf("%s=1\n", dbflags[i].name); diff --git a/mdb_load.c b/mdb_load.c index bb18232a..5cbbd0d5 100644 --- a/mdb_load.c +++ b/mdb_load.c @@ -70,7 +70,11 @@ static void readhdr(void) while (fgets(dbuf.mv_data, dbuf.mv_size, stdin) != NULL) { lineno++; - if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) { + if (!strncmp(dbuf.mv_data, "db_pagesize=", STRLENOF("db_pagesize=")) + || !strncmp(dbuf.mv_data, "duplicates=", STRLENOF("duplicates="))) { + /* LY: silently ignore information fields. */ + continue; + } else if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) { version=atoi((char *)dbuf.mv_data+STRLENOF("VERSION=")); if (version > 3) { fprintf(stderr, "%s: line %" Z "d: unsupported VERSION %d\n",