Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package lmdb for openSUSE:Factory checked in at 2021-03-10 08:46:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lmdb (Old) and /work/SRC/openSUSE:Factory/.lmdb.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lmdb" Wed Mar 10 08:46:28 2021 rev:17 rq:876445 version:0.9.28 Changes: -------- --- /work/SRC/openSUSE:Factory/lmdb/lmdb.changes 2020-03-27 21:56:01.918748587 +0100 +++ /work/SRC/openSUSE:Factory/.lmdb.new.2378/lmdb.changes 2021-03-10 08:46:32.950225939 +0100 @@ -1,0 +2,14 @@ +Wed Mar 03 01:34:52 UTC 2021 - Wang Jun <jgw...@suse.com> + +- LMDB 0.9.28 Release (2021/02/04) + * ITS#8662 add -a append option to mdb_load +- LMDB 0.9.27 Release (2020/10/26) + * ITS#9376 fix repeated DUPSORT cursor deletes +- LMDB 0.9.26 Release (2020/08/11) + * ITS#9278 fix robust mutex cleanup for FreeBSD +- LMDB 0.9.25 Release (2020/01/30) + * ITS#9068 fix mdb_dump/load backslashes in printable content + * ITS#9118 add MAP_NOSYNC for FreeBSD + * ITS#9155 free mt_spill_pgs in non-nested txn on end + +------------------------------------------------------------------- Old: ---- LMDB_0.9.24.tar.gz New: ---- LMDB_0.9.28.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lmdb.spec ++++++ --- /var/tmp/diff_new_pack.V3iIXo/_old 2021-03-10 08:46:34.046227070 +0100 +++ /var/tmp/diff_new_pack.V3iIXo/_new 2021-03-10 08:46:34.046227070 +0100 @@ -1,7 +1,7 @@ # # spec file for package lmdb # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,10 +20,10 @@ Summary: Lightning Memory-Mapped Database Manager License: OLDAP-2.8 Group: Productivity/Databases/Tools -%define lname liblmdb-0_9_24 -Version: 0.9.24 +%define lname liblmdb-0_9_28 +Version: 0.9.28 Release: 0 -Url: https://symas.com/mdb/ +URL: https://symas.com/mdb/ #Git-Clone: git://git.openldap.org/openldap mdb.master Source: https://github.com/LMDB/lmdb/archive/LMDB_%version.tar.gz ++++++ LMDB_0.9.24.tar.gz -> LMDB_0.9.28.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/CHANGES new/lmdb-LMDB_0.9.28/libraries/liblmdb/CHANGES --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/CHANGES 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/CHANGES 2021-02-04 21:46:33.000000000 +0100 @@ -1,5 +1,19 @@ LMDB 0.9 Change Log +LMDB 0.9.28 Release (2021/02/04) + ITS#8662 add -a append option to mdb_load + +LMDB 0.9.27 Release (2020/10/26) + ITS#9376 fix repeated DUPSORT cursor deletes + +LMDB 0.9.26 Release (2020/08/11) + ITS#9278 fix robust mutex cleanup for FreeBSD + +LMDB 0.9.25 Release (2020/01/30) + ITS#9068 fix mdb_dump/load backslashes in printable content + ITS#9118 add MAP_NOSYNC for FreeBSD + ITS#9155 free mt_spill_pgs in non-nested txn on end + LMDB 0.9.24 Release (2019/07/24) ITS#8969 Tweak mdb_page_split ITS#8975 WIN32 fix writemap set_mapsize crash diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/COPYRIGHT new/lmdb-LMDB_0.9.28/libraries/liblmdb/COPYRIGHT --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/COPYRIGHT 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/COPYRIGHT 2021-02-04 21:46:33.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright 2011-2019 Howard Chu, Symas Corp. +Copyright 2011-2021 Howard Chu, Symas Corp. All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/intro.doc new/lmdb-LMDB_0.9.28/libraries/liblmdb/intro.doc --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/intro.doc 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/intro.doc 2021-02-04 21:46:33.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright 2015-2018 Howard Chu, Symas Corp. + * Copyright 2015-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/lmdb.h new/lmdb-LMDB_0.9.28/libraries/liblmdb/lmdb.h --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/lmdb.h 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/lmdb.h 2021-02-04 21:46:33.000000000 +0100 @@ -135,7 +135,7 @@ * * @author Howard Chu, Symas Corporation. * - * @copyright Copyright 2011-2019 Howard Chu, Symas Corp. All rights reserved. + * @copyright Copyright 2011-2021 Howard Chu, Symas Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP @@ -200,7 +200,7 @@ /** Library minor version */ #define MDB_VERSION_MINOR 9 /** Library patch version */ -#define MDB_VERSION_PATCH 24 +#define MDB_VERSION_PATCH 28 /** Combine args a,b,c into a single integer for easy version comparisons */ #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c)) @@ -210,7 +210,7 @@ MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH) /** The release date of this library version */ -#define MDB_VERSION_DATE "July 24, 2019" +#define MDB_VERSION_DATE "February 4, 2020" /** A stringifier for the version info */ #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb.c 2021-02-04 21:46:33.000000000 +0100 @@ -5,7 +5,7 @@ * BerkeleyDB API, but much simplified. */ /* - * Copyright 2011-2019 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -124,7 +124,10 @@ #include <resolv.h> /* defines BYTE_ORDER on HPUX and Solaris */ #endif -#if defined(__APPLE__) || defined (BSD) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) && defined(__FreeBSD_version) && __FreeBSD_version >= 1100110 +# define MDB_USE_POSIX_MUTEX 1 +# define MDB_USE_ROBUST 1 +#elif defined(__APPLE__) || defined (BSD) || defined(__FreeBSD_kernel__) # define MDB_USE_POSIX_SEM 1 # define MDB_FDATASYNC fsync #elif defined(ANDROID) @@ -1375,7 +1378,7 @@ static int mdb_env_read_header(MDB_env *env, MDB_meta *meta); static MDB_meta *mdb_env_pick_meta(const MDB_env *env); static int mdb_env_write_meta(MDB_txn *txn); -#ifdef MDB_USE_POSIX_MUTEX /* Drop unused excl arg */ +#if defined(MDB_USE_POSIX_MUTEX) && !defined(MDB_ROBUST_SUPPORTED) /* Drop unused excl arg */ # define mdb_env_close0(env, excl) mdb_env_close1(env) #endif static void mdb_env_close0(MDB_env *env, int excl); @@ -3027,9 +3030,9 @@ txn->mt_parent->mt_flags &= ~MDB_TXN_HAS_CHILD; env->me_pgstate = ((MDB_ntxn *)txn)->mnt_pgstate; mdb_midl_free(txn->mt_free_pgs); - mdb_midl_free(txn->mt_spill_pgs); free(txn->mt_u.dirty_list); } + mdb_midl_free(txn->mt_spill_pgs); mdb_midl_free(pghead); } @@ -4010,13 +4013,18 @@ if (rc) return rc; #else + int mmap_flags = MAP_SHARED; int prot = PROT_READ; +#ifdef MAP_NOSYNC /* Used on FreeBSD */ + if (flags & MDB_NOSYNC) + mmap_flags |= MAP_NOSYNC; +#endif if (flags & MDB_WRITEMAP) { prot |= PROT_WRITE; if (ftruncate(env->me_fd, env->me_mapsize) < 0) return ErrCode(); } - env->me_map = mmap(addr, env->me_mapsize, prot, MAP_SHARED, + env->me_map = mmap(addr, env->me_mapsize, prot, mmap_flags, env->me_fd, 0); if (env->me_map == MAP_FAILED) { env->me_map = NULL; @@ -5128,6 +5136,17 @@ sem_unlink(env->me_txns->mti_wmname); } } +#elif defined(MDB_ROBUST_SUPPORTED) + /* If we have the filelock: If we are the + * only remaining user, clean up robust + * mutexes. + */ + if (excl == 0) + mdb_env_excl_lock(env, &excl); + if (excl > 0) { + pthread_mutex_destroy(env->me_txns->mti_rmutex); + pthread_mutex_destroy(env->me_txns->mti_wmutex); + } #endif munmap((void *)env->me_txns, (env->me_maxreaders-1)*sizeof(MDB_reader)+sizeof(MDB_txninfo)); } @@ -5923,16 +5942,12 @@ if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); - } - if (data) { + rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); + if (rc != MDB_SUCCESS) + return rc; + } else if (data) { if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; - - if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { - rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); - if (rc != MDB_SUCCESS) - return rc; - } } MDB_GET_KEY(leaf, key); @@ -5956,7 +5971,8 @@ mp = mc->mc_pg[mc->mc_top]; - if (mc->mc_db->md_flags & MDB_DUPSORT) { + if ((mc->mc_db->md_flags & MDB_DUPSORT) && + mc->mc_ki[mc->mc_top] < NUMKEYS(mp)) { leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (op == MDB_PREV || op == MDB_PREV_DUP) { @@ -5995,27 +6011,25 @@ DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u", mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); + if (!IS_LEAF(mp)) + return MDB_CORRUPTED; + if (IS_LEAF2(mp)) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], key->mv_size); return MDB_SUCCESS; } - mdb_cassert(mc, IS_LEAF(mp)); leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); - } - if (data) { + rc = mdb_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); + if (rc != MDB_SUCCESS) + return rc; + } else if (data) { if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; - - if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { - rc = mdb_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); - if (rc != MDB_SUCCESS) - return rc; - } } MDB_GET_KEY(leaf, key); @@ -6171,24 +6185,22 @@ if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); - } - if (data) { - if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { - if (op == MDB_SET || op == MDB_SET_KEY || op == MDB_SET_RANGE) { - rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); + if (op == MDB_SET || op == MDB_SET_KEY || op == MDB_SET_RANGE) { + rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); + } else { + int ex2, *ex2p; + if (op == MDB_GET_BOTH) { + ex2p = &ex2; + ex2 = 0; } else { - int ex2, *ex2p; - if (op == MDB_GET_BOTH) { - ex2p = &ex2; - ex2 = 0; - } else { - ex2p = NULL; - } - rc = mdb_cursor_set(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_SET_RANGE, ex2p); - if (rc != MDB_SUCCESS) - return rc; + ex2p = NULL; } - } else if (op == MDB_GET_BOTH || op == MDB_GET_BOTH_RANGE) { + rc = mdb_cursor_set(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_SET_RANGE, ex2p); + if (rc != MDB_SUCCESS) + return rc; + } + } else if (data) { + if (op == MDB_GET_BOTH || op == MDB_GET_BOTH_RANGE) { MDB_val olddata; MDB_cmp_func *dcmp; if ((rc = mdb_node_read(mc, leaf, &olddata)) != MDB_SUCCESS) @@ -6246,22 +6258,23 @@ mc->mc_ki[mc->mc_top] = 0; if (IS_LEAF2(mc->mc_pg[mc->mc_top])) { - key->mv_size = mc->mc_db->md_pad; - key->mv_data = LEAF2KEY(mc->mc_pg[mc->mc_top], 0, key->mv_size); + if ( key ) { + key->mv_size = mc->mc_db->md_pad; + key->mv_data = LEAF2KEY(mc->mc_pg[mc->mc_top], 0, key->mv_size); + } return MDB_SUCCESS; } - if (data) { - if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { - mdb_xcursor_init1(mc, leaf); - rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); - if (rc) - return rc; - } else { - if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) - return rc; - } + if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { + mdb_xcursor_init1(mc, leaf); + rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); + if (rc) + return rc; + } else if (data) { + if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; } + MDB_GET_KEY(leaf, key); return MDB_SUCCESS; } @@ -6288,21 +6301,21 @@ leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (IS_LEAF2(mc->mc_pg[mc->mc_top])) { - key->mv_size = mc->mc_db->md_pad; - key->mv_data = LEAF2KEY(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top], key->mv_size); + if (key) { + key->mv_size = mc->mc_db->md_pad; + key->mv_data = LEAF2KEY(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top], key->mv_size); + } return MDB_SUCCESS; } - if (data) { - if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { - mdb_xcursor_init1(mc, leaf); - rc = mdb_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); - if (rc) - return rc; - } else { - if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) - return rc; - } + if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { + mdb_xcursor_init1(mc, leaf); + rc = mdb_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); + if (rc) + return rc; + } else if (data) { + if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) + return rc; } MDB_GET_KEY(leaf, key); @@ -6584,7 +6597,7 @@ dkey.mv_size = 0; - if (flags == MDB_CURRENT) { + if (flags & MDB_CURRENT) { if (!(mc->mc_flags & C_INITIALIZED)) return EINVAL; rc = MDB_SUCCESS; @@ -6780,7 +6793,7 @@ offset *= 4; /* space for 4 more */ break; } - /* FALLTHRU: Big enough MDB_DUPFIXED sub-page */ + /* FALLTHRU */ /* Big enough MDB_DUPFIXED sub-page */ case MDB_CURRENT: fp->mp_flags |= P_DIRTY; COPY_PGNO(fp->mp_pgno, mp->mp_pgno); @@ -6979,7 +6992,7 @@ xdata.mv_size = 0; xdata.mv_data = ""; leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); - if (flags & MDB_CURRENT) { + if (flags == MDB_CURRENT) { xflags = MDB_CURRENT|MDB_NOSPILL; } else { mdb_xcursor_init1(mc, leaf); @@ -7083,6 +7096,8 @@ return rc; mp = mc->mc_pg[mc->mc_top]; + if (!IS_LEAF(mp)) + return MDB_CORRUPTED; if (IS_LEAF2(mp)) goto del_key; leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); @@ -8454,60 +8469,70 @@ } } rc = mdb_rebalance(mc); + if (rc) + goto fail; - if (rc == MDB_SUCCESS) { - /* DB is totally empty now, just bail out. - * Other cursors adjustments were already done - * by mdb_rebalance and aren't needed here. - */ - if (!mc->mc_snum) - return rc; + /* DB is totally empty now, just bail out. + * Other cursors adjustments were already done + * by mdb_rebalance and aren't needed here. + */ + if (!mc->mc_snum) { + mc->mc_flags |= C_EOF; + return rc; + } - mp = mc->mc_pg[mc->mc_top]; - nkeys = NUMKEYS(mp); + ki = mc->mc_ki[mc->mc_top]; + mp = mc->mc_pg[mc->mc_top]; + nkeys = NUMKEYS(mp); - /* Adjust other cursors pointing to mp */ - for (m2 = mc->mc_txn->mt_cursors[dbi]; !rc && m2; m2=m2->mc_next) { - m3 = (mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2; - if (! (m2->mc_flags & m3->mc_flags & C_INITIALIZED)) - continue; - if (m3->mc_snum < mc->mc_snum) - continue; - if (m3->mc_pg[mc->mc_top] == mp) { - /* if m3 points past last node in page, find next sibling */ - if (m3->mc_ki[mc->mc_top] >= mc->mc_ki[mc->mc_top]) { - if (m3->mc_ki[mc->mc_top] >= nkeys) { - rc = mdb_cursor_sibling(m3, 1); - if (rc == MDB_NOTFOUND) { - m3->mc_flags |= C_EOF; - rc = MDB_SUCCESS; - continue; - } - } - if (mc->mc_db->md_flags & MDB_DUPSORT) { - MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]); - /* If this node has dupdata, it may need to be reinited - * because its data has moved. - * If the xcursor was not initd it must be reinited. - * Else if node points to a subDB, nothing is needed. - * Else (xcursor was initd, not a subDB) needs mc_pg[0] reset. - */ - if (node->mn_flags & F_DUPDATA) { - if (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { - if (!(node->mn_flags & F_SUBDATA)) - m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); - } else { - mdb_xcursor_init1(m3, node); - m3->mc_xcursor->mx_cursor.mc_flags |= C_DEL; - } + /* Adjust other cursors pointing to mp */ + for (m2 = mc->mc_txn->mt_cursors[dbi]; !rc && m2; m2=m2->mc_next) { + m3 = (mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2; + if (!(m2->mc_flags & m3->mc_flags & C_INITIALIZED)) + continue; + if (m3->mc_snum < mc->mc_snum) + continue; + if (m3->mc_pg[mc->mc_top] == mp) { + /* if m3 points past last node in page, find next sibling */ + if (m3->mc_ki[mc->mc_top] >= nkeys) { + rc = mdb_cursor_sibling(m3, 1); + if (rc == MDB_NOTFOUND) { + m3->mc_flags |= C_EOF; + rc = MDB_SUCCESS; + continue; + } + if (rc) + goto fail; + } + if (m3->mc_ki[mc->mc_top] >= ki || + /* moved to right sibling */ m3->mc_pg[mc->mc_top] != mp) { + if (m3->mc_xcursor && !(m3->mc_flags & C_EOF)) { + MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]); + /* If this node has dupdata, it may need to be reinited + * because its data has moved. + * If the xcursor was not initd it must be reinited. + * Else if node points to a subDB, nothing is needed. + * Else (xcursor was initd, not a subDB) needs mc_pg[0] reset. + */ + if (node->mn_flags & F_DUPDATA) { + if (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { + if (!(node->mn_flags & F_SUBDATA)) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + } else { + mdb_xcursor_init1(m3, node); + rc = mdb_cursor_first(&m3->mc_xcursor->mx_cursor, NULL, NULL); + if (rc) + goto fail; } } + m3->mc_xcursor->mx_cursor.mc_flags |= C_DEL; } + m3->mc_flags |= C_DEL; } } - mc->mc_flags |= C_DEL; } +fail: if (rc) mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_copy.1 new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_copy.1 --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_copy.1 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_copy.1 2021-02-04 21:46:33.000000000 +0100 @@ -1,5 +1,5 @@ .TH MDB_COPY 1 "2014/07/01" "LMDB 0.9.14" -.\" Copyright 2012-2018 Howard Chu, Symas Corp. All Rights Reserved. +.\" Copyright 2012-2021 Howard Chu, Symas Corp. All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. .SH NAME mdb_copy \- LMDB environment copy tool diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_copy.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_copy.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_copy.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_copy.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mdb_copy.c - memory-mapped database backup tool */ /* - * Copyright 2012-2018 Howard Chu, Symas Corp. + * Copyright 2012-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_dump.1 new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_dump.1 --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_dump.1 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_dump.1 2021-02-04 21:46:33.000000000 +0100 @@ -1,5 +1,5 @@ .TH MDB_DUMP 1 "2015/09/30" "LMDB 0.9.17" -.\" Copyright 2014-2018 Howard Chu, Symas Corp. All Rights Reserved. +.\" Copyright 2014-2021 Howard Chu, Symas Corp. All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. .SH NAME mdb_dump \- LMDB environment export tool diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_dump.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_dump.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_dump.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_dump.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mdb_dump.c - memory-mapped database dump tool */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,6 +68,8 @@ end = c + v->mv_size; while (c < end) { if (isprint(*c)) { + if (*c == '\\') + putchar('\\'); putchar(*c); } else { putchar('\\'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_load.1 new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_load.1 --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_load.1 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_load.1 2021-02-04 21:46:33.000000000 +0100 @@ -1,5 +1,5 @@ .TH MDB_LOAD 1 "2015/09/30" "LMDB 0.9.17" -.\" Copyright 2014-2018 Howard Chu, Symas Corp. All Rights Reserved. +.\" Copyright 2014-2021 Howard Chu, Symas Corp. All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. .SH NAME mdb_load \- LMDB environment import tool @@ -37,6 +37,13 @@ .BR \-V Write the library version number to the standard output, and exit. .TP +.BR \-a +Append all records in the order they appear in the input. The input is assumed to already be +in correctly sorted order and no sorting or checking for redundant values will be performed. +This option must be used to reload data that was produced by running +.B mdb_dump +on a database that uses custom compare functions. +.TP .BR \-f \ file Read from the specified file instead of from the standard input. .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_load.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_load.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_load.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_load.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mdb_load.c - memory-mapped database load tool */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +37,7 @@ static MDB_envinfo info; static MDB_val kbuf, dbuf; +static MDB_val k0buf; #ifdef _WIN32 #define Z "I" @@ -238,7 +239,7 @@ while (c2 < end) { if (*c2 == '\\') { if (c2[1] == '\\') { - c1++; c2 += 2; + *c1++ = *c2; } else { if (c2+3 > end || !isxdigit(c2[1]) || !isxdigit(c2[2])) { Eof = 1; @@ -246,8 +247,8 @@ return EOF; } *c1++ = unhex(++c2); - c2 += 2; } + c2 += 2; } else { /* copies are redundant when no escapes were used */ *c1++ = *c2++; @@ -278,10 +279,15 @@ static void usage(void) { - fprintf(stderr, "usage: %s [-V] [-f input] [-n] [-s name] [-N] [-T] dbpath\n", prog); + fprintf(stderr, "usage: %s [-V] [-a] [-f input] [-n] [-s name] [-N] [-T] dbpath\n", prog); exit(EXIT_FAILURE); } +static int greater(const MDB_val *a, const MDB_val *b) +{ + return 1; +} + int main(int argc, char *argv[]) { int i, rc; @@ -290,8 +296,9 @@ MDB_cursor *mc; MDB_dbi dbi; char *envname; - int envflags = 0, putflags = 0; - int dohdr = 0; + int envflags = MDB_NOSYNC, putflags = 0; + int dohdr = 0, append = 0; + MDB_val prevk; prog = argv[0]; @@ -299,19 +306,23 @@ usage(); } - /* -f: load file instead of stdin + /* -a: append records in input order + * -f: load file instead of stdin * -n: use NOSUBDIR flag on env_open * -s: load into named subDB * -N: use NOOVERWRITE on puts * -T: read plaintext * -V: print version and exit */ - while ((i = getopt(argc, argv, "f:ns:NTV")) != EOF) { + while ((i = getopt(argc, argv, "af:ns:NTV")) != EOF) { switch(i) { case 'V': printf("%s\n", MDB_VERSION_STRING); exit(0); break; + case 'a': + append = 1; + break; case 'f': if (freopen(optarg, "r", stdin) == NULL) { fprintf(stderr, "%s: %s: reopen: %s\n", @@ -370,11 +381,16 @@ } kbuf.mv_size = mdb_env_get_maxkeysize(env) * 2 + 2; - kbuf.mv_data = malloc(kbuf.mv_size); + kbuf.mv_data = malloc(kbuf.mv_size * 2); + k0buf.mv_size = kbuf.mv_size; + k0buf.mv_data = (char *)kbuf.mv_data + kbuf.mv_size; + prevk.mv_data = k0buf.mv_data; while(!Eof) { MDB_val key, data; int batch = 0; + flags = 0; + int appflag; if (!dohdr) { dohdr = 1; @@ -392,6 +408,12 @@ fprintf(stderr, "mdb_open failed, error %d %s\n", rc, mdb_strerror(rc)); goto txn_abort; } + prevk.mv_size = 0; + if (append) { + mdb_set_compare(txn, dbi, greater); + if (flags & MDB_DUPSORT) + mdb_set_dupsort(txn, dbi, greater); + } rc = mdb_cursor_open(txn, dbi, &mc); if (rc) { @@ -410,7 +432,20 @@ goto txn_abort; } - rc = mdb_cursor_put(mc, &key, &data, putflags); + if (append) { + appflag = MDB_APPEND; + if (flags & MDB_DUPSORT) { + if (prevk.mv_size == key.mv_size && !memcmp(prevk.mv_data, key.mv_data, key.mv_size)) + appflag = MDB_CURRENT|MDB_APPENDDUP; + else { + memcpy(prevk.mv_data, key.mv_data, key.mv_size); + prevk.mv_size = key.mv_size; + } + } + } else { + appflag = 0; + } + rc = mdb_cursor_put(mc, &key, &data, putflags|appflag); if (rc == MDB_KEYEXIST && putflags) continue; if (rc) { @@ -435,6 +470,10 @@ fprintf(stderr, "mdb_cursor_open failed, error %d %s\n", rc, mdb_strerror(rc)); goto txn_abort; } + if (appflag & MDB_APPENDDUP) { + MDB_val k, d; + mdb_cursor_get(mc, &k, &d, MDB_LAST); + } batch = 0; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_stat.1 new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_stat.1 --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_stat.1 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_stat.1 2021-02-04 21:46:33.000000000 +0100 @@ -1,5 +1,5 @@ .TH MDB_STAT 1 "2015/09/30" "LMDB 0.9.17" -.\" Copyright 2012-2018 Howard Chu, Symas Corp. All Rights Reserved. +.\" Copyright 2012-2021 Howard Chu, Symas Corp. All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. .SH NAME mdb_stat \- LMDB environment status tool diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_stat.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_stat.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mdb_stat.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mdb_stat.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mdb_stat.c - memory-mapped database status tool */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/midl.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/midl.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/midl.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/midl.c 2021-02-04 21:46:33.000000000 +0100 @@ -3,8 +3,8 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2000-2019 The OpenLDAP Foundation. - * Portions Copyright 2001-2018 Howard Chu, Symas Corp. + * Copyright 2000-2021 The OpenLDAP Foundation. + * Portions Copyright 2001-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/midl.h new/lmdb-LMDB_0.9.28/libraries/liblmdb/midl.h --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/midl.h 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/midl.h 2021-02-04 21:46:33.000000000 +0100 @@ -11,8 +11,8 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software <http://www.openldap.org/>. * - * Copyright 2000-2019 The OpenLDAP Foundation. - * Portions Copyright 2001-2018 Howard Chu, Symas Corp. + * Copyright 2000-2021 The OpenLDAP Foundation. + * Portions Copyright 2001-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mtest.c - memory-mapped database tester/toy */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest2.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest2.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest2.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest2.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mtest2.c - memory-mapped database tester/toy */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest3.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest3.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest3.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest3.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mtest3.c - memory-mapped database tester/toy */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest4.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest4.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest4.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest4.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mtest4.c - memory-mapped database tester/toy */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest5.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest5.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest5.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest5.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mtest5.c - memory-mapped database tester/toy */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest6.c new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest6.c --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/mtest6.c 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/mtest6.c 2021-02-04 21:46:33.000000000 +0100 @@ -1,6 +1,6 @@ /* mtest6.c - memory-mapped database tester/toy */ /* - * Copyright 2011-2018 Howard Chu, Symas Corp. + * Copyright 2011-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/sample-bdb.txt new/lmdb-LMDB_0.9.28/libraries/liblmdb/sample-bdb.txt --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/sample-bdb.txt 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/sample-bdb.txt 2021-02-04 21:46:33.000000000 +0100 @@ -3,7 +3,7 @@ * Do a line-by-line comparison of this and sample-mdb.txt */ /* - * Copyright 2012-2018 Howard Chu, Symas Corp. + * Copyright 2012-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lmdb-LMDB_0.9.24/libraries/liblmdb/sample-mdb.txt new/lmdb-LMDB_0.9.28/libraries/liblmdb/sample-mdb.txt --- old/lmdb-LMDB_0.9.24/libraries/liblmdb/sample-mdb.txt 2019-07-19 18:41:12.000000000 +0200 +++ new/lmdb-LMDB_0.9.28/libraries/liblmdb/sample-mdb.txt 2021-02-04 21:46:33.000000000 +0100 @@ -3,7 +3,7 @@ * Do a line-by-line comparison of this and sample-bdb.txt */ /* - * Copyright 2012-2018 Howard Chu, Symas Corp. + * Copyright 2012-2021 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without ++++++ baselibs.conf ++++++ --- /var/tmp/diff_new_pack.V3iIXo/_old 2021-03-10 08:46:34.166227193 +0100 +++ /var/tmp/diff_new_pack.V3iIXo/_new 2021-03-10 08:46:34.170227198 +0100 @@ -1 +1 @@ -liblmdb-0_9_24 +liblmdb-0_9_28