This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new e5ba36aba8a Pipe: Enhanced the "isEmpty" judgement for tablets to
prevent NPE (#13051)
e5ba36aba8a is described below
commit e5ba36aba8aa37a977131b74111b747a688f48e5
Author: Caideyipi <[email protected]>
AuthorDate: Mon Jul 29 15:21:27 2024 +0800
Pipe: Enhanced the "isEmpty" judgement for tablets to prevent NPE (#13051)
---
.../payload/evolvable/request/PipeTransferTabletRawReq.java | 4 +++-
.../db/pipe/event/common/tablet/PipeRawTabletInsertionEvent.java | 9 ++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/payload/evolvable/request/PipeTransferTabletRawReq.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/payload/evolvable/request/PipeTransferTabletRawReq.java
index c739a26a7d3..61790f883ae 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/payload/evolvable/request/PipeTransferTabletRawReq.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/payload/evolvable/request/PipeTransferTabletRawReq.java
@@ -42,6 +42,8 @@ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Objects;
+import static
org.apache.iotdb.db.pipe.event.common.tablet.PipeRawTabletInsertionEvent.isTabletEmpty;
+
public class PipeTransferTabletRawReq extends TPipeTransferReq {
private static final Logger LOGGER =
LoggerFactory.getLogger(PipeTransferTabletRawReq.class);
@@ -61,7 +63,7 @@ public class PipeTransferTabletRawReq extends
TPipeTransferReq {
new
PipeTabletEventSorter(tablet).deduplicateAndSortTimestampsIfNecessary();
try {
- if (tablet == null || tablet.rowSize == 0) {
+ if (isTabletEmpty(tablet)) {
// Empty statement, will be filtered after construction
return new InsertTabletStatement();
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeRawTabletInsertionEvent.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeRawTabletInsertionEvent.java
index 05227ce0408..48acc332ddf 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeRawTabletInsertionEvent.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/PipeRawTabletInsertionEvent.java
@@ -260,7 +260,14 @@ public class PipeRawTabletInsertionEvent extends
EnrichedEvent implements Tablet
}
public boolean hasNoNeedParsingAndIsEmpty() {
- return !shouldParseTimeOrPattern() && tablet.rowSize == 0;
+ return !shouldParseTimeOrPattern() && isTabletEmpty(tablet);
+ }
+
+ public static boolean isTabletEmpty(final Tablet tablet) {
+ return Objects.isNull(tablet)
+ || tablet.rowSize == 0
+ || Objects.isNull(tablet.getSchemas())
+ || tablet.getSchemas().isEmpty();
}
/////////////////////////// Object ///////////////////////////