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
Improve performance by avoiding string concatenation in a loop using StringBuilder #458
Open
tyqi11
wants to merge
1
commit into
apache:trunk
Choose a base branch
from
tyqi11:pr
base: trunk
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
@tyqi11 please create a jira ticket in Apache Cassandra JIRA if you want to see this happen. |
blambov
pushed a commit
to blambov/cassandra
that referenced
this pull request
Sep 30, 2022
* abstract mutations used by CDC At first, I tried to refactor StorageProxy methods and WritePerformer interface, but since every now and then we want to rebase on OS C*, I reverted all the changes. Instead, a new abstraction level over various mutate methods is introduced - Mutator. The default implementation proxies the calls to the original (default) methods. The users may provide a custom class Mutator implementation to alter the mutation behavior. This solution was chosen to minimize the rebase conflicts, it's a compromise between code structuring and maintenance cost. In the ideal world we could refactor the mutation methods to separate classes. * add ComplexColumnData.hasCells * make currentTimeoutNanos overridable CDCWriteResponseHandler doesn't use the default timeout taken from DatabaseDescriptor * port 'CNDB-3334 CDC counter support' Add applyCounterMutationWithoutLocks method. The method applies the counter without locks (not needed in CDC as all the writes to the same partition are serialized by CDC Service). The mutation is applied with the given id and clockMicros. The values are precomputed and distributed by CDC Service. Writers receive the mutation with the attached values, thanks to this all the writers may apply the mutation as if they were leader replicas. See the ticket description for details on leader and follower replica concepts used by pure Cassandra counter write path. * make RepairedDataInfo public RepairedDataInfo.NO_OP_REPAIRED_DATA_INFO is used by CDC to denote no repair data info.
blambov
pushed a commit
to blambov/cassandra
that referenced
this pull request
Nov 24, 2022
* abstract mutations used by CDC At first, I tried to refactor StorageProxy methods and WritePerformer interface, but since every now and then we want to rebase on OS C*, I reverted all the changes. Instead, a new abstraction level over various mutate methods is introduced - Mutator. The default implementation proxies the calls to the original (default) methods. The users may provide a custom class Mutator implementation to alter the mutation behavior. This solution was chosen to minimize the rebase conflicts, it's a compromise between code structuring and maintenance cost. In the ideal world we could refactor the mutation methods to separate classes. * add ComplexColumnData.hasCells * make currentTimeoutNanos overridable CDCWriteResponseHandler doesn't use the default timeout taken from DatabaseDescriptor * port 'CNDB-3334 CDC counter support' Add applyCounterMutationWithoutLocks method. The method applies the counter without locks (not needed in CDC as all the writes to the same partition are serialized by CDC Service). The mutation is applied with the given id and clockMicros. The values are precomputed and distributed by CDC Service. Writers receive the mutation with the attached values, thanks to this all the writers may apply the mutation as if they were leader replicas. See the ticket description for details on leader and follower replica concepts used by pure Cassandra counter write path. * make RepairedDataInfo public RepairedDataInfo.NO_OP_REPAIRED_DATA_INFO is used by CDC to denote no repair data info. (cherry picked from commit 5191be2)
adelapena
pushed a commit
to adelapena/cassandra
that referenced
this pull request
Sep 26, 2023
* abstract mutations used by CDC At first, I tried to refactor StorageProxy methods and WritePerformer interface, but since every now and then we want to rebase on OS C*, I reverted all the changes. Instead, a new abstraction level over various mutate methods is introduced - Mutator. The default implementation proxies the calls to the original (default) methods. The users may provide a custom class Mutator implementation to alter the mutation behavior. This solution was chosen to minimize the rebase conflicts, it's a compromise between code structuring and maintenance cost. In the ideal world we could refactor the mutation methods to separate classes. * add ComplexColumnData.hasCells * make currentTimeoutNanos overridable CDCWriteResponseHandler doesn't use the default timeout taken from DatabaseDescriptor * port 'CNDB-3334 CDC counter support' Add applyCounterMutationWithoutLocks method. The method applies the counter without locks (not needed in CDC as all the writes to the same partition are serialized by CDC Service). The mutation is applied with the given id and clockMicros. The values are precomputed and distributed by CDC Service. Writers receive the mutation with the attached values, thanks to this all the writers may apply the mutation as if they were leader replicas. See the ticket description for details on leader and follower replica concepts used by pure Cassandra counter write path. * make RepairedDataInfo public RepairedDataInfo.NO_OP_REPAIRED_DATA_INFO is used by CDC to denote no repair data info. (cherry picked from commit 5191be2) (cherry picked from commit 75b8d12) (cherry picked from commit ba2a0a6)
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.
String concatenation in a loop is inefficient in time and space complexity. Using a StringBuilder solves the problem.