VoltDB Home » Documentation » Using VoltDB


@SnapshotDelete — Deletes one or more native snapshots.


@SnapshotDelete String[] directory-paths, String[] Unique-IDs


The @SnapshotDelete system procedure deletes native 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 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.

@SnapshotDelete can delete native format snapshots only. The procedure cannot delete CSV format snapshots.

Return Values

Returns one VoltTable with a row for every snapshot file affected by the operation.

HOST_IDINTEGERNumeric ID for the host node.
HOSTNAMESTRINGServer name of the host node.
PATHSTRINGThe directory path where the snapshot file resides.
NONCESTRINGThe unique identifier for the snapshot.
NAMESTRINGThe file name.
SIZEBIGINTThe total size, in bytes, of the file.
DELETEDSTRINGString value indicating whether the file was successfully deleted ("TRUE") or not ("FALSE").
RESULTSTRINGString value indicating the success ("SUCCESS") or failure ("FAILURE") of the request.
ERR_MSGSTRINGIf the result is FAILURE, this column contains a message explaining the cause of the failure.


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",
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/"; }
   i = 0;
   while (table.advanceRow()) { 
       nonces[i] = table.getString("NONCE");

   try {
  catch (Exception e) { e.printStackTrace(); }