c859ebf5ce
New replication_one_per_device (True by default) that restricts incoming REPLICATION requests to one per device, replication_currency allowing. Also has replication_lock_timeout (15 by default) to control how long a request will wait to obtain a replication device lock before giving up. This should be very useful in that you can be assured any concurrent REPLICATION requests are each writing to distinct devices. If you have 100 devices on a server, you can set replication_concurrency to 100 and be confident that, even if 100 replication requests were executing concurrently, they'd each be writing to separate devices. Before, all 100 could end up writing to the same device, bringing it to a horrible crawl. NOTE: This is only for ssync replication. The current default rsync replication still has the potentially horrible behavior. Change-Id: I36e99a3d7e100699c76db6d3a4846514537ff685
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
# Copyright (c) 2010-2012 OpenStack Foundation
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# TODO(creiht): Tests
|
|
|
|
import unittest
|
|
from swift.common import exceptions
|
|
|
|
|
|
class TestExceptions(unittest.TestCase):
|
|
|
|
def test_replication_exception(self):
|
|
self.assertEqual(str(exceptions.ReplicationException()), '')
|
|
self.assertEqual(str(exceptions.ReplicationException('test')), 'test')
|
|
|
|
def test_replication_lock_timeout(self):
|
|
exc = exceptions.ReplicationLockTimeout(15, 'test')
|
|
try:
|
|
self.assertTrue(isinstance(exc, exceptions.MessageTimeout))
|
|
finally:
|
|
exc.cancel()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|