aboutsummaryrefslogtreecommitdiff
path: root/xenserver
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-03-10 11:15:01 -0800
committerBen Pfaff <blp@nicira.com>2011-03-10 11:24:00 -0800
commitc5f341ab193b9126dffef8c77bf8ed35e91290fd (patch)
treef44aae0db39ec6f5c1001535b19fe511333492d2 /xenserver
parent7f90cb0efe782cbbfb2557d81cf0f9de21e12435 (diff)
ovsdb: Implement garbage collection.
Diffstat (limited to 'xenserver')
-rwxr-xr-xxenserver/etc_init.d_openvswitch13
1 files changed, 12 insertions, 1 deletions
diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch
index 13b9d40a..73009813 100755
--- a/xenserver/etc_init.d_openvswitch
+++ b/xenserver/etc_init.d_openvswitch
@@ -341,7 +341,18 @@ function start {
cksum=`$ovsdb_tool db-cksum "$OVSDB_SERVER_DB" | awk '{print $1}'`
cp "$OVSDB_SERVER_DB" "$OVSDB_SERVER_DB.backup$version-$cksum"
- # Upgrade or downgrade schema and compact database.
+ # Compact database. This is important if the old schema did not enable
+ # garbage collection (i.e. if it did not have any tables with "isRoot":
+ # true) but the new schema does. In that situation the old database
+ # may contain a transaction that creates a record followed by a
+ # transaction that creates the first use of the record. Replaying that
+ # series of transactions against the new database schema (as "convert"
+ # does) would cause the record to be dropped by the first transaction,
+ # then the second transaction would cause a referential integrity
+ # failure (for a strong reference).
+ $ovsdb_tool -vANY:console:emer compact "$OVSDB_SERVER_DB"
+
+ # Upgrade or downgrade schema.
$ovsdb_tool -vANY:console:emer convert "$OVSDB_SERVER_DB" "$VSWITCHD_OVSDB_SCHEMA"
fi