You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2015/09/18 13:40:36 UTC

[3/3] cassandra git commit: Merge branch 'cassandra-2.0' into cassandra-2.1

Merge branch 'cassandra-2.0' into cassandra-2.1


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a2f0da07
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a2f0da07
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a2f0da07

Branch: refs/heads/cassandra-2.1
Commit: a2f0da07315a13cd24a6f253b63c4bed6bfe6ed3
Parents: 98c4a7c c4de752
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Fri Sep 18 12:40:25 2015 +0100
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Fri Sep 18 12:40:25 2015 +0100

----------------------------------------------------------------------
 CHANGES.txt                                           |  1 +
 .../locator/GossipingPropertyFileSnitch.java          | 14 +++++++++-----
 .../apache/cassandra/locator/PropertyFileSnitch.java  | 14 +++++++++-----
 .../org/apache/cassandra/locator/TokenMetadata.java   |  2 ++
 .../locator/YamlFileNetworkTopologySnitch.java        | 10 ++++++----
 .../org/apache/cassandra/service/StorageService.java  |  3 ++-
 6 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2f0da07/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 166106d,658c19f..f629050
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -1,50 -1,8 +1,51 @@@
 -2.0.17
 +2.1.10
 + * Prevent ALTER TYPE from creating circular references (CASSANDRA-10339)
 + * Fix cache handling of 2i and base tables (CASSANDRA-10155, 10359)
 + * Fix NPE in nodetool compactionhistory (CASSANDRA-9758)
 + * (Pig) support BulkOutputFormat as a URL parameter (CASSANDRA-7410)
 + * BATCH statement is broken in cqlsh (CASSANDRA-10272)
 + * Added configurable warning threshold for GC duration (CASSANDRA-8907)
 + * (cqlsh) Make cqlsh PEP8 compliant (CASSANDRA-10066)
 + * (cqlsh) Fix error when starting cqlsh with --debug (CASSANDRA-10282)
 + * Scrub, Cleanup and Upgrade do not unmark compacting until all operations
 +   have completed, regardless of the occurence of exceptions (CASSANDRA-10274)
 + * Fix handling of streaming EOF (CASSANDRA-10206)
 + * Only check KeyCache when it is enabled
 + * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
 + * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
 +Merged from 2.0:
+  * Fix rare race where older gossip states can be shadowed (CASSANDRA-10366)
   * Fix consolidating racks violating the RF contract (CASSANDRA-10238)
   * Disallow decommission when node is in drained state (CASSANDRA-8741)
 - * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)
 +
 +
 +2.1.9
 + * Avoid race condition during read repair (CASSANDRA-9460)
 + * (cqlsh) default load-from-file encoding to utf-8 (CASSANDRA-9898)
 + * Avoid returning Permission.NONE when failing to query users table (CASSANDRA-10168)
 + * (cqlsh) Allow encoding to be set through command line (CASSANDRA-10004)
 + * Add new JMX methods to change local compaction strategy (CASSANDRA-9965)
 + * Write hints for paxos commits (CASSANDRA-7342)
 + * (cqlsh) Fix timestamps before 1970 on Windows, always
 +   use UTC for timestamp display (CASSANDRA-10000)
 + * (cqlsh) Avoid overwriting new config file with old config
 +   when both exist (CASSANDRA-9777)
 + * Release snapshot selfRef when doing snapshot repair (CASSANDRA-9998)
 + * Cannot replace token does not exist - DN node removed as Fat Client (CASSANDRA-9871)
 + * Fix handling of enable/disable autocompaction (CASSANDRA-9899)
 + * Commit log segment recycling is disabled by default (CASSANDRA-9896)
 + * Add consistency level to tracing ouput (CASSANDRA-9827)
 + * Fix MarshalException when upgrading superColumn family (CASSANDRA-9582)
 + * Fix broken logging for "empty" flushes in Memtable (CASSANDRA-9837)
 + * Handle corrupt files on startup (CASSANDRA-9686)
 + * Fix clientutil jar and tests (CASSANDRA-9760)
 + * (cqlsh) Allow the SSL protocol version to be specified through the
 +   config file or environment variables (CASSANDRA-9544)
 + * Remove repair snapshot leftover on startup (CASSANDRA-7357)
 + * Use random nodes for batch log when only 2 racks (CASSANDRA-8735)
 + * Ensure atomicity inside thrift and stream session (CASSANDRA-7757)
 + * Fix nodetool info error when the node is not joined (CASSANDRA-9031)
 +Merged from 2.0:
   * Make getFullyExpiredSSTables less expensive (CASSANDRA-9882)
   * Add tool to find why expired sstables are not getting dropped (CASSANDRA-10015)
   * Remove erroneous pending HH tasks from tpstats/jmx (CASSANDRA-9129)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2f0da07/src/java/org/apache/cassandra/locator/GossipingPropertyFileSnitch.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/locator/GossipingPropertyFileSnitch.java
index da43600,dd1637d..f3f38a0
--- a/src/java/org/apache/cassandra/locator/GossipingPropertyFileSnitch.java
+++ b/src/java/org/apache/cassandra/locator/GossipingPropertyFileSnitch.java
@@@ -41,30 -38,23 +41,30 @@@ public class GossipingPropertyFileSnitc
      private static final Logger logger = LoggerFactory.getLogger(GossipingPropertyFileSnitch.class);
  
      private PropertyFileSnitch psnitch;
 -    private String myDC;
 -    private String myRack;
 +
 +    private volatile String myDC;
 +    private volatile String myRack;
 +    private volatile boolean preferLocal;
 +    private AtomicReference<ReconnectableSnitchHelper> snitchHelperReference;
 +    private volatile boolean gossipStarted;
 +
      private Map<InetAddress, Map<String, String>> savedEndpoints;
 -    private String DEFAULT_DC = "UNKNOWN_DC";
 -    private String DEFAULT_RACK = "UNKNOWN_RACK";
 -    private final boolean preferLocal;
 +    private static final String DEFAULT_DC = "UNKNOWN_DC";
 +    private static final String DEFAULT_RACK = "UNKNOWN_RACK";
  
 +    private static final int DEFAULT_REFRESH_PERIOD_IN_SECONDS = 60;
 +    
      public GossipingPropertyFileSnitch() throws ConfigurationException
      {
 -        myDC = SnitchProperties.get("dc", null);
 -        myRack = SnitchProperties.get("rack", null);
 -        if (myDC == null || myRack == null)
 -            throw new ConfigurationException("DC or rack not found in snitch properties, check your configuration in: " + SnitchProperties.RACKDC_PROPERTY_FILENAME);
 +        this(DEFAULT_REFRESH_PERIOD_IN_SECONDS);
 +    }
 +
 +    public GossipingPropertyFileSnitch(int refreshPeriodInSeconds) throws ConfigurationException
 +    {
 +        snitchHelperReference = new AtomicReference<ReconnectableSnitchHelper>();
 +
-         reloadConfiguration();
++        reloadConfiguration(false);
  
 -        myDC = myDC.trim();
 -        myRack = myRack.trim();
 -        preferLocal = Boolean.parseBoolean(SnitchProperties.get("prefer_local", "false"));
          try
          {
              psnitch = new PropertyFileSnitch();
@@@ -72,25 -62,7 +72,24 @@@
          }
          catch (ConfigurationException e)
          {
 -            logger.info("Unable to load " + PropertyFileSnitch.SNITCH_PROPERTIES_FILENAME + "; compatibility mode disabled");
 +            logger.info("Unable to load {}; compatibility mode disabled", PropertyFileSnitch.SNITCH_PROPERTIES_FILENAME);
 +        }
 +
 +        try
 +        {
 +            FBUtilities.resourceToFile(SnitchProperties.RACKDC_PROPERTY_FILENAME);
 +            Runnable runnable = new WrappedRunnable()
 +            {
 +                protected void runMayThrow() throws ConfigurationException
 +                {
-                     reloadConfiguration();
-                     StorageService.instance.updateTopology(FBUtilities.getBroadcastAddress());
++                    reloadConfiguration(true);
 +                }
 +            };
 +            ResourceWatcher.watch(SnitchProperties.RACKDC_PROPERTY_FILENAME, runnable, refreshPeriodInSeconds * 1000);
 +        }
 +        catch (ConfigurationException ex)
 +        {
 +            logger.error("{} found, but does not look like a plain file. Will not watch it for changes", SnitchProperties.RACKDC_PROPERTY_FILENAME);
          }
      }
  
@@@ -153,55 -125,8 +152,60 @@@
      public void gossiperStarting()
      {
          super.gossiperStarting();
 +
          Gossiper.instance.addLocalApplicationState(ApplicationState.INTERNAL_IP,
 -                                                   StorageService.instance.valueFactory.internalIP(FBUtilities.getLocalAddress().getHostAddress()));
 -        Gossiper.instance.register(new ReconnectableSnitchHelper(this, myDC, preferLocal));
 +                StorageService.instance.valueFactory.internalIP(FBUtilities.getLocalAddress().getHostAddress()));
 +
 +        reloadGossiperState();
 +
 +        gossipStarted = true;
 +    }
 +    
-     private void reloadConfiguration() throws ConfigurationException
++    private void reloadConfiguration(boolean isUpdate) throws ConfigurationException
 +    {
 +        final SnitchProperties properties = new SnitchProperties();
 +
 +        String newDc = properties.get("dc", null);
 +        String newRack = properties.get("rack", null);
 +        if (newDc == null || newRack == null)
 +            throw new ConfigurationException("DC or rack not found in snitch properties, check your configuration in: " + SnitchProperties.RACKDC_PROPERTY_FILENAME);
 +
 +        newDc = newDc.trim();
 +        newRack = newRack.trim();
 +        final boolean newPreferLocal = Boolean.parseBoolean(properties.get("prefer_local", "false"));
 +
 +        if (!newDc.equals(myDC) || !newRack.equals(myRack) || (preferLocal != newPreferLocal))
 +        {
 +            myDC = newDc;
 +            myRack = newRack;
 +            preferLocal = newPreferLocal;
 +
 +            reloadGossiperState();
 +
 +            if (StorageService.instance != null)
-                 StorageService.instance.getTokenMetadata().invalidateCachedRings();
++            {
++                if (isUpdate)
++                    StorageService.instance.updateTopology(FBUtilities.getBroadcastAddress());
++                else
++                    StorageService.instance.getTokenMetadata().invalidateCachedRings();
++            }
 +
 +            if (gossipStarted)
 +                StorageService.instance.gossipSnitchInfo();
 +        }
 +    }
 +
 +    private void reloadGossiperState()
 +    {
 +        if (Gossiper.instance != null)
 +        {
 +            ReconnectableSnitchHelper pendingHelper = new ReconnectableSnitchHelper(this, myDC, preferLocal);
 +            Gossiper.instance.register(pendingHelper);
 +            
 +            pendingHelper = snitchHelperReference.getAndSet(pendingHelper);
 +            if (pendingHelper != null)
 +                Gossiper.instance.unregister(pendingHelper);
 +        }
 +        // else this will eventually rerun at gossiperStarting()
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2f0da07/src/java/org/apache/cassandra/locator/PropertyFileSnitch.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2f0da07/src/java/org/apache/cassandra/locator/TokenMetadata.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2f0da07/src/java/org/apache/cassandra/locator/YamlFileNetworkTopologySnitch.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/locator/YamlFileNetworkTopologySnitch.java
index 57fc1a3,b75fc28..4139662
--- a/src/java/org/apache/cassandra/locator/YamlFileNetworkTopologySnitch.java
+++ b/src/java/org/apache/cassandra/locator/YamlFileNetworkTopologySnitch.java
@@@ -102,9 -102,8 +102,9 @@@ public class YamlFileNetworkTopologySni
      YamlFileNetworkTopologySnitch(final String topologyConfigFilename)
              throws ConfigurationException
      {
 +        logger.warn("YamlFileNetworkTopologySnitch is deprecated; switch to GossipingPropertyFileSnitch instead");
          this.topologyConfigFilename = topologyConfigFilename;
-         loadTopologyConfiguration();
+         loadTopologyConfiguration(false);
  
          try
          {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2f0da07/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------