Merge "Fix SSYNC update phase blocking"

This commit is contained in:
Zuul 2021-11-23 20:48:04 +00:00 committed by Gerrit Code Review
commit 4c84f615a1
2 changed files with 8 additions and 0 deletions

View File

@ -445,6 +445,7 @@ class Receiver(object):
raise Exception('Looking for :UPDATES: START got %r' % line[:1024])
successes = 0
failures = 0
updates = 0
while True:
line = self._readline('updates line')
if not line or line.strip() == b':UPDATES: END':
@ -539,6 +540,9 @@ class Receiver(object):
# subreq.
for junk in subreq.environ['wsgi.input']:
pass
if updates % 5 == 0:
sleep() # Gives a chance for other greenthreads to run
updates += 1
if failures:
raise swob.HTTPInternalServerError(
'ERROR: With :UPDATES: %d failures to %d successes' %

View File

@ -369,6 +369,7 @@ class Sender(object):
msg = b':UPDATES: START\r\n'
connection.send(b'%x\r\n%s\r\n' % (len(msg), msg))
frag_prefs = [] if self.include_non_durable else None
updates = 0
for object_hash, want in send_map.items():
object_hash = urllib.parse.unquote(object_hash)
try:
@ -404,6 +405,9 @@ class Sender(object):
# continue. The diskfile may however be deleted after a
# successful ssync since it remains in the send_map.
pass
if updates % 5 == 0:
sleep() # Gives a chance for other greenthreads to run
updates += 1
with exceptions.MessageTimeout(
self.daemon.node_timeout, 'updates end'):
msg = b':UPDATES: END\r\n'