mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 08:27:14 +02:00
Migrate to Flogger (green)
This is a 'green' Flogger migration CL. Green CLs are intended to be as safe as possible and should be easy to review and submit. No changes should be necessary to the code itself prior to submission, but small changes to BUILD files may be required. Changes within files are completely independent of each other, so this CL can be safely split up for review using tools such as Rosie. For more information, see [] Base CL: 197826149 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=198560170
This commit is contained in:
parent
0d2fb3a8f0
commit
70b13596e4
178 changed files with 984 additions and 988 deletions
|
@ -8,7 +8,6 @@ java_library(
|
|||
name = "batch",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//java/com/google/common/logging:formatting_logger",
|
||||
"//java/google/registry/bigquery",
|
||||
"//java/google/registry/config",
|
||||
"//java/google/registry/dns",
|
||||
|
@ -32,6 +31,8 @@ java_library(
|
|||
"@com_google_auto_value",
|
||||
"@com_google_code_findbugs_jsr305",
|
||||
"@com_google_dagger",
|
||||
"@com_google_flogger",
|
||||
"@com_google_flogger_system_backend",
|
||||
"@com_google_guava",
|
||||
"@com_google_http_client",
|
||||
"@com_googlecode_json_simple",
|
||||
|
|
|
@ -19,7 +19,6 @@ import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
|
|||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static com.google.common.logging.FormattingLogger.getLoggerForCallerClass;
|
||||
import static com.google.common.math.IntMath.divide;
|
||||
import static com.googlecode.objectify.Key.getKind;
|
||||
import static google.registry.flows.ResourceFlowUtils.denyPendingTransfer;
|
||||
|
@ -58,7 +57,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.batch.DeleteContactsAndHostsAction.DeletionResult.Type;
|
||||
import google.registry.dns.DnsQueue;
|
||||
|
@ -112,7 +111,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
static final String KIND_HOST = getKind(HostResource.class);
|
||||
|
||||
private static final long LEASE_MINUTES = 20;
|
||||
private static final FormattingLogger logger = getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final int MAX_REDUCE_SHARDS = 50;
|
||||
private static final int DELETES_PER_SHARD = 5;
|
||||
|
||||
|
@ -149,8 +148,8 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
requestsToDelete.add(deletionRequest);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.severefmt(
|
||||
e, "Could not parse async deletion request, delaying task for a day: %s", task);
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Could not parse async deletion request, delaying task for a day: %s", task);
|
||||
// Grab the lease for a whole day, so that it won't continue throwing errors every five
|
||||
// minutes.
|
||||
queue.modifyTaskLease(task, 1L, DAYS);
|
||||
|
@ -159,10 +158,10 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
deleteStaleTasksWithRetry(requestsToDelete);
|
||||
ImmutableList<DeletionRequest> deletionRequests = builder.build();
|
||||
if (deletionRequests.isEmpty()) {
|
||||
logger.info("No asynchronous deletions to process because all were already handled.");
|
||||
logger.atInfo().log("No asynchronous deletions to process because all were already handled.");
|
||||
response.setPayload("All requested deletions of contacts/hosts have already occurred.");
|
||||
} else {
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"Processing asynchronous deletion of %d contacts and %d hosts: %s",
|
||||
kindCounts.count(KIND_CONTACT), kindCounts.count(KIND_HOST), resourceKeys.build());
|
||||
runMapreduce(deletionRequests);
|
||||
|
@ -204,7 +203,8 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
new NullInput<>(),
|
||||
EppResourceInputs.createEntityInput(DomainBase.class)))));
|
||||
} catch (Throwable t) {
|
||||
logger.severefmt(t, "Error while kicking off mapreduce to delete contacts/hosts");
|
||||
logger.atSevere().withCause(t).log(
|
||||
"Error while kicking off mapreduce to delete contacts/hosts");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
@Override
|
||||
public void reduce(final DeletionRequest deletionRequest, ReducerInput<Boolean> values) {
|
||||
final boolean hasNoActiveReferences = !Iterators.contains(values, true);
|
||||
logger.infofmt("Processing async deletion request for %s", deletionRequest.key());
|
||||
logger.atInfo().log("Processing async deletion request for %s", deletionRequest.key());
|
||||
DeletionResult result =
|
||||
ofy()
|
||||
.transactNew(
|
||||
|
@ -290,7 +290,7 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
deletionRequest.requestedTime());
|
||||
String resourceNamePlural = deletionRequest.key().getKind() + "s";
|
||||
getContext().incrementCounter(result.type().renderCounterText(resourceNamePlural));
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"Result of async deletion for resource %s: %s",
|
||||
deletionRequest.key(), result.pollMessageText());
|
||||
}
|
||||
|
@ -563,11 +563,12 @@ public class DeleteContactsAndHostsAction implements Runnable {
|
|||
static boolean doesResourceStateAllowDeletion(EppResource resource, DateTime now) {
|
||||
Key<EppResource> key = Key.create(resource);
|
||||
if (isDeleted(resource, now)) {
|
||||
logger.warningfmt("Cannot asynchronously delete %s because it is already deleted", key);
|
||||
logger.atWarning().log("Cannot asynchronously delete %s because it is already deleted", key);
|
||||
return false;
|
||||
}
|
||||
if (!resource.getStatusValues().contains(PENDING_DELETE)) {
|
||||
logger.warningfmt("Cannot asynchronously delete %s because it is not in PENDING_DELETE", key);
|
||||
logger.atWarning().log(
|
||||
"Cannot asynchronously delete %s because it is not in PENDING_DELETE", key);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -24,7 +24,7 @@ import static google.registry.request.Action.Method.POST;
|
|||
import com.google.appengine.tools.mapreduce.Mapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
|
@ -54,7 +54,7 @@ import javax.inject.Inject;
|
|||
@Action(path = "/_dr/task/deleteLoadTestData", method = POST, auth = Auth.AUTH_INTERNAL_ONLY)
|
||||
public class DeleteLoadTestDataAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
/**
|
||||
* The registrars for which to wipe out all contacts/hosts.
|
||||
|
@ -136,7 +136,7 @@ public class DeleteLoadTestDataAction implements Runnable {
|
|||
.addAll(resourceAndDependentKeys)
|
||||
.build();
|
||||
if (isDryRun) {
|
||||
logger.infofmt("Would hard-delete the following entities: %s", allKeys);
|
||||
logger.atInfo().log("Would hard-delete the following entities: %s", allKeys);
|
||||
} else {
|
||||
ofy().deleteWithoutBackup().keys(allKeys);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
|
@ -72,7 +72,7 @@ import org.joda.time.Duration;
|
|||
)
|
||||
public class DeleteProberDataAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@Inject @Parameter(PARAM_DRY_RUN) boolean isDryRun;
|
||||
/** List of TLDs to work on. If empty - will work on all TLDs that end with .test. */
|
||||
|
@ -161,7 +161,7 @@ public class DeleteProberDataAction implements Runnable {
|
|||
getContext().incrementCounter("skipped, non-prober data");
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
logger.severefmt(t, "Error while deleting prober data for key %s", key);
|
||||
logger.atSevere().withCause(t).log("Error while deleting prober data for key %s", key);
|
||||
getContext().incrementCounter(String.format("error, kind %s", key.getKind()));
|
||||
}
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public class DeleteProberDataAction implements Runnable {
|
|||
return;
|
||||
}
|
||||
if (!domain.getSubordinateHosts().isEmpty()) {
|
||||
logger.warningfmt(
|
||||
logger.atWarning().log(
|
||||
"Cannot delete domain %s (%s) because it has subordinate hosts.",
|
||||
domainName, domainKey);
|
||||
getContext().incrementCounter("skipped, had subordinate host(s)");
|
||||
|
@ -207,7 +207,8 @@ public class DeleteProberDataAction implements Runnable {
|
|||
// time the mapreduce is run.
|
||||
if (EppResourceUtils.isActive(domain, now)) {
|
||||
if (isDryRun) {
|
||||
logger.infofmt("Would soft-delete the active domain: %s (%s)", domainName, domainKey);
|
||||
logger.atInfo().log(
|
||||
"Would soft-delete the active domain: %s (%s)", domainName, domainKey);
|
||||
} else {
|
||||
softDeleteDomain(domain);
|
||||
}
|
||||
|
@ -225,22 +226,28 @@ public class DeleteProberDataAction implements Runnable {
|
|||
final Key<EppResourceIndex> eppIndex = Key.create(EppResourceIndex.create(domainKey));
|
||||
final Key<? extends ForeignKeyIndex<?>> fki = ForeignKeyIndex.createKey(domain);
|
||||
|
||||
int entitiesDeleted = ofy().transact(() -> {
|
||||
// This ancestor query selects all descendant HistoryEntries, BillingEvents, PollMessages,
|
||||
// and TLD-specific entities, as well as the domain itself.
|
||||
List<Key<Object>> domainAndDependentKeys = ofy().load().ancestor(domainKey).keys().list();
|
||||
ImmutableSet<Key<?>> allKeys = new ImmutableSet.Builder<Key<?>>()
|
||||
.add(fki)
|
||||
.add(eppIndex)
|
||||
.addAll(domainAndDependentKeys)
|
||||
.build();
|
||||
if (isDryRun) {
|
||||
logger.infofmt("Would hard-delete the following entities: %s", allKeys);
|
||||
} else {
|
||||
ofy().deleteWithoutBackup().keys(allKeys);
|
||||
}
|
||||
return allKeys.size();
|
||||
});
|
||||
int entitiesDeleted =
|
||||
ofy()
|
||||
.transact(
|
||||
() -> {
|
||||
// This ancestor query selects all descendant HistoryEntries, BillingEvents,
|
||||
// PollMessages,
|
||||
// and TLD-specific entities, as well as the domain itself.
|
||||
List<Key<Object>> domainAndDependentKeys =
|
||||
ofy().load().ancestor(domainKey).keys().list();
|
||||
ImmutableSet<Key<?>> allKeys =
|
||||
new ImmutableSet.Builder<Key<?>>()
|
||||
.add(fki)
|
||||
.add(eppIndex)
|
||||
.addAll(domainAndDependentKeys)
|
||||
.build();
|
||||
if (isDryRun) {
|
||||
logger.atInfo().log("Would hard-delete the following entities: %s", allKeys);
|
||||
} else {
|
||||
ofy().deleteWithoutBackup().keys(allKeys);
|
||||
}
|
||||
return allKeys.size();
|
||||
});
|
||||
getContext().incrementCounter("domains hard-deleted");
|
||||
getContext().incrementCounter("total entities hard-deleted", entitiesDeleted);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Range;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.mapreduce.inputs.NullInput;
|
||||
|
@ -81,7 +81,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
|
||||
public static final String PARAM_CURSOR_TIME = "cursorTime";
|
||||
private static final String ERROR_COUNTER = "errors";
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@Inject Clock clock;
|
||||
@Inject MapreduceRunner mrRunner;
|
||||
|
@ -99,10 +99,9 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
checkArgument(
|
||||
cursorTime.isBefore(executeTime),
|
||||
"Cursor time must be earlier than execution time.");
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"Running Recurring billing event expansion for billing time range [%s, %s).",
|
||||
cursorTime,
|
||||
executeTime);
|
||||
cursorTime, executeTime);
|
||||
response.sendJavaScriptRedirect(createJobPath(mrRunner
|
||||
.setJobName("Expand Recurring billing events into synthetic OneTime events.")
|
||||
.setModuleName("backend")
|
||||
|
@ -232,11 +231,12 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
return syntheticOneTimes.size();
|
||||
});
|
||||
} catch (Throwable t) {
|
||||
logger.severefmt(
|
||||
t, "Error while expanding Recurring billing events for %s", recurring.getId());
|
||||
getContext().incrementCounter("error: " + t.getClass().getSimpleName());
|
||||
getContext().incrementCounter(ERROR_COUNTER);
|
||||
throw t;
|
||||
throw new RuntimeException(
|
||||
String.format(
|
||||
"Error while expanding Recurring billing events for %d", recurring.getId()),
|
||||
t);
|
||||
}
|
||||
if (!isDryRun) {
|
||||
getContext().incrementCounter("Saved OneTime billing events", numBillingEventsSaved);
|
||||
|
@ -300,16 +300,15 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
@Override
|
||||
public void reduce(final DateTime cursorTime, final ReducerInput<DateTime> executionTimeInput) {
|
||||
if (getContext().getCounter(ERROR_COUNTER).getValue() > 0) {
|
||||
logger.severefmt("One or more errors logged during recurring event expansion. Cursor will"
|
||||
+ " not be advanced.");
|
||||
logger.atSevere().log(
|
||||
"One or more errors logged during recurring event expansion. Cursor will"
|
||||
+ " not be advanced.");
|
||||
return;
|
||||
}
|
||||
final DateTime executionTime = executionTimeInput.next();
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"Recurring event expansion %s complete for billing event range [%s, %s).",
|
||||
isDryRun ? "(dry run) " : "",
|
||||
cursorTime,
|
||||
executionTime);
|
||||
isDryRun ? "(dry run) " : "", cursorTime, executionTime);
|
||||
ofy()
|
||||
.transact(
|
||||
() -> {
|
||||
|
@ -317,7 +316,7 @@ public class ExpandRecurringBillingEventsAction implements Runnable {
|
|||
DateTime currentCursorTime =
|
||||
(cursor == null ? START_OF_TIME : cursor.getCursorTime());
|
||||
if (!currentCursorTime.equals(expectedPersistedCursorTime)) {
|
||||
logger.severefmt(
|
||||
logger.atSevere().log(
|
||||
"Current cursor position %s does not match expected cursor position %s.",
|
||||
currentCursorTime, expectedPersistedCursorTime);
|
||||
return;
|
||||
|
|
|
@ -19,7 +19,7 @@ import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
|
|||
|
||||
import com.google.appengine.api.datastore.DatastoreService;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.batch.MapreduceEntityCleanupUtil.EligibleJobResults;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.request.Action;
|
||||
|
@ -88,7 +88,7 @@ public class MapreduceEntityCleanupAction implements Runnable {
|
|||
private static final String ERROR_NON_POSITIVE_JOBS_TO_DELETE =
|
||||
"Do not specify a non-positive integer for the number of jobs to delete";
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final Optional<String> jobId;
|
||||
private final Optional<String> jobName;
|
||||
|
@ -133,7 +133,7 @@ public class MapreduceEntityCleanupAction implements Runnable {
|
|||
}
|
||||
|
||||
private void handleBadRequest(String message) {
|
||||
logger.severe(message);
|
||||
logger.atSevere().log(message);
|
||||
response.setPayload(message);
|
||||
response.setStatus(SC_BAD_REQUEST);
|
||||
}
|
||||
|
@ -198,12 +198,12 @@ public class MapreduceEntityCleanupAction implements Runnable {
|
|||
&& (!numJobsToDelete.isPresent() || (numJobsProcessed < numJobsToDelete.get())));
|
||||
|
||||
if (numJobsProcessed == 0) {
|
||||
logger.infofmt(
|
||||
"No eligible jobs found with name '%s' older than %s days old.",
|
||||
logger.atInfo().log(
|
||||
"No eligible jobs found with name '%s' older than %d days old.",
|
||||
jobName.orElse("(any)"), defaultedDaysOld);
|
||||
payload.append("No eligible jobs found");
|
||||
} else {
|
||||
logger.infofmt("A total of %s job(s) processed.", numJobsProcessed);
|
||||
logger.atInfo().log("A total of %d job(s) processed.", numJobsProcessed);
|
||||
payload.append(String.format("A total of %d job(s) processed", numJobsProcessed));
|
||||
}
|
||||
response.setPayload(payload.toString());
|
||||
|
@ -219,16 +219,15 @@ public class MapreduceEntityCleanupAction implements Runnable {
|
|||
if (error.isPresent()) {
|
||||
errorCount++;
|
||||
}
|
||||
logger.infofmt("%s: %s", actualJobId, error.orElse("deletion requested"));
|
||||
logger.atInfo().log("%s: %s", actualJobId, error.orElse("deletion requested"));
|
||||
payloadChunkBuilder.ifPresent(
|
||||
stringBuilder ->
|
||||
stringBuilder.append(
|
||||
String.format("%s: %s\n", actualJobId, error.orElse("deletion requested"))));
|
||||
}
|
||||
logger.infofmt(
|
||||
"successfully requested async deletion of %s job(s); errors received on %s",
|
||||
actualJobIds.size() - errorCount,
|
||||
errorCount);
|
||||
logger.atInfo().log(
|
||||
"successfully requested async deletion of %d job(s); errors received on %d",
|
||||
actualJobIds.size() - errorCount, errorCount);
|
||||
if (payloadChunkBuilder.isPresent()) {
|
||||
payloadChunkBuilder.get().append(String.format(
|
||||
"successfully requested async deletion of %d job(s); errors received on %d\n",
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.google.appengine.tools.mapreduce.ReducerInput;
|
|||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.dns.DnsQueue;
|
||||
import google.registry.flows.async.AsyncFlowMetrics;
|
||||
|
@ -72,7 +72,7 @@ import org.joda.time.DateTime;
|
|||
)
|
||||
public class RefreshDnsOnHostRenameAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final long LEASE_MINUTES = 20;
|
||||
|
||||
@Inject AsyncFlowMetrics asyncFlowMetrics;
|
||||
|
@ -108,8 +108,8 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
|
|||
requestsToDelete.add(request);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.severefmt(
|
||||
e, "Could not parse DNS refresh for host request, delaying task for a day: %s", task);
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Could not parse DNS refresh for host request, delaying task for a day: %s", task);
|
||||
// Grab the lease for a whole day, so it won't continue throwing errors every five minutes.
|
||||
pullQueue.modifyTaskLease(task, 1L, DAYS);
|
||||
}
|
||||
|
@ -119,11 +119,12 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
|
|||
requestsToDelete, pullQueue, asyncFlowMetrics, retrier, OperationResult.STALE);
|
||||
ImmutableList<DnsRefreshRequest> refreshRequests = requestsBuilder.build();
|
||||
if (refreshRequests.isEmpty()) {
|
||||
logger.info(
|
||||
logger.atInfo().log(
|
||||
"No asynchronous DNS refreshes to process because all renamed hosts are deleted.");
|
||||
response.setPayload("All requested DNS refreshes are on hosts that were since deleted.");
|
||||
} else {
|
||||
logger.infofmt("Processing asynchronous DNS refresh for renamed hosts: %s", hostKeys.build());
|
||||
logger.atInfo().log(
|
||||
"Processing asynchronous DNS refresh for renamed hosts: %s", hostKeys.build());
|
||||
runMapreduce(refreshRequests);
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +142,8 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
|
|||
ImmutableList.of(
|
||||
new NullInput<>(), createEntityInput(DomainResource.class)))));
|
||||
} catch (Throwable t) {
|
||||
logger.severefmt(t, "Error while kicking off mapreduce to refresh DNS for renamed hosts.");
|
||||
logger.atSevere().withCause(t).log(
|
||||
"Error while kicking off mapreduce to refresh DNS for renamed hosts.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,7 +182,7 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
|
|||
retrier.callWithRetry(
|
||||
() -> dnsQueue.addDomainRefreshTask(domain.getFullyQualifiedDomainName()),
|
||||
TransientFailureException.class);
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"Enqueued DNS refresh for domain %s referenced by host %s.",
|
||||
domain.getFullyQualifiedDomainName(), referencingHostKey);
|
||||
getContext().incrementCounter("domains refreshed");
|
||||
|
@ -278,7 +280,7 @@ public class RefreshDnsOnHostRenameAction implements Runnable {
|
|||
boolean isHostDeleted =
|
||||
isDeleted(host, latestOf(now, host.getUpdateAutoTimestamp().getTimestamp()));
|
||||
if (isHostDeleted) {
|
||||
logger.infofmt("Host %s is already deleted, not refreshing DNS.", hostKey);
|
||||
logger.atInfo().log("Host %s is already deleted, not refreshing DNS.", hostKey);
|
||||
}
|
||||
return new AutoValue_RefreshDnsOnHostRenameAction_DnsRefreshRequest.Builder()
|
||||
.setHostKey(hostKey)
|
||||
|
|
|
@ -17,7 +17,6 @@ package google.registry.batch;
|
|||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.logging.FormattingLogger.getLoggerForCallerClass;
|
||||
import static com.googlecode.objectify.Key.getKind;
|
||||
import static google.registry.model.EppResourceUtils.isActive;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
|
@ -38,7 +37,7 @@ import com.google.appengine.tools.mapreduce.inputs.DatastoreKeyInput;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.mapreduce.MapreduceRunner;
|
||||
import google.registry.mapreduce.inputs.EppResourceInputs;
|
||||
|
@ -95,7 +94,7 @@ import org.joda.time.DateTime;
|
|||
)
|
||||
public class VerifyEntityIntegrityAction implements Runnable {
|
||||
|
||||
private static final FormattingLogger logger = getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final int NUM_SHARDS = 200;
|
||||
@NonFinalForTesting
|
||||
@VisibleForTesting
|
||||
|
@ -220,7 +219,8 @@ public class VerifyEntityIntegrityAction implements Runnable {
|
|||
mapEntity(keyOrEntity);
|
||||
} catch (Throwable e) {
|
||||
// Log and swallow so that the mapreduce doesn't abort on first error.
|
||||
logger.severefmt(e, "Exception while checking integrity of entity: %s", keyOrEntity);
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Exception while checking integrity of entity: %s", keyOrEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,8 +413,8 @@ public class VerifyEntityIntegrityAction implements Runnable {
|
|||
reduceKeys(mapperKey, keys);
|
||||
} catch (Throwable e) {
|
||||
// Log and swallow so that the mapreduce doesn't abort on first error.
|
||||
logger.severefmt(
|
||||
e, "Exception while checking foreign key integrity constraints for: %s", mapperKey);
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Exception while checking foreign key integrity constraints for: %s", mapperKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue