]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix MPOOL_IGNOREPIN to ease btree debugging
authorTom Yu <tlyu@mit.edu>
Mon, 8 Aug 2016 13:06:16 +0000 (09:06 -0400)
committerTom Yu <tlyu@mit.edu>
Tue, 16 Aug 2016 19:24:56 +0000 (15:24 -0400)
Various libdb2 test programs use the MPOOL_IGNOREPIN flag to examine
arbitrary mpool pages that may or may not be pinned.  This flag is
apparently intended to allow fetching pages that are already pinned,
and to avoid setting the MPOOL_PINNED flag.  When there was a cache
hit, mpool_get was setting MPOOL_PINNED anyway, causing aborts when
using debugging programs such as dbtest and bttest.

Fix this inconsistency by not setting MPOOL_PINNED when returning a
cached page when the caller requested MPOOL_IGNOREPIN.  In bttest, add
MPOOL_IGNOREPIN to allow dumping of pages while they are pinned
without disrupting their pinned status.

ticket: 8478

src/plugins/kdb/db2/libdb2/mpool/mpool.c
src/plugins/kdb/db2/libdb2/test/btree.tests/main.c

index 8dcda693ef96f5674c7aabf3e3eba52b9769028a..79ad61316dd7ce59868663054ed5cc3b66427085 100644 (file)
@@ -214,7 +214,8 @@ mpool_get(mp, pgno, flags)
                TAILQ_INSERT_TAIL(&mp->lqh, bp, q);
 
                /* Return a pinned page. */
-               bp->flags |= MPOOL_PINNED;
+               if (!(flags & MPOOL_IGNOREPIN))
+                       bp->flags |= MPOOL_PINNED;
                return (bp->page);
        }
 
index 78195d6e6768dce79489480d2791aea75decc942..5b9890b8a2abf063dbd6e1d6f75811a92a8290ec 100644 (file)
@@ -785,7 +785,7 @@ show(db, argv)
 
        pg = atoi(argv[1]);
        t = db->internal;
-       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL) {
+       if ((h = mpool_get(t->bt_mp, pg, MPOOL_IGNOREPIN)) == NULL) {
                (void)printf("getpage of %ld failed\n", pg);
                return;
        }
@@ -793,7 +793,6 @@ show(db, argv)
                __bt_dmpage(h);
        else
                __bt_dpage(db, h);
-       mpool_put(t->bt_mp, h, 0);
 }
 #endif