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 ff8a16a2df [ASTERIXDB-3435][STO] Use syncWrite instead of doSyncWrite 
on persist
ff8a16a2df is described below

commit ff8a16a2df2e12555eef609aae78858a3ef5fde7
Author: Wail Alkowaileet <[email protected]>
AuthorDate: Sun Jun 16 10:17:44 2024 -0700

    [ASTERIXDB-3435][STO] Use syncWrite instead of doSyncWrite on persist
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    Query threads could persist a page when reading from cloud.
    As such threads could be interrupted, this may also
    interrupt when persisting a page locally -- leading
    to closing the file channel.
    
    Change-Id: Iab15b9cd89339713dbe120fd1212ddd89f8db97a
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18380
    Integration-Tests: Jenkins <[email protected]>
    Tested-by: Jenkins <[email protected]>
    Reviewed-by: Murtadha Hubail <[email protected]>
---
 .../src/main/java/org/apache/asterix/cloud/AbstractCloudIOManager.java | 3 ++-
 .../cloud/buffercache/context/BufferCacheCloudReadContextUtil.java     | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/AbstractCloudIOManager.java
 
b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/AbstractCloudIOManager.java
index 4ca9f592b5..c0823af567 100644
--- 
a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/AbstractCloudIOManager.java
+++ 
b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/AbstractCloudIOManager.java
@@ -182,7 +182,8 @@ public abstract class AbstractCloudIOManager extends 
IOManager implements IParti
 
     @Override
     public final int localWriter(IFileHandle fHandle, long offset, ByteBuffer 
data) throws HyracksDataException {
-        return localIoManager.doSyncWrite(fHandle, offset, data);
+        // Using syncWrite here to avoid closing the file channel when the 
thread is interrupted
+        return localIoManager.syncWrite(fHandle, offset, data);
     }
 
     @Override
diff --git 
a/hyracks-fullstack/hyracks/hyracks-cloud/src/main/java/org/apache/hyracks/cloud/buffercache/context/BufferCacheCloudReadContextUtil.java
 
b/hyracks-fullstack/hyracks/hyracks-cloud/src/main/java/org/apache/hyracks/cloud/buffercache/context/BufferCacheCloudReadContextUtil.java
index 5674797b82..e209ff43e3 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-cloud/src/main/java/org/apache/hyracks/cloud/buffercache/context/BufferCacheCloudReadContextUtil.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-cloud/src/main/java/org/apache/hyracks/cloud/buffercache/context/BufferCacheCloudReadContextUtil.java
@@ -51,7 +51,6 @@ public class BufferCacheCloudReadContextUtil {
         // Next, write the header. This is like a "commit" for the page
         buffer.position(0);
         buffer.limit(RESERVED_HEADER_BYTES);
-        // TODO what if this failed to write fully? (e.g., it wrote the first 
3 bytes of the multiplier)
         cloudIOManager.localWriter(fileHandle, offset, buffer);
 
         // After this point the header is written. We are sure the page is 
valid and has the correct multiplier

Reply via email to