@Shutdown — Shuts down the database.
@Shutdown
The @Shutdown system procedure performs an immediate shut down of a VoltDB database on all nodes of the cluster.
The @Shutdown system procedure does not wait for running transactions to complete or queued data to be written to disk before stopping the database process, which can result in loss of data. Therefore, using the voltadmin shutdown command to perform an orderly shutdown, making all data durable, is the recommended method for stopping a VoltDB database.
Note that once the database shuts down, the client connection is lost and the calling program cannot make any further requests to the server.
The first example shows the recommended way to shutdown a VoltDB database, using the voltadmin shutdown command to perform an orderly shutdown:
$ voltadmin shutdown
The next example shows calling @Shutdown from sqlcmd. This is equivalent to the voltdb shutdown --force command:
$ sqlcmd 1> exec @Shutdown;
The following program example uses @Shutdown to stop the database cluster programmatically. Note the use of catch to separate out a VoltDB call procedure exception (which is expected) from any other exception.
try { client.callProcedure("@Shutdown"); } // we expect an exception when the connection drops. catch (org.voltdb.client.ProcCallException e) { System.out.println("Database shutdown initiated."); } // report any other exception. catch (Exception e) { e.printStackTrace(); }