Permalink
Browse files

Adding support for checksum verification and also incremental backups

  • Loading branch information...
vinothchandar committed Jan 13, 2012
1 parent 4918633 commit 38b330be7eb4eb54ed23f010e9d525b40b07fa31

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -203,6 +203,11 @@ public static void main(String[] args) throws Exception {
.withRequiredArg()
.describedAs("minutes to wait for backup completion, default 30 mins")
.ofType(Integer.class);
+ parser.accepts("backup-verify",
+ "If provided, backup will also verify checksum (with extra overhead)");
+ parser.accepts("backup-incremental",
+ "Perform an incremental backup for point-in-time recovery."
+ + " By default backup has latest consistent snapshot.");
OptionSet options = parser.parse(args);
@@ -444,7 +449,12 @@ public static void main(String[] args) throws Exception {
String backupDir = (String) options.valueOf("backup-dir");
String storeName = (String) options.valueOf("native-backup");
int timeout = CmdUtils.valueOf(options, "backup-timeout", 30);
- adminClient.nativeBackup(nodeId, storeName, backupDir, timeout);
+ adminClient.nativeBackup(nodeId,
+ storeName,
+ backupDir,
+ timeout,
+ options.has("backup-verify"),
+ options.has("backup-incremental"));
}
} catch(Exception e) {
e.printStackTrace();
@@ -561,7 +571,8 @@ public static void printHelp(PrintStream stream, OptionParser parser) throws IOE
stream.println("\t4) Clean a node after rebalancing is done");
stream.println("\t\t./bin/voldemort-admin-tool.sh --repair-job --url [url] --node [node-id]");
stream.println("\t5) Backup bdb data natively");
- stream.println("\t\t./bin/voldemort-admin-tool.sh --native-backup [store] --backup-dir [outdir] --backup-timeout [mins] --url [url] --node [node-id]");
+ stream.println("\t\t./bin/voldemort-admin-tool.sh --native-backup [store] --backup-dir [outdir] "
+ + "--backup-timeout [mins] [--backup-verify] [--backup-incremental] --url [url] --node [node-id]");
parser.printHelpOn(stream);
}
@@ -140,9 +140,9 @@ public AbstractStoreClientFactory(ClientConfig config) {
public <K, V, T> Store<K, V, T> getRawStore(String storeName,
InconsistencyResolver<Versioned<V>> resolver) {
+ logger.info("Client zone-id [" + clientZoneId
+ + "] Attempting to obtain metadata for store [" + storeName + "] ");
if(logger.isDebugEnabled()) {
- logger.debug("Client zone-id [" + clientZoneId + "]");
- logger.debug("Attempting to obtain metadata for store [" + storeName + "] ");
for(URI uri: bootstrapUrls) {
logger.debug("Client Bootstrap url [" + uri + "]");
}
@@ -2332,12 +2332,21 @@ private void individualStateChange(int nodeId,
* @param storeName The name of the store to backup
* @param destinationDirPath The destination path
* @param minutes to wait for operation to complete
+ * @param verify should the file checksums be verified
+ * @param isIncremental is the backup incremental
*/
- public void nativeBackup(int nodeId, String storeName, String destinationDirPath, int timeOut) {
+ public void nativeBackup(int nodeId,
+ String storeName,
+ String destinationDirPath,
+ int timeOut,
+ boolean verify,
+ boolean isIncremental) {
VAdminProto.NativeBackupRequest nativeBackupRequest = VAdminProto.NativeBackupRequest.newBuilder()
.setStoreName(storeName)
.setBackupDir(destinationDirPath)
+ .setIncremental(isIncremental)
+ .setVerifyFiles(verify)
.build();
VAdminProto.VoldemortAdminRequest adminRequest = VAdminProto.VoldemortAdminRequest.newBuilder()
.setNativeBackup(nativeBackupRequest)

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1392,6 +1392,8 @@ static ReadOnlyStorageEngine getReadOnlyStorageEngine(MetadataStore metadata,
public VAdminProto.AsyncOperationStatusResponse handleNativeBackup(VAdminProto.NativeBackupRequest request) {
final File backupDir = new File(request.getBackupDir());
+ final boolean isIncremental = request.getIncremental();
+ final boolean verifyFiles = request.getVerifyFiles();
final String storeName = request.getStoreName();
int requestId = asyncService.getUniqueRequestId();
VAdminProto.AsyncOperationStatusResponse.Builder response = VAdminProto.AsyncOperationStatusResponse.newBuilder()
@@ -1416,7 +1418,10 @@ public void markComplete() {
@Override
public void operate() {
- ((NativeBackupable) storageEngine).nativeBackup(backupDir, status);
+ ((NativeBackupable) storageEngine).nativeBackup(backupDir,
+ verifyFiles,
+ isIncremental,
+ status);
}
@Override
Oops, something went wrong.

0 comments on commit 38b330b

Please sign in to comment.