Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Archaius #785

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ subprojects {
compile 'com.google.http-client:google-http-client-jackson2:1.28.0'
compile 'com.netflix.spectator:spectator-api:0.83.0'
compileOnly 'javax.servlet:javax.servlet-api:3.1.0'
//Dynamic configuration management - https://github.com/Netflix/archaius/tree/2.x
compile 'com.netflix.archaius:archaius2-core:2.3.13'
compile group: 'com.netflix.archaius', name: 'archaius2-guice', version: '2.3.13'

testCompile 'org.jmockit:jmockit:1.31'
testCompile "org.spockframework:spock-core:1.1-groovy-2.4"
testCompile 'junit:junit:4.12'
testCompile 'com.netflix.governator:governator-test-junit:[1.15.3,)'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down
4 changes: 3 additions & 1 deletion priam/src/main/java/com/netflix/priam/PriamServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public PriamServer(
Sleeper sleeper,
ICassandraProcess cassProcess,
RestoreContext restoreContext,
SnapshotMetaService snapshotMetaService) {
SnapshotMetaService snapshotMetaService)
throws Exception {
this.config = config;
this.backupRestoreConfig = backupRestoreConfig;
this.scheduler = scheduler;
Expand All @@ -77,6 +78,7 @@ public PriamServer(
this.cassProcess = cassProcess;
this.restoreContext = restoreContext;
this.snapshotMetaService = snapshotMetaService;
initialize();
}

private void createDirectories() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public List<AbstractBackupPath> findMetaFiles(DateUtil.DateRange dateRange) {
Date startTime = new Date(dateRange.getStartTime().toEpochMilli());
Date endTime = new Date(dateRange.getEndTime().toEpochMilli());
String restorePrefix = fs.getPrefix().toString();
logger.debug("Looking for snapshot meta file within restore prefix: {}", restorePrefix);
logger.info("Looking for snapshot meta file within restore prefix: {}", restorePrefix);
List<AbstractBackupPath> metas = Lists.newArrayList();

Iterator<AbstractBackupPath> backupfiles = fs.list(restorePrefix, startTime, endTime);
Expand Down
6 changes: 1 addition & 5 deletions priam/src/main/java/com/netflix/priam/cli/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.netflix.priam.backup.IBackupFileSystem;
import com.netflix.priam.config.IConfiguration;

public class Application {
private static Injector injector;
Expand All @@ -29,10 +28,7 @@ static Injector getInjector() {
return injector;
}

static void initialize() {
IConfiguration conf = getInjector().getInstance(IConfiguration.class);
conf.initialize();
}
static void initialize() {}

static void shutdownAdditionalThreads() {
IBackupFileSystem fs = getInjector().getInstance(IBackupFileSystem.class);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
*/
package com.netflix.priam.config;

import com.google.inject.ImplementedBy;
import com.netflix.archaius.api.annotations.Configuration;
import com.netflix.archaius.api.annotations.PropertyName;
import com.netflix.priam.utils.PriamConstants;

/**
* This interface is to abstract out the backup and restore configuration used by Priam. Goal is to
* eventually have each module/functionality to have its own Config. Created by aagrawal on 6/26/18.
*/
@ImplementedBy(BackupRestoreConfig.class)
@Configuration(prefix = PriamConstants.PROP_NAMESPACE)
public interface IBackupRestoreConfig {

/**
Expand All @@ -30,6 +32,7 @@ public interface IBackupRestoreConfig {
* href="http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html">quartz-scheduler</a>
* @see <a href="http://www.cronmaker.com">http://www.cronmaker.com</a>
*/
@PropertyName(name = "snapshot.meta.cron")
default String getSnapshotMetaServiceCronExpression() {
return "-1";
}
Expand All @@ -40,6 +43,7 @@ default String getSnapshotMetaServiceCronExpression() {
*
* @return boolean value indicating if backups in version 2.0 should be started.
*/
@PropertyName(name = "enableV2Backups")
default boolean enableV2Backups() {
return false;
}
Expand All @@ -56,6 +60,7 @@ default boolean enableV2Backups() {
* href="http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html">quartz-scheduler</a>
* @see <a href="http://www.cronmaker.com">http://www.cronmaker.com</a>
*/
@PropertyName(name = "backupTTLCronExpression")
default String getBackupTTLCronExpression() {
return "0 0 0/6 1/1 * ? *";
}
Expand All @@ -70,6 +75,7 @@ default String getBackupTTLCronExpression() {
* href="http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html">quartz-scheduler</a>
* @see <a href="http://www.cronmaker.com">http://www.cronmaker.com</a>
*/
@PropertyName(name = "backupVerificationCronExpression")
default String getBackupVerificationCronExpression() {
return "0 30 0/1 1/1 * ? *";
}
Expand All @@ -81,6 +87,7 @@ default String getBackupVerificationCronExpression() {
*
* @return the backup SLO in hours. Default: 24 hours.
*/
@PropertyName(name = "backupVerificationSLOInHours")
default int getBackupVerificationSLOInHours() {
return 24;
}
Expand All @@ -91,6 +98,7 @@ default int getBackupVerificationSLOInHours() {
* @return if restore should be using backup version 2.0. If this is false we will use backup
* version 1.0.
*/
@PropertyName(name = "enableV2Restore")
default boolean enableV2Restore() {
return false;
}
Expand Down