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/04/08 15:31:57 UTC

[iotdb] branch IOTDB_2864_13 created (now f83d84f2f1)

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

haonan pushed a change to branch IOTDB_2864_13
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at f83d84f2f1 [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries

This branch includes the following new commits:

     new f83d84f2f1 [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries

Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f83d84f2f17ddf3cec4d1edd623c92b9564157b8
Author: HTHou <hh...@outlook.com>
AuthorDate: Fri Apr 8 23:08:06 2022 +0800

    [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries
---
 ...aluesIT.java => IoTDBInsertAlignedValuesIT.java} | 21 ++++++++++++++++++++-
 .../iotdb/db/utils/datastructure/AlignedTVList.java |  5 +++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IOTDBInsertAlignedValuesIT.java b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBInsertAlignedValuesIT.java
similarity index 92%
rename from integration/src/test/java/org/apache/iotdb/db/integration/aligned/IOTDBInsertAlignedValuesIT.java
rename to integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBInsertAlignedValuesIT.java
index d8b3363368..14beb4ae47 100644
--- a/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IOTDBInsertAlignedValuesIT.java
+++ b/integration/src/test/java/org/apache/iotdb/db/integration/aligned/IoTDBInsertAlignedValuesIT.java
@@ -40,7 +40,7 @@ import java.sql.Statement;
 import java.util.Objects;
 
 @Category({LocalStandaloneTest.class})
-public class IOTDBInsertAlignedValuesIT {
+public class IoTDBInsertAlignedValuesIT {
   private static Connection connection;
   private static final int oldTsFileGroupSizeInByte =
       TSFileDescriptor.getInstance().getConfig().getGroupSizeInByte();
@@ -369,4 +369,23 @@ public class IOTDBInsertAlignedValuesIT {
       Assert.assertEquals("411: Insertion contains duplicated measurement: status", e.getMessage());
     }
   }
+
+  @Test
+  public void testExtendTextColumn() {
+    int primitiveArraySize = IoTDBDescriptor.getInstance().getConfig().getPrimitiveArraySize();
+    IoTDBDescriptor.getInstance().getConfig().setPrimitiveArraySize(2);
+    try (Statement st1 = connection.createStatement()) {
+      st1.execute("insert into root.sg.d1(time,s1,s2) aligned values(1,'test','test')");
+      st1.execute("insert into root.sg.d1(time,s1,s2) aligned values(2,'test','test')");
+      st1.execute("insert into root.sg.d1(time,s1,s2) aligned values(3,'test','test')");
+      st1.execute("insert into root.sg.d1(time,s1,s2) aligned values(4,'test','test')");
+      st1.execute("insert into root.sg.d1(time,s1,s3) aligned values(5,'test','test')");
+      st1.execute("insert into root.sg.d1(time,s1,s2) aligned values(6,'test','test')");
+      st1.execute("flush");
+      st1.execute("insert into root.sg.d1(time,s1,s3) aligned values(7,'test','test')");
+    } catch (SQLException e) {
+      Assert.fail();
+    }
+    IoTDBDescriptor.getInstance().getConfig().setPrimitiveArraySize(primitiveArraySize);
+  }
 }
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
index c91348fce5..7f361e6228 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/AlignedTVList.java
@@ -298,8 +298,9 @@ public class AlignedTVList extends TVList {
           break;
       }
       BitMap bitMap = new BitMap(ARRAY_SIZE);
-      // last bitmap should be marked to the tslist size's position
-      if (i == timestamps.size() - 1) {
+      // last bitmap should be marked to the tvlist size's position
+      // if rowCount % ARRAY_SIZE != 0, last bitmap should mark all
+      if (i == timestamps.size() - 1 && rowCount % ARRAY_SIZE != 0) {
         for (int j = 0; j < rowCount % ARRAY_SIZE; j++) {
           bitMap.mark(j);
         }