




               Consistency
               
               The CAP Theorem says I cannot have all 3 features
               
               Consistency
               Availability
               Partition Tolerance
               
               Cassandra has AP and Consistency is left to the Developer...
               
               Cassandra has tunable Consistency
               -----------------------------------------------------
               
               My KeySpace has RF=3 (3 copies of each record)
               
               My appl does a insert.
               the Coodinator Node will need to insert 3 copies, however my 
               appl does not need to wait for all 3 copies to be inserted.
               my appl can tell the coordinator to let me know when 1 copy
               is done, and I can continue my code
               
               I set Consistency Level (CL) to 1 in my code.
               
               what this means is I get good responce time, and if a Node
               hosting a copy is down, it does not effect my responce
               
               it also means if another appl queries the record it may not find it
               
               
               -------------------------------------------------
               
               I have a CL for read or write (insert/update/delete)
               and per command being executed.  I can set a default CL
               in my connection and override it per executation
               
               ======================================================
               
               Consistency means "How many copies must responde to my 
               command before the command completes"
               
               choice include:
               CL=1
               CL=2
               CL=3
               CL=ALL
               ....
               
               
               ----------------------------------------------------
               
               I want to insert a record into a KeySpace w/ RF=3
               
               I have these choices:
               
               CL=1 <- wait until 1 copy is written to disk, then the appl continues
                       the coordinator will make sure the other 2 copies are written
                       but my code is not waiting for that
                      
               CL=ANY <- I ask the coordinator to handle the update, and I wait
                         for NO copies to be created, my response time is very fast
                         but no data is on disk, and if the coordinater dies
                         I am out of luck
                         
                         
               --------------------------------------------------------------
               
               I have a cluser w/ nodes
               My KeySpace is set to RF=3
               
               appl #1 updates a record w/ CL=1
               this means right now 1 copy has the latest data (timestamp)
               
               appl #2 does a read of this record
               w/ CL=1 the changes (1 out of 3) that I get the lastest copy
               of the record???
               
               if I set CL=ALL on the read, the coordinator will fetch the timestamps
               (not the data) from all 3 copies then fetch the lastest (column by column)
               returning this results to the appl (the coordinator will then do Read Repair)
               
               --------------------------------------------------------------------------
               
               during a write (insert/update/delete) command w/ CL less than all
               some of the copies are not updated when the appl continues
               
               However the coordinator MUST complete the request even if a Node is
               off-line for a while!!!!
               
               This is Hinted Hand-off
               
               ------------------------------------------------------
               
               
               My CLuster 
               
               Node #1
                    #2      <- use this node as my coordinator (this time)
                                I do an insert w/ CL=1 (the RF=3) 
                    ...
                    #12
                    
                            Node #2 must talk to all 3 copies, if one of the
                            copies is off-line, then Node #2 must store the 
                            insert until the copy comes back, when gossip tells
                            Node #2 the missing node came back, the insert command
                            will run, and the stored (hinted hand-off) will be removed
               
               
               
               
               
                       
               
               
               
               
               
               
               
                
                
