Eli Mesika has uploaded a new change for review. Change subject: core: Fixing duplicate scripts recognition ......................................................................
core: Fixing duplicate scripts recognition The upgrade utility should recognize that a script was installed before with a different prefix in order to only record it an skip its execution. This is done by recording in the database the md5 for each upgrade script so if a script is already installed and have the current script md5 , the new script will be recorded to the schema_version with a SKIPPED state and a comment saying which is the script that was already installed the contained code. This functionality of the upgrade utility was broken as a result of the following commit : 38e8f8aae8b4a92e6c191ca1d4df1b54eae581f2 This fix is mandatory for fixing the original bug and therefor ordered as a pre-patch of it. As a result of this change the following fix has been reverted: "When running create_db.sh scripts 03_00_0420 and beyond are executed but not inserted to the schema_version table. This is caused to a race since execute_command is running in a loop and creates a temporary file in each iteration. Solution is to gather all inserts in one file and execute them at once." Since this is just a problem with the logging to schema_version table and the scripts are executed correctly I am reverting this fix since the problem caused by it is much higher than the minor lack of recorded data. Change-Id: I2e887acc0e3bb266354af2ac5e77e5aec8537454 Signed-off-by: Eli Mesika <[email protected]> Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=903604 --- M backend/manager/dbscripts/dbfunctions.sh 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/81/11381/1 diff --git a/backend/manager/dbscripts/dbfunctions.sh b/backend/manager/dbscripts/dbfunctions.sh index 97dfe2c..4057ef9 100755 --- a/backend/manager/dbscripts/dbfunctions.sh +++ b/backend/manager/dbscripts/dbfunctions.sh @@ -303,7 +303,6 @@ last="${current:2:7}" disable_gaps_from="3010910" files=$(get_files "upgrade" 1) - insertfilename=$(mktemp) for file in $(ls -1 $files); do before=$(get_db_time) checksum=$(md5sum $file | cut -d " " -f1) @@ -359,10 +358,9 @@ CMD="insert into schema_version(version,script,checksum,installed_by,started_at,ended_at,state,current,comment) values (trim('$ver'),'$file','$checksum','${USERNAME}', cast(trim('$before') as timestamp),cast(trim('$after') as timestamp),'$state',false,'$comment');" - echo ${CMD} >> ${insertfilename} + psql -U ${USERNAME} --pset=tuples_only=on -h ${SERVERNAME} -p ${PORT} -c "${CMD}" ${DATABASE} > /dev/null fi done - execute_file ${insertfilename} ${DATABASE} ${SERVERNAME} ${PORT} > /dev/null set_last_version # restore views & SPs if dropped -- To view, visit http://gerrit.ovirt.org/11381 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e887acc0e3bb266354af2ac5e77e5aec8537454 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
