You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2023/07/03 14:02:44 UTC
[iotdb] branch IOTDB-6041 created (now ee1a58fc367)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a change to branch IOTDB-6041
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at ee1a58fc367 [IOTDB-6041] Pipe: NPE when handling partial insertion using DisruptorQueue in extractor stage
This branch includes the following new commits:
new ee1a58fc367 [IOTDB-6041] Pipe: NPE when handling partial insertion using DisruptorQueue in extractor stage
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-6041] Pipe: NPE when handling partial insertion using DisruptorQueue in extractor stage
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch IOTDB-6041
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit ee1a58fc367d800823a9173a0a700f39b01c3d07
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Mon Jul 3 21:41:42 2023 +0800
[IOTDB-6041] Pipe: NPE when handling partial insertion using DisruptorQueue in extractor stage
---
.../tablet/TabletInsertionDataContainer.java | 5 +++
.../realtime/assigner/DisruptorQueue.java | 6 +++
.../assigner/DisruptorQueueExceptionHandler.java | 44 ++++++++++++++++++++++
.../matcher/CachedSchemaPatternMatcher.java | 7 +++-
4 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/TabletInsertionDataContainer.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/TabletInsertionDataContainer.java
index 70d532b4631..05e2719874b 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/TabletInsertionDataContainer.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tablet/TabletInsertionDataContainer.java
@@ -283,6 +283,11 @@ public class TabletInsertionDataContainer {
for (int i = 0; i < originColumnSize; i++) {
final String measurement = originMeasurementList[i];
+ // ignore null measurement for partial insert
+ if (measurement == null) {
+ continue;
+ }
+
// low cost check comes first
if (pattern.length() == deviceId.length() + measurement.length() + 1
// high cost check comes later
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueue.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueue.java
index 0b335bf11e7..74eb367c848 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueue.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueue.java
@@ -28,12 +28,17 @@ import com.lmax.disruptor.WaitStrategy;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.dsl.ProducerType;
import com.lmax.disruptor.util.DaemonThreadFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadFactory;
public class DisruptorQueue<E> {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(DisruptorQueue.class);
+
private Disruptor<Container<E>> disruptor;
private RingBuffer<Container<E>> ringBuffer;
@@ -90,6 +95,7 @@ public class DisruptorQueue<E> {
(container, sequence, endOfBatch) ->
handler.onEvent(container.getObj(), sequence, endOfBatch));
}
+ disruptorQueue.disruptor.setDefaultExceptionHandler(new DisruptorQueueExceptionHandler());
disruptorQueue.disruptor.start();
disruptorQueue.ringBuffer = disruptorQueue.disruptor.getRingBuffer();
return disruptorQueue;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueueExceptionHandler.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueueExceptionHandler.java
new file mode 100644
index 00000000000..5a2b6379880
--- /dev/null
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/assigner/DisruptorQueueExceptionHandler.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.pipe.extractor.realtime.assigner;
+
+import com.lmax.disruptor.ExceptionHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DisruptorQueueExceptionHandler implements ExceptionHandler<Object> {
+ private static final Logger LOGGER =
+ LoggerFactory.getLogger(DisruptorQueueExceptionHandler.class);
+
+ @Override
+ public void handleEventException(final Throwable ex, final long sequence, final Object event) {
+ LOGGER.error("Exception processing: {} {}", sequence, event, ex);
+ }
+
+ @Override
+ public void handleOnStartException(final Throwable ex) {
+ LOGGER.warn("Exception during onStart()", ex);
+ }
+
+ @Override
+ public void handleOnShutdownException(final Throwable ex) {
+ LOGGER.warn("Exception during onShutdown()", ex);
+ }
+}
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java
index bb046ee972b..bc9621d31df 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/realtime/matcher/CachedSchemaPatternMatcher.java
@@ -136,7 +136,12 @@ public class CachedSchemaPatternMatcher implements PipeDataRegionMatcher {
// case 2: for example, pattern is root.a.b.c and device is root.a.b
// in this case, we need to check the full path
else {
- for (String measurement : measurements) {
+ for (final String measurement : measurements) {
+ // ignore null measurement for partial insert
+ if (measurement == null) {
+ continue;
+ }
+
// for example, pattern is root.a.b.c, device is root.a.b and measurement is c
// in this case, the extractor can be matched. other cases are not matched.
// please note that there should be a . between device and measurement.