Bug 1247525 - rhnservergroup table thrown error when run insert/update sql.
Summary: rhnservergroup table thrown error when run insert/update sql.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.2
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Jan Dobes
QA Contact: Jan Hutař
URL:
Whiteboard:
Depends On:
Blocks: space27
TreeView+ depends on / blocked
 
Reported: 2015-07-28 08:54 UTC by Muhammad Aizuddin
Modified: 2017-09-28 18:10 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-11-10 20:23:05 UTC
Embargoed:


Attachments (Terms of Use)

Description Muhammad Aizuddin 2015-07-28 08:54:39 UTC
Description of problem:
When executing below statement,

stmt = "insert into rhnservergroup (id, name, description, org_id) values (rhn_server_group_id_seq.nextval, '%s', '%s', 2)" % (name, description)

we have ORA error saying that,
cx_Oracle.DatabaseError: ORA-20297: Call get_log_id need to follow set_log_auth.
ORA-06512: at "SPACEWALK.LOGGING", line 29
ORA-06512: at "SPACEWALK.RHNSERVERGROUP_LOG_TRIG", line 5
ORA-04088: error during execution of trigger 'SPACEWALK.RHNSERVERGROUP_LOG_TRIG'

As workaround we had to disabled RHNSERVERGROUP_LOG_TRIG trigger and the statement will work without any errors.

Version-Release number of selected component (if applicable):
oracle-xe-11.2.0-1.0.x86_64
spacewalk-oracle-2.2.2-1.el6.noarch


How reproducible:
Execute insert/update sql statement into rhnservergroup table.

Steps to Reproduce:
1.
2.
3.

Actual results:
Insert/Update should not give any errors.

Expected results:


Additional info:

Comment 1 Avi Miller 2015-08-27 06:14:54 UTC
This is not a bug. You need to call clear_log_id() and set_log_auth(:user_id) prior to running the insert. Otherwise, the trigger won't fire correctly. This is handled automatically by Spacewalk's Hibernate Factory and the Logging mechanisms associated with creating new objects via Java (and the API).

Pseudo-code would look something like this (in PL/SQL):

begin
    logging.clear_log_id();
    logging.set_log_auth(1);
    insert into rhnservergroup (id, name, description, org_id) values (rhn_server_group_id_seq.nextval, :name, :description, :org_id);
end;
/

This assumes you're inserting with the user_id of 1, which is the initial super-admin account.

Comment 2 Fedora Update System 2015-10-02 18:08:30 UTC
subversion-1.8.14-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-be2c11d456

Comment 3 Muhammad Aizuddin 2015-10-04 07:13:48 UTC
Hi Avi,

Thank you for looking at this. I concur the same after reading schema docs. Hence this is enhancement to the database-application structure.

Regards

Comment 4 Fedora Update System 2015-12-16 17:21:27 UTC
subversion-1.8.15-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-6efa349a85

Comment 5 Fedora Update System 2015-12-17 10:28:19 UTC
subversion-1.8.15-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update subversion'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-6efa349a85

Comment 6 Jan Hutař 2016-11-10 20:23:05 UTC
Great, looks like no code change was required here.

I have tested on both SWnightly@OracleXE10@RHEL6 and SWnightly@PostgreSQL@RHEL7 (spacewalk-schema-2.6.14-1.el?.noarch) by creating new organization what creates new records in the table and yay, new records were created:

@Oracle before new organization creation:


# echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct -

	ID NAME 							    DESCRIPTION 																			     CURRENT_MEMBERS GROUP_TYPE     ORG_ID CREATED								       MODIFIED
---------- ---------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------- ---------- ---------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
	 1 Spacewalk Management Entitled Servers			    Spacewalk Management Entitled Servers																   0	      1 	 1 10-NOV-16 10.37.05.418097 AM 					       10-NOV-16 10.37.05.418369 AM
	 2 Virtualization Host Entitled Servers 			    Virtualization Host Entitled Servers																   0	      2 	 1 10-NOV-16 10.37.05.430974 AM 					       10-NOV-16 10.37.05.431062 AM


@Oracle after new organization created:


# echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct -

	ID NAME 							    DESCRIPTION 																			     CURRENT_MEMBERS GROUP_TYPE     ORG_ID CREATED								       MODIFIED
---------- ---------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------- ---------- ---------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------
	 3 Spacewalk Management Entitled Servers			    Spacewalk Management Entitled Servers																   0	      1 	 2 10-NOV-16 09.16.42.534602 PM 					       10-NOV-16 09.16.42.534674 PM
	 4 Virtualization Host Entitled Servers 			    Virtualization Host Entitled Servers																   0	      2 	 2 10-NOV-16 09.16.42.562595 PM 					       10-NOV-16 09.16.42.562668 PM
	 1 Spacewalk Management Entitled Servers			    Spacewalk Management Entitled Servers																   0	      1 	 1 10-NOV-16 10.37.05.418097 AM 					       10-NOV-16 10.37.05.418369 AM
	 2 Virtualization Host Entitled Servers 			    Virtualization Host Entitled Servers																   0	      2 	 1 10-NOV-16 10.37.05.430974 AM 					       10-NOV-16 10.37.05.431062 AM


@PostgreSQL before:


# echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct -
 id |                 name                  |              description              | current_members | group_type | org_id |            created            |           modified            
----+---------------------------------------+---------------------------------------+-----------------+------------+--------+-------------------------------+-------------------------------
  1 | Spacewalk Management Entitled Servers | Spacewalk Management Entitled Servers |               0 |          1 |      1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01
  2 | Virtualization Host Entitled Servers  | Virtualization Host Entitled Servers  |               0 |          2 |      1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01
(2 rows)


@PostgreSQL after:


# echo "SELECT * FROM rhnservergroup;" | spacewalk-sql --select-mode-direct -
 id |                 name                  |              description              | current_members | group_type | org_id |            created            |           modified            
----+---------------------------------------+---------------------------------------+-----------------+------------+--------+-------------------------------+-------------------------------
  1 | Spacewalk Management Entitled Servers | Spacewalk Management Entitled Servers |               0 |          1 |      1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01
  2 | Virtualization Host Entitled Servers  | Virtualization Host Entitled Servers  |               0 |          2 |      1 | 2016-11-10 10:24:26.639337+01 | 2016-11-10 10:24:26.639337+01
  3 | Spacewalk Management Entitled Servers | Spacewalk Management Entitled Servers |               0 |          1 |      2 | 2016-11-10 21:17:20.981545+01 | 2016-11-10 21:17:20.981545+01
  4 | Virtualization Host Entitled Servers  | Virtualization Host Entitled Servers  |               0 |          2 |      2 | 2016-11-10 21:17:20.981545+01 | 2016-11-10 21:17:20.981545+01
(4 rows)

Comment 7 Eric Herget 2017-09-28 18:10:25 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.


Note You need to log in before you can comment on or make changes to this bug.