Make sure we have enough .durable's for GETs
Increase the number of nodes from which we require a final successful HTTP responses before we return success to the client on a write - to the same number of nodes we'll require successful responses from to service a client request for a read. Change-Id: Ifd36790faa0a5d00ec79c23d1f96a332a0ca0f0b Related-Bug: #1469094
This commit is contained in:
parent
0e3e2db913
commit
a31ee07bda
@ -2443,10 +2443,14 @@ class ECObjectController(BaseObjectController):
|
|||||||
final_phase = True
|
final_phase = True
|
||||||
need_quorum = False
|
need_quorum = False
|
||||||
# The .durable file will propagate in a replicated fashion; if
|
# The .durable file will propagate in a replicated fashion; if
|
||||||
# one exists, the reconstructor will spread it around. Thus, we
|
# one exists, the reconstructor will spread it around.
|
||||||
# require "parity + 1" .durable files to be successfully written
|
# In order to avoid successfully writing an object, but refusing
|
||||||
# as we do fragment archives in order to call the PUT a success.
|
# to serve it on a subsequent GET because don't have enough
|
||||||
min_conns = policy.ec_nparity + 1
|
# durable data fragments - we require the same number of durable
|
||||||
|
# writes as quorum fragment writes. If object servers are in the
|
||||||
|
# future able to serve their non-durable fragment archives we may
|
||||||
|
# be able to reduce this quorum count if needed.
|
||||||
|
min_conns = policy.quorum
|
||||||
putters = [p for p in putters if not p.failed]
|
putters = [p for p in putters if not p.failed]
|
||||||
# ignore response etags, and quorum boolean
|
# ignore response etags, and quorum boolean
|
||||||
statuses, reasons, bodies, _etags, _quorum = \
|
statuses, reasons, bodies, _etags, _quorum = \
|
||||||
|
@ -2108,7 +2108,8 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
|
|||||||
codes = [FakeStatus(201, response_sleep=response_sleep)
|
codes = [FakeStatus(201, response_sleep=response_sleep)
|
||||||
for i in range(self.replicas())]
|
for i in range(self.replicas())]
|
||||||
# swap out some with regular fast responses
|
# swap out some with regular fast responses
|
||||||
number_of_fast_responses_needed_to_be_quick_enough = 5
|
number_of_fast_responses_needed_to_be_quick_enough = \
|
||||||
|
self.policy.quorum
|
||||||
fast_indexes = random.sample(
|
fast_indexes = random.sample(
|
||||||
range(self.replicas()),
|
range(self.replicas()),
|
||||||
number_of_fast_responses_needed_to_be_quick_enough)
|
number_of_fast_responses_needed_to_be_quick_enough)
|
||||||
@ -2125,12 +2126,29 @@ class TestECObjController(BaseObjectControllerMixin, unittest.TestCase):
|
|||||||
self.assertEqual(resp.status_int, 201)
|
self.assertEqual(resp.status_int, 201)
|
||||||
self.assertTrue(response_time < response_sleep)
|
self.assertTrue(response_time < response_sleep)
|
||||||
|
|
||||||
|
def test_PUT_with_just_enough_durable_responses(self):
|
||||||
|
req = swift.common.swob.Request.blank('/v1/a/c/o', method='PUT',
|
||||||
|
body='')
|
||||||
|
|
||||||
|
codes = [201] * (self.policy.ec_ndata + 1)
|
||||||
|
codes += [503] * (self.policy.ec_nparity - 1)
|
||||||
|
self.assertEqual(len(codes), self.replicas())
|
||||||
|
random.shuffle(codes)
|
||||||
|
expect_headers = {
|
||||||
|
'X-Obj-Metadata-Footer': 'yes',
|
||||||
|
'X-Obj-Multiphase-Commit': 'yes'
|
||||||
|
}
|
||||||
|
with set_http_connect(*codes, expect_headers=expect_headers):
|
||||||
|
resp = req.get_response(self.app)
|
||||||
|
self.assertEqual(resp.status_int, 201)
|
||||||
|
|
||||||
def test_PUT_with_less_durable_responses(self):
|
def test_PUT_with_less_durable_responses(self):
|
||||||
req = swift.common.swob.Request.blank('/v1/a/c/o', method='PUT',
|
req = swift.common.swob.Request.blank('/v1/a/c/o', method='PUT',
|
||||||
body='')
|
body='')
|
||||||
|
|
||||||
codes = [201] * self.policy.ec_nparity
|
codes = [201] * (self.policy.ec_ndata)
|
||||||
codes += [503] * (self.policy.ec_ndata - 1)
|
codes += [503] * (self.policy.ec_nparity)
|
||||||
|
self.assertEqual(len(codes), self.replicas())
|
||||||
random.shuffle(codes)
|
random.shuffle(codes)
|
||||||
expect_headers = {
|
expect_headers = {
|
||||||
'X-Obj-Metadata-Footer': 'yes',
|
'X-Obj-Metadata-Footer': 'yes',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user