Alon Bar-Lev has posted comments on this change.

Change subject: db: cleanup: psql usage
......................................................................


Patch Set 1:

(8 comments)

http://gerrit.ovirt.org/#/c/25127/1//COMMIT_MSG
Commit Message:

Line 25: 8. boolean as -z -n
Line 26: 
Line 27: 9. minor additional cleanups.
Line 28: 
Line 29: TODO: please seek TODO and reply to questions.
> Is this still relevant ?
Done
Line 30: 
Line 31: Change-Id: Ib93ad2ca4d35fe3f44e3f8915182778a9fe6ed66


http://gerrit.ovirt.org/#/c/25127/1/packaging/dbscripts/dbfunc-base.sh
File packaging/dbscripts/dbfunc-base.sh:

Line 55:         -c "copy (${statement}) to stdout with delimiter as '|';"
Line 56: }
Line 57: 
Line 58: #
Line 59: # parse line escape, each each field
> each each => each
Done
Line 60: # in own line
Line 61: #
Line 62: dbfunc_psql_statement_parse_line() {
Line 63:     local line="$1"


Line 67: 
Line 68:     local escape=
Line 69:     while [ -n "${line}" ]; do
Line 70:         c="$(expr substr "${line}" 1 1)"
Line 71:         line="$(expr substr "${line}" 2 10000000)"
> 10000000 ??? 
infinite :)

there is no get until end of string...

oh! there is a way to do this properly!
Line 72:         if [ -n "${escape}" ]; then
Line 73:             escape=
Line 74:             echo -n "$c"
Line 75:         else


http://gerrit.ovirt.org/#/c/25127/1/packaging/dbscripts/dbfunctions.sh
File packaging/dbscripts/dbfunctions.sh:

Line 316
Line 317
Line 318
Line 319
Line 320
> why this line is removed ???
I moved it to upgrade.sh

but now I added but the:

 dbfunc_psql_die --file="upgrade/03_02_0000_set_version.sql" > /dev/null

left the VERSION override to upgrade as it only relevant to there.

please confirm.


http://gerrit.ovirt.org/#/c/25127/1/packaging/dbscripts/unlock_entity.sh
File packaging/dbscripts/unlock_entity.sh:

Line 17:     -p PORT       - The database port for the database        (def. 
${DBFUNC_DB_PORT})
Line 18:     -d DATABASE   - The database name                         (def. 
${DBFUNC_DB_DATABASE})
Line 19:     -u USER       - The username for the database             (def. 
${DBFUNC_DB_USER})
Line 20:     -l LOGFILE    - The logfile for capturing output          (def. 
${DBFUNC_LOGFILE})
Line 21:     -t TYPE       - The object type {vm | template | disk | snapshot} 
> TWS
Done
Line 22:     -r            - Recursive, unlocks all disks under the selected 
vm/template.
Line 23:     -q            - Query db and display a list of the locked entites.
Line 24:     -v            - Turn on verbosity                         
(WARNING: lots of output)
Line 25:     -h            - This help text.


Line 22:     -r            - Recursive, unlocks all disks under the selected 
vm/template.
Line 23:     -q            - Query db and display a list of the locked entites.
Line 24:     -v            - Turn on verbosity                         
(WARNING: lots of output)
Line 25:     -h            - This help text.
Line 26:     ENTITIES      - The list of object names in case of vm/template, 
UUIDs in case of a disk 
> TWS (worth removing even if were in base code IMO
Done
Line 27: 
Line 28: __EOF__
Line 29: }
Line 30: 


http://gerrit.ovirt.org/#/c/25127/1/packaging/dbscripts/upgrade.sh
File packaging/dbscripts/upgrade.sh:

Line 75:        \?) usage; exit 1;;
Line 76:     esac
Line 77: done
Line 78: 
Line 79: dbfunc_psql_die --file="upgrade/03_02_0000_set_version.sql" > /dev/null
> As I see this code was moved from the upgrade func here ?
because VERSION override belongs to here... and I do think that the above line 
is executed anyway at setup per iteration of sql. but I moved the above line 
back.
Line 80: if [  -n "${VERSION}" ]; then
Line 81:     dbfunc_psql_die --command="
Line 82:         update schema_version
Line 83:         set current=true


http://gerrit.ovirt.org/#/c/25127/1/packaging/setup/dbutils/dbfunc-base.sh
File packaging/setup/dbutils/dbfunc-base.sh:

Line 22:     fi
Line 23: }
Line 24: 
Line 25: dbfunc_cleanup() {
Line 26:     :
> What does this mean ???
do nothing :))
Line 27: }
Line 28: 
Line 29: dbfunc_psql_raw() {
Line 30:     LC_ALL="C" "${PSQL}" \


-- 
To view, visit http://gerrit.ovirt.org/25127
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib93ad2ca4d35fe3f44e3f8915182778a9fe6ed66
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to