13 Commits

Author SHA1 Message Date
gholt
b5509b1bee Db reclamation should remove empty suffix dirs
When a db is reclaimed it removes the hash dir the db files are in,
but it does not try to remove the parent suffix dir though it might
be empty now. This eventually leads to a bunch of empty suffix dirs
lying around. This patch fixes that by attempting to remove the
parent suffix dir after a hash dir reclamation.

Here's a quick script to see how bad a given drive might be:

import os, os.path, sys
if len(sys.argv) != 2:
    sys.exit('%s <mount-point>' % sys.argv[0])
in_use = 0
empty = 0
containers = os.path.join(sys.argv[1], 'containers')
for p in os.listdir(containers):
    partition = os.path.join(containers, p)
    for s in os.listdir(partition):
        suffix = os.path.join(partition, s)
        if os.listdir(suffix):
            in_use += 1
        else:
            empty += 1
print in_use, 'in use,', empty, 'empty,', '%.02f%%' % (
    100.0 * empty / (in_use + empty)), 'empty'

And here's a quick script to clean up a drive:
NOTE THAT I HAVEN'T ACTUALLY RUN THIS ON A LIVE NODE YET!

import errno, os, os.path, sys
if len(sys.argv) != 2:
    sys.exit('%s <mount-point>' % sys.argv[0])
containers = os.path.join(sys.argv[1], 'containers')
for p in os.listdir(containers):
    partition = os.path.join(containers, p)
    for s in os.listdir(partition):
        suffix = os.path.join(partition, s)
        try:
            os.rmdir(suffix)
        except OSError, err:
            if err.errno not in (errno.ENOENT, errno.ENOTEMPTY):
                print err

Change-Id: I2e6463a4cd40597fc236ebe3e73b4b31347f2309
2012-10-25 19:42:56 +00:00
lrqrun
7b664c99e5 Fix PEP8 issues in ./test/unit/common .
Fix some pep8 issues in
       modified:   test_bufferedhttp.py
       modified:   test_constraints.py
       modified:   test_db.py
       modified:   test_db_replicator.py
       modified:   test_init.py
make the code looks pretty.

Change-Id: I1c374b1ccd4f028c4e4b2e8194a6d1c201d50571
2012-08-31 11:24:46 +08:00
Darrell Bishop
66400b7337 Add device name to *-replicator.removes for DBs
To tell when replication for a device has finished, it's important to
know when the replicator is removing objects.  This was previously
handled for the object-replicator
(object-replicator.partition.delete.count.<device> and
object-replicator.partition.update.count.<device> metrics) but not the
account and container replicators.

This patch extends the existing DB removal count metrics to make them
per-device.  The new metrics are:
 account-replicator.removes.<device>
 container-replicator.removes.<device>

There's also a bonus refactoring and increased test coverage of the DB
replicator code.

Change-Id: I2067317d4a5f8ad2a496834147954bdcdfc541c1
2012-08-22 13:35:09 -07:00
Jenkins
6682138b0a Merge "Make ring class interface slightly more abstracted from implementation." 2012-03-22 20:25:06 +00:00
John Dickinson
1ecf5ebba1 updated copyright date for all files
Change-Id: Ifd909d3561c2647770a7e0caa3cd91acd1b4f298
2012-03-19 13:45:34 -05:00
Michael Barton
e008c2ebb8 Make ring class interface slightly more abstracted from implementation.
Change-Id: I0f55d61c7b8de30460f17a69e5d9946494dbda6e
2012-03-14 22:00:30 +00:00
David Goetz
2d9103f9e0 adding double quarantine support for db replication 2011-04-18 15:00:59 -07:00
Anne Gentle
8823427161 Changed copyright notices on py files and the single rst file with a copyright notice 2011-01-04 17:34:43 -06:00
Chuck Thier
158e6c3ae9 refactored bins to by more DRY 2010-08-31 23:12:59 +00:00
Chuck Thier
2a36fe0619 Initial commit of middleware refactor 2010-08-20 00:50:12 +00:00
Chuck Thier
2c596c0a0f Initial commit of middleware refactor 2010-08-20 00:42:38 +00:00
gholt
15009bb76e Added metadata to account and container servers 2010-08-10 12:18:15 -07:00
Chuck Thier
001407b969 Initial commit of Swift code 2010-07-12 17:03:45 -05:00