[ 
https://issues.apache.org/jira/browse/CASSANDRA-13529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16390722#comment-16390722
 ] 

Dinesh Joshi commented on CASSANDRA-13529:
------------------------------------------

Hey [~chovatia.jayd...@gmail.com], I took an initial pass at your patch -
 # {{SchemaQuery::checkCASQuery}}
 ## Line 171: Usage of {{==}} to compare Integer objects is incorrect. Please 
use {{.equals()}}
 ## You can simplify oneConditionIndex counting by using lambdas
 ### {{Arrays.stream(argumentIndex).filter(( x ) -> x == 
oneConditionIndex).count();}}
 ## Remove type specification {{<Integer, Integer>}} while initializing 
{{casConditionMapping}}.
 ## Consider renaming {{casConditionMapping}} to {{casConditionArgFreqMap}} or 
better create a class that maps the {{conditionArgumentIndex}} to its frequency.
 ## It's a good idea to return a defensive copy in 
{{ModificationStatement::getConditions()}}

Taking a step back for a moment you may want to refactor your code along these 
lines -
 # There is a lot that was added to {{SchemaQuery}}. It would be beneficial if 
you add two classes {{CASQueryStatic}} and {{CASQueryDynamic}} inheriting from 
a new class called {{CASQuery}}.
 # You could add a factory that will accept the string query and return a 
{{CASQuery}}.
 # {{CASQueryStatic}} can implement the basic {{CASQuery}} without dynamic 
conditions while the {{CASQueryDynamic}} can extend {{CASQueryStatic}}'s 
functionality and encapsulate the logic to read current values within the 
{{CASQueryDynamic}}. It will help make the code easier to follow.
 # Consider adding a CASQueryRead class internal to CASQueryDynamic for 
representing it's CAS reads.
 # Pull out the {{CAS}} related changes to {{SchemaStatement}} to {{CASQuery}} 
base class.

> cassandra-stress light-weight transaction support
> -------------------------------------------------
>
>                 Key: CASSANDRA-13529
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13529
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Stress
>            Reporter: Jaydeepkumar Chovatia
>            Assignee: Jaydeepkumar Chovatia
>            Priority: Minor
>             Fix For: 4.x
>
>         Attachments: 13529.txt, lwttest.yaml
>
>
> It would be nice to have a light-weight transaction support in 
> cassandra-stress.
> Although currently in cassandra-stress we can achieve light-weight 
> transaction partially by using static conditions like "IF col1 != null" or 
> "IF not EXIST". 
> If would be ideal to have full fledged light-weight transaction support like 
> "IF col1 = ? and col2 = ?". One way to implement is to read values from 
> Cassandra and use that in the condition so it will execute all the paxos 
> phases in Cassandra.
> Please find git link for the patch: 
> https://github.com/apache/cassandra/compare/trunk...jaydeepkumar1984:13529-trunk?expand=1
> ||trunk|
> |[branch|https://github.com/jaydeepkumar1984/cassandra/tree/13529-trunk]|
> |[utests|https://circleci.com/gh/jaydeepkumar1984/cassandra/8]|



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to