Skip to content

Commit

Permalink
ovn: check whether db file is fixed (#3928)
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
  • Loading branch information
zhangzujian committed Apr 17, 2024
1 parent 021b996 commit 86be0f6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dist/images/start-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ function ovn_db_pre_start() {
cp "$db_file" "$db_bak" || return 1

echo "detected database corruption for file $db_file, try to fix it."
if ! ovsdb-tool fix-cluster "$db_file"; then
local fixed=0
if ovsdb-tool fix-cluster "$db_file"; then
echo "checking whether database file $db_file has been fixed."
if ovsdb-tool check-cluster "$db_file"; then
fixed=1
fi
fi
if [ $fixed -ne 1 ]; then
echo "failed to fix database file $db_file, rebuild it."
local sid=$(ovsdb-tool db-sid "$db_file")
if ! echo -n "$sid" | grep -qE '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'; then
Expand Down

0 comments on commit 86be0f6

Please sign in to comment.