xiangfu0 commented on code in PR #20076:
URL: https://github.com/apache/pinot/pull/20076#discussion_r4407476616


##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManager.java:
##########
@@ -664,6 +674,8 @@ private boolean processStreamEvents(MessageBatch 
messageBatch, long idlePipeSlee
       StreamPartitionMsgOffset nextOffset = metadata.getNextOffset();
       int rowSizeInBytes = metadata.getRecordSerializedSize();
       if (decodedRow.getException() != null) {
+        // A failed schema-registry lookup drops the row, so every failed row 
is classified and written at once.
+        recordSourceError("decode", decodedRow.getException(), true);

Review Comment:
   Every failed row gets classified, and an AUTH or SOURCE_READ result takes 
the recorder's table-wide lock. Locally, 4 consumer threads of one table, every 
row failing with a registry 403, went from 4.49M rows/s with decode alone to 
1.59M rows/s with decode plus record (aggregate). Single-threaded the cost is 
about 0.6 µs per row. That is still far cheaper than master's per-row ERROR 
log, so this isn't a blocker. But the gauge only has 1 s resolution, so 
throttling this per segment (classify at most once a second) would remove 
nearly all of the cost.



##########
pinot-core/src/main/java/org/apache/pinot/core/data/manager/realtime/IngestionSourceErrorRecorder.java:
##########
@@ -0,0 +1,126 @@
+/**
+ * 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.pinot.core.data.manager.realtime;
+
+import java.util.Collection;
+import java.util.EnumMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import org.apache.pinot.common.metrics.ServerGauge;
+import org.apache.pinot.common.metrics.ServerMetrics;
+import org.apache.pinot.spi.ingestion.error.IngestionSourceErrorCategory;
+import org.apache.pinot.spi.ingestion.error.IngestionSourceErrorClassification;
+import org.apache.pinot.spi.ingestion.error.IngestionSourceErrorClassifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/// Records the stream source failures a realtime table's consumers and its 
ingestion delay tracker see: a timestamp
+/// gauge per partition and category, and a WARN line per write, rate-limited 
per category.
+///
+/// [IngestionSourceErrorCategory#AUTH] is written at every refusal, whether 
or not Pinot retries.
+/// [IngestionSourceErrorCategory#SOURCE_READ] is written only once Pinot 
gives up on the source, so a transient
+/// failure it recovers from writes nothing. The gauges record when a failure 
last happened: they are never cleared on
+/// success or when a partition stops consuming, only when the table data 
manager shuts down ([#close]).

Review Comment:
   Design question for the owners: these partition gauges outlive the partition 
on this server. If a rebalance moves a partition away, this server keeps 
exporting its last timestamp until the table data manager shuts down (table 
deletion or server restart). The other per-partition ingestion gauges are 
dropped when `IngestionDelayTracker` stops tracking the partition 
(`stopTrackingPartition` / `timeoutInactivePartitions`). Freshness alerts still 
work, but dashboards that take a max by table, and series cardinality, will 
keep the stale series. Is that intended?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to