jihoonson commented on a change in pull request #10336:
URL: https://github.com/apache/druid/pull/10336#discussion_r482314655
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/common/task/BatchAppenderators.java
##########
@@ -59,7 +65,9 @@ public static Appenderator newAppenderator(
TaskToolbox toolbox,
DataSchema dataSchema,
AppenderatorConfig appenderatorConfig,
- DataSegmentPusher segmentPusher
+ DataSegmentPusher segmentPusher,
+ RowIngestionMeters rowIngestionMeters,
+ ParseExceptionHandler parseExceptionHandler
Review comment:
I see your point, but I'm not sure if it's good to have
`parseExceptionHandler` be a `rowIngestionMeters` provider. I guess we have a
couple of options for alternatives:
- Merge `RowIngestioMeters` and `ParseExceptionHandler`.
`RowIngestionMeters` will have `handle(ParseException)` method and throw an
exception when it hits the limit. This seems a bit strange to me since metrics
registry can throw an exception.
- Make `RowIngestionMeters` to be only a registry and use individual
`Meter`s. For example, `ParseExceptionHandler` will have only a `Meter` for
counting unparseable events. `AppenderatorImpl` will have only a `Meter` for
counting processed events. This seems sane, but can make code error-prone since
we will have multiple `Meter`s which should be properly chosen whenever we use
them.
I'm not sure any of these are better than now. Do you have any better idea?
##########
File path:
server/src/main/java/org/apache/druid/segment/realtime/appenderator/PeonAppenderatorsManager.java
##########
@@ -129,7 +137,9 @@ public Appenderator createOfflineAppenderatorForTask(
dataSegmentPusher,
objectMapper,
indexIO,
- indexMerger
+ indexMerger,
+ rowIngestionMeters,
+ parseExceptionHandler
Review comment:
They must not be null. I added null checks in `AppenderatorImpl`.
##########
File path:
processing/src/main/java/org/apache/druid/segment/incremental/OnheapIncrementalIndex.java
##########
@@ -186,7 +185,7 @@ protected AddToFactsResult addToFacts(
} else {
// We lost a race
aggs = concurrentGet(prev);
- parseExceptionMessages = doAggregate(metrics, aggs, rowContainer, row);
+ doAggregate(metrics, aggs, rowContainer, row, parseExceptionMessages);
Review comment:
Nice finding. Clearing parseExceptionMessages now.
##########
File path:
processing/src/main/java/org/apache/druid/segment/incremental/OffheapIncrementalIndex.java
##########
@@ -233,16 +232,13 @@ protected AddToFactsResult addToFacts(
}
catch (ParseException e) {
// "aggregate" can throw ParseExceptions if a selector expects
something but gets something else.
- if (getReportParseExceptions()) {
- throw new ParseException(e, "Encountered parse error for
aggregator[%s]", getMetricAggs()[i].getName());
- } else {
- log.debug(e, "Encountered parse error, skipping aggregator[%s].",
getMetricAggs()[i].getName());
- }
+ log.debug(e, "Encountered parse error, skipping aggregator[%s].",
getMetricAggs()[i].getName());
+ parseExceptionMessages.add(e.getMessage());
Review comment:
This is intentional to make it same with `OnheapIncrementalIndex`.
##########
File path:
processing/src/main/java/org/apache/druid/segment/incremental/NoopRowIngestionMeters.java
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.druid.segment.incremental;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class NoopRowIngestionMeters implements RowIngestionMeters
Review comment:
This is used only in `RealtimeIndexTask` which is used by `Tranquility`.
It can be a singleton, but doesn't seem matter.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]