Jakub Niedermertl has posted comments on this change.

Change subject: core: Vm Icons - backend part
......................................................................


Patch Set 15:

(2 comments)

https://gerrit.ovirt.org/#/c/38600/15/packaging/dbscripts/upgrade/03_06_1260_add_vm_icons_vm_icon_defaults_tables.sql
File 
packaging/dbscripts/upgrade/03_06_1260_add_vm_icons_vm_icon_defaults_tables.sql:

Line 1: CREATE TABLE vm_icons (
Line 2:     id             UUID           NOT NULL,
Line 3:     data_url       VARCHAR(32768) NOT NULL -- 1024 * 32
Line 4: );
Line 5: -- table viewer http://jsfiddle.net/jniederm/u1bf0767/
> What is that ???
It's hard to debug vm_icons table provided that first about 30 bytes of every 
png image are same and humans mostly can't parse png just by reading bytes.

The linked utility allows to visualize content of joined vm_icons and 
vm_icon_defaults.
Line 6: 
Line 7: SELECT fn_db_create_constraint('vm_icons',
Line 8:                                'pk_vm_icons',
Line 9:                                'PRIMARY KEY (id)');


Line 6: 
Line 7: SELECT fn_db_create_constraint('vm_icons',
Line 8:                                'pk_vm_icons',
Line 9:                                'PRIMARY KEY (id)');
Line 10: CREATE UNIQUE INDEX vm_icons_data_url_unique_index ON vm_icons( 
md5(data_url) );
> What do you want to achieve with this index ? and what is the point of usin
It basically means UNIQUE constraint on data_url column.

The catch is that one can create table with such unique constraint, however DB 
will fail if string longer than about 9000 chars is inserted. Moreover UNIQUE 
works only with pure columns, not general expression, so md5 can't be used with 
UNIQUE constraint. That's why index is used - it can be used with expressions.
Line 11: 
Line 12: CREATE TABLE vm_icon_defaults (
Line 13:     id UUID NOT NULL,
Line 14:     os_id INTEGER NOT NULL,


-- 
To view, visit https://gerrit.ovirt.org/38600
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I98ad0d76285af3b2913e477a340bfd1ac09a296e
Gerrit-PatchSet: 15
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Jakub Niedermertl <jnied...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Jakub Niedermertl <jnied...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
Gerrit-Reviewer: Yedidyah Bar David <d...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to