Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Upsert] Skip removing upsert metadata when shutting down the server #9551

Merged
merged 1 commit into from
Oct 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public abstract class BasePartitionUpsertMetadataManager implements PartitionUps
@VisibleForTesting
public final Set<IndexSegment> _replacedSegments = ConcurrentHashMap.newKeySet();

protected volatile boolean _closed = false;

protected long _lastOutOfOrderEventReportTimeNs = Long.MIN_VALUE;
protected int _numOutOfOrderEvents = 0;

Expand Down Expand Up @@ -245,6 +247,11 @@ public void removeSegment(IndexSegment segment) {
((ImmutableSegmentImpl) segment).persistValidDocIdsSnapshot(validDocIds);
}

if (_closed) {
_logger.info("Skip removing segment: {} because metadata manager is already closed", segment);
return;
}

if (validDocIds == null || validDocIds.isEmpty()) {
_logger.info("Skip removing segment without valid docs: {}", segmentName);
return;
Expand Down Expand Up @@ -281,5 +288,6 @@ protected void handleOutOfOrderEvent(Object currentComparisonValue, Object recor
public void close()
throws IOException {
_logger.info("Closing the metadata manager, current primary key count: {}", getNumPrimaryKeys());
_closed = true;
}
}