Cassandra
  1. Cassandra
  2. CASSANDRA-3856

consider using persistent data structures for some things

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Not a Problem
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      When thinking about CASSANDRA-3831, CASSANDRA-3833, CASSANDRA-3417 (and probably others) I keep thinking that I really want persistent data structures ala Clojure to enable giving out stable copies of data without copying, to avoid complicating the code significantly to achieve a combination of reasonable computational complexity, performance, and thread-safety. However, I am not about to propose that we introduce Clojure into the code base.

      Turns out other people have had similar desires and wanted to see Java varsions of the clojure data structures (https://github.com/krukow/clj-ds and http://thesoftwarelife.blogspot.com/2009/10/java-immutable-persistent-map.html) and there is another persistent ds project too (http://code.google.com/p/pcollections/).

      The latter in particular looks interesting (not having tested it).

      I think it's worth considering adopting the use of these for things like the token meta data. In general, I'd say it may be worth considering for things that are not performance critical in the sense of constant factor performance, but where you want thread-safety and reasonable computational complexity and an easier sense of what's safe from a concurrency perspective. Currently, we keep having to either copy data to "punt" a concurrency concern, at the cost of computational complexity, or else add locking at the cost of performance and complexity, or switch to concurrent data structures at the cost of performance and another type of complexity.

      Does this seem completely out of the blue to people or do people agree it's worth exploring?

        Issue Links

          Activity

          Hide
          Sylvain Lebresne added a comment -

          I agree with Jonathan, if persistent collection make sense for a ticket, let's use them there and/or have the discussion of how pertinent they are for that use case there.

          Show
          Sylvain Lebresne added a comment - I agree with Jonathan, if persistent collection make sense for a ticket, let's use them there and/or have the discussion of how pertinent they are for that use case there.
          Hide
          Jonathan Ellis added a comment -

          I think persistent collections are definitely useful, but I also think it makes sense to evaluate refactorings on a case-by-case basis (e.g., CASSANDRA-2893).

          Show
          Jonathan Ellis added a comment - I think persistent collections are definitely useful, but I also think it makes sense to evaluate refactorings on a case-by-case basis (e.g., CASSANDRA-2893 ).

            People

            • Assignee:
              Peter Schuller
              Reporter:
              Peter Schuller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development