From 2facedd60f1d7b5150f3b27165607a844e1129ed Mon Sep 17 00:00:00 2001 From: sarahcaseybot Date: Tue, 17 Oct 2023 16:58:37 -0400 Subject: [PATCH] Lower the isolation level for RefreshDnsForAllDomainsAction (#2182) * Lower the isolation level for RefreshDnsForAllDomainsAction This lowers the isolation level to TRANSACTION_REPEATABLE_READ which will hopefully allow the action to run the entire action without timing out on our larger TLDs. * Unchange default config --- .../tools/server/RefreshDnsForAllDomainsAction.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/google/registry/tools/server/RefreshDnsForAllDomainsAction.java b/core/src/main/java/google/registry/tools/server/RefreshDnsForAllDomainsAction.java index 2002a299d..22a5d399a 100644 --- a/core/src/main/java/google/registry/tools/server/RefreshDnsForAllDomainsAction.java +++ b/core/src/main/java/google/registry/tools/server/RefreshDnsForAllDomainsAction.java @@ -19,6 +19,7 @@ import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.Iterables.getLast; import static google.registry.dns.DnsUtils.requestDomainDnsRefresh; import static google.registry.model.tld.Tlds.assertTldsExist; +import static google.registry.persistence.PersistenceModule.TransactionIsolationLevel.TRANSACTION_REPEATABLE_READ; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.request.RequestParameters.PARAM_TLDS; import static google.registry.util.DateTimeUtils.END_OF_TIME; @@ -82,13 +83,16 @@ public class RefreshDnsForAllDomainsAction implements Runnable { public void run() { assertTldsExist(tlds); checkArgument(batchSize > 0, "Must specify a positive number for batch size"); - int smearMinutes = tm().transact(this::calculateSmearMinutes); + int smearMinutes = tm().transact(this::calculateSmearMinutes, TRANSACTION_REPEATABLE_READ); ImmutableList domainsBatch; @Nullable String lastInPreviousBatch = null; do { Optional lastInPreviousBatchOpt = Optional.ofNullable(lastInPreviousBatch); - domainsBatch = tm().transact(() -> refreshBatch(lastInPreviousBatchOpt, smearMinutes)); + domainsBatch = + tm().transact( + () -> refreshBatch(lastInPreviousBatchOpt, smearMinutes), + TRANSACTION_REPEATABLE_READ); lastInPreviousBatch = domainsBatch.isEmpty() ? null : getLast(domainsBatch); } while (domainsBatch.size() == batchSize); }