GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||
GeezerVison is showing docs.voltdb.com — @SnapshotRestore Documentation@SnapshotRestore@SnapshotRestore — Restores a database from disk using a native format snapshot. Synopsis@SnapshotRestore String directory-path, String unique-ID DescriptionThe @SnapshotRestore system procedure restores a previously saved database from disk to memory. The snapshot must be in native format. (You cannot restore a CSV format snapshot using @SnapshotRestore.) The restore request is propagated to all nodes of the cluster, so a single call to @SnapshotRestore will restore the entire database cluster. The first parameter, directory-path, specifies where VoltDB looks for the snapshot files. The second parameter, unique-ID, is a unique identifier that is used as a filename prefix to distinguish between multiple snapshots. In general, when restoring a complete snapshot you can perform only one restore operation on a running VoltDB database. Subsequent attempts to call @SnapshotRestore result in an error. More specifically, you can only restore each table once. Since you can create — and restore — partial snapshots, you can perform multiple restores as long as no individual table is restored more than once. Since command logging usually includes snapshots, you should never perform a manual @SnapshotRestore after recovering a database using command logs. See Chapter 13, Saving & Restoring a VoltDB Database for more information about saving and restoring VoltDB databases. Return ValuesReturns one VoltTable with a row for every table restored at each execution site.
ExamplesThe following example uses @SnapshotRestore to restore previously saved database content from the path
$ sqlcmd 1> exec @SnapshotRestore '/tmp/voltdb/backup/', 'flight'; Alternately, you can use the voltadmin restore command to perform the same function: $ voltadmin restore /tmp/voltdb/backup/ flight Since there are a number of situations that impact what data is restored, it is a good idea to review the return values to see what tables and partitions were affected. In the following program example, the contents of the VoltTable array is written to standard output so the operator can confirm that the restore completed as expected. VoltTable[] results = null;
try {
results = client.callProcedure("@SnapshotRestore",
"/tmp/voltdb/backup/",
"flight").getResults();
}
catch (Exception e) {
e.printStackTrace();
}
for (int t=0; t<results.length; t++) {
VoltTable table = results[t];
for (int r=0;r<table.getRowCount();r++) {
VoltTableRow row = table.fetchRow(r);
System.out.printf("Node %d Site %d restoring " +
"table %s partition %d.\n",
row.getLong("HOST_ID"), row.getLong("SITE_ID"),
row.getString("TABLE"),row.getLong("PARTITION"));
}
}
| ||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |