Skip to content

Commit

Permalink
Use repeatable-read in some batch actions
Browse files Browse the repository at this point in the history
  • Loading branch information
weiminyu committed Sep 13, 2024
1 parent f6e4289 commit a31281a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
package google.registry.batch;

import static google.registry.persistence.PersistenceModule.TransactionIsolationLevel.TRANSACTION_REPEATABLE_READ;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.util.DateTimeUtils.END_OF_TIME;

Expand Down Expand Up @@ -89,7 +90,7 @@ public CheckBulkComplianceAction(

@Override
public void run() {
tm().transact(this::checkBulkPackages);
tm().transact(TRANSACTION_REPEATABLE_READ, this::checkBulkPackages);
}

private void checkBulkPackages() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static google.registry.persistence.PersistenceModule.TransactionIsolationLevel.TRANSACTION_REPEATABLE_READ;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.request.Action.Method.POST;
import static google.registry.request.RequestParameters.PARAM_DRY_RUN;
Expand Down Expand Up @@ -90,6 +91,7 @@ public void run() {
"This action is not safe to run on PRODUCTION.");

tm().transact(
TRANSACTION_REPEATABLE_READ,
() -> {
LOAD_TEST_REGISTRARS.forEach(this::deletePollMessages);
tm().loadAllOfStream(Contact.class).forEach(this::deleteContact);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static com.google.common.base.Verify.verifyNotNull;
import static google.registry.model.tld.Tlds.getTldsOfType;
import static google.registry.persistence.PersistenceModule.TransactionIsolationLevel.TRANSACTION_REPEATABLE_READ;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.request.Action.Method.POST;
import static java.nio.charset.StandardCharsets.UTF_8;
Expand Down Expand Up @@ -70,6 +71,7 @@ public void run() {
tld -> {
List<String> domains =
tm().transact(
TRANSACTION_REPEATABLE_READ,
() ->
// Note that if we had "creationTime <= :now" in the condition (not
// necessary as there is no pending creation, the order of deletionTime
Expand Down

0 comments on commit a31281a

Please sign in to comment.