Remove published draft comments asynchronously

NoteDb operations on the draft comments storage are slower than
operations on change refs. When adding, modifying or deleting single
draft comments, the UI papers over this by performing those actions in
the background. It presents a notification once done.

When posting a review, we do two operations that are inheritanty
non-atomic because they touch different repositories: Update the change
metadata to post new comments and delete draft comments from All-Users.

Since these are non-atomic, existing Gerrit logic already dedupes
zombie draft comments. The fixup logic for a change can remove them.

This commit adapts NoteDbUpdateManager to perform draft comment
deletions asynchronously when we are publishing comments. If the update
is anything else, we perform the update synchronously.

Change-Id: I85f4e9580460a0313374045ec7b64950da72d5f7
This commit is contained in:
Patrick Hiesel
2019-04-17 16:04:18 +02:00
parent 13a0d3b891
commit cd291e5560
15 changed files with 676 additions and 238 deletions

View File

@@ -34,8 +34,8 @@ import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.logging.RequestId;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.notedb.ChangeUpdate;
import com.google.gerrit.server.notedb.NoteDbUpdateManager.TooManyUpdatesException;
import com.google.gerrit.server.notedb.Sequences;
import com.google.gerrit.server.notedb.TooManyUpdatesException;
import com.google.gerrit.server.util.time.TimeUtil;
import com.google.gerrit.testing.GerritBaseTests;
import com.google.gerrit.testing.InMemoryTestEnvironment;