From 6f9ccc356d24f21bff5675a5bc7bd228fc9f32a4 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Thu, 17 Apr 2008 02:09:16 +0000 Subject: more big index tests; minor bug fix git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@334 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/IndexPageCache.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/java/com/healthmarketscience/jackcess/IndexPageCache.java b/src/java/com/healthmarketscience/jackcess/IndexPageCache.java index f8046d4..0c0d890 100644 --- a/src/java/com/healthmarketscience/jackcess/IndexPageCache.java +++ b/src/java/com/healthmarketscience/jackcess/IndexPageCache.java @@ -610,6 +610,7 @@ public class IndexPageCache // clear the root page rootMain._leaf = false; + rootMain._childTailPageNumber = INVALID_INDEX_PAGE_NUMBER; rootExtra._entries = new ArrayList(); rootExtra._entryPrefix = EMPTY_PREFIX; rootExtra._totalEntrySize = 0; @@ -869,6 +870,7 @@ public class IndexPageCache throw new IllegalStateException("Prev page " + prevMain + " does not ref " + dpMain); } + validatePeerStatus(dpMain, prevMain); } DataPageMain nextMain = _dataPages.get(dpMain._nextPageNumber); @@ -877,6 +879,25 @@ public class IndexPageCache throw new IllegalStateException("Next page " + nextMain + " does not ref " + dpMain); } + validatePeerStatus(dpMain, nextMain); + } + } + + private void validatePeerStatus(DataPageMain dpMain, DataPageMain peerMain) + throws IOException + { + if(dpMain._leaf != peerMain._leaf) { + throw new IllegalStateException("Mismatched peer status " + + dpMain._leaf + " " + peerMain._leaf); + } + if(!dpMain._leaf) { + if((dpMain._parentPageNumber != null) && + (peerMain._parentPageNumber != null) && + ((int)dpMain._parentPageNumber != (int)peerMain._parentPageNumber)) { + throw new IllegalStateException("Mismatched node parents " + + dpMain._parentPageNumber + " " + + peerMain._parentPageNumber); + } } } -- cgit v1.2.3