~david-goetz/swift/db_double_quar

« back to all changes in this revision

Viewing changes to swift/common/db_replicator.py

  • Committer: David Goetz
  • Date: 2011-04-18 22:00:59 UTC
  • Revision ID: david.goetz@rackspace.com-20110418220059-2u6wykxwd3ddejz4
adding double quarantine support for db replication

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import math
21
21
import time
22
22
import shutil
 
23
import uuid
 
24
import errno
23
25
 
24
26
from eventlet import GreenPool, sleep, Timeout, TimeoutError
25
27
from eventlet.green import subprocess
49
51
    quarantine_dir = os.path.abspath(os.path.join(object_dir, '..',
50
52
        '..', '..', '..', 'quarantined', server_type + 's',
51
53
        os.path.basename(object_dir)))
52
 
    renamer(object_dir, quarantine_dir)
 
54
    try:
 
55
        renamer(object_dir, quarantine_dir)
 
56
    except OSError, e:
 
57
        if e.errno not in (errno.EEXIST, errno.ENOTEMPTY):
 
58
            raise
 
59
        quarantine_dir = "%s-%s" % (quarantine_dir, uuid.uuid4().hex)
 
60
        renamer(object_dir, quarantine_dir)
53
61
 
54
62
 
55
63
class ReplConnection(BufferedHTTPConnection):