Bug 1576937

Summary: Value too long for type character varying(50) for host_interface_configuration and vm_interface_configuration
Product: Red Hat Enterprise Virtualization Manager Reporter: Bimal Chollera <bcholler>
Component: ovirt-engine-dwhAssignee: Shirly Radco <sradco>
Status: CLOSED CURRENTRELEASE QA Contact: Lucie Leistnerova <lleistne>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.1.11CC: fgarciad, lsurette, lsvaty, pbrilla, rbalakri, Rhev-m-bugs, sradco, srevivo, ykaul, ylavi
Target Milestone: ovirt-4.2.4Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-dwh-4.2.4 Doc Type: Bug Fix
Doc Text:
Cause: Value of network_name length in engine db was updated to support up to 256 characters, but dwh was not updated and was still 50 characters. Consequence: Error in DWH Fix: Updated network_name length in dwh. Result: No errors about Value too long for type character varying(50) for host_interface_configuration and vm_interface_configuration
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-28 07:24:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Metrics RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1581854, 1631202    

Description Bimal Chollera 2018-05-10 19:14:44 UTC
Description of problem:



Value too long for type character varying(50) for host_interface_configuration and vm_interface_configuration tables.

The ovirt-engine-history database tables host_interface_configuration and vm_interface_configuration tables doesn't seem take more the 50 character names.
The ovirt-engine-dwh.log continues to stream errors [I1].  Also the pg_logs report the ERRORs as well [I2].

It appears BZ https://bugzilla.redhat.com/show_bug.cgi?id=1477204 added functionality to configure Network name length to 256 bytes but the ovirt-engine-history database tables host_interface_configuration and vm_interface_configuration tables can take up to 50 [I3].


[I1] 	Errors:

~~~
2018-05-10 13:33:11|PgFdnl|I53IsN|OiSVo3|OVIRT_ENGINE_DWH|SampleTimeKeepingJob|Default|6|Java Exception|tRunJob_1|java.lang.RuntimeException:Child job running failed|1
Exception in component tJDBCOutput_5
org.postgresql.util.PSQLException: ERROR: value too long for type character varying(50)
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_5Process(ConfigurationSync.java:22977)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_22Process(ConfigurationSync.java:21194)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_4Process(ConfigurationSync.java:18622)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_34Process(ConfigurationSync.java:16097)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_33Process(ConfigurationSync.java:14895)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_20Process(ConfigurationSync.java:13697)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_3Process(ConfigurationSync.java:12325)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_18Process(ConfigurationSync.java:11345)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_1Process(ConfigurationSync.java:9812)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_15Process(ConfigurationSync.java:8382)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_2Process(ConfigurationSync.java:7015)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_11Process(ConfigurationSync.java:6053)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync.tJDBCInput_9Process(ConfigurationSync.java:4288)
	at ovirt_engine_dwh.configurationsync_4_1.ConfigurationSync$2.run(ConfigurationSync.java:60001)
2018-05-10 13:33:11|8fAaTq|I53IsN|gdpyaE|OVIRT_ENGINE_DWH|ConfigurationSync|Default|6|Java Exception|tJDBCOutput_5|org.postgresql.util.PSQLException:ERROR: value too long for type character varying(50)|1
Exception in component tRunJob_1
java.lang.RuntimeException: Child job running failed
	at ovirt_engine_dwh.samplerunjobs_4_1.SampleRunJobs.tRunJob_1Process(SampleRunJobs.java:1198)
	at ovirt_engine_dwh.samplerunjobs_4_1.SampleRunJobs.tRunJob_4Process(SampleRunJobs.java:1000)
	at ovirt_engine_dwh.samplerunjobs_4_1.SampleRunJobs.tJDBCConnection_2Process(SampleRunJobs.java:767)
	at ovirt_engine_dwh.samplerunjobs_4_1.SampleRunJobs.tJDBCConnection_1Process(SampleRunJobs.java:642)
	at ovirt_engine_dwh.samplerunjobs_4_1.SampleRunJobs$2.run(SampleRunJobs.java:2683)
2018-05-10 13:33:11|gdpyaE|I53IsN|1TTZj9|OVIRT_ENGINE_DWH|SampleRunJobs|Default|6|Java Exception|tRunJob_1|java.lang.RuntimeException:Child job running failed|1
Exception in component tRunJob_1
java.lang.RuntimeException: Child job running failed
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tRunJob_1Process(SampleTimeKeepingJob.java:6067)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCInput_2Process(SampleTimeKeepingJob.java:5809)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCConnection_1Process(SampleTimeKeepingJob.java:4444)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCConnection_2Process(SampleTimeKeepingJob.java:4319)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tRowGenerator_2Process(SampleTimeKeepingJob.java:4188)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCInput_3Process(SampleTimeKeepingJob.java:3593)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCInput_5Process(SampleTimeKeepingJob.java:2977)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCInput_4Process(SampleTimeKeepingJob.java:2295)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob.tJDBCConnection_3Process(SampleTimeKeepingJob.java:1649)
	at ovirt_engine_dwh.sampletimekeepingjob_4_1.SampleTimeKeepingJob$2.run(SampleTimeKeepingJob.java:11363)
~~~


[I2]	pg_logs reporting error.

~~~
ERROR:  value too long for type character varying(50)
STATEMENT:  INSERT INTO host_interface_configuration (host_interface_id,host_interface_name,host_id,host_interface_type,host_interface_speed_bps,mac_address,logical_network_name,ip_address,gateway,bond,bond_name,vlan_id,host_configuration_version,create_date,update_date,delete_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)

ERROR:  value too long for type character varying(50)
STATEMENT:  INSERT INTO vm_interface_configuration (vm_interface_id,vm_interface_name,vm_id,vm_interface_type,vm_interface_speed_bps,mac_address,logical_network_name,vm_configuration_version,create_date,update_date,delete_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)
~~~

[I3]  host_interface_configuration and vm_interface_configuration functions.

~~~
ovirt_engine_history=# \d host_interface_configuration
                                   Table "public.host_interface_configuration"
           Column           |           Type           |                        Modifiers                        
----------------------------+--------------------------+---------------------------------------------------------
 history_id                 | integer                  | not null default nextval('configuration_seq'::regclass)
 host_interface_id          | uuid                     | not null
 host_interface_name        | character varying(50)    | not null
 host_id                    | uuid                     | not null
 host_interface_type        | smallint                 | 
 host_interface_speed_bps   | integer                  | 
 mac_address                | character varying(59)    | 
 logical_network_name       | character varying(50)    | 
 ip_address                 | character varying(20)    | 
 gateway                    | character varying(20)    | 
 bond                       | boolean                  | 
 bond_name                  | character varying(50)    | 
 vlan_id                    | integer                  | 
 host_configuration_version | integer                  | 
 create_date                | timestamp with time zone | 
 update_date                | timestamp with time zone | 
 delete_date                | timestamp with time zone | 
Indexes:
    "host_interface_configuration_pkey" PRIMARY KEY, btree (history_id)
    "host_interface_configuration_host_id_idx" btree (host_id)
    "host_interface_configuration_host_interface_id_idx" btree (host_interface_id)


    
ovirt_engine_history=# \d vm_interface_configuration
                                   Table "public.vm_interface_configuration"
          Column          |           Type           |                        Modifiers                        
--------------------------+--------------------------+---------------------------------------------------------
 history_id               | integer                  | not null default nextval('configuration_seq'::regclass)
 vm_interface_id          | uuid                     | not null
 vm_interface_name        | character varying(50)    | not null
 vm_id                    | uuid                     | 
 vm_interface_type        | smallint                 | 
 vm_interface_speed_bps   | integer                  | 
 mac_address              | character varying(20)    | 
 logical_network_name     | character varying(50)    | 
 vm_configuration_version | integer                  | 
 create_date              | timestamp with time zone | 
 update_date              | timestamp with time zone | 
 delete_date              | timestamp with time zone | 
Indexes:
    "vm_interface_configuration_pkey" PRIMARY KEY, btree (history_id)
    "vm_interface_configuration_vm_id_idx" btree (vm_id)
    "vm_interface_configuration_vm_interface_id_idx" btree (vm_interface_id)
~~~



Version-Release number of selected component (if applicable):

ovirt-engine-setup-4.1.11.2-0.1.el7.noarch

How reproducible:

100%

Steps to Reproduce:
1.  RHV-M UI -> Network:  Add New Logical Network with over 50 character name.
2.  Assign the large named network to a host and to a VM
3.  Start the VM.
4.  Check the /var/ovirt-engine-dwh/ovirt-engine-dwhd.log and /var/lib/pgsq/data/pg_logs for errors.

Actual results:

DB won't accept more then 50 characters


Expected results:

Should accept more the 50 characters.

Additional info:

Comment 3 Bimal Chollera 2018-05-10 22:41:42 UTC
Problem is also seen on 4.2 as well.

Comment 4 Bimal Chollera 2018-05-12 00:53:01 UTC
Engine db has:

    v_network_name VARCHAR(256),

dwh db has:

   network_name VARCHAR(50),

Comment 7 Bimal Chollera 2018-05-15 00:53:27 UTC
Thanks Shirly,
Tested the fix.

- Bimal.

Comment 11 Lucie Leistnerova 2018-05-30 13:58:46 UTC
After upgrade, problem still persist and error appears in dwh log

from upgrade log:
Running upgrade sql script '/usr/share/ovirt-engine-dwh/dbscripts/upgrade/04_02_0030_update_network_name_length.sql'...

but no change done

ovirt_engine_history=# \d host_interface_configuration
...
 logical_network_name       | character varying(50)    | 


ovirt_engine_history=# \d vm_interface_configuration
...
 logical_network_name     | character varying(50)    | 


tested in ovirt-engine-dwh-4.2.4-1.el7ev.noarch

Comment 12 Shirly Radco 2018-06-03 07:29:49 UTC
If you have upgraded or installed ovirt-engine-dwh 4.2.4 or master
you will need to run the following commands directly on the ovirt_engine_history db to fix this bug.
 ALTER TABLE host_interface_configuration ALTER COLUMN logical_network_name TYPE varchar(256);

ALTER TABLE vm_interface_configuration ALTER COLUMN logical_network_name TYPE varchar(256);

QE please test upgrading from 4.2.3.z and below and not from 4.2.4 to build. Thank you.

Comment 13 Pavol Brilla 2018-06-20 13:38:48 UTC
so according to last change in this bug, should be this re-target to 4.3?

Comment 14 Shirly Radco 2018-06-21 07:33:19 UTC
(In reply to Pavol Brilla from comment #13)
> so according to last change in this bug, should be this re-target to 4.3?

No. Sorry. It is already fixed in the ovirt-engine-dwh-4.2.4.1.
The issue was in the ovirt-engine-dwh-4.2.4 build.

Comment 15 Lucie Leistnerova 2018-06-22 06:36:22 UTC
After upgrade 4.1 -> 4.2.4 DWH works ok with long network name on host and VM. The same for upgrade 4.2.3 -> 4.2.4

verified in ovirt-engine-dwh-4.2.4.3-1.el7ev.noarch
ovirt-engine-dbscripts-4.2.4.5-0.1.el7_3.noarch

Comment 16 Franta Kust 2019-05-16 13:09:05 UTC
BZ<2>Jira Resync