Cassandra
  1. Cassandra
  2. CASSANDRA-4052

Add way to force the cassandra-cli to refresh it's schema

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 1.1.1
    • Component/s: Tools
    • Labels:

      Description

      By design, the cassandra-cli caches the schema and doesn't refresh it when various commands like "describe keyspaces" are run. This is reasonable, and it is easy enough to restart the cli if necessary. However, this does lead to confusion since a new user can reasonably assume that describe keyspaces will always show an accurate current represention of the ring. We should find a way to reduce the surprise (and lack of easy discoverability) of this behaviour.

      I propose any one of the following(#1 is probably the easiest and most likely):
      1) Add a command (that would be documented in the cli's help) to explicitly refresh the schema ("schema refresh", "refresh schema", or anything similar).
      2) Always force a refresh of the schema when performing at least the "describe keyspaces" command.
      3) Add a flag to cassandra-cli to explicitly enable schema caching. If that flag is not passed, then schema caching will be disabled for that session. This suggestion assumes that for simple deployments (few CFs, etc), schema caching isn't very important to the performance of the cli.

      1. 4052_refresh_schema_1.1_branch.diff
        13 kB
        Dave Brosius
      2. 4052_refresh_schema.diff
        13 kB
        Dave Brosius

        Activity

        Hide
        Hudson added a comment -

        Integrated in Cassandra #1273 (See https://builds.apache.org/job/Cassandra/1273/)
        fix for situation when assumtions are read for CF that does not exist (CASSANDRA-4052) (Revision 189e133a586a5b4afb1021440def9c02d14d17bb)

        Result = FAILURE
        xedin :
        Files :

        • src/java/org/apache/cassandra/cli/CliClient.java
        Show
        Hudson added a comment - Integrated in Cassandra #1273 (See https://builds.apache.org/job/Cassandra/1273/ ) fix for situation when assumtions are read for CF that does not exist ( CASSANDRA-4052 ) (Revision 189e133a586a5b4afb1021440def9c02d14d17bb) Result = FAILURE xedin : Files : src/java/org/apache/cassandra/cli/CliClient.java
        Hide
        Pavel Yaskevich added a comment -

        Committed.

        Show
        Pavel Yaskevich added a comment - Committed.
        Hide
        Dave Brosius added a comment -

        4052_refresh_schema_1.1_branch.diff
        patch applied to cassandra-1.1 branch

        Show
        Dave Brosius added a comment - 4052_refresh_schema_1.1_branch.diff patch applied to cassandra-1.1 branch
        Hide
        Pavel Yaskevich added a comment -

        Yeah,the ticket says that it's for 1.1.1 which is cassandra-1.1 branch.

        Show
        Pavel Yaskevich added a comment - Yeah,the ticket says that it's for 1.1.1 which is cassandra-1.1 branch.
        Hide
        Dave Brosius added a comment -

        Hmmm this applies directly, but it is against trunk.. Do you want me to apply it to some other branch?

        Show
        Dave Brosius added a comment - Hmmm this applies directly, but it is against trunk.. Do you want me to apply it to some other branch?
        Hide
        Pavel Yaskevich added a comment -

        Can you please rebase?

        Show
        Pavel Yaskevich added a comment - Can you please rebase?
        Hide
        Jonathan Ellis added a comment -

        To retain assume commands that have been applied, hold assumptions in a separate class that holds a map of these assumptions. Since we now have that, save these assumptions across separate invocations of cli by storing in a ~/.cassandra-cli directory file.

        Nice!

        Show
        Jonathan Ellis added a comment - To retain assume commands that have been applied, hold assumptions in a separate class that holds a map of these assumptions. Since we now have that, save these assumptions across separate invocations of cli by storing in a ~/.cassandra-cli directory file. Nice!
        Hide
        Dave Brosius added a comment - - edited

        Add flushing of cached schema in cli on updatekeyspace, use and describe. To retain assume commands that have been applied, hold assumptions in a separate class that holds a map of these assumptions. Since we now have that, save these assumptions across separate invocations of cli by storing in a ~/.cassandra-cli directory file.

        patch against trunk

        Show
        Dave Brosius added a comment - - edited Add flushing of cached schema in cli on updatekeyspace, use and describe. To retain assume commands that have been applied, hold assumptions in a separate class that holds a map of these assumptions. Since we now have that, save these assumptions across separate invocations of cli by storing in a ~/.cassandra-cli directory file. patch against trunk
        Hide
        Jonathan Ellis added a comment -

        Ah, I bet you're right.

        Show
        Jonathan Ellis added a comment - Ah, I bet you're right.
        Hide
        Dave Brosius added a comment -

        Is this schema cached to allow for the assumption of cf attributes?

        ie, assume cf validator as utf8;

        ?

        Show
        Dave Brosius added a comment - Is this schema cached to allow for the assumption of cf attributes? ie, assume cf validator as utf8; ?
        Hide
        Jonathan Ellis added a comment -

        Is schema querying so slow that we really need to cache it? Sounds to me like we may have overengineered this.

        Show
        Jonathan Ellis added a comment - Is schema querying so slow that we really need to cache it? Sounds to me like we may have overengineered this.

          People

          • Assignee:
            Dave Brosius
            Reporter:
            Tupshin Harper
            Reviewer:
            Pavel Yaskevich
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development