-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix three bugs with segment publishing. #6155
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
Changes from all commits
475ee7b
a181c68
64c4da9
0e09228
77bd38f
a6a9392
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -555,38 +555,33 @@ ListenableFuture<SegmentsAndMetadata> publishInBackground( | |
| final boolean published = publisher.publishSegments( | ||
| ImmutableSet.copyOf(segmentsAndMetadata.getSegments()), | ||
| metadata == null ? null : ((AppenderatorDriverMetadata) metadata).getCallerMetadata() | ||
| ); | ||
| ).isSuccess(); | ||
|
|
||
| if (published) { | ||
| log.info("Published segments."); | ||
| } else { | ||
| log.info("Transaction failure while publishing segments, checking if someone else beat us to it."); | ||
| log.info("Transaction failure while publishing segments, removing them from deep storage " | ||
| + "and checking if someone else beat us to publishing."); | ||
|
|
||
| segmentsAndMetadata.getSegments().forEach(dataSegmentKiller::killQuietly); | ||
|
|
||
| final Set<SegmentIdentifier> segmentsIdentifiers = segmentsAndMetadata | ||
| .getSegments() | ||
| .stream() | ||
| .map(SegmentIdentifier::fromDataSegment) | ||
| .collect(Collectors.toSet()); | ||
|
|
||
| if (usedSegmentChecker.findUsedSegments(segmentsIdentifiers) | ||
| .equals(Sets.newHashSet(segmentsAndMetadata.getSegments()))) { | ||
| log.info( | ||
| "Removing our segments from deep storage because someone else already published them: %s", | ||
| segmentsAndMetadata.getSegments() | ||
| ); | ||
| segmentsAndMetadata.getSegments().forEach(dataSegmentKiller::killQuietly); | ||
|
|
||
| log.info("Our segments really do exist, awaiting handoff."); | ||
| } else { | ||
| throw new ISE("Failed to publish segments[%s]", segmentsAndMetadata.getSegments()); | ||
| throw new ISE("Failed to publish segments."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change for removing too large logs? I feel sometimes this log helps..
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking it's not necessary, since they will get logged in the catch statement via: log.warn(e, "Failed publish, not removing segments: %s", segmentsAndMetadata.getSegments()); |
||
| } | ||
| } | ||
| } | ||
| catch (Exception e) { | ||
| log.warn( | ||
| "Removing segments from deep storage after failed publish: %s", | ||
| segmentsAndMetadata.getSegments() | ||
| ); | ||
| segmentsAndMetadata.getSegments().forEach(dataSegmentKiller::killQuietly); | ||
|
|
||
| // Must not remove segments here, we aren't sure if our transaction succeeded or not. | ||
| log.warn(e, "Failed publish, not removing segments: %s", segmentsAndMetadata.getSegments()); | ||
| throw Throwables.propagate(e); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding an exception to
SegmentPublishResulton failure, so that callers can figure out why it failed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not necessary, since there is supposed to be only one reason: compare-and-swap failure with the metadata update.