]> git.sur5r.net Git - openldap/commitdiff
ITS#8323 Fix nested commit
authorHoward Chu <hyc@openldap.org>
Mon, 23 Nov 2015 13:11:29 +0000 (13:11 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 24 Nov 2015 12:46:57 +0000 (12:46 +0000)
Must remove our spilled pages from parent's dirty list

libraries/liblmdb/mdb.c

index 6c4a4dace3f983369b86cb91f6a2fb1b664b5191..fe78eb9fa86602459d1892c0b3493dc43ccd1a39 100644 (file)
@@ -3500,6 +3500,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 */