Concurrent Streaming and Replace improvements#15813
Closed
AmatyaAvadhanula wants to merge 1 commit intoapache:masterfrom
Closed
Concurrent Streaming and Replace improvements#15813AmatyaAvadhanula wants to merge 1 commit intoapache:masterfrom
AmatyaAvadhanula wants to merge 1 commit intoapache:masterfrom
Conversation
| * @param persist If true, commit the newly created lock to the metadata store. | ||
| * Should be false when syncing from storage. | ||
| * @return A TaskLockPosse associating the lock for the request with the provided task. | ||
| */ |
Contributor
Author
There was a problem hiding this comment.
Unrelated docs improvement
| String dataSource, | ||
| Set<DataSegment> segmentsToAppend | ||
| Set<DataSegment> segmentsToAppend, | ||
| @Nullable Map<String, Set<SegmentIdWithShardSpec>> segmentIdToUpgradeVersions |
Contributor
There was a problem hiding this comment.
Suggested change
| @Nullable Map<String, Set<SegmentIdWithShardSpec>> segmentIdToUpgradeVersions | |
| @Nullable Map<String, Set<SegmentIdWithShardSpec>> segmentIdToUpgradedVersions |
Comment on lines
+1489
to
+1517
| for (Interval interval : segmentsToUpgrade.keySet()) { | ||
| filteredSegmentsToUpgrade.put(interval, new HashSet<>()); | ||
| for (DataSegment segment : segmentsToUpgrade.get(interval)) { | ||
| boolean include = true; | ||
| if (segmentIdToUpgradeVersions.containsKey(segment.getId().toString())) { | ||
| for (SegmentIdWithShardSpec upgradedSegment : segmentIdToUpgradeVersions.get(segment.getId().toString())) { | ||
| if (upgradedSegment.getVersion().equals(upgradeVersion)) { | ||
| upgradedSegments.add( | ||
| new DataSegment( | ||
| upgradedSegment.asSegmentId(), | ||
| segment.getLoadSpec(), | ||
| segment.getDimensions(), | ||
| segment.getMetrics(), | ||
| upgradedSegment.getShardSpec(), | ||
| null, | ||
| segment.getBinaryVersion(), | ||
| segment.getSize() | ||
| ) | ||
| ); | ||
| include = false; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| if (include) { | ||
| filteredSegmentsToUpgrade.get(interval).add(segment); | ||
| } | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
can you please some comments to describe what are you trying to do here? I don't follow.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes 2 issues with Streaming ingestion with concurrent replace.
Temporary duplicate results in queries
Suppose a streaming ingestion task has open segments V0-1 with a used segment V0-0, and a replace occurs concurrently with version V1. The replace job would convert the used segment to V1-0, and the open pending segment to V1-1.
However, when the appending job commits segments using the transactional append action, the pending segment is committed as V1-2. This means that there could be a period where V1-1 has not been unannounced, and V1-2 has been loaded, during which both results are visible.
This PR aims to remove that redundancy by committing V1-1 directly.
Temporary data loss in queries
Currently, handoff for streaming ingestion looks only at the original set of segments to the append action. This PR enhances the notifier to look at the upgraded segments as well. Without this change, an append that happens after a replace may miss data that relies on the handoff.