You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/01/13 08:08:48 UTC

[GitHub] [iotdb] HTHou commented on a change in pull request #2488: Add DirectByteBufferPool for WAL

HTHou commented on a change in pull request #2488:
URL: https://github.com/apache/iotdb/pull/2488#discussion_r556330461



##########
File path: server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupInfo.java
##########
@@ -94,13 +100,46 @@ public void setLastReportedSize(long size) {
   }
 
   /**
-   * When a TsFileProcessor is closing, remove it from reportedTsps, and report to systemInfo
-   * to update SG cost.
-   * 
+   * When a TsFileProcessor is closing, remove it from reportedTsps, and report to systemInfo to
+   * update SG cost.
+   *
    * @param tsFileProcessor
    */
   public void closeTsFileProcessorAndReportToSystem(TsFileProcessor tsFileProcessor) {
     reportedTsps.remove(tsFileProcessor);
     SystemInfo.getInstance().resetStorageGroupStatus(this, true);
   }
+
+  public Supplier<ByteBuffer[]> getWalSupplier() {
+    if (storageGroupProcessor != null) {
+      return storageGroupProcessor::getWalDirectByteBuffer;
+    } else { // only happens in test
+      return this::walSupplier;
+    }
+  }
+
+  @TestOnly
+  private ByteBuffer[] walSupplier() {
+    ByteBuffer[] buffers = new ByteBuffer[2];
+    buffers[0] = ByteBuffer
+        .allocateDirect(IoTDBDescriptor.getInstance().getConfig().getWalBufferSize() / 2);
+    buffers[0] = ByteBuffer

Review comment:
       Should be buffers[1]?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org