Yair Zaslavsky has uploaded a new change for review. Change subject: setup: checking if command_entities table exist ......................................................................
setup: checking if command_entities table exist oVirt 3.5 has introduced command_entities table. In addition to adding some new functions related to this table to the task clenaer utility, some functions got changed, but as it is run during setup and might run on top of version which preceeds oVirt 3.5, it should be checked in the relevant SPs that the table exists. Change-Id: I3152c4d3f6e02915053ada5019abeea7cb356751 Signed-off-by: Yair Zaslavsky <[email protected]> --- M packaging/setup/dbutils/taskcleaner_sp.sql 1 file changed, 12 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/22/37422/1 diff --git a/packaging/setup/dbutils/taskcleaner_sp.sql b/packaging/setup/dbutils/taskcleaner_sp.sql index f958bc7..8f7186c 100644 --- a/packaging/setup/dbutils/taskcleaner_sp.sql +++ b/packaging/setup/dbutils/taskcleaner_sp.sql @@ -35,10 +35,12 @@ IF EXISTS (SELECT 1 FROM GetAsyncTasksZombies() WHERE command_id = v_command_id) THEN DELETE FROM async_tasks WHERE command_id = v_command_id; END IF; - DELETE FROM command_entities where command_id = v_command_id; - GET DIAGNOSTICS deleted_rows = ROW_COUNT; - IF deleted_rows > 0 THEN - DELETE FROM command_entities C WHERE command_id = root_command_id_of_deleted_cmds AND NOT EXISTS (SELECT * from COMMAND_ENTITIES WHERE root_command_id = C.command_id); + IF (FN_TABLE_EXISTS ('command_entities')) THEN + DELETE FROM command_entities where command_id = v_command_id; + GET DIAGNOSTICS deleted_rows = ROW_COUNT; + IF deleted_rows > 0 THEN + DELETE FROM command_entities C WHERE command_id = root_command_id_of_deleted_cmds AND NOT EXISTS (SELECT * from COMMAND_ENTITIES WHERE root_command_id = C.command_id); + END IF; END IF; END; $procedure$ LANGUAGE plpgsql; @@ -50,11 +52,13 @@ root_command_id_of_deleted_cmds UUID; BEGIN DELETE FROM async_tasks WHERE command_id = v_command_id; - SELECT root_command_id into root_command_id_of_deleted_cmds FROM COMMAND_entities WHERE command_id = v_command_id; - DELETE FROM command_entities where command_id = v_command_id; - GET DIAGNOSTICS deleted_rows = ROW_COUNT; - IF deleted_rows > 0 THEN + IF (FN_TABLE_EXISTS ('command_entities')) THEN + SELECT root_command_id into root_command_id_of_deleted_cmds FROM COMMAND_entities WHERE command_id = v_command_id; + DELETE FROM command_entities where command_id = v_command_id; + GET DIAGNOSTICS deleted_rows = ROW_COUNT; + IF deleted_rows > 0 THEN DELETE FROM command_entities C WHERE command_id = root_command_id_of_deleted_cmds AND NOT EXISTS (SELECT * from COMMAND_ENTITIES WHERE root_command_id = C.command_id); + END IF; END IF; END; $procedure$ LANGUAGE plpgsql; -- To view, visit http://gerrit.ovirt.org/37422 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3152c4d3f6e02915053ada5019abeea7cb356751 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
