GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.voltactivedata.com — 4.2. Updating the Database Schema Documentation4.2. Updating the Database SchemaAs an application evolves, the database schema often needs changing. This is particularly true during the early stages of development and testing but also happens periodically with established applications, as the database is tuned for performance or adjusted to meet new requirements. In the case of VoltDB, these updates may involve changes to the table definitions, to the indexes, or to the stored procedures. The following sections explain how to:
4.2.1. Performing Live Schema UpdatesThere are two ways to update the database schema for a VoltDB database: live updates and save/restore updates. For most updates, you can update the schema while the database is running. To perform this type of live update, you use the DDL CREATE, ALTER, and DROP statements to modify the schema interactively as described in the section on modifying the schema in the Using VoltDB manual. You can make any changes you want to the schema as long as the tables you are modifying do not contain any data. The only limitations on performing live schema changes are that you cannot:
These limitations are in place to guarantee that the schema change will succeed without any pre-existing data violating the constraint. If you know that the data in the database does not violate the new constraints you can make these changes using the save and restore commands, as described in the following section. 4.2.2. Performing Updates Using Save and RestoreIf you need to add unique indexes or reduce columns to database tables with existing data, you must use the voltadmin save and restore commands to perform the schema update. This requires shutting down and restarting the database to allow VoltDB to validate the existing data against the new constraints. To perform a schema update using save and restore, use the following steps:
For example: $ # Issue once $ voltadmin pause $ voltadmin save --blocking /opt/archive/ mydb $ voltadmin shutdown $ # Issue next two commands on all servers $ voltdb init --dir=~/mydb --config=deployment.xml --force $ voltdb start --dir=~/mydb --host=svr1,svr2 --count=5 $ # Issue only once $ sqlcmd 1> load classes storedprocs.jar; 2> file newschema.sql; 3> exit $ voltadmin restore /opt/archive mydb $ voltadmin resume The key point to remember when adding new constraints is that there is the possibility that the restore operation will fail if existing records violate the new constraint. This is why it is important to make sure your database contents are compatible with the new schema before performing the update. |
| You are visitor 01402792 — 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. |