Bug 581812 - db-control extend will not properly create more than 100 dbf files
Summary: db-control extend will not properly create more than 100 dbf files
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 530
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Dimitar Yordanov
URL:
Whiteboard:
Depends On:
Blocks: sat540-blockers
TreeView+ depends on / blocked
 
Reported: 2010-04-13 10:19 UTC by Martin Osvald 🛹
Modified: 2018-10-27 13:44 UTC (History)
4 users (show)

Fixed In Version: spacewalk-web-1.1.6-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-10-28 14:51:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
temporary patch which fixes the bug (707 bytes, patch)
2010-04-13 10:19 UTC, Martin Osvald 🛹
no flags Details | Diff

Description Martin Osvald 🛹 2010-04-13 10:19:55 UTC
Created attachment 406199 [details]
temporary patch which fixes the bug

Description of problem:

If a given tablespace in Satellite with embedded Oracle db has 100 or more dbf files, then any attempt to extend with "db-control extend <tbsname>" fails.


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

spacewalk-dobby-0.5.23-28.el5sat


How reproducible:

always


Steps to Reproduce:

1. create 100 oracle db files, by running e.g. something similar:

  $ for x in $(seq $(($(ls /rhnsat/data/rhnsat/data_* | sed -e "s/^.*_\(.*\).dbf$/\1/" | sort -n | tail -n 1) + 1)) 100); do db-control extend DATA_TBS; done

  It will count a number of the last db file+1 and then create db files counting to 100

2. run db-control again to hit the bug:

  $ db-control extend DATA_TBS


Actual results:

$ db-control extend DATA_TBS
Extending DATA_TBS... DBD::Oracle::db do failed: ORA-01537: cannot add file '/rhnsat/data/rhnsat/data_100.dbf' - file already part of database (DBD ERROR: OCIStmtExecute) [for Statement "ALTER TABLESPACE DATA_TBS ADD DATAFILE '/rhnsat/data/rhnsat/data_100.dbf' SIZE 512000 K REUSE"] at /usr/lib/perl5/vendor_perl/5.8.8/Dobby/DB.pm line 160.
$


Expected results:

$ db-control extend DATA_TBS
Extending DATA_TBS... done.
$


Additional info:

The problem is caused by the fact that an array holding paths to db files is not correctly sorted as it is an array of hashes not array of paths, so pop() function won't pickup the number 100, but 99 and therefore it fails to create already existing db file number 100.

---------------------------------------------------------------

Debugging /usr/lib/perl5/vendor_perl/5.8.8/Dobby/CLI/MaintCommands.pm shows that the @files array is not sorted numerically by filename for integers greater than 99. For example, the first 12 values of the array look like this ...

HASH(0x13295a10)  

/rhnsat/data/rhnsat/data_01.dbf  

HASH(0x13295a30)  

/rhnsat/data/rhnsat/data_02.dbf  

HASH(0x13295a40)  

/rhnsat/data/rhnsat/data_03.dbf  

HASH(0x13295a50)  

/rhnsat/data/rhnsat/data_04.dbf  

HASH(0x13295ab0)  

/rhnsat/data/rhnsat/data_05.dbf  

HASH(0x13295b10)  

/rhnsat/data/rhnsat/data_06.dbf  

HASH(0x13295b70)  

/rhnsat/data/rhnsat/data_07.dbf  

HASH(0x13295bd0)  

/rhnsat/data/rhnsat/data_08.dbf  

HASH(0x13295c30)  

/rhnsat/data/rhnsat/data_09.dbf  

HASH(0x13295c90)  

/rhnsat/data/rhnsat/data_10.dbf  

HASH(0x13295cf0)  

/rhnsat/data/rhnsat/data_100.dbf  

HASH(0x13295d50)  

/rhnsat/data/rhnsat/data_11.dbf  

HASH(0x13295db0)  

The problem comes on line 57 of MaintCommands.pm where the last value of the array is pop'ed which evaluates to 99 instead of 100.

---------------------------------------------------------------

The attached patch solves the issue.

Comment 3 Martin Osvald 🛹 2010-04-13 13:55:14 UTC
Hello,

ah sorry, I forgot to mention in "Steps to Reproduce:" that you have to switch to oracle user first before doing anything with db, so that the first step would have been:

1. Change to oracle user:
  $ su - oracle

Best regards,
-Martin

Comment 4 Jan Pazdziora 2010-05-28 11:50:47 UTC
I might actually prefer to use the Schwartzian transformation so that the regexp (tr) operations happen outside of that sort. Alternatively, we can just store the number before \.dbf$ in that hash as well since the next_filename function needs the number anyway.

Comment 5 Michael Mráka 2010-07-16 14:36:09 UTC
Fixed in spacewalk master by ordering files returned from database:
commit c9401f27a283f7315ab782178b71b1b68eae51a6
    581812 - fixed file ordering

Comment 7 Dimitar Yordanov 2010-09-09 12:11:10 UTC
Hi all,

 I have just managed to reproduce the issue on Satellite 5.3.
 On Satellite 5.4 the problem is fixed.

 -bash-3.2$ db-control extend DATA_TBS
  Extending DATA_TBS... done.
  -bash-3.2$ ls /rhnsat/data/rhnsat/data_10*
/rhnsat/data/rhnsat/data_100.dbf  /rhnsat/data/rhnsat/data_101.dbf  /rhnsat/data/rhnsat/data_10.dbf 

 Regards
 Dimitar

Comment 10 Clifford Perry 2010-10-28 14:47:11 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford


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