You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/03/23 06:00:20 UTC

[iotdb] branch rel/0.13 updated: [IOTDB-2787] Fix aligned mem chunk concurrent problem (#5324)

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

haonan pushed a commit to branch rel/0.13
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/0.13 by this push:
     new f8d97a8  [IOTDB-2787] Fix aligned mem chunk concurrent problem (#5324)
f8d97a8 is described below

commit f8d97a887e315b0869ab3bc166e428fca621e5b2
Author: SilverNarcissus <15...@smail.nju.edu.cn>
AuthorDate: Wed Mar 23 13:59:28 2022 +0800

    [IOTDB-2787] Fix aligned mem chunk concurrent problem (#5324)
---
 .../apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java    | 6 +++---
 .../java/org/apache/iotdb/db/engine/memtable/IWritableMemChunk.java | 6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java
index cef4c5d..c7ec62f 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/memtable/AlignedWritableMemChunk.java
@@ -206,7 +206,7 @@ public class AlignedWritableMemChunk implements IWritableMemChunk {
   }
 
   @Override
-  public TVList getSortedTvListForQuery() {
+  public synchronized TVList getSortedTvListForQuery() {
     sortTVList();
     // increase reference count
     list.increaseReferenceCount();
@@ -214,7 +214,7 @@ public class AlignedWritableMemChunk implements IWritableMemChunk {
   }
 
   @Override
-  public TVList getSortedTvListForQuery(List<IMeasurementSchema> schemaList) {
+  public synchronized TVList getSortedTvListForQuery(List<IMeasurementSchema> schemaList) {
     sortTVList();
     // increase reference count
     list.increaseReferenceCount();
@@ -238,7 +238,7 @@ public class AlignedWritableMemChunk implements IWritableMemChunk {
   }
 
   @Override
-  public void sortTvListForFlush() {
+  public synchronized void sortTvListForFlush() {
     sortTVList();
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/memtable/IWritableMemChunk.java b/server/src/main/java/org/apache/iotdb/db/engine/memtable/IWritableMemChunk.java
index 3061c30..c46714f 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/memtable/IWritableMemChunk.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/memtable/IWritableMemChunk.java
@@ -94,6 +94,8 @@ public interface IWritableMemChunk {
    *
    * <p>the mechanism is just like copy on write
    *
+   * <p>This interface should be synchronized for concurrent with sortTvListForFlush
+   *
    * @return sorted tv list
    */
   TVList getSortedTvListForQuery();
@@ -103,6 +105,8 @@ public interface IWritableMemChunk {
    *
    * <p>the mechanism is just like copy on write
    *
+   * <p>This interface should be synchronized for concurrent with sortTvListForFlush
+   *
    * @return sorted tv list
    */
   TVList getSortedTvListForQuery(List<IMeasurementSchema> schemaList);
@@ -110,6 +114,8 @@ public interface IWritableMemChunk {
   /**
    * served for flush requests. The logic is just same as getSortedTVListForQuery, but without add
    * reference count
+   *
+   * <p>This interface should be synchronized for concurrent with getSortedTvListForQuery
    */
   void sortTvListForFlush();