Skip to content

Commit

Permalink
Retain data index references in RegionedColumnSourceManager
Browse files Browse the repository at this point in the history
  • Loading branch information
lbooker42 committed Mar 19, 2024
1 parent c221bd0 commit 37eb588
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ public class RegionedColumnSourceManager extends LivenessArtifact implements Col
private final ObjectArraySource<RowSet> rowSetSource;
private final ModifiedColumnSet rowSetModifiedColumnSet;

@SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
@ReferentialIntegrity
private final Collection<DataIndex> retainedDataIndexes = new ArrayList<>();

/**
* A reference to a delayed error notifier for the {@link #includedLocationsTable}, if one is pending.
*/
@SuppressWarnings("unused")
@ReferentialIntegrity
private Runnable delayedErrorReference;

Expand Down Expand Up @@ -221,6 +226,7 @@ public synchronized TrackingWritableRowSet initialize() {
try (final SafeCloseable ignored = isRefreshing ? LivenessScopeStack.open() : null) {
final DataIndex partitioningIndex =
new PartitioningColumnDataIndex<>(cd.getName(), columnSources.get(cd.getName()), this);
retainedDataIndexes.add(partitioningIndex);
if (isRefreshing) {
manage(partitioningIndex);
}
Expand All @@ -239,7 +245,10 @@ public synchronized TrackingWritableRowSet initialize() {
final ColumnSource<?>[] keySources = Arrays.stream(keyColumnNames)
.map(columnSources::get)
.toArray(ColumnSource[]::new);
DataIndexer.of(initialRowSet).addDataIndex(new MergedDataIndex(keyColumnNames, keySources, this));
final DataIndex mergedIndex = new MergedDataIndex(keyColumnNames, keySources, this);
retainedDataIndexes.add(mergedIndex);
// Not refreshing, so no need to manage mergedIndex
DataIndexer.of(initialRowSet).addDataIndex(mergedIndex);
}
}
return initialRowSet;
Expand Down

0 comments on commit 37eb588

Please sign in to comment.