This is an automated email from the ASF dual-hosted git repository.

htowaileb 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 320b2b964d [NO ISSUE][TX] Fix hang with COPY statement
320b2b964d is described below

commit 320b2b964d03f060e3400d35f0c7ae825b5f99c5
Author: Peeyush Gupta <[email protected]>
AuthorDate: Thu Aug 10 16:47:52 2023 -0700

    [NO ISSUE][TX] Fix hang with COPY statement
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    For atomic srtatements, GlobalVirtualBufferCache was waiting on a
    different memory component to be flushed than the scheduled one.
    
    Change-Id: I7b1750bc60381a45f1b799f5050b79550b22b552
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17718
    Reviewed-by: Peeyush Gupta <[email protected]>
    Reviewed-by: Murtadha Al Hubail <[email protected]>
    Integration-Tests: Jenkins <[email protected]>
    Tested-by: Peeyush Gupta <[email protected]>
---
 .../apache/asterix/common/context/GlobalVirtualBufferCache.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
index 0bb9bd5f79..2012fe81ee 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
@@ -498,12 +498,13 @@ public class GlobalVirtualBufferCache implements 
IVirtualBufferCache, ILifeCycle
                     // note that this is different from flushing a filtered 
memory component
                     PrimaryIndexOperationTracker opTracker =
                             (PrimaryIndexOperationTracker) 
primaryIndex.getOperationTracker();
+                    ILSMMemoryComponent memoryComponent = null;
                     synchronized (opTracker) {
                         boolean flushable = 
!primaryIndex.isCurrentMutableComponentEmpty();
                         if (flushable && !opTracker.isFlushLogCreated()) {
                             // if the flush log has already been created, then 
we can simply wait for
                             // that flush to complete
-                            ILSMMemoryComponent memoryComponent = 
primaryIndex.getCurrentMemoryComponent();
+                            memoryComponent = 
primaryIndex.getCurrentMemoryComponent();
                             if (memoryComponent.getState() == 
ComponentState.READABLE_WRITABLE) {
                                 // before we schedule the flush, mark the 
memory component as unwritable to prevent
                                 // future writers
@@ -522,7 +523,9 @@ public class GlobalVirtualBufferCache implements 
IVirtualBufferCache, ILifeCycle
                         if ((flushable || opTracker.isFlushLogCreated()) && 
!isMetadataIndex(primaryIndex)) {
                             // global vbc cannot wait on metadata indexes 
because metadata indexes support full
                             // ACID transactions. Waiting on metadata indexes 
can introduce deadlocks.
-                            
flushingComponents.add(primaryIndex.getCurrentMemoryComponent());
+                            if (memoryComponent != null) {
+                                flushingComponents.add(memoryComponent);
+                            }
                             return primaryIndex;
                         }
                     }

Reply via email to