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:08:30 UTC
[iotdb] 01/01: [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch IOTDB_2864
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 02b85e8dd42d7bc018367c5c14fa47f3e64cdf5b
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 cfdde1efb0..688aac3c35 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);
}