xiangfu0 commented on code in PR #19571:
URL: https://github.com/apache/pinot/pull/19571#discussion_r4087986000
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/IndexLoadingConfig.java:
##########
@@ -324,7 +388,24 @@ public String getSegmentTier() {
public void setSegmentTier(String segmentTier) {
_segmentTier = segmentTier;
- _dirty = true;
+ _resolvedIndexState = null;
Review Comment:
Addressed in 0236cd274f. `setSegmentTier()` now returns immediately when the
tier is unchanged, and `copyWithSegmentTier()` delegates to it so the
reload-specific wrapper keeps the existing resolved state in that case.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/IndexLoadingConfig.java:
##########
@@ -442,16 +518,36 @@ public void addOpenStructChildConfigs(SegmentMetadataImpl
segmentMetadata) {
FieldIndexConfigsUtil.fromFieldConfig(keyFieldConfig,
childFieldSpec))
.add(StandardIndexes.inverted(), enableInverted ?
IndexConfig.ENABLED : IndexConfig.DISABLED)
.build();
- _indexConfigsByColName.put(childColumn, childConfigs);
+ if (updatedConfigs == null) {
+ updatedConfigs = new HashMap<>(indexConfigsByColName);
+ }
+ updatedConfigs.put(childColumn, childConfigs);
+ }
+ if (updatedConfigs == null) {
+ return this;
}
+ IndexLoadingConfig derived = new IndexLoadingConfig(this);
+ derived._resolvedIndexState =
resolvedIndexState.withIndexConfigsByColName(updatedConfigs);
+ return derived;
}
- public void addKnownColumns(Set<String> columns) {
- if (_knownColumns == null) {
- _knownColumns = new HashSet<>(columns);
- } else {
- _knownColumns.addAll(columns);
+ public void addOpenStructChildConfigs(SegmentMetadataImpl segmentMetadata) {
+ _resolvedIndexState =
withOpenStructChildConfigs(segmentMetadata)._resolvedIndexState;
+ }
+
+ public IndexLoadingConfig withKnownColumns(Set<String> columns) {
+ if (_knownColumns != null && _knownColumns.containsAll(columns)) {
+ return this;
}
- _dirty = true;
+ IndexLoadingConfig derived = new IndexLoadingConfig(this);
+ derived.addKnownColumns(columns);
+ return derived;
+ }
+
+ public void addKnownColumns(Set<String> columns) {
+ Set<String> knownColumns = _knownColumns != null ? new
HashSet<>(_knownColumns) : new HashSet<>();
+ knownColumns.addAll(columns);
+ _knownColumns = knownColumns;
+ _resolvedIndexState = null;
Review Comment:
Addressed in 0236cd274f. `addKnownColumns()` now returns immediately when
all requested columns are already present, avoiding the set copy and
resolved-state invalidation for direct callers.
--
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]