Repository navigation
Wait for the failed message index when restoring deleted messages by range - #6113
Open
mauroservienti wants to merge 1 commit into
Open
mauroservienti wants to merge 1 commit into
mauroservienti wants to merge 1 commit into
Conversation
…range The patch query allowed stale results. A message deleted right before the request was still in the index as unresolved, so the patch skipped it and the message stayed deleted without an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Restoring deleted messages by date range (
PATCH /api/errors/{from}...{to}/unarchive) selects the messages throughFailedMessageViewIndexwith a patch-by-query that allows stale results. When a message was deleted shortly before the request, the index can still have it as unresolved. The patch then skips it, and the message stays deleted. The request returns 202 and the handler succeeds, so nothing reports that it was skipped.The acceptance test
When_deleted_messages_are_restored.Should_restore_a_deleted_selection_and_a_deleted_grouphits this on the Windows RavenDB build. It deletes two messages, waits until loading them by id shows them as deleted, and restores the range in the same second. The restore finds nothing, and the test times out waiting for the messages to come back. It failed this way on #6099 and on the 6.22 backport of #6100.Change
The patch in
ErrorMessagesDataStore.UnArchiveMessagesByRangewaits until the index is up to date, for up to 5 minutes, the same time limit the group archive and restore use for their index waits. RavenDB waits only for the changes made before the query, so ongoing ingestion does not keep it waiting. If the index is still stale after the time limit, RavenDB throws, the handler fails, and the message is retried through recoverability instead of being skipped.Tests
New
UnarchiveByRangeTests.Should_unarchive_a_message_archived_right_before_the_request. It stopsFailedMessageViewIndex, deletes a message, starts the range restore, then starts the index again. Without the change, the restore returns no messages and the message stays archived. With it, the message is restored.