KKcorps commented on code in PR #19710:
URL: https://github.com/apache/pinot/pull/19710#discussion_r4152766855
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -1225,6 +1228,28 @@ static void validateUpsertAndDedupConfig(TableConfig
tableConfig, Schema schema,
}
}
+ /// Rejects consuming the next segment during a download on tables that
revert upsert metadata in PROTECTED mode,
+ /// because the next segment's snapshot would run before the revert and miss
the rows it restores.
+ @VisibleForTesting
+ static void validateConsumptionDuringDownloadWithUpsertRevert(TableConfig
tableConfig) {
+ if (tableConfig.getTableType() != TableType.REALTIME ||
!isTableTypeInconsistentDuringConsumption(tableConfig)
+ ||
ConsumingSegmentConsistencyModeListener.getInstance().getConsistencyMode()
+ != ConsumingSegmentConsistencyModeListener.Mode.PROTECTED) {
+ return;
+ }
+ IngestionConfig ingestionConfig = tableConfig.getIngestionConfig();
+ StreamIngestionConfig streamIngestionConfig =
+ ingestionConfig != null ? ingestionConfig.getStreamIngestionConfig() :
null;
+ ParallelSegmentConsumptionPolicy policy =
+ streamIngestionConfig != null ?
streamIngestionConfig.getParallelSegmentConsumptionPolicy() : null;
+ boolean consumesDuringDownload = policy != null ?
policy.isAllowedDuringDownload()
Review Comment:
This already rejects `ALLOW_ALWAYS`, since `isAllowedDuringDownload()` is
true for it and the test covers that case. I added a comment and made the error
start with the policy it rejected, so it is easy to see.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -1225,6 +1228,28 @@ static void validateUpsertAndDedupConfig(TableConfig
tableConfig, Schema schema,
}
}
+ /// Rejects consuming the next segment during a download on tables that
revert upsert metadata in PROTECTED mode,
+ /// because the next segment's snapshot would run before the revert and miss
the rows it restores.
+ @VisibleForTesting
+ static void validateConsumptionDuringDownloadWithUpsertRevert(TableConfig
tableConfig) {
+ if (tableConfig.getTableType() != TableType.REALTIME ||
!isTableTypeInconsistentDuringConsumption(tableConfig)
+ ||
ConsumingSegmentConsistencyModeListener.getInstance().getConsistencyMode()
+ != ConsumingSegmentConsistencyModeListener.Mode.PROTECTED) {
+ return;
+ }
+ IngestionConfig ingestionConfig = tableConfig.getIngestionConfig();
Review Comment:
I do not think `enforceConsumptionInOrder` stops this one, because N
registers itself as soon as it starts consuming, so N+1's in-order wait passes
before N's download begins. Requiring it would also reject every revert table
that keeps the default `false`, so I would rather track that as a separate
check if we want it.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -1225,6 +1228,28 @@ static void validateUpsertAndDedupConfig(TableConfig
tableConfig, Schema schema,
}
}
+ /// Rejects consuming the next segment during a download on tables that
revert upsert metadata in PROTECTED mode,
+ /// because the next segment's snapshot would run before the revert and miss
the rows it restores.
+ @VisibleForTesting
+ static void validateConsumptionDuringDownloadWithUpsertRevert(TableConfig
tableConfig) {
Review Comment:
Done, renamed to `validateConsumptionDuringUpsertRevert`.
--
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]