From 3e74ab2aeeaf049d16865cbe45eb773db33c424f Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 23 Nov 2015 13:03:09 +0100 Subject: [PATCH 1/6] mdbx: backport - CURSOR_TMP_[UN]TRACK() -> WITH_CURSOR_TRACKING(). Change-Id: I008b7db829765889fd63900b802f57eca0c6cd20 --- mdb.c | 43 ++++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/mdb.c b/mdb.c index 0bc9a48a..c2555138 100644 --- a/mdb.c +++ b/mdb.c @@ -7679,21 +7679,21 @@ mdb_update_key(MDB_cursor *mc, MDB_val *key) static void mdb_cursor_copy(const MDB_cursor *csrc, MDB_cursor *cdst); -/** Track a temporary cursor */ -#define CURSOR_TMP_TRACK(mc, mn, dummy, tracked) \ - if (mc->mc_flags & C_SUB) { \ +/** Perform \b act while tracking temporary cursor \b mn */ +#define WITH_CURSOR_TRACKING(mn, act) do { \ + MDB_cursor dummy, *tracked, **tp = &(mn).mc_txn->mt_cursors[mn.mc_dbi]; \ + if ((mn).mc_flags & C_SUB) { \ dummy.mc_flags = C_INITIALIZED; \ - dummy.mc_xcursor = (MDB_xcursor *)&mn; \ + dummy.mc_xcursor = (MDB_xcursor *)&(mn); \ tracked = &dummy; \ } else { \ - tracked = &mn; \ + tracked = &(mn); \ } \ - tracked->mc_next = mc->mc_txn->mt_cursors[mc->mc_dbi]; \ - mc->mc_txn->mt_cursors[mc->mc_dbi] = tracked - -/** Stop tracking a temporary cursor */ -#define CURSOR_TMP_UNTRACK(mc, tracked) \ - mc->mc_txn->mt_cursors[mc->mc_dbi] = tracked->mc_next + tracked->mc_next = *tp; \ + *tp = tracked; \ + { act; } \ + *tp = tracked->mc_next; \ +} while (0) /** Move a node from csrc to cdst. */ @@ -7850,7 +7850,6 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) */ if (csrc->mc_ki[csrc->mc_top] == 0) { if (csrc->mc_ki[csrc->mc_top-1] != 0) { - MDB_cursor dummy, *tracked; if (IS_LEAF2(csrc->mc_pg[csrc->mc_top])) { key.mv_data = LEAF2KEY(csrc->mc_pg[csrc->mc_top], 0, key.mv_size); } else { @@ -7864,9 +7863,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) mn.mc_snum--; mn.mc_top--; /* We want mdb_rebalance to find mn when doing fixups */ - CURSOR_TMP_TRACK(csrc, mn, dummy, tracked); - rc = mdb_update_key(&mn, &key); - CURSOR_TMP_UNTRACK(csrc, tracked); + WITH_CURSOR_TRACKING(mn, rc = mdb_update_key(&mn, &key)); if (unlikely(rc != MDB_SUCCESS)) return rc; } @@ -7883,7 +7880,6 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) if (cdst->mc_ki[cdst->mc_top] == 0) { if (cdst->mc_ki[cdst->mc_top-1] != 0) { - MDB_cursor dummy, *tracked; if (IS_LEAF2(csrc->mc_pg[csrc->mc_top])) { key.mv_data = LEAF2KEY(cdst->mc_pg[cdst->mc_top], 0, key.mv_size); } else { @@ -7897,9 +7893,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) mn.mc_snum--; mn.mc_top--; /* We want mdb_rebalance to find mn when doing fixups */ - CURSOR_TMP_TRACK(cdst, mn, dummy, tracked); - rc = mdb_update_key(&mn, &key); - CURSOR_TMP_UNTRACK(cdst, tracked); + WITH_CURSOR_TRACKING(mn, rc = mdb_update_key(&mn, &key)); if (unlikely(rc != MDB_SUCCESS)) return rc; } @@ -8258,13 +8252,11 @@ mdb_rebalance(MDB_cursor *mc) if (!fromleft) { rc = mdb_page_merge(&mn, mc); } else { - MDB_cursor dummy, *tracked; oldki += NUMKEYS(mn.mc_pg[mn.mc_top]); mn.mc_ki[mn.mc_top] += mc->mc_ki[mn.mc_top] + 1; /* We want mdb_rebalance to find mn when doing fixups */ - CURSOR_TMP_TRACK(mc, mn, dummy, tracked); - rc = mdb_page_merge(mc, &mn); - CURSOR_TMP_UNTRACK(mc, tracked); + WITH_CURSOR_TRACKING(mn, + rc = mdb_page_merge(mc, &mn)); mdb_cursor_copy(&mn, mc); } mc->mc_flags &= ~C_EOF; @@ -8634,14 +8626,11 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno */ if (SIZELEFT(mn.mc_pg[ptop]) < mdb_branch_size(env, &sepkey)) { int snum = mc->mc_snum; - MDB_cursor dummy, *tracked; mn.mc_snum--; mn.mc_top--; did_split = 1; /* We want other splits to find mn when doing fixups */ - CURSOR_TMP_TRACK(mc, mn, dummy, tracked); - rc = mdb_page_split(&mn, &sepkey, NULL, rp->mp_pgno, 0); - CURSOR_TMP_UNTRACK(mc, tracked); + WITH_CURSOR_TRACKING(mn, rc = mdb_page_split(&mn, &sepkey, NULL, rp->mp_pgno, 0)); if (unlikely(rc != MDB_SUCCESS)) goto done; From 3eb38d2f1bcd98e540057a265da3c2830702bf66 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 23 Nov 2015 13:11:29 +0000 Subject: [PATCH 2/6] mdbx: backport - ITS#8323 Fix nested commit. Must remove our spilled pages from parent's dirty list Change-Id: Ic37bcea4975801e48832968ea38050064a581d21 --- CHANGES | 1 + mdb.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGES b/CHANGES index 03db4c3f..2301bd42 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ LMDB 0.9.17 Release Engineering Fix ITS#8312 loose pages in nested txn Fix ITS#8313 mdb_rebalance dummy cursor Fix ITS#8315 dirty_room in nested txn + Fix ITS#8323 dirty_list in nested txn Fix ITS#8316 page_merge cursor tracking Fix ITS#8319 mdb_load error messages Fix ITS#8320 mdb_load plaintext input diff --git a/mdb.c b/mdb.c index c2555138..570e9928 100644 --- a/mdb.c +++ b/mdb.c @@ -3761,6 +3761,25 @@ mdb_txn_commit(MDB_txn *txn) pspill[0] = y; } + /* Remove anything in our spill list from parent's dirty list */ + if (txn->mt_spill_pgs && txn->mt_spill_pgs[0]) { + for (i=1; i<=txn->mt_spill_pgs[0]; i++) { + MDB_ID pn = txn->mt_spill_pgs[i]; + if (pn & 1) + continue; /* deleted spillpg */ + pn >>= 1; + y = mdb_mid2l_search(dst, pn); + if (y <= dst[0].mid && dst[y].mid == pn) { + free(dst[y].mptr); + while (y < dst[0].mid) { + dst[y] = dst[y+1]; + y++; + } + dst[0].mid--; + } + } + } + /* Find len = length of merging our dirty list with parent's */ x = dst[0].mid; dst[0].mid = 0; /* simplify loops */ From 2a6bfa56f095b07c24acb7022779b3ad35210688 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Wed, 25 Nov 2015 19:08:14 +0300 Subject: [PATCH 3/6] mdbx: backport - more for cursor tracking. Includes: - ITS#8321 deinit empty cursors Always unset C_INIT flag if the cursor's target DB has been deleted - ITS#8321 Fix mdb_cursor_set Always reinit mc_pg[0] if cursor is not C_INITIALIZED It might have a stale value when using nested txns - ITS#8321 mdb_put cursor needs tracking too - ITS#8321 page_touch - don't fixup the cursor we just touched - ITS#8321 More cursor fixup Based on page_touch fixup from ITS#7594 but expanded: make sure sub-cursors agree with main cursors. - ITS#8321 cleanup unused var Change-Id: I4b825e20e9d42d3166052e9b3e5bd0ac33b70e85 ITS#8321 fix ambiguity in cursor_put fixup After delete/add of a node, other nodes may no longer be pointing at the data they intended. This can confuse subsequent fixups. Change-Id: Id43406a9828b440735835b024e94e9b2d5a17693 --- mdb.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/mdb.c b/mdb.c index 570e9928..960814dd 100644 --- a/mdb.c +++ b/mdb.c @@ -1409,6 +1409,13 @@ mdb_cursor_chk(MDB_cursor *mc) } if (unlikely(mc->mc_ki[i] >= NUMKEYS(mc->mc_pg[i]))) mdb_print("ack!\n"); + if (mc->mc_xcursor && (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) { + node = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); + if (((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) && + mc->mc_xcursor->mx_cursor.mc_pg[0] != NODEDATA(node)) { + mdb_print("blah!\n"); + } + } } #endif /* 0 */ @@ -2497,14 +2504,15 @@ done: } else { for (; m2; m2=m2->mc_next) { if (m2->mc_snum < mc->mc_snum) continue; + if (m2 == mc) continue; if (m2->mc_pg[mc->mc_top] == mp) { m2->mc_pg[mc->mc_top] = np; if ((mc->mc_db->md_flags & MDB_DUPSORT) && IS_LEAF(np) && - m2->mc_ki[mc->mc_top] == mc->mc_ki[mc->mc_top]) + (m2->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) { - MDB_node *leaf = NODEPTR(np, mc->mc_ki[mc->mc_top]); - if (!(leaf->mn_flags & F_SUBDATA)) + MDB_node *leaf = NODEPTR(np, m2->mc_ki[mc->mc_top]); + if ((leaf->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) m2->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf); } } @@ -5266,8 +5274,11 @@ mdb_cursor_pop(MDB_cursor *mc) mc->mc_pg[mc->mc_top]->mp_pgno, DDBI(mc), (void *) mc); mc->mc_snum--; - if (mc->mc_snum) + if (mc->mc_snum) { mc->mc_top--; + } else { + mc->mc_flags &= ~C_INITIALIZED; + } } } @@ -5991,6 +6002,8 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, } else return MDB_NOTFOUND; } + } else { + mc->mc_pg[0] = 0; } rc = mdb_page_search(mc, key, 0); @@ -6797,7 +6810,7 @@ new_sub: } else { /* There is room already in this leaf page. */ rc = mdb_node_add(mc, mc->mc_ki[mc->mc_top], key, rdata, 0, nflags); - if (likely(rc == 0) && insert_key) { + if (likely(rc == 0)) { /* Adjust other cursors pointing to mp */ MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; @@ -6809,10 +6822,15 @@ new_sub: m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; - if (m3 == mc || m3->mc_snum < mc->mc_snum) continue; - if (m3->mc_pg[i] == mp && m3->mc_ki[i] >= mc->mc_ki[i]) { + if (m3 == mc || m3->mc_snum < mc->mc_snum || m3->mc_pg[i] != mp) continue; + if (m3->mc_ki[i] >= mc->mc_ki[i] && insert_key) { m3->mc_ki[i]++; } + if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) { + MDB_node *n2 = NODEPTR(mp, m3->mc_ki[i]); + if ((n2->mn_flags & (F_SUBDATA|F_DUPDATA)) == F_DUPDATA) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(n2); + } } } } @@ -6951,6 +6969,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned flags) if (flags & MDB_NODUPDATA) { /* mdb_cursor_del0() will subtract the final entry */ mc->mc_db->md_entries -= mc->mc_xcursor->mx_db.md_entries - 1; + mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; } else { if (!F_ISSET(leaf->mn_flags, F_SUBDATA)) { mc->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf); @@ -6988,6 +7007,8 @@ mdb_cursor_del(MDB_cursor *mc, unsigned flags) mc->mc_db->md_entries--; mc->mc_flags |= C_DEL; return rc; + } else { + mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; } /* otherwise fall thru and delete the sub-DB */ } @@ -7769,6 +7790,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) data.mv_size = NODEDSZ(srcnode); data.mv_data = NODEDATA(srcnode); } + mn.mc_xcursor = NULL; if (IS_BRANCH(cdst->mc_pg[cdst->mc_top]) && cdst->mc_ki[cdst->mc_top] == 0) { unsigned snum = cdst->mc_snum; MDB_node *s2; @@ -7840,6 +7862,12 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) m3->mc_ki[csrc->mc_top] = cdst->mc_ki[cdst->mc_top]; m3->mc_ki[csrc->mc_top-1]++; } + if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) && + IS_LEAF(mps)) { + MDB_node *node = NODEPTR(m3->mc_pg[csrc->mc_top], m3->mc_ki[csrc->mc_top]); + if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + } } } else /* Adding on the right, bump others down */ @@ -7860,6 +7888,12 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) } else { m3->mc_ki[csrc->mc_top]--; } + if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) && + IS_LEAF(mps)) { + MDB_node *node = NODEPTR(m3->mc_pg[csrc->mc_top], m3->mc_ki[csrc->mc_top]); + if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + } } } } @@ -7982,6 +8016,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) MDB_cursor mn; MDB_node *s2; mdb_cursor_copy(csrc, &mn); + mn.mc_xcursor = NULL; /* must find the lowest key below src */ rc = mdb_page_search_lowest(&mn); if (unlikely(rc)) @@ -8057,6 +8092,12 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) m3->mc_ki[top-1] > csrc->mc_ki[top-1]) { m3->mc_ki[top-1]--; } + if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) && + IS_LEAF(psrc)) { + MDB_node *node = NODEPTR(m3->mc_pg[top], m3->mc_ki[top]); + if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + } } } { @@ -8315,6 +8356,11 @@ mdb_cursor_del0(MDB_cursor *mc) else if (mc->mc_db->md_flags & MDB_DUPSORT) m3->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; } + if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) { + MDB_node *node = NODEPTR(m3->mc_pg[mc->mc_top], m3->mc_ki[mc->mc_top]); + if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + } } } } @@ -8503,6 +8549,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno } mdb_cursor_copy(mc, &mn); + mn.mc_xcursor = NULL; mn.mc_pg[mn.mc_top] = rp; mn.mc_ki[ptop] = mc->mc_ki[ptop]+1; @@ -8807,7 +8854,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno m3->mc_ki[k+1] = m3->mc_ki[k]; m3->mc_pg[k+1] = m3->mc_pg[k]; } - if (m3->mc_ki[0] > nkeys) { + if (m3->mc_ki[0] >= nkeys) { m3->mc_ki[0] = 1; } else { m3->mc_ki[0] = 0; @@ -8831,6 +8878,12 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno m3->mc_ki[ptop] >= mc->mc_ki[ptop]) { m3->mc_ki[ptop]++; } + if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) && + IS_LEAF(mp)) { + MDB_node *node = NODEPTR(m3->mc_pg[mc->mc_top], m3->mc_ki[mc->mc_top]); + if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) + m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); + } } } mdb_debug("mp left: %d, rp left: %d", SIZELEFT(mp), SIZELEFT(rp)); @@ -8849,6 +8902,7 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, { MDB_cursor mc; MDB_xcursor mx; + int rc; if (unlikely(!key || !data || !txn)) return EINVAL; @@ -8866,7 +8920,11 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; mdb_cursor_init(&mc, txn, dbi, &mx); - return mdb_cursor_put(&mc, key, data, flags); + mc.mc_next = txn->mt_cursors[dbi]; + txn->mt_cursors[dbi] = &mc; + rc = mdb_cursor_put(&mc, key, data, flags); + txn->mt_cursors[dbi] = mc.mc_next; + return rc; } #ifndef MDB_WBUF @@ -9858,6 +9916,7 @@ done: } else if (rc == MDB_NOTFOUND) { rc = MDB_SUCCESS; } + mc->mc_flags &= ~C_INITIALIZED; return rc; } From d0a0b096eed40ce88345a46150684e11c006685d Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 24 Nov 2015 12:14:49 +0000 Subject: [PATCH 4/6] mdbx: backport - Cleanup C_DEL flag usage. Only set it if the cursor's current position was deleted Change-Id: I4c4c2fa157b73042419cb7b7e39e280a1eca155a --- mdb.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mdb.c b/mdb.c index 960814dd..7919b88d 100644 --- a/mdb.c +++ b/mdb.c @@ -6218,8 +6218,6 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_GET_KEY(leaf, key); if (data) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { - if (mc->mc_flags & C_DEL) - mdb_xcursor_init1(mc, leaf); rc = mdb_cursor_get(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_GET_CURRENT); } else { rc = mdb_node_read(mc->mc_txn, leaf, data); @@ -7005,7 +7003,6 @@ mdb_cursor_del(MDB_cursor *mc, unsigned flags) } } mc->mc_db->md_entries--; - mc->mc_flags |= C_DEL; return rc; } else { mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; @@ -8349,12 +8346,12 @@ mdb_cursor_del0(MDB_cursor *mc) if (m3 == mc || m3->mc_snum < mc->mc_snum) continue; if (m3->mc_pg[mc->mc_top] == mp) { - if (m3->mc_ki[mc->mc_top] >= ki) { + if (m3->mc_ki[mc->mc_top] == ki) { m3->mc_flags |= C_DEL; - if (m3->mc_ki[mc->mc_top] > ki) - m3->mc_ki[mc->mc_top]--; - else if (mc->mc_db->md_flags & MDB_DUPSORT) + if (mc->mc_db->md_flags & MDB_DUPSORT) m3->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; + } else if (m3->mc_ki[mc->mc_top] > ki) { + m3->mc_ki[mc->mc_top]--; } if (m3->mc_xcursor && (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) { MDB_node *node = NODEPTR(m3->mc_pg[mc->mc_top], m3->mc_ki[mc->mc_top]); From 35452812b5a2e12d57e35179d06128964611d7e2 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Wed, 25 Nov 2015 19:08:34 +0300 Subject: [PATCH 5/6] mdbx: pull CHANGES from LMDB. Change-Id: Id85578ea842564792dd7141984b67406fa5a804c --- CHANGES | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 2301bd42..1fc52917 100644 --- a/CHANGES +++ b/CHANGES @@ -30,9 +30,11 @@ LMDB 0.9.17 Release Engineering Miscellaneous cleanup/simplification Build Create install dirs if needed (ITS#8256) - Fix ThreadProc decl on Win32/MSVC (ITS#8270) - Added ssize_t typedef for MSVC (ITS#8067) - Use ANSI apis on Windows (ITS#8069) + Fix ThreadProc decl on Win32/MSVC (ITS#8270 - nothing for MDBX) + Added ssize_t typedef for MSVC (ITS#8067 - nothing for MDBX) + Use ANSI apis on Windows (ITS#8069 - nothing for MDBX) + Use O_SYNC if O_DSYNC,MDB_DSYNC are not defined (ITS#7209 - nothing for MDBX) + Allow passing AR to make (ITS#8168 - already done for MDBX) LMDB 0.9.16 Release (2015/08/14) Fix cursor EOF bug (ITS#8190) From 1739a2f4c1604057ad9038fed14163e6af8d81ff Mon Sep 17 00:00:00 2001 From: Heiko Becker Date: Thu, 11 Jun 2015 21:09:59 +0200 Subject: [PATCH 6/6] mdbx: backport - ITS#8169 Allow passing mandir to make install. The motivation for this change is my distribution moving to a multiarch layout. While the architecture specific stuff (binaries, libraries, etc.) is installed under /usr/${host}/{bin,lib,...} architecture-independent data should still be installed to /usr/share/. Change-Id: I9bc1e4ba975e8ef7fe945ca3b30f044ac40eedf2 --- CHANGES | 1 + Makefile | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 1fc52917..08bf80b0 100644 --- a/CHANGES +++ b/CHANGES @@ -35,6 +35,7 @@ LMDB 0.9.17 Release Engineering Use ANSI apis on Windows (ITS#8069 - nothing for MDBX) Use O_SYNC if O_DSYNC,MDB_DSYNC are not defined (ITS#7209 - nothing for MDBX) Allow passing AR to make (ITS#8168 - already done for MDBX) + Allow passing mandir to make install (ITS#8169) LMDB 0.9.16 Release (2015/08/14) Fix cursor EOF bug (ITS#8190) diff --git a/Makefile b/Makefile index ee18d454..f9a11225 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,7 @@ XCFLAGS ?= CFLAGS ?= -O2 -g -Wall -Werror -Wno-unused-parameter CFLAGS += -pthread $(XCFLAGS) prefix ?= /usr/local +mandir ?= $(prefix)/man ######################################################################## @@ -46,7 +47,7 @@ install: $(ILIBS) $(IPROGS) $(IHDRS) for f in $(IPROGS); do cp $$f $(DESTDIR)$(prefix)/bin; done for f in $(ILIBS); do cp $$f $(DESTDIR)$(prefix)/lib; done for f in $(IHDRS); do cp $$f $(DESTDIR)$(prefix)/include; done - for f in $(IDOCS); do cp $$f $(DESTDIR)$(prefix)/man/man1; done + for f in $(IDOCS); do cp $$f $(DESTDIR)$(mandir)/man1; done clean: rm -rf $(PROGS) @* *.[ao] *.[ls]o *~ testdb/* *.gcov