Skip to content

Commit e66aee0

Browse files
authored
Downgrade the tx isolation level of poll message ack flow (#2615)
This might help alleviate DB transaction contention on the PollMessage table. A lower transaction isolation level is safe because acking a poll message is idempotent: there are only two things it does, either delete a poll message or take a recurring one from the past and set it to be a year in the future from the date in the past. Both of these operations will always yield the same final result even if executed multiple times simultaneously for some reason.
1 parent c7e1fc1 commit e66aee0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/src/main/java/google/registry/flows/poll/PollAckFlow.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import google.registry.model.poll.PollMessage;
3838
import google.registry.model.poll.PollMessageExternalKeyConverter;
3939
import google.registry.model.poll.PollMessageExternalKeyConverter.PollMessageExternalKeyParseException;
40+
import google.registry.persistence.IsolationLevel;
41+
import google.registry.persistence.PersistenceModule.TransactionIsolationLevel;
4042
import google.registry.persistence.VKey;
4143
import java.util.Optional;
4244
import javax.inject.Inject;
@@ -55,6 +57,7 @@
5557
* @error {@link PollAckFlow.MissingMessageIdException}
5658
* @error {@link PollAckFlow.NotAuthorizedToAckMessageException}
5759
*/
60+
@IsolationLevel(value = TransactionIsolationLevel.TRANSACTION_READ_COMMITTED)
5861
public final class PollAckFlow implements MutatingFlow {
5962

6063
@Inject ExtensionManager extensionManager;

0 commit comments

Comments
 (0)