Cassandra
  1. Cassandra
  2. CASSANDRA-1314

snitch that prefers a single replica for all reads to a given key

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 0.7 beta 2
    • Component/s: Core
    • Labels:
      None

      Description

      motivation is, if you reduce or eliminate read repair (CASSANDRA-930) then you can cache about RF times as much data in memory, than if you're scattering reads across all the replicas equally.

      making this data-center aware would be a nice improvement, but i'm just targetting a single DC here.

      1. 1314.txt
        10 kB
        Jonathan Ellis
      2. SimpleSnitch.java
        0.5 kB
        Jonathan Ellis
      3. StaticPreferenceSnitch.java
        1 kB
        Jonathan Ellis

        Activity

        Hide
        Jonathan Ellis added a comment -

        this won't be effective w/o disabling readrepair.

        in 0.6, <DoConsistencyChecksBoolean>false</DoConsistencyChecksBoolean> under
        <Storage>

        in 0.7, read_repair_chance=0

        Show
        Jonathan Ellis added a comment - this won't be effective w/o disabling readrepair. in 0.6, <DoConsistencyChecksBoolean>false</DoConsistencyChecksBoolean> under <Storage> in 0.7, read_repair_chance=0
        Hide
        Jonathan Ellis added a comment -

        for 0.6 we'll have to "cheat" and rely on our knowledge that the ordering we already have is in token order for the key in question.

        The problem is that the snitch needs to return different nodes for different keys given the same set of addresses, and it doesn't have enough information to do that.

        Show
        Jonathan Ellis added a comment - for 0.6 we'll have to "cheat" and rely on our knowledge that the ordering we already have is in token order for the key in question. The problem is that the snitch needs to return different nodes for different keys given the same set of addresses, and it doesn't have enough information to do that.
        Hide
        Jonathan Ellis added a comment -

        at least one person on IRC would like the order of nodes from Strategy (which i believe is exposed almost directly by describe_ring) to be in algorithmic order so he can easily pick non-overlapping ranges to process on each node locally.

        so maybe moving Strategy back to a List (instead of the current Set) and making that explicit guarantee is the easiest solution to both.

        Show
        Jonathan Ellis added a comment - at least one person on IRC would like the order of nodes from Strategy (which i believe is exposed almost directly by describe_ring) to be in algorithmic order so he can easily pick non-overlapping ranges to process on each node locally. so maybe moving Strategy back to a List (instead of the current Set) and making that explicit guarantee is the easiest solution to both.
        Hide
        Brandon Williams added a comment -

        +1. Note that the dynamic snitch defeats this until CASSANDRA-1519 is solved.

        Show
        Brandon Williams added a comment - +1. Note that the dynamic snitch defeats this until CASSANDRA-1519 is solved.
        Hide
        Jonathan Ellis added a comment -

        committed

        Show
        Jonathan Ellis added a comment - committed
        Hide
        Brandon Williams added a comment -

        Oops, I get build failures on the tests that I overlooked before:

        build-test:
        [javac] Compiling 89 source files to /srv/cassandra/build/test/classes
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:122: calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.ReplicationStrategyEndpointCacheTest.FakeSimpleStrategy cannot override calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.AbstractReplicationStrategy; attempting to use incompatible return type
        [javac] found : java.util.Set<java.net.InetAddress>
        [javac] required: java.util.List<java.net.InetAddress>
        [javac] public Set<InetAddress> calculateNaturalEndpoints(Token token, TokenMetadata metadata)
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:126: incompatible types
        [javac] found : java.util.List<java.net.InetAddress>
        [javac] required: java.util.Set<java.net.InetAddress>
        [javac] return super.calculateNaturalEndpoints(token, metadata);
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:121: method does not override or implement a method from a supertype
        [javac] @Override
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:140: calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.ReplicationStrategyEndpointCacheTest.FakeOldNetworkTopologyStrategy cannot override calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.AbstractReplicationStrategy; attempting to use incompatible return type
        [javac] found : java.util.Set<java.net.InetAddress>
        [javac] required: java.util.List<java.net.InetAddress>
        [javac] public Set<InetAddress> calculateNaturalEndpoints(Token token, TokenMetadata metadata)
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:144: incompatible types
        [javac] found : java.util.List<java.net.InetAddress>
        [javac] required: java.util.Set<java.net.InetAddress>
        [javac] return super.calculateNaturalEndpoints(token, metadata);
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:139: method does not override or implement a method from a supertype
        [javac] @Override
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:158: calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.ReplicationStrategyEndpointCacheTest.FakeNetworkTopologyStrategy cannot override calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.AbstractReplicationStrategy; attempting to use incompatible return type
        [javac] found : java.util.Set<java.net.InetAddress>
        [javac] required: java.util.List<java.net.InetAddress>
        [javac] public Set<InetAddress> calculateNaturalEndpoints(Token token, TokenMetadata metadata)
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:162: incompatible types
        [javac] found : java.util.List<java.net.InetAddress>
        [javac] required: java.util.Set<java.net.InetAddress>
        [javac] return super.calculateNaturalEndpoints(token, metadata);
        [javac] ^
        [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:157: method does not override or implement a method from a supertype
        [javac] @Override
        [javac] ^
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 9 errors

        BUILD FAILED

        Show
        Brandon Williams added a comment - Oops, I get build failures on the tests that I overlooked before: build-test: [javac] Compiling 89 source files to /srv/cassandra/build/test/classes [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:122: calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.ReplicationStrategyEndpointCacheTest.FakeSimpleStrategy cannot override calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.AbstractReplicationStrategy; attempting to use incompatible return type [javac] found : java.util.Set<java.net.InetAddress> [javac] required: java.util.List<java.net.InetAddress> [javac] public Set<InetAddress> calculateNaturalEndpoints(Token token, TokenMetadata metadata) [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:126: incompatible types [javac] found : java.util.List<java.net.InetAddress> [javac] required: java.util.Set<java.net.InetAddress> [javac] return super.calculateNaturalEndpoints(token, metadata); [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:121: method does not override or implement a method from a supertype [javac] @Override [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:140: calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.ReplicationStrategyEndpointCacheTest.FakeOldNetworkTopologyStrategy cannot override calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.AbstractReplicationStrategy; attempting to use incompatible return type [javac] found : java.util.Set<java.net.InetAddress> [javac] required: java.util.List<java.net.InetAddress> [javac] public Set<InetAddress> calculateNaturalEndpoints(Token token, TokenMetadata metadata) [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:144: incompatible types [javac] found : java.util.List<java.net.InetAddress> [javac] required: java.util.Set<java.net.InetAddress> [javac] return super.calculateNaturalEndpoints(token, metadata); [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:139: method does not override or implement a method from a supertype [javac] @Override [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:158: calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.ReplicationStrategyEndpointCacheTest.FakeNetworkTopologyStrategy cannot override calculateNaturalEndpoints(org.apache.cassandra.dht.Token,org.apache.cassandra.locator.TokenMetadata) in org.apache.cassandra.locator.AbstractReplicationStrategy; attempting to use incompatible return type [javac] found : java.util.Set<java.net.InetAddress> [javac] required: java.util.List<java.net.InetAddress> [javac] public Set<InetAddress> calculateNaturalEndpoints(Token token, TokenMetadata metadata) [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:162: incompatible types [javac] found : java.util.List<java.net.InetAddress> [javac] required: java.util.Set<java.net.InetAddress> [javac] return super.calculateNaturalEndpoints(token, metadata); [javac] ^ [javac] /srv/cassandra/test/unit/org/apache/cassandra/locator/ReplicationStrategyEndpointCacheTest.java:157: method does not override or implement a method from a supertype [javac] @Override [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 9 errors BUILD FAILED
        Hide
        Jonathan Ellis added a comment -

        fixed in r999606

        Show
        Jonathan Ellis added a comment - fixed in r999606

          People

          • Assignee:
            Jonathan Ellis
            Reporter:
            Jonathan Ellis
            Reviewer:
            Brandon Williams
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development