SmartThingsOSS / ratpack-cassandra

Other
14 stars 13 forks source link

Modify QueryOption, RetryPolicy and refactoring code #17

Closed jaejinKim closed 6 years ago

jaejinKim commented 7 years ago
  1. Add the QueryOption for the statement's retry policy

    • Set the readTimeout for reducing read time if readTime over the value then the statement retry again
    • Set the defaultIdempotence for statement's retry policy (default is false it will does not working)
  2. Add the CustomRetryPolicy

    • it will work to retry 3 times
  3. Add the DefaultConsistencyLevel for result resond correctly

    • Set to LOCAL_QUORUM from ONE
  4. Code refactoring for extending subclass

    • Existing function and variables are private so it can not use builder object
beckje01 commented 7 years ago

Why would a good default for DefaultConsistencyLevel be LOCAL_QUORUM?

jaejinKim commented 7 years ago

@beckje01
I set LOCAL_QUORUM in order to increase accuracy about the result.

If default ConsistencyLevel.ONE use, Cassandra sometimes return the result that is null when write and read.

For example, replica exists A,B,C. Client wirte a data then eplica A write operation is successful. Then client quickly read the wrote data. Then return null value from replica B or C because replica B and C does not copy the result not yet.

So I set LOCAL_QUORUM that number of replica / 2 + 1 are successful then return lthe recent result.

So it is more fastest than QUORUM because it does not read/write in Global Data center. It read/write in same local Data center.only.

Write and quickly read then result is null this issue occurs many times in real server environemnts.. not only Global Cassandra but also Local Cassandra.

beckje01 commented 7 years ago

CL.ONE is the better choice for defaults, generally you should be either tuning the cluster to work better or designing around the immediate write then read that shouldn't be needed. This library should embrace C* best practices

jaejinKim commented 7 years ago

Ok I will modify to CL.ONE.

jaejinKim commented 7 years ago

I modifyed your requirements. Please check again.

jaejinKim commented 7 years ago

Ok I fixed some codes. Please check again.