Red Hat Bugzilla – Bug 238843
rhnpush doesn't rollback db transactions during a failure to write to disk
Last modified: 2010-10-22 10:42:20 EDT
Description of problem:
If there is an error with the /var/satellite filesystem on the satellite and a
user attempts to publish a package, then the database will be in an inconsistent
state. A record of the rpm will exist in the database, but the rpm will not
exist in /var/satellite. What is worse is that the database records are
incomplete, and the rpm does not show up in the webui.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. create 32 thousand subdirectories in /var/satellite/redhat/1, that will cause
errors with ext3
2. try to rhnpush a package
3. notice that the package did not make it into the filesystem
4. notice that a record of the rpm exists in the rhnPackage oracle table
reported error, but not all database transactions rolled back
rhnpush throws an error and rolls back all db transactions
Committed revision 132011
Committed revision 132012
create 32000 + directories under /var/satellite/redhat/1 puts the file system in
a state such that any more additional files will get a "oo many links" error.
With this state rhnpush is basically failing to put the package on the
filesystm. But includesa n entry in the db.. this is because packageUpload cal
computes the db entries and populates the db before actually putting the file on
filesystem by reading the package metadata from its header. I fixed the logic
such that it first validates the package on file and then does the db entires.
This is the test after the fix:
create 32000+ dirs under /var/satellite/redhat/1
[root@rlx-0-22 ~]# ls -l /var/satellite/redhat/1/ |wc -l
[root@rlx-0-22 ~]# mkdir /var/satellite/redhat/1/asm/
mkdir: cannot create directory `/var/satellite/redhat/1/asm/': Too many links
so its in a stale state..
now try uploading a package
[root@rlx-0-22 rhnpush]# rhnpush --server=rlx-0-22.rhndev.redhat.com --username
admin --password redhat --channel=test-push ~/asm-1.4.1-2jpp.noarch.rpm
-vvvvConnecting to http://rlx-0-22.rhndev.redhat.com/APP
url is http://rlx-0-22.rhndev.redhat.com/PACKAGE-PUSH
Result codes: 200 OK
Computing md5sum and package Info .This may take sometime ...
Package /root/asm-1.4.1-2jpp.noarch.rpm Not Found on RHN Server -- Uploading
Uploading package /root/asm-1.4.1-2jpp.noarch.rpm
Using POST request
Internal server error 500 Internal Server Error
Error pushing /root/asm-1.4.1-2jpp.noarch.rpm: Error Message:
Package upload failed: [Errno 31] Too many links: '/var/satellite/redhat/1/asm'
Error Class Code: 50
Error Class Info: Invalid information uploaded to the server (500)
so the push failed.
lets check the filesystem,
[root@rlx-0-22 ~]# ls /var/satellite/redhat/1/asm
ls: /var/satellite/redhat/1/asm: No such file or directory
so it failed to put it on file system
Now check the db:
SQL> select 1 from rhnPackageName where name = 'asm';
no rows selected
So there is no trace of asm package in the db's rhnpackageName which means its
not in the db
This should fix the issue Goldman is facing.
this hotfix needs to be for
We will update our rhn infrastructure to this version.
This event sent from IssueTracker by vzlatkin
Committed revision 134812.
5.1 Sat GA so Closed for Current Release.
Removed Bug 238843 blocks bug 421541.