Eli Mesika has uploaded a new change for review.

Change subject: core: create db fails on rhel 6.4 using postgres..
......................................................................

core: create db fails on rhel 6.4 using postgres..

create db fails on rhel 6.4 using postgresql-8.4.13-1.el6_3.x86_64

This patch fix a failure on postgres 8.4 that fails to update a
parameter to a SP on postgres 8.4 while the same modification is OK for
postgres 9.x.

The solution uses a local SO variable to do the modifications and be
used later on on the INSERT statement.
This patch also modified the message data type to be text and not
varchar(4000) to match the audit_table definitions.

Change-Id: I4451f5bdf118efc02bb9100c59e0729283c4c2b5
Signed-off-by: Eli Mesika <emes...@redhat.com>
Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=890982
---
M backend/manager/dbscripts/audit_log_sp.sql
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/29/10529/1

diff --git a/backend/manager/dbscripts/audit_log_sp.sql 
b/backend/manager/dbscripts/audit_log_sp.sql
index 9f8876c..1774f48 100644
--- a/backend/manager/dbscripts/audit_log_sp.sql
+++ b/backend/manager/dbscripts/audit_log_sp.sql
@@ -7,7 +7,7 @@
  v_log_type INTEGER,
     v_log_type_name VARCHAR(100),
  v_severity INTEGER,
- v_message VARCHAR(4000),
+ v_message text,
  v_user_id UUID ,
  v_user_name VARCHAR(255) ,
  v_vds_id UUID ,
@@ -60,7 +60,7 @@
     v_log_type INTEGER,
     v_log_type_name VARCHAR(100),
     v_severity INTEGER,
-    v_message VARCHAR(4000),
+    v_message text,
     v_user_id UUID ,
     v_user_name VARCHAR(255) ,
     v_vds_id UUID ,
@@ -88,17 +88,19 @@
 AS $procedure$
 DECLARE
     v_max_message_length INTEGER;
+    v_truncated_message text;
 BEGIN
 
    -- truncate message if exceeds configured max length. truncated messages 
will be ended
    -- with "..." to indicate that message is incomplete due to size limits.
 
+   v_truncated_message := v_message;
    v_max_message_length := cast(option_value as int) FROM vdc_options WHERE 
option_name = 'MaxAuditLogMessageLength' and version = 'general';
    IF (v_max_message_length IS NOT NULL and length(v_message) > 
v_max_message_length) THEN
-      v_message := substr(v_message, 1, v_max_message_length -3) || '...';
+      v_truncated_message := substr(v_message, 1, v_max_message_length -3) || 
'...';
    END IF;
    INSERT INTO audit_log(LOG_TIME, log_type, log_type_name, severity,message, 
user_id, USER_NAME, vds_id, VDS_NAME, vm_id, 
VM_NAME,vm_template_id,VM_TEMPLATE_NAME,storage_pool_id,STORAGE_POOL_NAME,storage_domain_id,STORAGE_DOMAIN_NAME,vds_group_id,vds_group_name,
 correlation_id, job_id, quota_id, quota_name, gluster_volume_id, 
gluster_volume_name,origin, custom_event_id, event_flood_in_sec, custom_data )
-               VALUES(v_log_time, v_log_type, v_log_type_name, v_severity, 
v_message, v_user_id, v_user_name, v_vds_id, v_vds_name, v_vm_id, 
v_vm_name,v_vm_template_id,v_vm_template_name,v_storage_pool_id,v_storage_pool_name,v_storage_domain_id,v_storage_domain_name,v_vds_group_id,v_vds_group_name,
 v_correlation_id, v_job_id, v_quota_id, v_quota_name, v_gluster_volume_id, 
v_gluster_volume_name,v_origin, v_custom_event_id, v_event_flood_in_sec, 
v_custom_data);
+               VALUES(v_log_time, v_log_type, v_log_type_name, v_severity, 
v_truncated_message, v_user_id, v_user_name, v_vds_id, v_vds_name, v_vm_id, 
v_vm_name,v_vm_template_id,v_vm_template_name,v_storage_pool_id,v_storage_pool_name,v_storage_domain_id,v_storage_domain_name,v_vds_group_id,v_vds_group_name,
 v_correlation_id, v_job_id, v_quota_id, v_quota_name, v_gluster_volume_id, 
v_gluster_volume_name,v_origin, v_custom_event_id, v_event_flood_in_sec, 
v_custom_data);
 
    v_audit_log_id := CURRVAL('audit_log_seq');
 END; $procedure$


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4451f5bdf118efc02bb9100c59e0729283c4c2b5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <emes...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to