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.
This commit is contained in:
Weimin Yu 2021-11-02 11:12:57 -04:00 committed by GitHub
parent e761e67434
commit 73f28ec70d

View file

@ -262,8 +262,8 @@ public final class Transforms {
// Production data repair configs go below. See b/185954992. // Production data repair configs go below. See b/185954992.
// Prober domains in bad state, without associated contacts, hosts, billings, and history. // Prober domains in bad state, without associated contacts, hosts, billings, and non-synthesized
// They can be safely ignored. // history. They can be safely ignored.
private static final ImmutableSet<String> IGNORED_DOMAINS = private static final ImmutableSet<String> IGNORED_DOMAINS =
ImmutableSet.of("6AF6D2-IQCANT", "2-IQANYT"); ImmutableSet.of("6AF6D2-IQCANT", "2-IQANYT");
@ -299,7 +299,7 @@ public final class Transforms {
return !IGNORED_HOSTS.contains(roid); return !IGNORED_HOSTS.contains(roid);
} }
if (entity.getKind().equals("HistoryEntry")) { 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(); com.google.appengine.api.datastore.Key parentKey = entity.getKey().getParent();
if (parentKey.getKind().equals("ContactResource")) { if (parentKey.getKind().equals("ContactResource")) {
String contactRoid = parentKey.getName(); String contactRoid = parentKey.getName();
@ -309,6 +309,10 @@ public final class Transforms {
String hostRoid = parentKey.getName(); String hostRoid = parentKey.getName();
return !IGNORED_HOSTS.contains(hostRoid); return !IGNORED_HOSTS.contains(hostRoid);
} }
if (parentKey.getKind().equals("DomainBase")) {
String domainRoid = parentKey.getName();
return !IGNORED_DOMAINS.contains(domainRoid);
}
} }
// End of production-specific checks. // End of production-specific checks.