Cassandra
  1. Cassandra
  2. CASSANDRA-876

Support session (read-after-write) consistency

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Fix Version/s: None
    • Component/s: Core
    • Labels:

      Description

      In http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html and http://www.allthingsdistributed.com/2008/12/eventually_consistent.html Amazon discusses the concept of "eventual consistency." Cassandra uses eventual consistency in a design similar to Dynamo.

      Supporting session consistency would be useful and relatively easy to add: we already have the concept of a Memtable (see http://wiki.apache.org/cassandra/MemtableSSTable ) to "stage" updates in before flushing to disk; if we applied mutations to a session-level memtable on the coordinator machine (that is, the machine the client is connected to), and then did a final merge from that table against query results before handing them to the client, we'd get it almost for free.

      Of course, the devil is in the details; thrift doesn't provide any hooks for session-level data out of the box, but we could do this with a threadlocal approach fairly easily. CASSANDRA-569 has some (probably out of date now) code that might be useful here.

      1. 876-v2.txt
        47 kB
        Jonathan Ellis
      2. CASSANDRA-876.patch
        53 kB
        Brian Palmer

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        143d 23h 44m 1 Brian Palmer 01/Aug/10 20:19
        Patch Available Patch Available Resolved Resolved
        16d 21h 22m 1 Jonathan Ellis 18/Aug/10 17:41
        Resolved Resolved Reopened Reopened
        4m 34s 1 Jonathan Ellis 18/Aug/10 17:46
        Reopened Reopened Resolved Resolved
        1343d 5h 3m 1 Jonathan Ellis 22/Apr/14 22:49
        Jonathan Ellis made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Hide
        Jonathan Ellis added a comment -

        Going to close as wontfix; I don't see "be careful not to do too many writes in your session or you'll OOM because we're saving them for CL.RYW" as a fun explanation to give people.

        Show
        Jonathan Ellis added a comment - Going to close as wontfix; I don't see "be careful not to do too many writes in your session or you'll OOM because we're saving them for CL.RYW" as a fun explanation to give people.
        Hide
        Muhammad Adel added a comment - - edited

        Is this issue still open for the latest version of Cassandra? As far as I understand from reading different documentations and articles about MemTables, They are already searched for data before searching the SSTable when performing a query.

        Show
        Muhammad Adel added a comment - - edited Is this issue still open for the latest version of Cassandra? As far as I understand from reading different documentations and articles about MemTables, They are already searched for data before searching the SSTable when performing a query.
        Gavin made changes -
        Workflow patch-available, re-open possible [ 12753633 ] reopen-resolved, no closed status, patch-avail, testing [ 12758845 ]
        Gavin made changes -
        Workflow no-reopen-closed, patch-avail [ 12501414 ] patch-available, re-open possible [ 12753633 ]
        Jonathan Ellis made changes -
        Assignee Brian Palmer [ codekitchen ]
        Jonathan Ellis made changes -
        Fix Version/s 0.7.0 [ 12315212 ]
        Hide
        Hudson added a comment -

        Integrated in Cassandra #518 (See https://hudson.apache.org/hudson/job/Cassandra/518/)
        per-connection read-your-writes "session" consistency. patch by Brian Palmer; reviewed by jbellis for CASSANDRA-876

        Show
        Hudson added a comment - Integrated in Cassandra #518 (See https://hudson.apache.org/hudson/job/Cassandra/518/ ) per-connection read-your-writes "session" consistency. patch by Brian Palmer; reviewed by jbellis for CASSANDRA-876
        Jonathan Ellis made changes -
        Fix Version/s 0.7.0 [ 12315212 ]
        Fix Version/s 0.7 beta 2 [ 12315251 ]
        Jonathan Ellis made changes -
        Attachment 876-v2.txt [ 12452416 ]
        Jonathan Ellis made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Jonathan Ellis added a comment -

        forgot about range slice support – should add that before committing. reopening and will attach my edits.

        Show
        Jonathan Ellis added a comment - forgot about range slice support – should add that before committing. reopening and will attach my edits.
        Jonathan Ellis made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Reviewer jbellis
        Resolution Fixed [ 1 ]
        Hide
        Jonathan Ellis added a comment -

        rebased and committed with minor changes

        Show
        Jonathan Ellis added a comment - rebased and committed with minor changes
        Jonathan Ellis made changes -
        Fix Version/s 0.7 beta 2 [ 12315251 ]
        Fix Version/s 0.7.0 [ 12315212 ]
        Jonathan Ellis made changes -
        Summary Support session consistency (i.e. read after write consistency for clients) Support session (read-after-write) consistency
        Assignee Brian Palmer [ codekitchen ]
        Fix Version/s 0.7.0 [ 12315212 ]
        Affects Version/s 0.7.0 [ 12315212 ]
        Priority Major [ 3 ] Minor [ 4 ]
        Matthew F. Dennis made changes -
        Summary Support session consistency Support session consistency (i.e. read after write consistency for clients)
        Brian Palmer made changes -
        Attachment CASSANDRA-876.patch [ 12450997 ]
        Brian Palmer made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Affects Version/s 0.7.0 [ 12315212 ]
        Hide
        Brian Palmer added a comment -

        Here's my first take on session consistency. I've tested it manually, I'm currently digging through the unit and system tests so I can work out the best way to write some automated testing for the new functionality.

        I'm pretty sure this doesn't work properly against range queries yet, since I didn't touch StorageProxy.getRangeSlice(). I'm also not positive it works properly with deletes (tombstones) in the session Memtable, I'll make sure one of the tests exercises that scenario.

        Let me know if I'm on the right track, it took me a bit of time to work out how all the various layers in the o.a.c.db package interact.

        Show
        Brian Palmer added a comment - Here's my first take on session consistency. I've tested it manually, I'm currently digging through the unit and system tests so I can work out the best way to write some automated testing for the new functionality. I'm pretty sure this doesn't work properly against range queries yet, since I didn't touch StorageProxy.getRangeSlice(). I'm also not positive it works properly with deletes (tombstones) in the session Memtable, I'll make sure one of the tests exercises that scenario. Let me know if I'm on the right track, it took me a bit of time to work out how all the various layers in the o.a.c.db package interact.
        Hide
        Jonathan Ellis added a comment -

        Memtables are currently dealt with from Table.apply (for writes) and ColumnFamilyStore.getColumnFamily (for reads).

        Show
        Jonathan Ellis added a comment - Memtables are currently dealt with from Table.apply (for writes) and ColumnFamilyStore.getColumnFamily (for reads).
        Hide
        Jonathan Ellis added a comment -

        (We're now preserving keyspace information between calls in a threadlocal.)

        Show
        Jonathan Ellis added a comment - (We're now preserving keyspace information between calls in a threadlocal.)
        Jonathan Ellis made changes -
        Field Original Value New Value
        Labels gsoc gsoc gsoc2010
        Jonathan Ellis created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Jonathan Ellis
            Reviewer:
            Jonathan Ellis
          • Votes:
            8 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development