~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to swift/container/sync.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2013-08-13 10:37:13 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20130813103713-1ctbx4zifyljs2aq
Tags: 1.9.1-0ubuntu1
[ James Page ]
* d/control: Update VCS fields for new branch locations.

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
 
 
16
from gettext import gettext as _
16
17
from time import ctime, time
17
18
from random import random, shuffle
18
19
from struct import unpack_from
155
156
            begin = time()
156
157
            all_locs = audit_location_generator(self.devices,
157
158
                                                container_server.DATADIR,
 
159
                                                '.db',
158
160
                                                mount_check=self.mount_check,
159
161
                                                logger=self.logger)
160
162
            for path, device, partition in all_locs:
172
174
        self.logger.info(_('Begin container sync "once" mode'))
173
175
        begin = time()
174
176
        all_locs = audit_location_generator(self.devices,
175
 
                                            container_server.DATADIR,
 
177
                                            container_server.DATADIR, '.db',
176
178
                                            mount_check=self.mount_check,
177
179
                                            logger=self.logger)
178
180
        for path, device, partition in all_locs:
213
215
 
214
216
        :param path: the path to a container db
215
217
        """
 
218
        broker = None
216
219
        try:
217
 
            if not path.endswith('.db'):
218
 
                return
219
220
            broker = ContainerBroker(path)
220
221
            info = broker.get_info()
221
222
            x, nodes = self.container_ring.get_nodes(info['account'],
294
295
                    broker.set_x_container_sync_points(sync_point1, None)
295
296
                self.container_syncs += 1
296
297
                self.logger.increment('syncs')
297
 
        except (Exception, Timeout), err:
 
298
        except (Exception, Timeout) as err:
298
299
            self.container_failures += 1
299
300
            self.logger.increment('failures')
300
 
            self.logger.exception(_('ERROR Syncing %s'), (broker.db_file))
 
301
            self.logger.exception(_('ERROR Syncing %s'),
 
302
                                  broker.db_file if broker else path)
301
303
 
302
304
    def container_sync_row(self, row, sync_to, sync_key, broker, info):
303
305
        """