Skip to content

Commit

Permalink
PBTree: Fix NPE during concurrent creating and iterating schema (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcosZyk authored Dec 26, 2023
1 parent d9cea67 commit 2c360ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ public void flushVolatileNodes() throws MetadataException {
processFlushDatabase(databaseMNode);
} catch (Exception e) {
exceptions.add(e);
logger.error(e.getMessage());
logger.warn(e.getMessage(), e);
}
}
while (subtreeRoots.hasNext() && checkRemainToFlush()) {
try {
processFlushNonDatabase(subtreeRoots.next());
} catch (Exception e) {
exceptions.add(e);
logger.error(e.getMessage());
logger.warn(e.getMessage(), e);
}
}
if (!exceptions.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,15 @@ public boolean hasNext() {
try {
ISchemaPage nPage;
while (children.isEmpty() && nextSeg >= 0) {
boolean hasThisPage = cxt.referredPages.containsKey(getPageIndex(nextSeg));
nPage = getPageInstance(getPageIndex(nextSeg), cxt);
children = nPage.getAsSegmentedPage().getChildren(getSegIndex(nextSeg));
nextSeg = nPage.getAsSegmentedPage().getNextSegAddress(getSegIndex(nextSeg));
// children iteration need not pin page, consistency is guaranteed by upper layer
nPage.decrementAndGetRefCnt();
if (!hasThisPage) {
cxt.referredPages.remove(nPage.getPageIndex());
nPage.decrementAndGetRefCnt();
}
}
} catch (MetadataException | IOException e) {
logger.error(e.getMessage());
Expand Down

0 comments on commit 2c360ad

Please sign in to comment.