tarun11Mavani commented on code in PR #18643:
URL: https://github.com/apache/pinot/pull/18643#discussion_r3503441561
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/IndexLoadingConfig.java:
##########
@@ -408,6 +414,47 @@ private <K, V> Map<K, V> unmodifiable(Map<K, V> map) {
return map == null ? null : Collections.unmodifiableMap(map);
}
+ // NOTE: entries added here are written directly into
_indexConfigsByColName. Any later call that
+ // sets _dirty = true (e.g. setSegmentTier, addKnownColumns) will trigger
refreshIndexConfigs()
+ // and rebuild the map from scratch, wiping these entries. Callers must
ensure no dirty-flag
+ // mutations happen between this call and the point where the configs are
consumed.
+ public void addOpenStructChildConfigs(SegmentMetadataImpl segmentMetadata) {
+ if (_indexConfigsByColName == null || _dirty) {
+ refreshIndexConfigs();
+ }
+ for (Map.Entry<String, ColumnMetadata> entry :
segmentMetadata.getColumnMetadataMap().entrySet()) {
+ String childColumn = entry.getKey();
+ if (!childColumn.contains(OpenStructNaming.SEPARATOR) ||
_indexConfigsByColName.containsKey(childColumn)) {
+ continue;
+ }
+ if (OpenStructNaming.isSparseColumn(childColumn)) {
+ continue;
+ }
+ String parentColumn = OpenStructNaming.parseParentColumn(childColumn);
+ FieldIndexConfigs parentConfigs =
_indexConfigsByColName.get(parentColumn);
+ if (parentConfigs == null) {
+ continue;
Review Comment:
Good catch — Anurag flagged the same concern. The implicit ordering
dependency is fragile.
Fixed: `addOpenStructChildConfigs` now stores the `SegmentMetadataImpl`
reference, and `refreshIndexConfigs()` re-derives the child configs after every
dirty rebuild. The entries are always computed from first principles (segment
metadata + parent's `OpenStructIndexConfig`), so they survive any
`setSegmentTier()` or `addKnownColumns()` call regardless of ordering.
--
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]