This is an automated email from the ASF dual-hosted git repository.
wyk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 8f49dc5ac3 [ASTERIXDB-3451][STO] Avoid unlocking twice when pin fails
8f49dc5ac3 is described below
commit 8f49dc5ac39a9ec3577d096c5bd3f722f0d75fad
Author: Wail Alkowaileet <[email protected]>
AuthorDate: Wed Jul 3 03:32:48 2024 -0700
[ASTERIXDB-3451][STO] Avoid unlocking twice when pin fails
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
readLock().unlock() could be called twice if pin fails
while pinning the next mega-leaf node. Pin should be
called first to avoid releasing the read lock twice.
Change-Id: Ib590716f5018c4b6b79b9cb22992d32994b75a67
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18424
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Wail Alkowaileet <[email protected]>
Reviewed-by: Ian Maxon <[email protected]>
---
.../column/cloud/buffercache/read/CloudColumnReadContext.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/cloud/buffercache/read/CloudColumnReadContext.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/cloud/buffercache/read/CloudColumnReadContext.java
index 4cb717a46d..8d64eec6eb 100644
---
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/cloud/buffercache/read/CloudColumnReadContext.java
+++
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/cloud/buffercache/read/CloudColumnReadContext.java
@@ -117,10 +117,15 @@ public final class CloudColumnReadContext implements
IColumnReadContext {
int nextLeaf = leafFrame.getNextLeaf();
// Release the previous pages
release(bufferCache);
+ /*
+ * First pin the next page0. This has to be called before the unpin
below to avoid doing
+ * readLock().unlock() twice. If unpin called first and pin fails,
then the method onUnpin will be
+ * called twice on the same pageZero, once when unpin called within
this method and another one when the
+ * cursor is closed due to the pin failure.
+ */
+ ICachedPage nextPage =
bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, nextLeaf), this);
// Release page0
bufferCache.unpin(leafFrame.getPage(), this);
- // pin the next page0
- ICachedPage nextPage =
bufferCache.pin(BufferedFileHandle.getDiskPageId(fileId, nextLeaf), this);
leafFrame.setPage(nextPage);
return nextPage;
}