-
Notifications
You must be signed in to change notification settings - Fork 40
Improve logging in Consensus Commit #2915
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
26f9880
Improve logging in Consensus Commit
brfrn169 5d98797
Fix based on feedback
brfrn169 3eb12fe
Fix
brfrn169 30c23c8
Add conditoin to NoMutationException message
brfrn169 5ea0c84
Fix
brfrn169 7e9a377
Merge branch 'master' into improve-logging-in-consensus-commit
brfrn169 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
53 changes: 49 additions & 4 deletions
53
core/src/main/java/com/scalar/db/exception/storage/NoMutationException.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,57 @@ | ||
| package com.scalar.db.exception.storage; | ||
|
|
||
| import com.google.common.collect.ImmutableList; | ||
| import com.scalar.db.api.Mutation; | ||
| import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | ||
| import java.util.List; | ||
|
|
||
| public class NoMutationException extends ExecutionException { | ||
|
|
||
| public NoMutationException(String message) { | ||
| super(message); | ||
| private final List<? extends Mutation> mutations; | ||
|
|
||
| public NoMutationException( | ||
| String message, @SuppressFBWarnings("EI_EXPOSE_REP2") List<? extends Mutation> mutations) { | ||
| super(addTransactionIdToMessage(message, mutations)); | ||
| this.mutations = mutations; | ||
| } | ||
|
|
||
| public NoMutationException(String message, Throwable cause) { | ||
| super(message, cause); | ||
| public NoMutationException( | ||
| String message, | ||
| @SuppressFBWarnings("EI_EXPOSE_REP2") List<? extends Mutation> mutations, | ||
| Throwable cause) { | ||
| super(addTransactionIdToMessage(message, mutations), cause); | ||
| this.mutations = mutations; | ||
| } | ||
|
|
||
| public List<? extends Mutation> getMutations() { | ||
| return ImmutableList.copyOf(mutations); | ||
| } | ||
|
|
||
| private static String addTransactionIdToMessage( | ||
| String message, List<? extends Mutation> mutations) { | ||
| StringBuilder builder = new StringBuilder(message).append(". Mutations: ["); | ||
|
|
||
| boolean first = true; | ||
| for (Mutation mutation : mutations) { | ||
| assert mutation.forFullTableName().isPresent(); | ||
|
|
||
| if (!first) { | ||
| builder.append(", "); | ||
| } else { | ||
| first = false; | ||
| } | ||
| builder | ||
brfrn169 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .append("{Type: ") | ||
| .append(mutation.getClass().getSimpleName()) | ||
| .append(", Table: ") | ||
| .append(mutation.forFullTableName().get()) | ||
| .append(", Partition Key: ") | ||
| .append(mutation.getPartitionKey()) | ||
| .append(", Clustering Key: ") | ||
| .append(mutation.getClusteringKey()) | ||
brfrn169 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| .append("}"); | ||
| } | ||
|
|
||
| return builder.append("]").toString(); | ||
| } | ||
| } | ||
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.