From aa90b27693be071237d3c118b64a3c915611e5c0 Mon Sep 17 00:00:00 2001 From: Marcel Denia Date: Mon, 18 Aug 2014 11:21:28 +0200 Subject: [PATCH] db47: Update to 4.7.25.4 Signed-off-by: Marcel Denia --- libs/db47/Makefile | 10 +- ...ce_lock.patch => 010-patch.4.7.25.1.patch} | 13 +- ...02-lock.patch => 020-patch.4.7.25.2.patch} | 9 +- ...ad_lock.patch => 030-patch.4.7.25.3.patch} | 33 +++-- libs/db47/patches/040-patch.4.7.25.4.patch | 118 ++++++++++++++++++ 5 files changed, 150 insertions(+), 33 deletions(-) rename libs/db47/patches/{001-sequence_lock.patch => 010-patch.4.7.25.1.patch} (80%) rename libs/db47/patches/{002-lock.patch => 020-patch.4.7.25.2.patch} (82%) rename libs/db47/patches/{003-dead_lock.patch => 030-patch.4.7.25.3.patch} (86%) create mode 100644 libs/db47/patches/040-patch.4.7.25.4.patch diff --git a/libs/db47/Makefile b/libs/db47/Makefile index 43d539a7ba..2083fc9dca 100644 --- a/libs/db47/Makefile +++ b/libs/db47/Makefile @@ -8,12 +8,14 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/uclibc++.mk +BASE_VERSION:=4.7.25 + PKG_NAME:=db47 -PKG_VERSION:=4.7.25.NC -PKG_RELEASE:=6 +PKG_VERSION:=$(BASE_VERSION).4.NC +PKG_RELEASE:=1 -PKG_BUILD_DIR:=$(BUILD_DIR)/db-$(PKG_VERSION) -PKG_SOURCE:=db-$(PKG_VERSION).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/db-$(BASE_VERSION).NC +PKG_SOURCE:=db-$(BASE_VERSION).NC.tar.gz PKG_SOURCE_URL:=http://download.oracle.com/berkeley-db/ PKG_MD5SUM:=073ab7f20d24b3872a51ca762f5090e7 diff --git a/libs/db47/patches/001-sequence_lock.patch b/libs/db47/patches/010-patch.4.7.25.1.patch similarity index 80% rename from libs/db47/patches/001-sequence_lock.patch rename to libs/db47/patches/010-patch.4.7.25.1.patch index 8ede4b4b00..f1fd472708 100644 --- a/libs/db47/patches/001-sequence_lock.patch +++ b/libs/db47/patches/010-patch.4.7.25.1.patch @@ -1,7 +1,6 @@ -diff -ruN db-4.7.25.NC/sequence/sequence.c db-4.7.25.NC.new/sequence/sequence.c ---- db-4.7.25.NC/sequence/sequence.c 2008-05-05 22:25:09.000000000 +0200 -+++ db-4.7.25.NC.new/sequence/sequence.c 2009-11-08 12:50:27.000000000 +0100 -@@ -187,7 +187,11 @@ +--- a/sequence/sequence.c ++++ b/sequence/sequence.c +@@ -187,7 +187,11 @@ __seq_open_pp(seq, txn, keyp, flags) if ((ret = __db_get_flags(dbp, &tflags)) != 0) goto err; @@ -14,7 +13,7 @@ diff -ruN db-4.7.25.NC/sequence/sequence.c db-4.7.25.NC.new/sequence/sequence.c ret = __db_rdonly(dbp->env, "DB_SEQUENCE->open"); goto err; } -@@ -244,6 +248,11 @@ +@@ -244,6 +248,11 @@ retry: if ((ret = __db_get(dbp, ip, if ((ret != DB_NOTFOUND && ret != DB_KEYEMPTY) || !LF_ISSET(DB_CREATE)) goto err; @@ -26,7 +25,7 @@ diff -ruN db-4.7.25.NC/sequence/sequence.c db-4.7.25.NC.new/sequence/sequence.c ret = 0; rp = &seq->seq_record; -@@ -296,7 +305,12 @@ +@@ -296,7 +305,12 @@ retry: if ((ret = __db_get(dbp, ip, */ rp = seq->seq_data.data; if (rp->seq_version == DB_SEQUENCE_OLDVER) { @@ -40,7 +39,7 @@ diff -ruN db-4.7.25.NC/sequence/sequence.c db-4.7.25.NC.new/sequence/sequence.c if (!F_ISSET(env, ENV_LITTLEENDIAN)) { if (IS_DB_AUTO_COMMIT(dbp, txn)) { if ((ret = -@@ -707,6 +721,13 @@ +@@ -707,6 +721,13 @@ __seq_get(seq, txn, delta, retp, flags) MUTEX_LOCK(env, seq->mtx_seq); diff --git a/libs/db47/patches/002-lock.patch b/libs/db47/patches/020-patch.4.7.25.2.patch similarity index 82% rename from libs/db47/patches/002-lock.patch rename to libs/db47/patches/020-patch.4.7.25.2.patch index 8cfd8faa9a..ddf830a301 100644 --- a/libs/db47/patches/002-lock.patch +++ b/libs/db47/patches/020-patch.4.7.25.2.patch @@ -1,7 +1,6 @@ -diff -urN db-4.7.25.NC/lock/lock.c db-4.7.25.NC.new/lock/lock.c ---- db-4.7.25.NC/lock/lock.c 2008-05-07 14:27:35.000000000 +0200 -+++ db-4.7.25.NC.new/lock/lock.c 2009-11-08 12:52:19.000000000 +0100 -@@ -1274,10 +1274,12 @@ +--- a/lock/lock.c ++++ b/lock/lock.c +@@ -1274,10 +1274,12 @@ __lock_put_internal(lt, lockp, obj_ndx, SH_TAILQ_REMOVE( <->obj_tab[obj_ndx], sh_obj, links, __db_lockobj); if (sh_obj->lockobj.size > sizeof(sh_obj->objdata)) { @@ -16,7 +15,7 @@ diff -urN db-4.7.25.NC/lock/lock.c db-4.7.25.NC.new/lock/lock.c } SH_TAILQ_INSERT_HEAD( &FREE_OBJS(lt, part_id), sh_obj, links, __db_lockobj); -@@ -1467,15 +1469,21 @@ +@@ -1467,15 +1469,21 @@ retry: SH_TAILQ_FOREACH(sh_obj, <->obj if (obj->size <= sizeof(sh_obj->objdata)) p = sh_obj->objdata; else { diff --git a/libs/db47/patches/003-dead_lock.patch b/libs/db47/patches/030-patch.4.7.25.3.patch similarity index 86% rename from libs/db47/patches/003-dead_lock.patch rename to libs/db47/patches/030-patch.4.7.25.3.patch index 2b866601d2..59b00e6512 100644 --- a/libs/db47/patches/003-dead_lock.patch +++ b/libs/db47/patches/030-patch.4.7.25.3.patch @@ -1,7 +1,6 @@ -diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock.c ---- db-4.7.25.NC/lock/lock_deadlock.c 2008-03-10 14:31:33.000000000 +0100 -+++ db-4.7.25.NC.new/lock/lock_deadlock.c 2009-11-08 12:53:25.000000000 +0100 -@@ -121,7 +121,7 @@ +--- a/lock/lock_deadlock.c ++++ b/lock/lock_deadlock.c +@@ -121,7 +121,7 @@ __lock_detect(env, atype, rejectp) DB_LOCKTAB *lt; db_timespec now; locker_info *idmap; @@ -10,7 +9,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. u_int32_t i, cid, keeper, killid, limit, nalloc, nlockers; u_int32_t lock_max, txn_max; int ret, status; -@@ -133,7 +133,8 @@ +@@ -133,7 +133,8 @@ __lock_detect(env, atype, rejectp) if (IS_REP_CLIENT(env)) atype = DB_LOCK_MINWRITE; @@ -20,7 +19,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. lt = env->lk_handle; if (rejectp != NULL) -@@ -179,11 +180,11 @@ +@@ -179,11 +180,11 @@ __lock_detect(env, atype, rejectp) memcpy(copymap, bitmap, nlockers * sizeof(u_int32_t) * nalloc); if ((ret = __os_calloc(env, sizeof(u_int32_t), nalloc, &tmpmap)) != 0) @@ -34,7 +33,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. return (ret); /* -@@ -204,8 +205,7 @@ +@@ -204,8 +205,7 @@ __lock_detect(env, atype, rejectp) txn_max = TXN_MAXIMUM; killid = BAD_KILLID; @@ -44,7 +43,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. if (rejectp != NULL) ++*rejectp; killid = (u_int32_t)(*deadp - bitmap) / nalloc; -@@ -342,11 +342,12 @@ +@@ -342,11 +342,12 @@ dokill: if (killid == BAD_KILLID) { __db_msg(env, "Aborting locker %lx", (u_long)idmap[killid].id); } @@ -62,7 +61,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. __os_free(env, bitmap); __os_free(env, idmap); -@@ -360,6 +361,17 @@ +@@ -360,6 +361,17 @@ err: if (free_me != NULL) #define DD_INVALID_ID ((u_int32_t) -1) @@ -80,7 +79,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. static int __dd_build(env, atype, bmp, nlockers, allocp, idmap, rejectp) ENV *env; -@@ -393,6 +405,7 @@ +@@ -393,6 +405,7 @@ __dd_build(env, atype, bmp, nlockers, al * In particular we do not build the conflict array and our caller * needs to expect this. */ @@ -88,7 +87,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. if (atype == DB_LOCK_EXPIRE) { skip: LOCK_DD(env, region); op = SH_TAILQ_FIRST(®ion->dd_objs, __db_lockobj); -@@ -430,17 +443,18 @@ +@@ -430,17 +443,18 @@ skip: LOCK_DD(env, region); OBJECT_UNLOCK(lt, region, indx); } UNLOCK_DD(env, region); @@ -112,7 +111,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. *nlockers = 0; return (0); } -@@ -448,50 +462,37 @@ +@@ -448,50 +462,37 @@ retry: count = region->stat.st_nlockers; if (FLD_ISSET(env->dbenv->verbose, DB_VERB_DEADLOCK)) __db_msg(env, "%lu lockers", (u_long)count); @@ -170,7 +169,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. lip->dd_id = id++; id_array[lip->dd_id].id = lip->id; switch (atype) { -@@ -510,7 +511,6 @@ +@@ -510,7 +511,6 @@ retry: count = region->stat.st_nlockers; lip->dd_id = DD_INVALID_ID; } @@ -178,7 +177,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. /* * We only need consider objects that have waiters, so we use -@@ -669,7 +669,6 @@ +@@ -669,7 +669,6 @@ again: memset(bitmap, 0, count * sizeof * status after building the bit maps so that we will not detect * a blocked transaction without noting that it is already aborting. */ @@ -186,7 +185,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. for (id = 0; id < count; id++) { if (!id_array[id].valid) continue; -@@ -738,6 +737,7 @@ +@@ -738,6 +737,7 @@ get_lock: id_array[id].last_lock = R_OF id_array[id].in_abort = 1; } UNLOCK_LOCKERS(env, region); @@ -194,7 +193,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. /* * Now we can release everything except the bitmap matrix that we -@@ -839,6 +839,7 @@ +@@ -839,6 +839,7 @@ __dd_abort(env, info, statusp) ret = 0; /* We must lock so this locker cannot go away while we abort it. */ @@ -202,7 +201,7 @@ diff -urN db-4.7.25.NC/lock/lock_deadlock.c db-4.7.25.NC.new/lock/lock_deadlock. LOCK_LOCKERS(env, region); /* -@@ -895,6 +896,7 @@ +@@ -895,6 +896,7 @@ __dd_abort(env, info, statusp) done: OBJECT_UNLOCK(lt, region, info->last_ndx); err: out: UNLOCK_LOCKERS(env, region); diff --git a/libs/db47/patches/040-patch.4.7.25.4.patch b/libs/db47/patches/040-patch.4.7.25.4.patch new file mode 100644 index 0000000000..7db406120d --- /dev/null +++ b/libs/db47/patches/040-patch.4.7.25.4.patch @@ -0,0 +1,118 @@ +--- a/dbinc/repmgr.h ++++ b/dbinc/repmgr.h +@@ -374,6 +374,7 @@ typedef struct { + #define SITE_FROM_EID(eid) (&db_rep->sites[eid]) + #define EID_FROM_SITE(s) ((int)((s) - (&db_rep->sites[0]))) + #define IS_VALID_EID(e) ((e) >= 0) ++#define IS_KNOWN_REMOTE_SITE(e) ((e) >= 0 && ((u_int)(e)) < db_rep->site_cnt) + #define SELF_EID INT_MAX + + #define IS_PEER_POLICY(p) ((p) == DB_REPMGR_ACKS_ALL_PEERS || \ +--- a/rep/rep_elect.c ++++ b/rep/rep_elect.c +@@ -33,7 +33,7 @@ static int __rep_elect_init + static int __rep_fire_elected __P((ENV *, REP *, u_int32_t)); + static void __rep_elect_master __P((ENV *, REP *)); + static int __rep_tally __P((ENV *, REP *, int, u_int32_t *, u_int32_t, roff_t)); +-static int __rep_wait __P((ENV *, db_timeout_t *, int *, int, u_int32_t)); ++static int __rep_wait __P((ENV *, db_timeout_t *, int, u_int32_t)); + + /* + * __rep_elect -- +@@ -55,7 +55,7 @@ __rep_elect(dbenv, given_nsites, nvotes, + ENV *env; + LOG *lp; + REP *rep; +- int done, eid, elected, full_elect, locked, in_progress, need_req; ++ int done, elected, full_elect, locked, in_progress, need_req; + int ret, send_vote, t_ret; + u_int32_t ack, ctlflags, egen, nsites, orig_tally, priority, realpri; + u_int32_t tiebreaker; +@@ -181,8 +181,7 @@ __rep_elect(dbenv, given_nsites, nvotes, + REP_SYSTEM_UNLOCK(env); + (void)__rep_send_message(env, DB_EID_BROADCAST, + REP_MASTER_REQ, NULL, NULL, 0, 0); +- ret = __rep_wait(env, &to, &eid, +- 0, REP_F_EPHASE0); ++ ret = __rep_wait(env, &to, 0, REP_F_EPHASE0); + REP_SYSTEM_LOCK(env); + F_CLR(rep, REP_F_EPHASE0); + switch (ret) { +@@ -286,11 +285,11 @@ restart: + REP_SYSTEM_LOCK(env); + goto vote; + } +- ret = __rep_wait(env, &to, &eid, full_elect, REP_F_EPHASE1); ++ ret = __rep_wait(env, &to, full_elect, REP_F_EPHASE1); + switch (ret) { + case 0: + /* Check if election complete or phase complete. */ +- if (eid != DB_EID_INVALID && !IN_ELECTION(rep)) { ++ if (!IN_ELECTION(rep)) { + RPRINT(env, DB_VERB_REP_ELECT, + (env, "Ended election phase 1")); + goto edone; +@@ -398,15 +397,12 @@ phase2: + REP_SYSTEM_LOCK(env); + goto i_won; + } +- ret = __rep_wait(env, &to, &eid, full_elect, REP_F_EPHASE2); ++ ret = __rep_wait(env, &to, full_elect, REP_F_EPHASE2); + RPRINT(env, DB_VERB_REP_ELECT, + (env, "Ended election phase 2 %d", ret)); + switch (ret) { + case 0: +- if (eid != DB_EID_INVALID) +- goto edone; +- ret = DB_REP_UNAVAIL; +- break; ++ goto edone; + case DB_REP_EGENCHG: + if (to > timeout) + to = timeout; +@@ -1050,13 +1046,6 @@ __rep_elect_master(env, rep) + ENV *env; + REP *rep; + { +- /* +- * We often come through here twice, sometimes even more. We mustn't +- * let the redundant calls affect stats counting. But rep_elect relies +- * on this first part for setting eidp. +- */ +- rep->master_id = rep->eid; +- + if (F_ISSET(rep, REP_F_MASTERELECT | REP_F_MASTER)) { + /* We've been through here already; avoid double counting. */ + return; +@@ -1093,10 +1082,10 @@ __rep_fire_elected(env, rep, egen) + (timeout > 5000000) ? 500000 : ((timeout >= 10) ? timeout / 10 : 1); + + static int +-__rep_wait(env, timeoutp, eidp, full_elect, flags) ++__rep_wait(env, timeoutp, full_elect, flags) + ENV *env; + db_timeout_t *timeoutp; +- int *eidp, full_elect; ++ int full_elect; + u_int32_t flags; + { + DB_REP *db_rep; +@@ -1174,7 +1163,6 @@ __rep_wait(env, timeoutp, eidp, full_ele + F_CLR(rep, REP_F_EGENUPDATE); + ret = DB_REP_EGENCHG; + } else if (phase_over) { +- *eidp = rep->master_id; + done = 1; + ret = 0; + } +--- a/repmgr/repmgr_net.c ++++ b/repmgr/repmgr_net.c +@@ -100,6 +100,8 @@ __repmgr_send(dbenv, control, rec, lsnp, + control, rec, &nsites_sent, &npeers_sent)) != 0) + goto out; + } else { ++ DB_ASSERT(env, IS_KNOWN_REMOTE_SITE(eid)); ++ + /* + * If this is a request that can be sent anywhere, then see if + * we can send it to our peer (to save load on the master), but -- 2.30.2