Skip to content

Commit 06d6c7c

Browse files
BackupStatusMgr (#2) (#570)
1. Make backup/snapshot status manager store additional details like meta file location. 2. Ensure it can save last 60 snapshot days. 3. Allow bindable values on how to save snapshot status in file/datastore. Default implementation stores in a file on the local instance. 4. Non-backward compatible. The previous backup file gets overwritten with new values(null) during the upgrade process.
1 parent 3ef569c commit 06d6c7c

24 files changed

+816
-433
lines changed

gradle/wrapper/gradle-wrapper.jar

-77 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Wed Jun 28 17:25:48 PDT 2017
1+
#Thu Jun 29 13:18:34 PDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME

gradlew

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"
3535

36-
warn ( ) {
36+
warn () {
3737
echo "$*"
3838
}
3939

40-
die ( ) {
40+
die () {
4141
echo
4242
echo "$*"
4343
echo
@@ -155,7 +155,7 @@ if $cygwin ; then
155155
fi
156156

157157
# Escape application args
158-
save ( ) {
158+
save () {
159159
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160160
echo " "
161161
}

priam/src/main/java/com/netflix/priam/SimpleDBConfigSource.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package com.netflix.priam;
1717

18+
import com.amazonaws.services.simpledb.AmazonSimpleDB;
1819
import com.amazonaws.services.simpledb.AmazonSimpleDBClient;
20+
import com.amazonaws.services.simpledb.AmazonSimpleDBClientBuilder;
1921
import com.amazonaws.services.simpledb.model.Attribute;
2022
import com.amazonaws.services.simpledb.model.Item;
2123
import com.amazonaws.services.simpledb.model.SelectRequest;
@@ -65,7 +67,7 @@ public void intialize(final String asgName, final String region)
6567
super.intialize(asgName, region);
6668

6769
// End point is us-east-1
68-
AmazonSimpleDBClient simpleDBClient = new AmazonSimpleDBClient(provider.getAwsCredentialProvider());
70+
AmazonSimpleDB simpleDBClient = AmazonSimpleDBClient.builder().withCredentials(provider.getAwsCredentialProvider()).build();
6971

7072
String nextToken = null;
7173
String appid = asgName.lastIndexOf('-') > 0 ? asgName.substring(0, asgName.indexOf('-')) : asgName;

priam/src/main/java/com/netflix/priam/aws/IAMCredential.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class IAMCredential implements ICredential
2626

2727
public IAMCredential()
2828
{
29-
this.iamCredProvider = new InstanceProfileCredentialsProvider();
29+
this.iamCredProvider = InstanceProfileCredentialsProvider.getInstance();
3030
}
3131

3232
public String getAccessKeyId()

priam/src/main/java/com/netflix/priam/aws/S3CrossAccountFileSystem.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package com.netflix.priam.aws;
1717

18+
import com.amazonaws.services.s3.AmazonS3;
1819
import org.slf4j.Logger;
1920
import org.slf4j.LoggerFactory;
2021

@@ -39,7 +40,7 @@
3940
public class S3CrossAccountFileSystem {
4041
private static final Logger logger = LoggerFactory.getLogger(S3CrossAccountFileSystem.class);
4142

42-
private AmazonS3Client s3Client;
43+
private AmazonS3 s3Client;
4344
private S3FileSystem s3fs;
4445
private IConfiguration config;
4546
private IS3Credential s3Credential;
@@ -58,7 +59,7 @@ public IBackupFileSystem getBackupFileSystem() {
5859
return this.s3fs;
5960
}
6061

61-
public AmazonS3Client getCrossAcctS3Client() {
62+
public AmazonS3 getCrossAcctS3Client() {
6263
if (this.s3Client == null ) {
6364

6465
synchronized(this) {
@@ -67,13 +68,13 @@ public AmazonS3Client getCrossAcctS3Client() {
6768

6869
try {
6970

70-
this.s3Client = new AmazonS3Client(s3Credential.getAwsCredentialProvider());
71+
this.s3Client = AmazonS3Client.builder().withCredentials(s3Credential.getAwsCredentialProvider()).withRegion(config.getDC()).build();//new AmazonS3Client(s3Credential.getAwsCredentialProvider());
7172

7273
} catch (Exception e) {
7374
throw new IllegalStateException("Exception in getting handle to s3 client. Msg: " + e.getLocalizedMessage(), e);
7475

7576
}
76-
this.s3Client.setEndpoint(s3fs.getS3Endpoint(config));
77+
//this.s3Client.setEndpoint(s3fs.getS3Endpoint(config));
7778

7879
//Lets leverage the IBackupFileSystem behaviors except we want it to use our amazon S3 client which has cross AWS account api capability.
7980
this.s3fs.setS3Client(s3Client);

priam/src/main/java/com/netflix/priam/aws/S3EncryptedFileSystem.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public S3EncryptedFileSystem(Provider<AbstractBackupPath> pathProvider, ICompres
108108
throw new RuntimeException("Unable to regiser JMX bean: " + mbeanName + " to JMX server. Msg: " + e.getLocalizedMessage(), e);
109109
}
110110

111-
super.s3Client = new AmazonS3Client(cred.getAwsCredentialProvider());
112-
super.s3Client.setEndpoint(super.getS3Endpoint(this.config));
111+
super.s3Client = AmazonS3Client.builder().withCredentials(cred.getAwsCredentialProvider()).withRegion(config.getDC()).build();
112+
//super.s3Client.setEndpoint(super.getS3Endpoint(this.config));
113113
}
114114

115115
@Override

priam/src/main/java/com/netflix/priam/aws/S3FileSystem.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import javax.management.MBeanServer;
3333
import javax.management.ObjectName;
3434

35+
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
3536
import com.amazonaws.services.s3.model.*;
3637
import com.netflix.priam.aws.auth.IS3Credential;
3738
import com.netflix.priam.backup.*;
@@ -105,8 +106,8 @@ public S3FileSystem(Provider<AbstractBackupPath> pathProvider, ICompression comp
105106
throw new RuntimeException(e);
106107
}
107108

108-
super.s3Client = new AmazonS3Client(cred.getAwsCredentialProvider());
109-
super.s3Client.setEndpoint(super.getS3Endpoint(this.config));
109+
super.s3Client = AmazonS3Client.builder().withCredentials(cred.getAwsCredentialProvider()).withRegion(config.getDC()).build();
110+
//super.s3Client.setEndpoint(super.getS3Endpoint(this.config));
110111
}
111112

112113
@Override
@@ -242,7 +243,7 @@ public void cleanup()
242243
/*
243244
* A means to change the default handle to the S3 client.
244245
*/
245-
public void setS3Client(AmazonS3Client client) {
246+
public void setS3Client(AmazonS3 client) {
246247
super.s3Client = client;
247248
}
248249

priam/src/main/java/com/netflix/priam/aws/S3FileSystemBase.java

+17-17
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,23 @@ public S3FileSystemBase (IMetricPublisher metricPublisher) {
6060
awsSlowDownMeasurement = new AWSSlowDownExceptionMeasurement(); //a counter of AWS warning for all uploads
6161
}
6262

63-
/*
64-
* S3 End point information
65-
* http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
66-
*/
67-
protected String getS3Endpoint(IConfiguration config)
68-
{
69-
final String curRegion = config.getDC();
70-
if("us-east-1".equalsIgnoreCase(curRegion) ||
71-
"us-west-1".equalsIgnoreCase(curRegion) ||
72-
"us-west-2".equalsIgnoreCase(curRegion) ||
73-
"eu-west-1".equalsIgnoreCase(curRegion) ||
74-
"sa-east-1".equalsIgnoreCase(curRegion) ||
75-
"eu-central-1".equalsIgnoreCase(curRegion))
76-
return config.getS3EndPoint();
77-
78-
throw new IllegalStateException("Unsupported region for this application: " + curRegion);
79-
}
63+
// /*
64+
// * S3 End point information
65+
// * http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
66+
// */
67+
// protected String getS3Endpoint(IConfiguration config)
68+
// {
69+
// final String curRegion = config.getDC();
70+
// if("us-east-1".equalsIgnoreCase(curRegion) ||
71+
// "us-west-1".equalsIgnoreCase(curRegion) ||
72+
// "us-west-2".equalsIgnoreCase(curRegion) ||
73+
// "eu-west-1".equalsIgnoreCase(curRegion) ||
74+
// "sa-east-1".equalsIgnoreCase(curRegion) ||
75+
// "eu-central-1".equalsIgnoreCase(curRegion))
76+
// return config.getS3EndPoint();
77+
//
78+
// throw new IllegalStateException("Unsupported region for this application: " + curRegion);
79+
// }
8080

8181
public AmazonS3 getS3Client()
8282
{

priam/src/main/java/com/netflix/priam/aws/S3PrefixIterator.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class S3PrefixIterator implements Iterator<AbstractBackupPath>
4949
private String bucket = "";
5050
private String clusterPath = "";
5151
private SimpleDateFormat datefmt = new SimpleDateFormat("yyyyMMdd");
52-
private ObjectListing objectListing;
52+
private ObjectListing objectListing = null;
5353
Date date;
5454

5555
@Inject
@@ -68,7 +68,6 @@ public S3PrefixIterator(IConfiguration config, Provider<AbstractBackupPath> path
6868
String[] paths = path.split(String.valueOf(S3BackupPath.PATH_SEP));
6969
bucket = paths[0];
7070
this.clusterPath = remotePrefix(path);
71-
objectListing = null;
7271
iterator = createIterator();
7372
}
7473

0 commit comments

Comments
 (0)