@SnapshotScan — Lists information about existing native snapshots in a given directory path.
@SnapshotScan String directory-path
The @SnapshotScan system procedure provides information about any native snapshots that exist within the specified directory path for all nodes on the cluster. The procedure reports the name (prefix) of the snapshot, when it was created, how long it took to create, and the size of the individual files that make up the snapshot(s).
@SnapshotScan does not include CSV format snapshots in its output. Only native format snapshots are listed.
On successful completion, this system procedure returns three VoltTables providing the following information:
A summary of the snapshots found
Available space in the directories scanned
Details concerning the Individual files that make up the snapshots
The first table contains one row for every snapshot found.
Name | Datatype | Description |
---|---|---|
PATH | STRING | The directory path where the snapshot resides. |
NONCE | STRING | The unique identifier for the snapshot. |
TXNID | BIGINT | The transaction ID of the snapshot. |
CREATED | BIGINT | The timestamp when the snapshot was created (in milliseconds). |
SIZE | BIGINT | The total size, in bytes, of all the snapshot data. |
TABLES_REQUIRED | STRING | A comma-separated list of all the table names listed in the snapshot digest file. In other words, all of the tables that make up the snapshot. |
TABLES_MISSING | STRING | A comma-separated list of database tables for which no data can be found. (That is, the corresponding files are missing or unreadable.) |
TABLES_INCOMPLETE | STRING | A comma-separated list of database tables with only partial data saved in the snapshot. (That is, data from some partitions is missing.) |
COMPLETE | STRING | A string value indicating whether the snapshot as a whole is complete ("TRUE") or incomplete ("FALSE"). If this column is "FALSE", the preceding two columns provide additional information concerning what is missing. |
PATHTYPE | STRING | A string value indicating the type of snapshot and its location, where the type can be "SNAP_PATH" for manual snapshots, "SNAP_CL" for command log snapshots, and "SNAP_AUTO" for automated snapshots. |
The second table contains one row for every host.
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 specified in the call to the procedure. |
TOTAL | BIGINT | The total space (in bytes) on the device. |
FREE | BIGINT | The available free space (in bytes) on the device. |
USED | BIGINT | The total space currently in use (in bytes) on the device. |
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. |
The third table contains one row for every file in the snapshot collection.
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. |
NAME | STRING | The file name. |
TXNID | BIGINT | The transaction ID of the snapshot. |
CREATED | BIGINT | The timestamp when the snapshot was created (in milliseconds). |
TABLE | STRING | The name of the database table the data comes from. |
COMPLETED | STRING | A string indicating whether all of the data was successfully written to the file ("TRUE") or not ("FALSE"). |
SIZE | BIGINT | The total size, in bytes, of the file. |
IS_REPLICATED | STRING | A string indicating whether the table in question is replicated ("TRUE") or partitioned ("FALSE"). |
PARTITIONS | STRING | A comma-separated string of partition (or site) IDs from which data was taken during the snapshot. For partitioned tables where there are multiple sites per host, there can be data from multiple partitions in each snapshot file. For replicated tables, data from only one copy (and therefore one partition) is required. |
TOTAL_PARTITIONS | BIGINT | The total number of partitions from which data was taken. |
READABLE | STRING | A string indicating whether the file is accessible ("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. |
If the system procedure fails because it cannot access the specified path, it returns a single VoltTable with one row and one column.
Name | Datatype | Description |
---|---|---|
ERR_MSG | STRING | A message explaining the cause of the failure. |
The following example uses @SnapshotScan to list information about the snapshots in the directory
/tmp/voltdb/backup/
.
$ sqlcmd 1> exec @SnapshotScan /tmp/voltdb/backup/;
The following program example performs the same function, using the VoltTable toString()
method to
display the results of the procedure call:
VoltTable[] results = null; try { results = client.callProcedure("@SnapshotScan", "/tmp/voltdb/backup/").getResults(); } catch (Exception e) { e.printStackTrace(); } for (VoltTable t: results) { System.out.println(t.toString()); }
In the return value, the first VoltTable in the array lists the snapshots and certain status information. The second element of the array provides information about the directory itself (such as used, free, and total disk space). The third element of the array lists specific information about the individual files in the snapshot(s).