You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2023/07/19 18:48:24 UTC

[pinot] branch master updated: Fix reload bug (#11131)

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

jlli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cb876422c Fix reload bug (#11131)
9cb876422c is described below

commit 9cb876422c8c9a329aa5c0fdbbe0f0a8ef8711dd
Author: Vivek Iyer Vaidyanathan <vv...@gmail.com>
AuthorDate: Wed Jul 19 11:48:17 2023 -0700

    Fix reload bug (#11131)
---
 .../segment/creator/impl/inv/geospatial/BaseH3IndexCreator.java  | 9 ++++++---
 .../segment/creator/impl/inv/json/BaseJsonIndexCreator.java      | 6 ++++--
 .../local/segment/creator/impl/text/NativeTextIndexCreator.java  | 5 +++--
 .../segment/local/segment/store/SingleFileIndexDirectory.java    | 2 +-
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/geospatial/BaseH3IndexCreator.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/geospatial/BaseH3IndexCreator.java
index a52b041ae6..ada362c9f8 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/geospatial/BaseH3IndexCreator.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/geospatial/BaseH3IndexCreator.java
@@ -157,9 +157,12 @@ public abstract class BaseH3IndexCreator implements GeoSpatialIndexCreator {
         FileChannel bitmapOffsetFileChannel = new RandomAccessFile(_bitmapOffsetFile, "r").getChannel();
         FileChannel bitmapValueFileChannel = new RandomAccessFile(_bitmapValueFile, "r").getChannel()) {
       indexFileChannel.write(headerBuffer);
-      dictionaryFileChannel.transferTo(0, _dictionaryFile.length(), indexFileChannel);
-      bitmapOffsetFileChannel.transferTo(0, _bitmapOffsetFile.length(), indexFileChannel);
-      bitmapValueFileChannel.transferTo(0, _bitmapValueFile.length(), indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(dictionaryFileChannel, 0, _dictionaryFile.length(),
+          indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(bitmapOffsetFileChannel, 0, _bitmapOffsetFile.length(),
+          indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(bitmapValueFileChannel, 0, _bitmapValueFile.length(),
+          indexFileChannel);
     }
   }
 
diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/json/BaseJsonIndexCreator.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/json/BaseJsonIndexCreator.java
index e2afca19fa..ec3dc439dd 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/json/BaseJsonIndexCreator.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/inv/json/BaseJsonIndexCreator.java
@@ -148,8 +148,10 @@ public abstract class BaseJsonIndexCreator implements JsonIndexCreator {
         FileChannel dictionaryFileChannel = new RandomAccessFile(_dictionaryFile, "r").getChannel();
         FileChannel invertedIndexFileChannel = new RandomAccessFile(_invertedIndexFile, "r").getChannel()) {
       indexFileChannel.write(headerBuffer);
-      dictionaryFileChannel.transferTo(0, dictionaryFileLength, indexFileChannel);
-      invertedIndexFileChannel.transferTo(0, invertedIndexFileLength, indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(dictionaryFileChannel, 0, dictionaryFileLength,
+          indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(invertedIndexFileChannel, 0, invertedIndexFileLength,
+          indexFileChannel);
 
       // Write the doc id mapping to the index file
       ByteBuffer docIdMappingBuffer =
diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/text/NativeTextIndexCreator.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/text/NativeTextIndexCreator.java
index 11af1c14f2..d455c1a789 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/text/NativeTextIndexCreator.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/creator/impl/text/NativeTextIndexCreator.java
@@ -175,8 +175,9 @@ public class NativeTextIndexCreator extends AbstractTextIndexCreator {
         FileChannel invertedIndexFileChannel = new RandomAccessFile(_invertedIndexFile, "r").getChannel();
         FileChannel fstFileChannel = new RandomAccessFile(_fstIndexFile, "rw").getChannel()) {
       indexFileChannel.write(headerBuffer);
-      fstFileChannel.transferTo(0, _fstDataSize, indexFileChannel);
-      invertedIndexFileChannel.transferTo(0, invertedIndexFileLength, indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(fstFileChannel, 0, _fstDataSize, indexFileChannel);
+      org.apache.pinot.common.utils.FileUtils.transferBytes(invertedIndexFileChannel, 0, invertedIndexFileLength,
+          indexFileChannel);
     }
   }
 }
diff --git a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/SingleFileIndexDirectory.java b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/SingleFileIndexDirectory.java
index aac9968afb..a8af853be3 100644
--- a/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/SingleFileIndexDirectory.java
+++ b/pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/store/SingleFileIndexDirectory.java
@@ -417,7 +417,7 @@ class SingleFileIndexDirectory extends ColumnIndexDirectory {
     try (FileChannel srcCh = new RandomAccessFile(srcFile, "r").getChannel();
         FileChannel dstCh = new RandomAccessFile(destFile, "rw").getChannel()) {
       for (IndexEntry index : indicesToCopy.values()) {
-        srcCh.transferTo(index._startOffset, index._size, dstCh);
+        org.apache.pinot.common.utils.FileUtils.transferBytes(srcCh, index._startOffset, index._size, dstCh);
         retained.add(new IndexEntry(index._key, nextOffset, index._size));
         nextOffset += index._size;
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org