Skip to content

Commit

Permalink
Merge branch 'cassandra-3.0' into cassandra-3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ekaterinadimitrova2 committed Jan 19, 2021
2 parents c1f60ae + 0a1e900 commit 11cb810
Show file tree
Hide file tree
Showing 17 changed files with 758 additions and 329 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -3,6 +3,7 @@
* Rate limit validation compactions using compaction_throughput_mb_per_sec (CASSANDRA-16161)
* SASI's `max_compaction_flush_memory_in_mb` settings over 100GB revert to default of 1GB (CASSANDRA-16071)
Merged from 3.0:
* Prevent unbounded number of pending flushing tasks (CASSANDRA-16261)
* Improve empty hint file handling during startup (CASSANDRA-16162)
* Allow empty string in collections with COPY FROM in cqlsh (CASSANDRA-16372)
* Fix skipping on pre-3.0 created compact storage sstables due to missing primary key liveness (CASSANDRA-16226)
Expand Down
Expand Up @@ -23,6 +23,8 @@

import java.util.concurrent.TimeUnit;

import com.google.common.annotations.VisibleForTesting;

public class InfiniteLoopExecutor
{
private static final Logger logger = LoggerFactory.getLogger(InfiniteLoopExecutor.class);
Expand Down Expand Up @@ -81,4 +83,10 @@ public boolean awaitTermination(long time, TimeUnit unit) throws InterruptedExce
thread.join(unit.toMillis(time));
return !thread.isAlive();
}

@VisibleForTesting
public boolean isAlive()
{
return this.thread.isAlive();
}
}
36 changes: 16 additions & 20 deletions src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Expand Up @@ -271,8 +271,8 @@ public static Config loadConfig() throws ConfigurationException

String loaderClass = System.getProperty(Config.PROPERTY_PREFIX + "config.loader");
ConfigurationLoader loader = loaderClass == null
? new YamlConfigurationLoader()
: FBUtilities.<ConfigurationLoader>construct(loaderClass, "configuration loading");
? new YamlConfigurationLoader()
: FBUtilities.construct(loaderClass, "configuration loading");
Config config = loader.loadConfig();

if (!hasLoggedConfig)
Expand Down Expand Up @@ -513,7 +513,7 @@ else if (conf.native_transport_max_frame_size_in_mb >= 2048)
if (conf.cdc_total_space_in_mb == 0)
{
int preferredSize = 4096;
int minSize = 0;
int minSize;
try
{
// use 1/8th of available space. See discussion on #10013 and #10199 on the CL, taking half that for CDC
Expand Down Expand Up @@ -827,7 +827,7 @@ else if (config.listen_address != null)
}
catch (UnknownHostException e)
{
throw new ConfigurationException("Unknown listen_address '" + config.listen_address + "'", false);
throw new ConfigurationException("Unknown listen_address '" + config.listen_address + '\'', false);
}

if (listenAddress.isAnyLocalAddress())
Expand All @@ -847,7 +847,7 @@ else if (config.listen_interface != null)
}
catch (UnknownHostException e)
{
throw new ConfigurationException("Unknown broadcast_address '" + config.broadcast_address + "'", false);
throw new ConfigurationException("Unknown broadcast_address '" + config.broadcast_address + '\'', false);
}

if (broadcastAddress.isAnyLocalAddress())
Expand Down Expand Up @@ -888,7 +888,7 @@ else if (config.rpc_interface != null)
}
catch (UnknownHostException e)
{
throw new ConfigurationException("Unknown broadcast_rpc_address '" + config.broadcast_rpc_address + "'", false);
throw new ConfigurationException("Unknown broadcast_rpc_address '" + config.broadcast_rpc_address + '\'', false);
}

if (broadcastRpcAddress.isAnyLocalAddress())
Expand Down Expand Up @@ -1030,18 +1030,14 @@ public static void applySnitch()
EndpointSnitchInfo.create();

localDC = snitch.getDatacenter(FBUtilities.getBroadcastAddress());
localComparator = new Comparator<InetAddress>()
{
public int compare(InetAddress endpoint1, InetAddress endpoint2)
{
boolean local1 = localDC.equals(snitch.getDatacenter(endpoint1));
boolean local2 = localDC.equals(snitch.getDatacenter(endpoint2));
if (local1 && !local2)
return -1;
if (local2 && !local1)
return 1;
return 0;
}
localComparator = (endpoint1, endpoint2) -> {
boolean local1 = localDC.equals(snitch.getDatacenter(endpoint1));
boolean local2 = localDC.equals(snitch.getDatacenter(endpoint2));
if (local1 && !local2)
return -1;
if (local2 && !local1)
return 1;
return 0;
};
}

Expand Down Expand Up @@ -1395,7 +1391,7 @@ public static String getAllocateTokensForKeyspace()

public static Collection<String> tokensFromString(String tokenString)
{
List<String> tokens = new ArrayList<String>();
List<String> tokens = new ArrayList<>();
if (tokenString != null)
for (String token : StringUtils.split(tokenString, ','))
tokens.add(token.trim());
Expand Down Expand Up @@ -2076,7 +2072,7 @@ public static File getHintsDirectory()
public static File getSerializedCachePath(CacheType cacheType, String version, String extension)
{
String name = cacheType.toString()
+ (version == null ? "" : "-" + version + "." + extension);
+ (version == null ? "" : '-' + version + '.' + extension);
return new File(conf.saved_caches_directory, name);
}

Expand Down

0 comments on commit 11cb810

Please sign in to comment.