Skip to content

Commit

Permalink
Merge pull request #576 from arunagrawal84/3.11
Browse files Browse the repository at this point in the history
Remove guava dependency in NewTokenRetriever.
  • Loading branch information
arunagrawal-84 authored Jul 21, 2017
2 parents dc3cbc1 + adffa5d commit c092060
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 3 deletions.
4 changes: 4 additions & 0 deletions priam/src/main/java/com/netflix/priam/IConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public interface IConfiguration {
*/
public String getDataFileLocation();

/**
* @return Location of the hints data directory
*/
public String getHintsLocation();
/**
* @return Location of local cache
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public class PriamConfiguration implements IConfiguration
private final String DEFAULT_DATA_LOCATION = "/var/lib/cassandra/data";
private final String DEFAULT_COMMIT_LOG_LOCATION = "/var/lib/cassandra/commitlog";
private final String DEFAULT_CACHE_LOCATION = "/var/lib/cassandra/saved_caches";
private final String DEFAULT_HINTS_DIR_LOCATION = "/var/lib/cassandra/hints";
private final String DEFAULT_ENDPOINT_SNITCH = "org.apache.cassandra.locator.Ec2Snitch";
private final String DEFAULT_SEED_PROVIDER = "com.netflix.priam.cassandra.extensions.NFSeedProvider";
private final String DEFAULT_PARTITIONER = "org.apache.cassandra.dht.RandomPartitioner";
Expand Down Expand Up @@ -325,6 +326,7 @@ public void intialize()
SystemUtils.createDirs(getCommitLogLocation());
SystemUtils.createDirs(getCacheLocation());
SystemUtils.createDirs(getDataFileLocation());
SystemUtils.createDirs(getHintsLocation());
}

private InstanceDataRetriever getInstanceDataRetriever() throws InstantiationException, IllegalAccessException, ClassNotFoundException
Expand Down Expand Up @@ -490,6 +492,11 @@ public String getDataFileLocation()
return config.get(CONFIG_DATA_LOCATION, DEFAULT_DATA_LOCATION);
}

@Override
public String getHintsLocation() {
return config.get(PRIAM_PRE + ".hints.location", DEFAULT_HINTS_DIR_LOCATION);
}

@Override
public String getCacheLocation()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void writeAllProperties(String yamlLocation, String hostname, String seed

map.put("saved_caches_directory", config.getCacheLocation());
map.put("commitlog_directory", config.getCommitLogLocation());
map.put("hints_directory", config.getHintsLocation());
map.put("data_file_directories", Lists.newArrayList(config.getDataFileLocation()));
boolean enableIncremental = (config.getBackupHour() >= 0 && config.isIncrBackup()) && (CollectionUtils.isEmpty(config.getBackupRacs()) || config.getBackupRacs().contains(config.getRac()));
map.put("incremental_backups", enableIncremental);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ public List<PriamInstance> get()

private final Predicate<PriamInstance> differentHostPredicate = new Predicate<PriamInstance>() {
@Override
/**
* This is used to provide the list of seed providers.
* Since 3.x backported the @see <a href="https://issues.apache.org/jira/browse/CASSANDRA-10134">CASSANDRA-10134</a> we need to ensure that seed list contains all the seed(including itself) or cluster would never come up.
*/
public boolean apply(PriamInstance instance) {
return (!instance.getInstanceId().equalsIgnoreCase(DUMMY_INSTANCE_ID) && !instance.getHostName().equals(myInstance.getHostName()));
return (!instance.getInstanceId().equalsIgnoreCase(DUMMY_INSTANCE_ID));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ public PriamInstance get() throws Exception {

if (hash == max && locMap.get(config.getRac()).size() == 0) {
int idx = config.getRacs().indexOf(config.getRac());
Preconditions.checkState(idx >= 0, "Rac %s is not in Racs %s", config.getRac(), config.getRacs());
my_slot = idx + maxSlot;
if (idx < 0)
throw new Exception(String.format("Rac %s is not in Racs %s", config.getRac(), config.getRacs()));
my_slot = idx + maxSlot;
} else
my_slot = config.getRacs().size() + maxSlot;

Expand Down
5 changes: 5 additions & 0 deletions priam/src/test/java/com/netflix/priam/FakeConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public String getDataFileLocation()
return "target/data";
}

@Override
public String getHintsLocation() {
return "target/hints";
}

@Override
public String getCacheLocation()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public String getDataFileLocation()
return "target/data";
}

@Override
public String getHintsLocation() {
return "target/hints";
}

@Override
public String getCacheLocation()
{
Expand Down

0 comments on commit c092060

Please sign in to comment.