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 2021/03/09 12:41:57 UTC
[iotdb] branch rel/0.11 updated: [IOTDB-1188][To rel/0.11]Fix IoTDB
0.11 unable to delete data bug (#2781)
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch rel/0.11
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.11 by this push:
new 234564a [IOTDB-1188][To rel/0.11]Fix IoTDB 0.11 unable to delete data bug (#2781)
234564a is described below
commit 234564a3af90cd0dfa5e2f6d764d25257ffc1798
Author: wshao08 <59...@users.noreply.github.com>
AuthorDate: Tue Mar 9 20:41:32 2021 +0800
[IOTDB-1188][To rel/0.11]Fix IoTDB 0.11 unable to delete data bug (#2781)
---
.../engine/storagegroup/StorageGroupProcessor.java | 14 +-----------
.../iotdb/db/integration/IoTDBDeletionIT.java | 25 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
index 4394fda..751789f 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessor.java
@@ -1504,7 +1504,7 @@ public class StorageGroupProcessor {
* Delete data whose timestamp <= 'timestamp' and belongs to the time series
* deviceId.measurementId.
*
- * @param path the timeseries path of the to be deleted.
+ * @param path the timeseries path to be deleted.
* @param startTime the startTime of delete range.
* @param endTime the endTime of delete range.
*/
@@ -1522,18 +1522,6 @@ public class StorageGroupProcessor {
try {
Set<PartialPath> devicePaths = IoTDB.metaManager.getDevices(path.getDevicePath());
for (PartialPath device : devicePaths) {
- Long lastUpdateTime = null;
- for (Map<String, Long> latestTimeMap : latestTimeForEachDevice.values()) {
- Long curTime = latestTimeMap.get(device.getFullPath());
- if (curTime != null && (lastUpdateTime == null || lastUpdateTime < curTime)) {
- lastUpdateTime = curTime;
- }
- }
- // There is no tsfile data, the delete operation is invalid
- if (lastUpdateTime == null) {
- logger.debug("No device {} in SG {}, deletion invalid", device, storageGroupName);
- return;
- }
// delete Last cache record if necessary
tryToDeleteLastCache(device, path, startTime, endTime);
}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
index 77c4f90..5173154 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBDeletionIT.java
@@ -313,6 +313,31 @@ public class IoTDBDeletionIT {
}
}
+ @Test
+ public void testDeletionWithNullSeries() throws SQLException {
+ try (Connection connection = DriverManager
+ .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
+ "root");
+ Statement statement = connection.createStatement()) {
+ statement.execute("SET STORAGE GROUP TO root.sg");
+ statement.execute("CREATE TIMESERIES root.sg.d1.s0 WITH DATATYPE=INT32,"
+ + " ENCODING=PLAIN");
+ statement.execute("CREATE TIMESERIES root.sg.d2.s0 WITH DATATYPE=INT32,"
+ + " ENCODING=PLAIN");
+ statement.execute("CREATE TIMESERIES root.sg.d3.s0 WITH DATATYPE=INT32,"
+ + " ENCODING=PLAIN");
+ statement.execute("CREATE TIMESERIES root.sg.d4.s0 WITH DATATYPE=INT32,"
+ + " ENCODING=PLAIN");
+ statement.execute("INSERT INTO root.sg.d2(timestamp,s0) VALUES(100, 32)");
+
+ statement.execute("delete from root.sg.d2 where time <= 300");
+ try (ResultSet resultSet = statement.executeQuery("select * from root.sg.d2")) {
+ // Delete successful
+ assertFalse(resultSet.next());
+ }
+ }
+ }
+
private static void prepareSeries() {
try (Connection connection = DriverManager
.getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",