|
|
Login/Register | Contact Us | 1+ 978-528-4660 |
@SnapshotDelete
@SnapshotDelete
@SnapshotDelete — Deletes one or more snapshots.
Synopsis
ClientResponse client.callProcedure("@SnapshotDelete", String[]
directory-paths, String[] Unique-IDs)
Description
The @SnapshotDelete system procedure deletes snapshots from the database cluster. This is a cluster-wide operation and a single invocation will remove the snapshot files from all of the nodes.
The procedure takes two additional parameters: a String array of directory paths and a String array of unique IDs (prefixes).
The two arrays are read as a series of value pairs, so that the first element of the directory path array and the first element of the unique ID array will be used to identify the first snapshot to delete. The second element of each array will identify the second snapshot to delete. And so on.
Return Values
Returns one VoltTable with a row for every snapshot file affected by the operation.
| Name | Datatype | Description |
|---|---|---|
| HOST_ID | INTEGER | Numeric ID for the host node. |
| HOSTNAME | STRING | Server name of the host node. |
| PATH | STRING | The directory path where the snapshot file resides. |
| NONCE | STRING | The unique identifier for the snapshot. |
| NAME | STRING | The file name. |
| SIZE | BIGINT | The total size, in bytes, of the file. |
| DELETED | STRING | String value indicating whether the file was successfully deleted ("TRUE") or not ("FALSE"). |
| RESULT | STRING | String value indicating the success ("SUCCESS") or failure ("FAILURE") of the request. |
| ERR_MSG | STRING | If the result is FAILURE, this column contains a message explaining the cause of the failure. |
Example
The following example uses @SnapshotScan to identify all of the snapshots in the directory /tmp/voltdb/backup/. This information is then used by @SnapshotDelete to delete those snapshots.
try {
results = client.callProcedure("@SnapshotScan",
"/tmp/voltdb/backup/").getResults();
}
catch (Exception e) { e.printStackTrace(); }
VoltTable table = results[0];
int numofsnapshots = table.getRowCount();
int i = 0;
if (numofsnapshots > 0) {
String[] paths = new String[numofsnapshots];
String[] nonces = new String[numofsnapshots];
for (i=0;i<numofsnapshots;i++) { paths[i] = "/etc/voltdb/backup/"; }
table.resetRowPosition();
i = 0;
while (table.advanceRow()) {
nonces[i] = table.getString("NONCE");
i++;
}
try {
client.callProcedure("@SnapshotDelete",paths,nonces);
}
catch (Exception e) { e.printStackTrace(); }
}
copyright 2012 VoltDB, Inc.
- Printer-friendly version
- Login or register to post comments
