From 73f28ec70de15eca7d5601913a6227a99cfb85de Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Tue, 2 Nov 2021 11:12:57 -0400 Subject: [PATCH] Fix InitSqlPipeline regarding synthesized history (#1404) * Fix InitSqlPipeline regarding synthesized history There are a few bad domains in Datastore that we hardcoded to ignore during SQL population. They didn't have history so we didn't try to filter when writing history. Recently we created synthesized history for domains, including the bad domains. Now we need to filter History entries. --- .../java/google/registry/beam/initsql/Transforms.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/google/registry/beam/initsql/Transforms.java b/core/src/main/java/google/registry/beam/initsql/Transforms.java index 0de9103f8..0c502b0a9 100644 --- a/core/src/main/java/google/registry/beam/initsql/Transforms.java +++ b/core/src/main/java/google/registry/beam/initsql/Transforms.java @@ -262,8 +262,8 @@ public final class Transforms { // Production data repair configs go below. See b/185954992. - // Prober domains in bad state, without associated contacts, hosts, billings, and history. - // They can be safely ignored. + // Prober domains in bad state, without associated contacts, hosts, billings, and non-synthesized + // history. They can be safely ignored. private static final ImmutableSet IGNORED_DOMAINS = ImmutableSet.of("6AF6D2-IQCANT", "2-IQANYT"); @@ -299,7 +299,7 @@ public final class Transforms { return !IGNORED_HOSTS.contains(roid); } if (entity.getKind().equals("HistoryEntry")) { - // Remove production bad data: History of the contacts to be ignored: + // Remove production bad data: Histories of ignored EPP resources: com.google.appengine.api.datastore.Key parentKey = entity.getKey().getParent(); if (parentKey.getKind().equals("ContactResource")) { String contactRoid = parentKey.getName(); @@ -309,6 +309,10 @@ public final class Transforms { String hostRoid = parentKey.getName(); return !IGNORED_HOSTS.contains(hostRoid); } + if (parentKey.getKind().equals("DomainBase")) { + String domainRoid = parentKey.getName(); + return !IGNORED_DOMAINS.contains(domainRoid); + } } // End of production-specific checks.