dcapwell commented on code in PR #2220:
URL: https://github.com/apache/cassandra/pull/2220#discussion_r1139396338
##########
src/java/org/apache/cassandra/cql3/Operations.java:
##########
@@ -42,29 +44,46 @@ public final class Operations implements Iterable<Operation>
/**
* The operations on regular columns.
*/
- private final List<Operation> regularOperations = new ArrayList<>();
+ private final List<Operation> regularOperations;
/**
* The operations on static columns.
*/
- private final List<Operation> staticOperations = new ArrayList<>();
+ private final List<Operation> staticOperations;
- private final List<ReferenceOperation> regularSubstitutions = new
ArrayList<>();
- private final List<ReferenceOperation> staticSubstitutions = new
ArrayList<>();
+ private final List<ReferenceOperation> regularSubstitutions;
+ private final List<ReferenceOperation> staticSubstitutions;
public Operations(StatementType type)
{
this.type = type;
+ regularOperations = new ArrayList<>();
+ staticOperations = new ArrayList<>();
+ regularSubstitutions = new ArrayList<>();
+ staticSubstitutions = new ArrayList<>();
+ }
+
+ private Operations(Operations other)
+ {
+ type = other.type;
+ regularOperations = new ArrayList<>(other.regularOperations);
+ staticOperations = new ArrayList<>(other.staticOperations);
+ regularSubstitutions = new ArrayList<>(other.regularSubstitutions);
+ staticSubstitutions = new ArrayList<>(other.staticSubstitutions);
}
- public void migrateReadRequiredOperations()
+ @Nullable
+ public Operations migrateReadRequiredOperations()
{
- migrateReadRequiredOperations(staticOperations, staticSubstitutions);
- migrateReadRequiredOperations(regularOperations, regularSubstitutions);
+ Operations other = new Operations(this);
Review Comment:
had so many back and forth on this due to CAS.... I simplified it all by
having `Operations` take a `boolean isForTxn` and it properly places operations
where they belong, and added new constructor that does the migration in a
single path
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]