|
|
Login/Register | Contact Us | 1+ 978-528-4660 |
@UpdateApplicationCatalog
@UpdateApplicationCatalog
@UpdateApplicationCatalog — Reconfigures the database by replacing the application catalog currently in use.
Synopsis
ClientResponse client.callProcedure("@UpdateApplicationCatalog", byte[]
catalog, String deployment)
Description
The @UpdateApplicationCatalog system procedure lets make the following modifications to a running database without having to shutdown and restart:
Add, remove, or modify stored procedures
Add or remove database tables to the schema
Modify the security permissions for the database
Modify the settings for automated snapshots (whether they are enabled or not, their frequency, location, prefix, and number retained)
The arguments to the system procedure are a byte array containing the contents of the new catalog jar and a string containing the contents of the deployment file. That is, you pass the actual contents of the catalog and deployment files, using a byte array for the binary catalog and a string for the text deployment file.
The new catalog and the deployment file must not contain any changes other than the allowed modifications listed above. Currently, if there are any other changes from the original catalog and deployment file (such as changes to the export configuration or to the configuration of the cluster), the procedure returns an error indicating that an incompatible change has been found.
To simplify the process of encoding the catalog contents, the Java client interface includes two helper methods (one synchronous and one asynchronous) to encode the files and issue the stored procedure request:
ClientResponse client.updateApplicationCatalog( File catalog-file, File
deployment-file)
ClientResponse client.updateApplicationCatalog( clientCallback callback,
File catalog-file, File deployment-file)
Example
The following example uses the @UpdateApplicationCatalog directly to update the current database catalog, using the
catalog at project/newcatalog.jar and configuration file at
project/production.xml.
String newcat = "project/newcatalog.jar";
String newdeploy = "project/production.xml";
try {
File file = new File(newcat);
FileInputStream fin = new FileInputStream(file);
byte[] catalog = new byte[(int)file.length()];
fin.read(catalog);
fin.close();
file = new File(newdeploy);
fin = new FileInputStream(file);
byte[] deploybytes = new byte[(int)file.length()];
fin.read(deploybytes);
fin.close();
String deployment = new String(deploybytes, "UTF-8");
client.callProcedure("@UpdateApplicationCatalog",catalog, deployment);
}
catch (Exception e) { e.printStackTrace(); }The following example uses the synchronous helper method to perform the same operation.
String newcat = "project/newcatalog.jar";
String newdeploy = "project/production.xml";
try {
client.updateApplicationCatalog(new File(newcat), new File(newdeploy));
}
catch (Exception e) { e.printStackTrace(); }copyright 2012 VoltDB, Inc.
- Printer-friendly version
- Login or register to post comments
