[ZBX-12142] Zabbix database upgrade from 3.0.3 to 3.2.5 fails with oracle db backend in use Created: 2017 May 05  Updated: 2017 Jul 19  Resolved: 2017 May 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 3.2.5
Fix Version/s: 3.0.10rc1, 3.2.7rc1, 3.4.0alpha1, 3.4 (plan)

Type: Problem report Priority: Critical
Reporter: Dmitriy Chir Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: dbpatches, oracle, upgrade
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

linux x86_64


Issue Links:
Duplicate
is duplicated by ZBX-12395 failed to update local proxy configur... Closed
Team: Team C
Sprint: Sprint 8
Story Points: 0.5

 Description   

Problems start from DBpatch_3010021.
You started to use zbx_db_statement_execute() in zbx_db_insert_execute() [ src/libs/zbxdbhigh/db.c at line 2315 ]
which actually returns number of affected rows. Later in code you check it against status codes: ret = (ZBX_DB_OK == rc ? SUCCEED : FAIL); [line 2335]
So possibly zbx_db_statement_execute should return code:

diff -u -r -N  zabbix-3.2.5/src/libs/zbxdb/db.c zabbix-3.2.5-mod/src/libs/zbxdb/db.c 
--- zabbix-3.2.5/src/libs/zbxdb/db.c    2017-04-20 22:10:25.000000000 +1000
+++ zabbix-3.2.5-mod/src/libs/zbxdb/db.c        2017-05-04 16:08:48.305256812 +1000
@@ -1196,7 +1196,8 @@
        if (OCI_SUCCESS != (err = zbx_oracle_statement_execute(iters, &nrows)))
                ret = OCI_handle_sql_error(ERR_Z3007, err, NULL);
        else
-               ret = (int)nrows;
+//             ret = (int)nrows;
+               ret = err;
 
        if (ZBX_DB_FAIL == ret && 0 < txn_level)
        {


 Comments   
Comment by Glebs Ivanovskis (Inactive) [ 2017 May 08 ]

Looks like a regression from ZBXNEXT-3681. In my opinion, a better fix would be:

Index: src/libs/zbxdbhigh/db.c
===================================================================
--- src/libs/zbxdbhigh/db.c	(revision 67862)
+++ src/libs/zbxdbhigh/db.c	(working copy)
@@ -2332,7 +2332,7 @@
 		goto retry_oracle;
 	}
 
-	ret = (ZBX_DB_OK == rc ? SUCCEED : FAIL);
+	ret = (ZBX_DB_OK =< rc ? SUCCEED : FAIL);
 
 #else
 	DBbegin_multiple_update(&sql, &sql_alloc, &sql_offset);

glebs.ivanovskis Oops, that was too pseudo code I meant <=

Comment by Andris Zeila [ 2017 May 19 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-12142

However there are still problems with Oracle database upgrade from 3.0 to 3.4 described here.

Comment by dimir [ 2017 May 25 ]

Tested

Comment by Andris Zeila [ 2017 May 26 ]

Released in:

  • pre-3.0.10rc1 r68558
  • pre-3.2.7rc1 68560
  • pre-3.4.0alpha1 68561
Generated at Fri Mar 29 08:35:01 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.