Skip to content

Improve handling of fail queues (#6781) #7106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/reindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def main(argv: list[str]):
reject(args.deindex and (args.delete or args.create),
'--deindex is incompatible with --create and --delete.')

azul.check_fail_queues_state()
deindex = args.deindex or (args.delete and not every_source)
delete = args.delete and every_source

Expand Down Expand Up @@ -184,6 +185,7 @@ def main(argv: list[str]):
args.prefix, args.catalogs)
else:
azul.wait_for_indexer()
azul.check_fail_queues_state()


if __name__ == '__main__':
Expand Down
10 changes: 10 additions & 0 deletions src/azul/azulclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,16 @@ def message(source: SourceRef):
messages = map(message, sources)
self.queue_mirror_messages(messages)

def check_fail_queues_state(self):
queue_states = set()
for fail_queue in config.fail_queue_names:
queue_state = self.is_queue_empty(fail_queue)
queue_states.add(queue_state)
log.info('Queue %r is empty: %r', fail_queue, queue_state)
assert len(queue_states) > 0, R('No fail queues found')
assert all(queue_states), R(
'Non empty fail queues; run `manage_queue.py dump --delete` to empty them.')


class AzulClientError(RuntimeError):
pass
Expand Down
3 changes: 3 additions & 0 deletions test/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ class Catalog:

def _wait_for_indexer():
self.azul_client.wait_for_indexer()
self.azul_client.check_fail_queues_state()

flags = config.it_flags
index, delete = ['no_' + flag not in flags for flag in ['index', 'delete']]
Expand All @@ -438,6 +439,7 @@ def _wait_for_indexer():
else:
log.warning('Will skip indexing due to overriding IT flag.')

self.azul_client.check_fail_queues_state()
catalogs: list[Catalog] = []
for catalog in config.integration_test_catalogs:
if index:
Expand Down Expand Up @@ -495,6 +497,7 @@ def _wait_for_indexer():
self._test_mirroring()

def _reset_indexer(self):
self.azul_client.check_fail_queues_state()
# While it's OK to erase the integration test catalog, the queues are
# shared by all catalogs and we can't afford to trash them in a stable
# deployment like production.
Expand Down