Add missing foreign key constraints (#845)

* Add missing foreign key constraints

* Fix failed unit tests
This commit is contained in:
Shicong Huang 2020-11-09 10:55:29 -05:00 committed by GitHub
parent 9f5be6d2a3
commit 346306af02
16 changed files with 6756 additions and 4864 deletions

View file

@ -92,9 +92,8 @@ public class InitSqlPipeline implements Serializable {
* Datastore kinds to be written to the SQL database before the cleansed version of {@link * Datastore kinds to be written to the SQL database before the cleansed version of {@link
* DomainBase}. * DomainBase}.
*/ */
// TODO(weiminyu): include Registry.class when it is modeled in JPA.
private static final ImmutableList<Class<?>> PHASE_ONE_ORDERED = private static final ImmutableList<Class<?>> PHASE_ONE_ORDERED =
ImmutableList.of(Registrar.class, ContactResource.class); ImmutableList.of(Registry.class, Registrar.class, ContactResource.class);
/** /**
* Datastore kinds to be written to the SQL database after the cleansed version of {@link * Datastore kinds to be written to the SQL database after the cleansed version of {@link

View file

@ -121,13 +121,11 @@ public abstract class BillingEvent extends ImmutableObject
String clientId; String clientId;
/** Revision id of the entry in DomainHistory table that ths bill belongs to. */ /** Revision id of the entry in DomainHistory table that ths bill belongs to. */
// TODO(shicong): Add foreign key constraint when DomainHistory table is generated
@Ignore @Ignore
@Column(nullable = false) @Column(nullable = false)
Long domainHistoryRevisionId; Long domainHistoryRevisionId;
/** ID of the EPP resource that the bill is for. */ /** ID of the EPP resource that the bill is for. */
// TODO(shicong): Add foreign key constraint when we expand DatastoreHelp for Postgresql
@Ignore @Ignore
@Column(nullable = false) @Column(nullable = false)
String domainRepoId; String domainRepoId;
@ -291,7 +289,7 @@ public abstract class BillingEvent extends ImmutableObject
@javax.persistence.Index(columnList = "eventTime"), @javax.persistence.Index(columnList = "eventTime"),
@javax.persistence.Index(columnList = "billingTime"), @javax.persistence.Index(columnList = "billingTime"),
@javax.persistence.Index(columnList = "syntheticCreationTime"), @javax.persistence.Index(columnList = "syntheticCreationTime"),
@javax.persistence.Index(columnList = "allocation_token_id") @javax.persistence.Index(columnList = "allocationToken")
}) })
@AttributeOverride(name = "id", column = @Column(name = "billing_event_id")) @AttributeOverride(name = "id", column = @Column(name = "billing_event_id"))
@WithLongVKey @WithLongVKey
@ -334,10 +332,7 @@ public abstract class BillingEvent extends ImmutableObject
/** /**
* The {@link AllocationToken} used in the creation of this event, or null if one was not used. * The {@link AllocationToken} used in the creation of this event, or null if one was not used.
*
* <p>TODO(shicong): Add foreign key constraint when AllocationToken schema is generated
*/ */
@Column(name = "allocation_token_id")
@Index @Index
@Nullable @Nullable
VKey<AllocationToken> allocationToken; VKey<AllocationToken> allocationToken;

View file

@ -217,7 +217,7 @@ class InitSqlPipelineTest {
GracePeriodStatus.ADD, GracePeriodStatus.ADD,
"4-COM", "4-COM",
fakeClock.nowUtc().plusDays(1), fakeClock.nowUtc().plusDays(1),
"registrar", "TheRegistrar",
null)) null))
.build()); .build());
exportDir = store.export(exportRootDir.getAbsolutePath(), ALL_KINDS, ImmutableSet.of()); exportDir = store.export(exportRootDir.getAbsolutePath(), ALL_KINDS, ImmutableSet.of());

View file

@ -17,6 +17,7 @@ package google.registry.model.domain;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects; import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects;
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.SqlHelper.assertThrowForeignKeyViolation; import static google.registry.testing.SqlHelper.assertThrowForeignKeyViolation;
import static google.registry.testing.SqlHelper.saveRegistrar; import static google.registry.testing.SqlHelper.saveRegistrar;
import static google.registry.util.DateTimeUtils.END_OF_TIME; import static google.registry.util.DateTimeUtils.END_OF_TIME;
@ -45,30 +46,29 @@ import google.registry.model.reporting.HistoryEntry;
import google.registry.model.transfer.ContactTransferData; import google.registry.model.transfer.ContactTransferData;
import google.registry.model.transfer.DomainTransferData; import google.registry.model.transfer.DomainTransferData;
import google.registry.persistence.VKey; import google.registry.persistence.VKey;
import google.registry.persistence.transaction.JpaTestRules; import google.registry.testing.AppEngineExtension;
import google.registry.persistence.transaction.JpaTestRules.JpaIntegrationWithCoverageExtension; import google.registry.testing.DualDatabaseTest;
import google.registry.testing.DatastoreEntityExtension;
import google.registry.testing.FakeClock; import google.registry.testing.FakeClock;
import google.registry.testing.TestSqlOnly;
import java.util.Arrays; import java.util.Arrays;
import org.joda.money.Money; import org.joda.money.Money;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.RegisterExtension;
/** Verify that we can store/retrieve DomainBase objects from a SQL database. */ /** Verify that we can store/retrieve DomainBase objects from a SQL database. */
@DualDatabaseTest
public class DomainBaseSqlTest { public class DomainBaseSqlTest {
protected FakeClock fakeClock = new FakeClock(DateTime.now(UTC)); protected FakeClock fakeClock = new FakeClock(DateTime.now(UTC));
@RegisterExtension @RegisterExtension
@Order(value = 1) public final AppEngineExtension appEngine =
DatastoreEntityExtension datastoreEntityExtension = new DatastoreEntityExtension(); AppEngineExtension.builder()
.withDatastoreAndCloudSql()
@RegisterExtension .enableJpaEntityCoverageCheck(true)
JpaIntegrationWithCoverageExtension jpa = .withClock(fakeClock)
new JpaTestRules.Builder().withClock(fakeClock).buildIntegrationWithCoverageExtension(); .build();
private DomainBase domain; private DomainBase domain;
private DomainHistory historyEntry; private DomainHistory historyEntry;
@ -132,7 +132,7 @@ public class DomainBaseSqlTest {
contact2 = makeContact("contact_id2"); contact2 = makeContact("contact_id2");
} }
@Test @TestSqlOnly
void testDomainBasePersistence() { void testDomainBasePersistence() {
persistDomain(); persistDomain();
@ -144,7 +144,7 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testHostForeignKeyConstraints() { void testHostForeignKeyConstraints() {
assertThrowForeignKeyViolation( assertThrowForeignKeyViolation(
() -> () ->
@ -158,7 +158,7 @@ public class DomainBaseSqlTest {
})); }));
} }
@Test @TestSqlOnly
void testContactForeignKeyConstraints() { void testContactForeignKeyConstraints() {
assertThrowForeignKeyViolation( assertThrowForeignKeyViolation(
() -> () ->
@ -171,7 +171,7 @@ public class DomainBaseSqlTest {
})); }));
} }
@Test @TestSqlOnly
void testResaveDomain_succeeds() { void testResaveDomain_succeeds() {
persistDomain(); persistDomain();
jpaTm() jpaTm()
@ -189,7 +189,7 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testModifyGracePeriod_setEmptyCollectionSuccessfully() { void testModifyGracePeriod_setEmptyCollectionSuccessfully() {
persistDomain(); persistDomain();
jpaTm() jpaTm()
@ -209,7 +209,7 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testModifyGracePeriod_setNullCollectionSuccessfully() { void testModifyGracePeriod_setNullCollectionSuccessfully() {
persistDomain(); persistDomain();
jpaTm() jpaTm()
@ -228,7 +228,7 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testModifyGracePeriod_addThenRemoveSuccessfully() { void testModifyGracePeriod_addThenRemoveSuccessfully() {
persistDomain(); persistDomain();
jpaTm() jpaTm()
@ -305,7 +305,7 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testModifyGracePeriod_removeThenAddSuccessfully() { void testModifyGracePeriod_removeThenAddSuccessfully() {
persistDomain(); persistDomain();
jpaTm() jpaTm()
@ -347,7 +347,7 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testModifyDsData_addThenRemoveSuccessfully() { void testModifyDsData_addThenRemoveSuccessfully() {
persistDomain(); persistDomain();
DelegationSignerData extraDsData = DelegationSignerData extraDsData =
@ -391,8 +391,9 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void testUpdates() { void testUpdates() {
createTld("com");
jpaTm() jpaTm()
.transact( .transact(
() -> { () -> {
@ -423,6 +424,7 @@ public class DomainBaseSqlTest {
} }
private void persistDomain() { private void persistDomain() {
createTld("com");
jpaTm() jpaTm()
.transact( .transact(
() -> { () -> {
@ -442,8 +444,9 @@ public class DomainBaseSqlTest {
}); });
} }
@Test @TestSqlOnly
void persistDomainWithCompositeVKeys() { void persistDomainWithCompositeVKeys() {
createTld("com");
jpaTm() jpaTm()
.transact( .transact(
() -> { () -> {
@ -572,8 +575,9 @@ public class DomainBaseSqlTest {
assertThat(persisted.getGracePeriods()).isEqualTo(gracePeriods); assertThat(persisted.getGracePeriods()).isEqualTo(gracePeriods);
} }
@Test @TestSqlOnly
void persistDomainWithLegacyVKeys() { void persistDomainWithLegacyVKeys() {
createTld("com");
jpaTm() jpaTm()
.transact( .transact(
() -> { () -> {

View file

@ -20,10 +20,10 @@ import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableO
import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence; import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence;
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newContactResourceWithRoid; import static google.registry.testing.DatastoreHelper.newContactResourceWithRoid;
import static google.registry.testing.DatastoreHelper.newDomainBase; import static google.registry.testing.DatastoreHelper.newDomainBase;
import static google.registry.testing.DatastoreHelper.newHostResourceWithRoid; import static google.registry.testing.DatastoreHelper.newHostResourceWithRoid;
import static google.registry.testing.SqlHelper.saveRegistrar;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -41,22 +41,19 @@ import google.registry.model.reporting.DomainTransactionRecord;
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField; import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.persistence.VKey; import google.registry.persistence.VKey;
import org.junit.jupiter.api.BeforeEach; import google.registry.testing.DualDatabaseTest;
import org.junit.jupiter.api.Test; import google.registry.testing.TestOfyOnly;
import google.registry.testing.TestSqlOnly;
/** Tests for {@link DomainHistory}. */ /** Tests for {@link DomainHistory}. */
@DualDatabaseTest
public class DomainHistoryTest extends EntityTestCase { public class DomainHistoryTest extends EntityTestCase {
DomainHistoryTest() { DomainHistoryTest() {
super(JpaEntityCoverageCheck.ENABLED); super(JpaEntityCoverageCheck.ENABLED);
} }
@BeforeEach @TestSqlOnly
void beforeEach() {
saveRegistrar("TheRegistrar");
}
@Test
void testPersistence() { void testPersistence() {
DomainBase domain = createDomainWithContactsAndHosts(); DomainBase domain = createDomainWithContactsAndHosts();
DomainHistory domainHistory = createDomainHistory(domain); DomainHistory domainHistory = createDomainHistory(domain);
@ -71,7 +68,7 @@ public class DomainHistoryTest extends EntityTestCase {
}); });
} }
@Test @TestSqlOnly
void testLegacyPersistence_nullResource() { void testLegacyPersistence_nullResource() {
DomainBase domain = createDomainWithContactsAndHosts(); DomainBase domain = createDomainWithContactsAndHosts();
DomainHistory domainHistory = DomainHistory domainHistory =
@ -92,7 +89,7 @@ public class DomainHistoryTest extends EntityTestCase {
}); });
} }
@Test @TestOfyOnly
void testOfyPersistence() { void testOfyPersistence() {
HostResource host = newHostResourceWithRoid("ns1.example.com", "host1"); HostResource host = newHostResourceWithRoid("ns1.example.com", "host1");
ContactResource contact = newContactResourceWithRoid("contactId", "contact1"); ContactResource contact = newContactResourceWithRoid("contactId", "contact1");
@ -128,6 +125,7 @@ public class DomainHistoryTest extends EntityTestCase {
} }
static DomainBase createDomainWithContactsAndHosts() { static DomainBase createDomainWithContactsAndHosts() {
createTld("tld");
HostResource host = newHostResourceWithRoid("ns1.example.com", "host1"); HostResource host = newHostResourceWithRoid("ns1.example.com", "host1");
ContactResource contact = newContactResourceWithRoid("contactId", "contact1"); ContactResource contact = newContactResourceWithRoid("contactId", "contact1");

View file

@ -17,10 +17,10 @@ package google.registry.model.history;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects; import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects;
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm; import static google.registry.persistence.transaction.TransactionManagerFactory.ofyTm;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newContactResourceWithRoid; import static google.registry.testing.DatastoreHelper.newContactResourceWithRoid;
import static google.registry.testing.DatastoreHelper.newHostResourceWithRoid; import static google.registry.testing.DatastoreHelper.newHostResourceWithRoid;
import static google.registry.testing.SqlHelper.saveRegistrar;
import static google.registry.util.CollectionUtils.nullToEmpty; import static google.registry.util.CollectionUtils.nullToEmpty;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
@ -40,34 +40,32 @@ import google.registry.model.reporting.DomainTransactionRecord;
import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField; import google.registry.model.reporting.DomainTransactionRecord.TransactionReportField;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.persistence.VKey; import google.registry.persistence.VKey;
import org.junit.jupiter.api.BeforeEach; import google.registry.testing.DualDatabaseTest;
import org.junit.jupiter.api.Test; import google.registry.testing.TestSqlOnly;
/** Tests to check {@link HistoryEntry} + its subclasses' transitions to/from Datastore/SQL. */ /** Tests to check {@link HistoryEntry} + its subclasses' transitions to/from Datastore/SQL. */
@DualDatabaseTest
public class LegacyHistoryObjectTest extends EntityTestCase { public class LegacyHistoryObjectTest extends EntityTestCase {
public LegacyHistoryObjectTest() { public LegacyHistoryObjectTest() {
super(JpaEntityCoverageCheck.ENABLED); super(JpaEntityCoverageCheck.ENABLED);
} }
@BeforeEach @TestSqlOnly
void beforeEach() {
saveRegistrar("TheRegistrar");
}
@Test
void testFullConversion_contact() { void testFullConversion_contact() {
// Create+save an old contact HistoryEntry, reload it, and verify it's a proper ContactHistory // Create+save an old contact HistoryEntry, reload it, and verify it's a proper ContactHistory
ContactResource contact = newContactResourceWithRoid("contactId", "contact1"); ContactResource contact = newContactResourceWithRoid("contactId", "contact1");
HistoryEntry legacyHistoryEntry = historyEntryBuilderFor(contact).build(); HistoryEntry legacyHistoryEntry = historyEntryBuilderFor(contact).build();
tm().transact(() -> tm().insert(legacyHistoryEntry)); ofyTm().transact(() -> ofyTm().insert(legacyHistoryEntry));
// In Datastore, we will save it as HistoryEntry but retrieve it as ContactHistory // In Datastore, we will save it as HistoryEntry but retrieve it as ContactHistory
long historyEntryId = legacyHistoryEntry.getId(); long historyEntryId = legacyHistoryEntry.getId();
HistoryEntry fromObjectify = HistoryEntry fromObjectify =
tm().transact( ofyTm()
.transact(
() -> () ->
tm().load( ofyTm()
.load(
VKey.create( VKey.create(
HistoryEntry.class, HistoryEntry.class,
historyEntryId, historyEntryId,
@ -96,19 +94,22 @@ public class LegacyHistoryObjectTest extends EntityTestCase {
.isEqualTo(legacyHistoryFromSql.getParentVKey().getSqlKey()); .isEqualTo(legacyHistoryFromSql.getParentVKey().getSqlKey());
} }
@Test @TestSqlOnly
void testFullConversion_domain() { void testFullConversion_domain() {
createTld("foobar");
// Create+save an old domain HistoryEntry, reload it, and verify it's a proper DomainHistory // Create+save an old domain HistoryEntry, reload it, and verify it's a proper DomainHistory
DomainBase domain = DomainHistoryTest.createDomainWithContactsAndHosts(); DomainBase domain = DomainHistoryTest.createDomainWithContactsAndHosts();
HistoryEntry legacyHistoryEntry = historyEntryForDomain(domain); HistoryEntry legacyHistoryEntry = historyEntryForDomain(domain);
tm().transact(() -> tm().insert(legacyHistoryEntry)); ofyTm().transact(() -> ofyTm().insert(legacyHistoryEntry));
// In Datastore, we will save it as HistoryEntry but retrieve it as DomainHistory // In Datastore, we will save it as HistoryEntry but retrieve it as DomainHistory
long historyEntryId = legacyHistoryEntry.getId(); long historyEntryId = legacyHistoryEntry.getId();
HistoryEntry fromObjectify = HistoryEntry fromObjectify =
tm().transact( ofyTm()
.transact(
() -> () ->
tm().load( ofyTm()
.load(
VKey.create( VKey.create(
HistoryEntry.class, HistoryEntry.class,
historyEntryId, historyEntryId,
@ -140,19 +141,21 @@ public class LegacyHistoryObjectTest extends EntityTestCase {
.isEqualTo(nullToEmpty(legacyHistoryFromSql.getNsHosts())); .isEqualTo(nullToEmpty(legacyHistoryFromSql.getNsHosts()));
} }
@Test @TestSqlOnly
void testFullConversion_host() { void testFullConversion_host() {
// Create+save an old host HistoryEntry, reload it, and verify it's a proper HostHistory // Create+save an old host HistoryEntry, reload it, and verify it's a proper HostHistory
HostResource host = newHostResourceWithRoid("hs1.example.com", "host1"); HostResource host = newHostResourceWithRoid("hs1.example.com", "host1");
HistoryEntry legacyHistoryEntry = historyEntryBuilderFor(host).build(); HistoryEntry legacyHistoryEntry = historyEntryBuilderFor(host).build();
tm().transact(() -> tm().insert(legacyHistoryEntry)); ofyTm().transact(() -> ofyTm().insert(legacyHistoryEntry));
// In Datastore, we will save it as HistoryEntry but retrieve it as HostHistory // In Datastore, we will save it as HistoryEntry but retrieve it as HostHistory
long historyEntryId = legacyHistoryEntry.getId(); long historyEntryId = legacyHistoryEntry.getId();
HistoryEntry fromObjectify = HistoryEntry fromObjectify =
tm().transact( ofyTm()
.transact(
() -> () ->
tm().load( ofyTm()
.load(
VKey.create( VKey.create(
HistoryEntry.class, HistoryEntry.class,
historyEntryId, historyEntryId,

View file

@ -15,13 +15,12 @@
package google.registry.model.poll; package google.registry.model.poll;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
import static google.registry.testing.DatastoreHelper.createTld; import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainBase; import static google.registry.testing.DatastoreHelper.newDomainBase;
import static google.registry.testing.DatastoreHelper.persistActiveContact; import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistResource; import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.SqlHelper.saveRegistrar;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
@ -31,10 +30,14 @@ import google.registry.model.domain.Period;
import google.registry.model.eppcommon.Trid; import google.registry.model.eppcommon.Trid;
import google.registry.model.reporting.HistoryEntry; import google.registry.model.reporting.HistoryEntry;
import google.registry.persistence.VKey; import google.registry.persistence.VKey;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.TestOfyAndSql;
import google.registry.testing.TestOfyOnly;
import google.registry.testing.TestSqlOnly;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link PollMessage}. */ /** Unit tests for {@link PollMessage}. */
@DualDatabaseTest
public class PollMessageTest extends EntityTestCase { public class PollMessageTest extends EntityTestCase {
private DomainBase domain; private DomainBase domain;
@ -64,7 +67,8 @@ public class PollMessageTest extends EntityTestCase {
.setBySuperuser(false) .setBySuperuser(false)
.setReason("reason") .setReason("reason")
.setRequestedByRegistrar(false) .setRequestedByRegistrar(false)
.build()); .build()
.toChildHistoryEntity());
oneTime = oneTime =
new PollMessage.OneTime.Builder() new PollMessage.OneTime.Builder()
.setId(100L) .setId(100L)
@ -83,35 +87,9 @@ public class PollMessageTest extends EntityTestCase {
.setAutorenewEndTime(fakeClock.nowUtc().plusDays(365)) .setAutorenewEndTime(fakeClock.nowUtc().plusDays(365))
.setTargetId("foobar.foo") .setTargetId("foobar.foo")
.build(); .build();
jpaTm()
.transact(
() -> {
saveRegistrar("TheRegistrar");
jpaTm().insert(contact);
jpaTm().insert(domain);
jpaTm().insert(historyEntry.toChildHistoryEntity());
});
} }
@Test @TestSqlOnly
void testCloudSqlPersistenceOneTime() {
jpaTm().transact(() -> jpaTm().insert(oneTime));
PollMessage.OneTime persisted =
jpaTm().transact(() -> jpaTm().load(VKey.createSql(PollMessage.OneTime.class, oneTime.id)));
assertThat(persisted).isEqualTo(oneTime);
}
@Test
void testCloudSqlPersistenceAutorenew() {
jpaTm().transact(() -> jpaTm().insert(autoRenew));
PollMessage.Autorenew persisted =
jpaTm()
.transact(
() -> jpaTm().load(VKey.createSql(PollMessage.Autorenew.class, autoRenew.id)));
assertThat(persisted).isEqualTo(autoRenew);
}
@Test
void testCloudSqlSupportForPolymorphicVKey() { void testCloudSqlSupportForPolymorphicVKey() {
jpaTm().transact(() -> jpaTm().insert(oneTime)); jpaTm().transact(() -> jpaTm().insert(oneTime));
PollMessage persistedOneTime = PollMessage persistedOneTime =
@ -126,7 +104,7 @@ public class PollMessageTest extends EntityTestCase {
assertThat(persistedAutoRenew).isEqualTo(autoRenew); assertThat(persistedAutoRenew).isEqualTo(autoRenew);
} }
@Test @TestOfyAndSql
void testPersistenceOneTime() { void testPersistenceOneTime() {
PollMessage.OneTime pollMessage = PollMessage.OneTime pollMessage =
persistResource( persistResource(
@ -136,10 +114,10 @@ public class PollMessageTest extends EntityTestCase {
.setMsg("Test poll message") .setMsg("Test poll message")
.setParent(historyEntry) .setParent(historyEntry)
.build()); .build());
assertThat(ofy().load().entity(pollMessage).now()).isEqualTo(pollMessage); assertThat(tm().transact(() -> tm().load(pollMessage))).isEqualTo(pollMessage);
} }
@Test @TestOfyAndSql
void testPersistenceAutorenew() { void testPersistenceAutorenew() {
PollMessage.Autorenew pollMessage = PollMessage.Autorenew pollMessage =
persistResource( persistResource(
@ -151,10 +129,10 @@ public class PollMessageTest extends EntityTestCase {
.setAutorenewEndTime(fakeClock.nowUtc().plusDays(365)) .setAutorenewEndTime(fakeClock.nowUtc().plusDays(365))
.setTargetId("foobar.foo") .setTargetId("foobar.foo")
.build()); .build());
assertThat(ofy().load().entity(pollMessage).now()).isEqualTo(pollMessage); assertThat(tm().transact(() -> tm().load(pollMessage))).isEqualTo(pollMessage);
} }
@Test @TestOfyOnly
void testIndexingAutorenew() throws Exception { void testIndexingAutorenew() throws Exception {
PollMessage.Autorenew pollMessage = PollMessage.Autorenew pollMessage =
persistResource( persistResource(

View file

@ -17,23 +17,42 @@ package google.registry.model.reporting;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence; import static google.registry.model.ImmutableObjectSubject.immutableObjectCorrespondence;
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm; import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
import static google.registry.testing.DatastoreHelper.createTlds;
import static google.registry.testing.DatastoreHelper.newDomainBase;
import static google.registry.testing.DatastoreHelper.persistActiveContact;
import static google.registry.testing.DatastoreHelper.persistResource;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import google.registry.model.EntityTestCase; import google.registry.model.EntityTestCase;
import google.registry.model.contact.ContactResource;
import google.registry.model.domain.DomainBase;
import google.registry.model.reporting.Spec11ThreatMatch.ThreatType; import google.registry.model.reporting.Spec11ThreatMatch.ThreatType;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.TestSqlOnly;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link Spec11ThreatMatchDao}. */ /** Unit tests for {@link Spec11ThreatMatchDao}. */
@DualDatabaseTest
public class Spec11ThreatMatchDaoTest extends EntityTestCase { public class Spec11ThreatMatchDaoTest extends EntityTestCase {
private static final LocalDate TODAY = new LocalDate(2020, 8, 4); private static final LocalDate TODAY = new LocalDate(2020, 8, 4);
private static final LocalDate YESTERDAY = new LocalDate(2020, 8, 3); private static final LocalDate YESTERDAY = new LocalDate(2020, 8, 3);
private DomainBase todayComDomain;
private DomainBase todayOrgDomain;
private DomainBase yesterdayComDomain;
private DomainBase yesterdayOrgDomain;
@BeforeEach @BeforeEach
void setUp() { void setUp() {
createTlds("com", "org");
ContactResource contact = persistActiveContact("jd1234");
todayComDomain = persistResource(newDomainBase("today.com", contact));
todayOrgDomain = persistResource(newDomainBase("today.org", contact));
yesterdayComDomain = persistResource(newDomainBase("yesterday.com", contact));
yesterdayOrgDomain = persistResource(newDomainBase("yesterday.org", contact));
jpaTm() jpaTm()
.transact( .transact(
() -> { () -> {
@ -42,7 +61,7 @@ public class Spec11ThreatMatchDaoTest extends EntityTestCase {
}); });
} }
@Test @TestSqlOnly
void testDeleteEntriesByDate() { void testDeleteEntriesByDate() {
// Verify that all entries with the date TODAY were removed // Verify that all entries with the date TODAY were removed
jpaTm() jpaTm()
@ -66,7 +85,7 @@ public class Spec11ThreatMatchDaoTest extends EntityTestCase {
}); });
} }
@Test @TestSqlOnly
void testLoadEntriesByDate() { void testLoadEntriesByDate() {
jpaTm() jpaTm()
.transact( .transact(
@ -82,23 +101,25 @@ public class Spec11ThreatMatchDaoTest extends EntityTestCase {
private ImmutableList<Spec11ThreatMatch> getThreatMatchesYesterday() { private ImmutableList<Spec11ThreatMatch> getThreatMatchesYesterday() {
return ImmutableList.of( return ImmutableList.of(
createThreatMatch("yesterday.com", YESTERDAY), createThreatMatch("yesterday.com", yesterdayComDomain.getRepoId(), YESTERDAY),
createThreatMatch("yesterday.org", YESTERDAY)); createThreatMatch("yesterday.org", yesterdayOrgDomain.getRepoId(), YESTERDAY));
} }
private ImmutableList<Spec11ThreatMatch> getThreatMatchesToday() { private ImmutableList<Spec11ThreatMatch> getThreatMatchesToday() {
return ImmutableList.of( return ImmutableList.of(
createThreatMatch("today.com", TODAY), createThreatMatch("today.org", TODAY)); createThreatMatch("today.com", todayComDomain.getRepoId(), TODAY),
createThreatMatch("today.org", todayOrgDomain.getRepoId(), TODAY));
} }
private Spec11ThreatMatch createThreatMatch(String domainName, LocalDate date) { private Spec11ThreatMatch createThreatMatch(
String domainName, String domainRepoId, LocalDate date) {
return new Spec11ThreatMatch() return new Spec11ThreatMatch()
.asBuilder() .asBuilder()
.setThreatTypes(ImmutableSet.of(ThreatType.MALWARE)) .setThreatTypes(ImmutableSet.of(ThreatType.MALWARE))
.setCheckDate(date) .setCheckDate(date)
.setDomainName(domainName) .setDomainName(domainName)
.setRegistrarId("Example Registrar") .setRegistrarId("TheRegistrar")
.setDomainRepoId("1-COM") .setDomainRepoId(domainRepoId)
.build(); .build();
} }
} }

View file

@ -30,13 +30,16 @@ import google.registry.model.domain.DomainBase;
import google.registry.model.host.HostResource; import google.registry.model.host.HostResource;
import google.registry.model.transfer.ContactTransferData; import google.registry.model.transfer.ContactTransferData;
import google.registry.persistence.VKey; import google.registry.persistence.VKey;
import google.registry.testing.DualDatabaseTest;
import google.registry.testing.TestOfyAndSql;
import google.registry.testing.TestSqlOnly;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.joda.time.format.ISODateTimeFormat; import org.joda.time.format.ISODateTimeFormat;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/** Unit tests for {@link Spec11ThreatMatch}. */ /** Unit tests for {@link Spec11ThreatMatch}. */
@DualDatabaseTest
public class Spec11ThreatMatchTest extends EntityTestCase { public class Spec11ThreatMatchTest extends EntityTestCase {
private static final String REGISTRAR_ID = "registrar"; private static final String REGISTRAR_ID = "registrar";
@ -100,8 +103,9 @@ public class Spec11ThreatMatchTest extends EntityTestCase {
.build(); .build();
} }
@Test @TestSqlOnly
void testPersistence() { void testPersistence() {
createTld("tld");
saveRegistrar(REGISTRAR_ID); saveRegistrar(REGISTRAR_ID);
jpaTm() jpaTm()
@ -121,7 +125,7 @@ public class Spec11ThreatMatchTest extends EntityTestCase {
assertThat(threat).isEqualTo(persistedThreat); assertThat(threat).isEqualTo(persistedThreat);
} }
@Test @TestSqlOnly
@Disabled("We can't rely on foreign keys until we've migrated to SQL") @Disabled("We can't rely on foreign keys until we've migrated to SQL")
void testThreatForeignKeyConstraints() { void testThreatForeignKeyConstraints() {
assertThrowForeignKeyViolation( assertThrowForeignKeyViolation(
@ -152,7 +156,7 @@ public class Spec11ThreatMatchTest extends EntityTestCase {
}); });
} }
@Test @TestOfyAndSql
void testFailure_threatsWithInvalidFields() { void testFailure_threatsWithInvalidFields() {
assertThrows( assertThrows(
IllegalArgumentException.class, () -> threat.asBuilder().setRegistrarId(null).build()); IllegalArgumentException.class, () -> threat.asBuilder().setRegistrarId(null).build());

View file

@ -210,77 +210,77 @@ digraph {
78 -> 79 [style=solid label=""] 78 -> 79 [style=solid label=""]
} }
subgraph cluster_80 { subgraph cluster_80 {
label = "Write to sql: Transforms:Registrar" label = "Write to sql: Transforms:Registry"
subgraph cluster_81 { subgraph cluster_81 {
label = "Write to sql: Transforms:Registrar/Shard data for Transforms:Registrar" label = "Write to sql: Transforms:Registry/Shard data for Transforms:Registry"
subgraph cluster_82 { subgraph cluster_82 {
label = "Write to sql: Transforms:Registrar/Shard data for Transforms:Registrar/Map" label = "Write to sql: Transforms:Registry/Shard data for Transforms:Registry/Map"
83 [label="ParMultiDo(Anonymous)"] 83 [label="ParMultiDo(Anonymous)"]
79 -> 83 [style=solid label=""] 79 -> 83 [style=solid label=""]
} }
} }
subgraph cluster_84 { subgraph cluster_84 {
label = "Write to sql: Transforms:Registrar/Batch output by shard Transforms:Registrar" label = "Write to sql: Transforms:Registry/Batch output by shard Transforms:Registry"
subgraph cluster_85 { subgraph cluster_85 {
label = "Write to sql: Transforms:Registrar/Batch output by shard Transforms:Registrar/ParDo(GroupIntoBatches)" label = "Write to sql: Transforms:Registry/Batch output by shard Transforms:Registry/ParDo(GroupIntoBatches)"
86 [label="ParMultiDo(GroupIntoBatches)"] 86 [label="ParMultiDo(GroupIntoBatches)"]
83 -> 86 [style=solid label=""] 83 -> 86 [style=solid label=""]
} }
} }
subgraph cluster_87 { subgraph cluster_87 {
label = "Write to sql: Transforms:Registrar/Write in batch for Transforms:Registrar" label = "Write to sql: Transforms:Registry/Write in batch for Transforms:Registry"
88 [label="ParMultiDo(SqlBatchWriter)"] 88 [label="ParMultiDo(SqlBatchWriter)"]
86 -> 88 [style=solid label=""] 86 -> 88 [style=solid label=""]
} }
} }
subgraph cluster_89 { subgraph cluster_89 {
label = "Wait on Transforms:Registrar" label = "Wait on Transforms:Registry"
subgraph cluster_90 { subgraph cluster_90 {
label = "Wait on Transforms:Registrar/To wait view 0" label = "Wait on Transforms:Registry/To wait view 0"
subgraph cluster_91 { subgraph cluster_91 {
label = "Wait on Transforms:Registrar/To wait view 0/Window.Into()" label = "Wait on Transforms:Registry/To wait view 0/Window.Into()"
92 [label="Flatten.PCollections"] 92 [label="Flatten.PCollections"]
88 -> 92 [style=solid label=""] 88 -> 92 [style=solid label=""]
} }
subgraph cluster_93 { subgraph cluster_93 {
label = "Wait on Transforms:Registrar/To wait view 0/ParDo(CollectWindows)" label = "Wait on Transforms:Registry/To wait view 0/ParDo(CollectWindows)"
94 [label="ParMultiDo(CollectWindows)"] 94 [label="ParMultiDo(CollectWindows)"]
92 -> 94 [style=solid label=""] 92 -> 94 [style=solid label=""]
} }
subgraph cluster_95 { subgraph cluster_95 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any"
subgraph cluster_96 { subgraph cluster_96 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)"
subgraph cluster_97 { subgraph cluster_97 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys"
subgraph cluster_98 { subgraph cluster_98 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys"
subgraph cluster_99 { subgraph cluster_99 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map"
100 [label="ParMultiDo(Anonymous)"] 100 [label="ParMultiDo(Anonymous)"]
94 -> 100 [style=solid label=""] 94 -> 100 [style=solid label=""]
} }
} }
} }
subgraph cluster_101 { subgraph cluster_101 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)"
102 [label="GroupByKey"] 102 [label="GroupByKey"]
100 -> 102 [style=solid label=""] 100 -> 102 [style=solid label=""]
subgraph cluster_103 { subgraph cluster_103 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues"
subgraph cluster_104 { subgraph cluster_104 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)"
105 [label="ParMultiDo(Anonymous)"] 105 [label="ParMultiDo(Anonymous)"]
102 -> 105 [style=solid label=""] 102 -> 105 [style=solid label=""]
} }
} }
} }
subgraph cluster_106 { subgraph cluster_106 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values"
subgraph cluster_107 { subgraph cluster_107 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values"
subgraph cluster_108 { subgraph cluster_108 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map"
109 [label="ParMultiDo(Anonymous)"] 109 [label="ParMultiDo(Anonymous)"]
105 -> 109 [style=solid label=""] 105 -> 109 [style=solid label=""]
} }
@ -288,11 +288,11 @@ digraph {
} }
} }
subgraph cluster_110 { subgraph cluster_110 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Flatten.Iterables" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Flatten.Iterables"
subgraph cluster_111 { subgraph cluster_111 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables"
subgraph cluster_112 { subgraph cluster_112 {
label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap" label = "Wait on Transforms:Registry/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap"
113 [label="ParMultiDo(Anonymous)"] 113 [label="ParMultiDo(Anonymous)"]
109 -> 113 [style=solid label=""] 109 -> 113 [style=solid label=""]
} }
@ -300,11 +300,11 @@ digraph {
} }
} }
subgraph cluster_114 { subgraph cluster_114 {
label = "Wait on Transforms:Registrar/To wait view 0/View.AsList" label = "Wait on Transforms:Registry/To wait view 0/View.AsList"
subgraph cluster_115 { subgraph cluster_115 {
label = "Wait on Transforms:Registrar/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization" label = "Wait on Transforms:Registry/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization"
subgraph cluster_116 { subgraph cluster_116 {
label = "Wait on Transforms:Registrar/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)" label = "Wait on Transforms:Registry/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)"
117 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"] 117 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"]
113 -> 117 [style=solid label=""] 113 -> 117 [style=solid label=""]
} }
@ -314,9 +314,9 @@ digraph {
} }
} }
subgraph cluster_119 { subgraph cluster_119 {
label = "Wait on Transforms:Registrar/Wait" label = "Wait on Transforms:Registry/Wait"
subgraph cluster_120 { subgraph cluster_120 {
label = "Wait on Transforms:Registrar/Wait/Map" label = "Wait on Transforms:Registry/Wait/Map"
121 [label="ParMultiDo(Anonymous)"] 121 [label="ParMultiDo(Anonymous)"]
79 -> 121 [style=solid label=""] 79 -> 121 [style=solid label=""]
117 -> 121 [style=dashed label=""] 117 -> 121 [style=dashed label=""]
@ -324,196 +324,196 @@ digraph {
} }
} }
subgraph cluster_122 { subgraph cluster_122 {
label = "Write to sql: Transforms:ContactResource" label = "Write to sql: Transforms:Registrar"
subgraph cluster_123 { subgraph cluster_123 {
label = "Write to sql: Transforms:ContactResource/Shard data for Transforms:ContactResource" label = "Write to sql: Transforms:Registrar/Shard data for Transforms:Registrar"
subgraph cluster_124 { subgraph cluster_124 {
label = "Write to sql: Transforms:ContactResource/Shard data for Transforms:ContactResource/Map" label = "Write to sql: Transforms:Registrar/Shard data for Transforms:Registrar/Map"
125 [label="ParMultiDo(Anonymous)"] 125 [label="ParMultiDo(Anonymous)"]
121 -> 125 [style=solid label=""] 121 -> 125 [style=solid label=""]
} }
} }
subgraph cluster_126 { subgraph cluster_126 {
label = "Write to sql: Transforms:ContactResource/Batch output by shard Transforms:ContactResource" label = "Write to sql: Transforms:Registrar/Batch output by shard Transforms:Registrar"
subgraph cluster_127 { subgraph cluster_127 {
label = "Write to sql: Transforms:ContactResource/Batch output by shard Transforms:ContactResource/ParDo(GroupIntoBatches)" label = "Write to sql: Transforms:Registrar/Batch output by shard Transforms:Registrar/ParDo(GroupIntoBatches)"
128 [label="ParMultiDo(GroupIntoBatches)"] 128 [label="ParMultiDo(GroupIntoBatches)"]
125 -> 128 [style=solid label=""] 125 -> 128 [style=solid label=""]
} }
} }
subgraph cluster_129 { subgraph cluster_129 {
label = "Write to sql: Transforms:ContactResource/Write in batch for Transforms:ContactResource" label = "Write to sql: Transforms:Registrar/Write in batch for Transforms:Registrar"
130 [label="ParMultiDo(SqlBatchWriter)"] 130 [label="ParMultiDo(SqlBatchWriter)"]
128 -> 130 [style=solid label=""] 128 -> 130 [style=solid label=""]
} }
} }
subgraph cluster_131 { subgraph cluster_131 {
label = "Remove circular foreign keys from DomainBase" label = "Wait on Transforms:Registrar"
132 [label="ParMultiDo(RemoveDomainBaseForeignKeys)"] subgraph cluster_132 {
79 -> 132 [style=solid label=""] label = "Wait on Transforms:Registrar/To wait view 0"
} subgraph cluster_133 {
subgraph cluster_133 { label = "Wait on Transforms:Registrar/To wait view 0/Window.Into()"
label = "Wait on phase one" 134 [label="Flatten.PCollections"]
subgraph cluster_134 { 130 -> 134 [style=solid label=""]
label = "Wait on phase one/To wait view 0" }
subgraph cluster_135 { subgraph cluster_135 {
label = "Wait on phase one/To wait view 0/Window.Into()" label = "Wait on Transforms:Registrar/To wait view 0/ParDo(CollectWindows)"
136 [label="Flatten.PCollections"] 136 [label="ParMultiDo(CollectWindows)"]
130 -> 136 [style=solid label=""] 134 -> 136 [style=solid label=""]
} }
subgraph cluster_137 { subgraph cluster_137 {
label = "Wait on phase one/To wait view 0/ParDo(CollectWindows)" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any"
138 [label="ParMultiDo(CollectWindows)"] subgraph cluster_138 {
136 -> 138 [style=solid label=""] label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)"
} subgraph cluster_139 {
subgraph cluster_139 { label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys"
label = "Wait on phase one/To wait view 0/Sample.Any" subgraph cluster_140 {
subgraph cluster_140 { label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys"
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)" subgraph cluster_141 {
subgraph cluster_141 { label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map"
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys" 142 [label="ParMultiDo(Anonymous)"]
subgraph cluster_142 { 136 -> 142 [style=solid label=""]
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys"
subgraph cluster_143 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map"
144 [label="ParMultiDo(Anonymous)"]
138 -> 144 [style=solid label=""]
} }
} }
} }
subgraph cluster_145 { subgraph cluster_143 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)"
146 [label="GroupByKey"] 144 [label="GroupByKey"]
144 -> 146 [style=solid label=""] 142 -> 144 [style=solid label=""]
subgraph cluster_147 { subgraph cluster_145 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues"
subgraph cluster_148 { subgraph cluster_146 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)"
149 [label="ParMultiDo(Anonymous)"] 147 [label="ParMultiDo(Anonymous)"]
146 -> 149 [style=solid label=""] 144 -> 147 [style=solid label=""]
} }
} }
} }
subgraph cluster_150 { subgraph cluster_148 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values"
subgraph cluster_151 { subgraph cluster_149 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values"
subgraph cluster_152 { subgraph cluster_150 {
label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map"
153 [label="ParMultiDo(Anonymous)"] 151 [label="ParMultiDo(Anonymous)"]
149 -> 153 [style=solid label=""] 147 -> 151 [style=solid label=""]
} }
} }
} }
} }
subgraph cluster_154 { subgraph cluster_152 {
label = "Wait on phase one/To wait view 0/Sample.Any/Flatten.Iterables" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Flatten.Iterables"
subgraph cluster_155 { subgraph cluster_153 {
label = "Wait on phase one/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables"
subgraph cluster_156 { subgraph cluster_154 {
label = "Wait on phase one/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap" label = "Wait on Transforms:Registrar/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap"
157 [label="ParMultiDo(Anonymous)"] 155 [label="ParMultiDo(Anonymous)"]
153 -> 157 [style=solid label=""] 151 -> 155 [style=solid label=""]
} }
} }
} }
} }
subgraph cluster_158 { subgraph cluster_156 {
label = "Wait on phase one/To wait view 0/View.AsList" label = "Wait on Transforms:Registrar/To wait view 0/View.AsList"
subgraph cluster_159 { subgraph cluster_157 {
label = "Wait on phase one/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization" label = "Wait on Transforms:Registrar/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization"
subgraph cluster_160 { subgraph cluster_158 {
label = "Wait on phase one/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)" label = "Wait on Transforms:Registrar/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)"
161 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"] 159 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"]
157 -> 161 [style=solid label=""] 155 -> 159 [style=solid label=""]
} }
} }
162 [label="View.CreatePCollectionView"] 160 [label="View.CreatePCollectionView"]
161 -> 162 [style=solid label=""] 159 -> 160 [style=solid label=""]
} }
} }
subgraph cluster_163 { subgraph cluster_161 {
label = "Wait on phase one/Wait" label = "Wait on Transforms:Registrar/Wait"
subgraph cluster_164 { subgraph cluster_162 {
label = "Wait on phase one/Wait/Map" label = "Wait on Transforms:Registrar/Wait/Map"
165 [label="ParMultiDo(Anonymous)"] 163 [label="ParMultiDo(Anonymous)"]
132 -> 165 [style=solid label=""] 79 -> 163 [style=solid label=""]
161 -> 165 [style=dashed label=""] 159 -> 163 [style=dashed label=""]
} }
} }
} }
subgraph cluster_166 { subgraph cluster_164 {
label = "Write to sql: DomainBase without circular foreign keys" label = "Write to sql: Transforms:ContactResource"
subgraph cluster_167 { subgraph cluster_165 {
label = "Write to sql: DomainBase without circular foreign keys/Shard data for DomainBase without circular foreign keys" label = "Write to sql: Transforms:ContactResource/Shard data for Transforms:ContactResource"
subgraph cluster_168 { subgraph cluster_166 {
label = "Write to sql: DomainBase without circular foreign keys/Shard data for DomainBase without circular foreign keys/Map" label = "Write to sql: Transforms:ContactResource/Shard data for Transforms:ContactResource/Map"
169 [label="ParMultiDo(Anonymous)"] 167 [label="ParMultiDo(Anonymous)"]
165 -> 169 [style=solid label=""] 163 -> 167 [style=solid label=""]
} }
} }
subgraph cluster_170 { subgraph cluster_168 {
label = "Write to sql: DomainBase without circular foreign keys/Batch output by shard DomainBase without circular foreign keys" label = "Write to sql: Transforms:ContactResource/Batch output by shard Transforms:ContactResource"
subgraph cluster_171 { subgraph cluster_169 {
label = "Write to sql: DomainBase without circular foreign keys/Batch output by shard DomainBase without circular foreign keys/ParDo(GroupIntoBatches)" label = "Write to sql: Transforms:ContactResource/Batch output by shard Transforms:ContactResource/ParDo(GroupIntoBatches)"
172 [label="ParMultiDo(GroupIntoBatches)"] 170 [label="ParMultiDo(GroupIntoBatches)"]
169 -> 172 [style=solid label=""] 167 -> 170 [style=solid label=""]
} }
} }
subgraph cluster_173 { subgraph cluster_171 {
label = "Write to sql: DomainBase without circular foreign keys/Write in batch for DomainBase without circular foreign keys" label = "Write to sql: Transforms:ContactResource/Write in batch for Transforms:ContactResource"
174 [label="ParMultiDo(SqlBatchWriter)"] 172 [label="ParMultiDo(SqlBatchWriter)"]
172 -> 174 [style=solid label=""] 170 -> 172 [style=solid label=""]
} }
} }
subgraph cluster_173 {
label = "Remove circular foreign keys from DomainBase"
174 [label="ParMultiDo(RemoveDomainBaseForeignKeys)"]
79 -> 174 [style=solid label=""]
}
subgraph cluster_175 { subgraph cluster_175 {
label = "Wait on DomainBaseNoFkeys" label = "Wait on phase one"
subgraph cluster_176 { subgraph cluster_176 {
label = "Wait on DomainBaseNoFkeys/To wait view 0" label = "Wait on phase one/To wait view 0"
subgraph cluster_177 { subgraph cluster_177 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Window.Into()" label = "Wait on phase one/To wait view 0/Window.Into()"
178 [label="Flatten.PCollections"] 178 [label="Flatten.PCollections"]
174 -> 178 [style=solid label=""] 172 -> 178 [style=solid label=""]
} }
subgraph cluster_179 { subgraph cluster_179 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/ParDo(CollectWindows)" label = "Wait on phase one/To wait view 0/ParDo(CollectWindows)"
180 [label="ParMultiDo(CollectWindows)"] 180 [label="ParMultiDo(CollectWindows)"]
178 -> 180 [style=solid label=""] 178 -> 180 [style=solid label=""]
} }
subgraph cluster_181 { subgraph cluster_181 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any" label = "Wait on phase one/To wait view 0/Sample.Any"
subgraph cluster_182 { subgraph cluster_182 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)"
subgraph cluster_183 { subgraph cluster_183 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys"
subgraph cluster_184 { subgraph cluster_184 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys"
subgraph cluster_185 { subgraph cluster_185 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map"
186 [label="ParMultiDo(Anonymous)"] 186 [label="ParMultiDo(Anonymous)"]
180 -> 186 [style=solid label=""] 180 -> 186 [style=solid label=""]
} }
} }
} }
subgraph cluster_187 { subgraph cluster_187 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)"
188 [label="GroupByKey"] 188 [label="GroupByKey"]
186 -> 188 [style=solid label=""] 186 -> 188 [style=solid label=""]
subgraph cluster_189 { subgraph cluster_189 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues"
subgraph cluster_190 { subgraph cluster_190 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)"
191 [label="ParMultiDo(Anonymous)"] 191 [label="ParMultiDo(Anonymous)"]
188 -> 191 [style=solid label=""] 188 -> 191 [style=solid label=""]
} }
} }
} }
subgraph cluster_192 { subgraph cluster_192 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values"
subgraph cluster_193 { subgraph cluster_193 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values"
subgraph cluster_194 { subgraph cluster_194 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map" label = "Wait on phase one/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map"
195 [label="ParMultiDo(Anonymous)"] 195 [label="ParMultiDo(Anonymous)"]
191 -> 195 [style=solid label=""] 191 -> 195 [style=solid label=""]
} }
@ -521,11 +521,11 @@ digraph {
} }
} }
subgraph cluster_196 { subgraph cluster_196 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Flatten.Iterables" label = "Wait on phase one/To wait view 0/Sample.Any/Flatten.Iterables"
subgraph cluster_197 { subgraph cluster_197 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables" label = "Wait on phase one/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables"
subgraph cluster_198 { subgraph cluster_198 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap" label = "Wait on phase one/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap"
199 [label="ParMultiDo(Anonymous)"] 199 [label="ParMultiDo(Anonymous)"]
195 -> 199 [style=solid label=""] 195 -> 199 [style=solid label=""]
} }
@ -533,11 +533,11 @@ digraph {
} }
} }
subgraph cluster_200 { subgraph cluster_200 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/View.AsList" label = "Wait on phase one/To wait view 0/View.AsList"
subgraph cluster_201 { subgraph cluster_201 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization" label = "Wait on phase one/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization"
subgraph cluster_202 { subgraph cluster_202 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)" label = "Wait on phase one/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)"
203 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"] 203 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"]
199 -> 203 [style=solid label=""] 199 -> 203 [style=solid label=""]
} }
@ -547,38 +547,152 @@ digraph {
} }
} }
subgraph cluster_205 { subgraph cluster_205 {
label = "Wait on DomainBaseNoFkeys/Wait" label = "Wait on phase one/Wait"
subgraph cluster_206 { subgraph cluster_206 {
label = "Wait on DomainBaseNoFkeys/Wait/Map" label = "Wait on phase one/Wait/Map"
207 [label="ParMultiDo(Anonymous)"] 207 [label="ParMultiDo(Anonymous)"]
79 -> 207 [style=solid label=""] 174 -> 207 [style=solid label=""]
203 -> 207 [style=dashed label=""] 203 -> 207 [style=dashed label=""]
} }
} }
} }
subgraph cluster_208 { subgraph cluster_208 {
label = "Write to sql: Transforms:HostResource" label = "Write to sql: DomainBase without circular foreign keys"
subgraph cluster_209 { subgraph cluster_209 {
label = "Write to sql: Transforms:HostResource/Shard data for Transforms:HostResource" label = "Write to sql: DomainBase without circular foreign keys/Shard data for DomainBase without circular foreign keys"
subgraph cluster_210 { subgraph cluster_210 {
label = "Write to sql: Transforms:HostResource/Shard data for Transforms:HostResource/Map" label = "Write to sql: DomainBase without circular foreign keys/Shard data for DomainBase without circular foreign keys/Map"
211 [label="ParMultiDo(Anonymous)"] 211 [label="ParMultiDo(Anonymous)"]
207 -> 211 [style=solid label=""] 207 -> 211 [style=solid label=""]
} }
} }
subgraph cluster_212 { subgraph cluster_212 {
label = "Write to sql: Transforms:HostResource/Batch output by shard Transforms:HostResource" label = "Write to sql: DomainBase without circular foreign keys/Batch output by shard DomainBase without circular foreign keys"
subgraph cluster_213 { subgraph cluster_213 {
label = "Write to sql: Transforms:HostResource/Batch output by shard Transforms:HostResource/ParDo(GroupIntoBatches)" label = "Write to sql: DomainBase without circular foreign keys/Batch output by shard DomainBase without circular foreign keys/ParDo(GroupIntoBatches)"
214 [label="ParMultiDo(GroupIntoBatches)"] 214 [label="ParMultiDo(GroupIntoBatches)"]
211 -> 214 [style=solid label=""] 211 -> 214 [style=solid label=""]
} }
} }
subgraph cluster_215 { subgraph cluster_215 {
label = "Write to sql: Transforms:HostResource/Write in batch for Transforms:HostResource" label = "Write to sql: DomainBase without circular foreign keys/Write in batch for DomainBase without circular foreign keys"
216 [label="ParMultiDo(SqlBatchWriter)"] 216 [label="ParMultiDo(SqlBatchWriter)"]
214 -> 216 [style=solid label=""] 214 -> 216 [style=solid label=""]
} }
} }
subgraph cluster_217 {
label = "Wait on DomainBaseNoFkeys"
subgraph cluster_218 {
label = "Wait on DomainBaseNoFkeys/To wait view 0"
subgraph cluster_219 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Window.Into()"
220 [label="Flatten.PCollections"]
216 -> 220 [style=solid label=""]
}
subgraph cluster_221 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/ParDo(CollectWindows)"
222 [label="ParMultiDo(CollectWindows)"]
220 -> 222 [style=solid label=""]
}
subgraph cluster_223 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any"
subgraph cluster_224 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)"
subgraph cluster_225 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys"
subgraph cluster_226 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys"
subgraph cluster_227 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/WithKeys/AddKeys/Map"
228 [label="ParMultiDo(Anonymous)"]
222 -> 228 [style=solid label=""]
}
}
}
subgraph cluster_229 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)"
230 [label="GroupByKey"]
228 -> 230 [style=solid label=""]
subgraph cluster_231 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues"
subgraph cluster_232 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Combine.perKey(SampleAny)/Combine.GroupedValues/ParDo(Anonymous)"
233 [label="ParMultiDo(Anonymous)"]
230 -> 233 [style=solid label=""]
}
}
}
subgraph cluster_234 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values"
subgraph cluster_235 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values"
subgraph cluster_236 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Combine.globally(SampleAny)/Values/Values/Map"
237 [label="ParMultiDo(Anonymous)"]
233 -> 237 [style=solid label=""]
}
}
}
}
subgraph cluster_238 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Flatten.Iterables"
subgraph cluster_239 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables"
subgraph cluster_240 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/Sample.Any/Flatten.Iterables/FlattenIterables/FlatMap"
241 [label="ParMultiDo(Anonymous)"]
237 -> 241 [style=solid label=""]
}
}
}
}
subgraph cluster_242 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/View.AsList"
subgraph cluster_243 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization"
subgraph cluster_244 {
label = "Wait on DomainBaseNoFkeys/To wait view 0/View.AsList/View.VoidKeyToMultimapMaterialization/ParDo(VoidKeyToMultimapMaterialization)"
245 [label="ParMultiDo(VoidKeyToMultimapMaterialization)"]
241 -> 245 [style=solid label=""]
}
}
246 [label="View.CreatePCollectionView"]
245 -> 246 [style=solid label=""]
}
}
subgraph cluster_247 {
label = "Wait on DomainBaseNoFkeys/Wait"
subgraph cluster_248 {
label = "Wait on DomainBaseNoFkeys/Wait/Map"
249 [label="ParMultiDo(Anonymous)"]
79 -> 249 [style=solid label=""]
245 -> 249 [style=dashed label=""]
}
}
}
subgraph cluster_250 {
label = "Write to sql: Transforms:HostResource"
subgraph cluster_251 {
label = "Write to sql: Transforms:HostResource/Shard data for Transforms:HostResource"
subgraph cluster_252 {
label = "Write to sql: Transforms:HostResource/Shard data for Transforms:HostResource/Map"
253 [label="ParMultiDo(Anonymous)"]
249 -> 253 [style=solid label=""]
}
}
subgraph cluster_254 {
label = "Write to sql: Transforms:HostResource/Batch output by shard Transforms:HostResource"
subgraph cluster_255 {
label = "Write to sql: Transforms:HostResource/Batch output by shard Transforms:HostResource/ParDo(GroupIntoBatches)"
256 [label="ParMultiDo(GroupIntoBatches)"]
253 -> 256 [style=solid label=""]
}
}
subgraph cluster_257 {
label = "Write to sql: Transforms:HostResource/Write in batch for Transforms:HostResource"
258 [label="ParMultiDo(SqlBatchWriter)"]
256 -> 258 [style=solid label=""]
}
}
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -69,3 +69,4 @@ V68__make_reserved_list_nullable_in_registry.sql
V69__change_primary_key_and_add_history_table_for_delegation_signer.sql V69__change_primary_key_and_add_history_table_for_delegation_signer.sql
V70__signed_mark_revocation_list.sql V70__signed_mark_revocation_list.sql
V71__create_kms_secret.sql V71__create_kms_secret.sql
V72__add_missing_foreign_keys.sql

View file

@ -0,0 +1,95 @@
-- Copyright 2020 The Nomulus Authors. All Rights Reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
alter table if exists "RegistrarPoc"
add constraint fk_registrar_poc_registrar_id
foreign key (registrar_id)
references "Registrar";
alter table if exists "Spec11ThreatMatch"
add constraint fk_spec11_threat_match_domain_repo_id
foreign key (domain_repo_id)
references "Domain";
alter table if exists "Spec11ThreatMatch"
add constraint fk_spec11_threat_match_registrar_id
foreign key (registrar_id)
references "Registrar";
alter table if exists "Spec11ThreatMatch"
add constraint fk_spec11_threat_match_tld
foreign key (tld)
references "Tld";
alter table if exists "BillingEvent"
add constraint fk_billing_event_domain_history
foreign key (domain_repo_id, domain_history_revision_id)
references "DomainHistory";
alter table "BillingEvent" rename allocation_token_id to allocation_token;
alter table if exists "BillingEvent"
add constraint fk_billing_event_allocation_token
foreign key (allocation_token)
references "AllocationToken";
alter table if exists "BillingRecurrence"
add constraint fk_billing_recurrence_domain_history
foreign key (domain_repo_id, domain_history_revision_id)
references "DomainHistory";
alter table if exists "BillingCancellation"
add constraint fk_billing_cancellation_domain_history
foreign key (domain_repo_id, domain_history_revision_id)
references "DomainHistory";
alter table if exists "Contact"
add constraint fk_contact_transfer_gaining_poll_message_id
foreign key (transfer_gaining_poll_message_id)
references "PollMessage";
alter table if exists "Contact"
add constraint fk_contact_transfer_losing_poll_message_id
foreign key (transfer_losing_poll_message_id)
references "PollMessage";
alter table if exists "Domain"
add constraint fk_domain_tld
foreign key (tld)
references "Tld";
alter table if exists "DomainTransactionRecord"
add constraint fk_domain_transaction_record_tld
foreign key (tld)
references "Tld";
alter table if exists "GracePeriod"
add constraint fk_grace_period_registrar_id
foreign key (registrar_id)
references "Registrar";
alter table if exists "Host"
add constraint fk_host_creation_registrar_id
foreign key (creation_registrar_id)
references "Registrar";
alter table if exists "Host"
add constraint fk_host_current_sponsor_registrar_id
foreign key (current_sponsor_registrar_id)
references "Registrar";
alter table if exists "Host"
add constraint fk_host_last_epp_update_registrar_id
foreign key (last_epp_update_registrar_id)
references "Registrar";

View file

@ -52,7 +52,7 @@
flags text[], flags text[],
reason text not null, reason text not null,
domain_name text not null, domain_name text not null,
allocation_token_id text, allocation_token text,
billing_time timestamptz, billing_time timestamptz,
cancellation_matching_billing_recurrence_id int8, cancellation_matching_billing_recurrence_id int8,
cost_amount numeric(19, 2), cost_amount numeric(19, 2),
@ -705,7 +705,7 @@ create index IDXqspv57gj2led8ly42fq01t7m7 on "BillingEvent" (registrar_id);
create index IDX5yfbr88439pxw0v3j86c74fp8 on "BillingEvent" (event_time); create index IDX5yfbr88439pxw0v3j86c74fp8 on "BillingEvent" (event_time);
create index IDX6py6ocrab0ivr76srcd2okpnq on "BillingEvent" (billing_time); create index IDX6py6ocrab0ivr76srcd2okpnq on "BillingEvent" (billing_time);
create index IDXplxf9v56p0wg8ws6qsvd082hk on "BillingEvent" (synthetic_creation_time); create index IDXplxf9v56p0wg8ws6qsvd082hk on "BillingEvent" (synthetic_creation_time);
create index IDXhmv411mdqo5ibn4vy7ykxpmlv on "BillingEvent" (allocation_token_id); create index IDXcesda59ssop44kklytpb292hn on "BillingEvent" (allocation_token);
create index IDXd3gxhkh0jk694pjvh9pyn7wjc on "BillingRecurrence" (registrar_id); create index IDXd3gxhkh0jk694pjvh9pyn7wjc on "BillingRecurrence" (registrar_id);
create index IDX6syykou4nkc7hqa5p8r92cpch on "BillingRecurrence" (event_time); create index IDX6syykou4nkc7hqa5p8r92cpch on "BillingRecurrence" (event_time);
create index IDXp3usbtvk0v1m14i5tdp4xnxgc on "BillingRecurrence" (recurrence_end_time); create index IDXp3usbtvk0v1m14i5tdp4xnxgc on "BillingRecurrence" (recurrence_end_time);

View file

@ -86,7 +86,7 @@ CREATE TABLE public."BillingEvent" (
flags text[], flags text[],
reason text NOT NULL, reason text NOT NULL,
domain_name text NOT NULL, domain_name text NOT NULL,
allocation_token_id text, allocation_token text,
billing_time timestamp with time zone, billing_time timestamp with time zone,
cancellation_matching_billing_recurrence_id bigint, cancellation_matching_billing_recurrence_id bigint,
cost_amount numeric(19,2), cost_amount numeric(19,2),
@ -1514,7 +1514,7 @@ CREATE INDEX idxhlqqd5uy98cjyos72d81x9j95 ON public."DelegationSignerData" USING
-- Name: idxhmv411mdqo5ibn4vy7ykxpmlv; Type: INDEX; Schema: public; Owner: - -- Name: idxhmv411mdqo5ibn4vy7ykxpmlv; Type: INDEX; Schema: public; Owner: -
-- --
CREATE INDEX idxhmv411mdqo5ibn4vy7ykxpmlv ON public."BillingEvent" USING btree (allocation_token_id); CREATE INDEX idxhmv411mdqo5ibn4vy7ykxpmlv ON public."BillingEvent" USING btree (allocation_token);
-- --
@ -1786,6 +1786,14 @@ ALTER TABLE ONLY public."BillingCancellation"
ADD CONSTRAINT fk_billing_cancellation_billing_recurrence_id FOREIGN KEY (billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id); ADD CONSTRAINT fk_billing_cancellation_billing_recurrence_id FOREIGN KEY (billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id);
--
-- Name: BillingCancellation fk_billing_cancellation_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."BillingCancellation"
ADD CONSTRAINT fk_billing_cancellation_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id);
-- --
-- Name: BillingCancellation fk_billing_cancellation_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: BillingCancellation fk_billing_cancellation_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1794,6 +1802,14 @@ ALTER TABLE ONLY public."BillingCancellation"
ADD CONSTRAINT fk_billing_cancellation_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id); ADD CONSTRAINT fk_billing_cancellation_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: BillingEvent fk_billing_event_allocation_token; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."BillingEvent"
ADD CONSTRAINT fk_billing_event_allocation_token FOREIGN KEY (allocation_token) REFERENCES public."AllocationToken"(token);
-- --
-- Name: BillingEvent fk_billing_event_cancellation_matching_billing_recurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: BillingEvent fk_billing_event_cancellation_matching_billing_recurrence_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1802,6 +1818,14 @@ ALTER TABLE ONLY public."BillingEvent"
ADD CONSTRAINT fk_billing_event_cancellation_matching_billing_recurrence_id FOREIGN KEY (cancellation_matching_billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id); ADD CONSTRAINT fk_billing_event_cancellation_matching_billing_recurrence_id FOREIGN KEY (cancellation_matching_billing_recurrence_id) REFERENCES public."BillingRecurrence"(billing_recurrence_id);
--
-- Name: BillingEvent fk_billing_event_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."BillingEvent"
ADD CONSTRAINT fk_billing_event_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id);
-- --
-- Name: BillingEvent fk_billing_event_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: BillingEvent fk_billing_event_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1810,6 +1834,14 @@ ALTER TABLE ONLY public."BillingEvent"
ADD CONSTRAINT fk_billing_event_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id); ADD CONSTRAINT fk_billing_event_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: BillingRecurrence fk_billing_recurrence_domain_history; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."BillingRecurrence"
ADD CONSTRAINT fk_billing_recurrence_domain_history FOREIGN KEY (domain_repo_id, domain_history_revision_id) REFERENCES public."DomainHistory"(domain_repo_id, history_revision_id);
-- --
-- Name: BillingRecurrence fk_billing_recurrence_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: BillingRecurrence fk_billing_recurrence_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1834,6 +1866,14 @@ ALTER TABLE ONLY public."ContactHistory"
ADD CONSTRAINT fk_contact_history_registrar_id FOREIGN KEY (history_registrar_id) REFERENCES public."Registrar"(registrar_id); ADD CONSTRAINT fk_contact_history_registrar_id FOREIGN KEY (history_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Contact fk_contact_transfer_gaining_poll_message_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Contact"
ADD CONSTRAINT fk_contact_transfer_gaining_poll_message_id FOREIGN KEY (transfer_gaining_poll_message_id) REFERENCES public."PollMessage"(poll_message_id);
-- --
-- Name: Contact fk_contact_transfer_gaining_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: Contact fk_contact_transfer_gaining_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1842,6 +1882,14 @@ ALTER TABLE ONLY public."Contact"
ADD CONSTRAINT fk_contact_transfer_gaining_registrar_id FOREIGN KEY (transfer_gaining_registrar_id) REFERENCES public."Registrar"(registrar_id); ADD CONSTRAINT fk_contact_transfer_gaining_registrar_id FOREIGN KEY (transfer_gaining_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Contact fk_contact_transfer_losing_poll_message_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Contact"
ADD CONSTRAINT fk_contact_transfer_losing_poll_message_id FOREIGN KEY (transfer_losing_poll_message_id) REFERENCES public."PollMessage"(poll_message_id);
-- --
-- Name: Contact fk_contact_transfer_losing_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: Contact fk_contact_transfer_losing_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1922,6 +1970,22 @@ ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_tech_contact FOREIGN KEY (tech_contact) REFERENCES public."Contact"(repo_id); ADD CONSTRAINT fk_domain_tech_contact FOREIGN KEY (tech_contact) REFERENCES public."Contact"(repo_id);
--
-- Name: Domain fk_domain_tld; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Domain"
ADD CONSTRAINT fk_domain_tld FOREIGN KEY (tld) REFERENCES public."Tld"(tld_name);
--
-- Name: DomainTransactionRecord fk_domain_transaction_record_tld; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."DomainTransactionRecord"
ADD CONSTRAINT fk_domain_transaction_record_tld FOREIGN KEY (tld) REFERENCES public."Tld"(tld_name);
-- --
-- Name: Domain fk_domain_transfer_billing_cancellation_id; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: Domain fk_domain_transfer_billing_cancellation_id; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -1994,6 +2058,38 @@ ALTER TABLE ONLY public."GracePeriod"
ADD CONSTRAINT fk_grace_period_domain_repo_id FOREIGN KEY (domain_repo_id) REFERENCES public."Domain"(repo_id) DEFERRABLE INITIALLY DEFERRED; ADD CONSTRAINT fk_grace_period_domain_repo_id FOREIGN KEY (domain_repo_id) REFERENCES public."Domain"(repo_id) DEFERRABLE INITIALLY DEFERRED;
--
-- Name: GracePeriod fk_grace_period_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."GracePeriod"
ADD CONSTRAINT fk_grace_period_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Host fk_host_creation_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Host"
ADD CONSTRAINT fk_host_creation_registrar_id FOREIGN KEY (creation_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Host fk_host_current_sponsor_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Host"
ADD CONSTRAINT fk_host_current_sponsor_registrar_id FOREIGN KEY (current_sponsor_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Host fk_host_last_epp_update_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Host"
ADD CONSTRAINT fk_host_last_epp_update_registrar_id FOREIGN KEY (last_epp_update_registrar_id) REFERENCES public."Registrar"(registrar_id);
-- --
-- Name: Host fk_host_superordinate_domain; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: Host fk_host_superordinate_domain; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --
@ -2082,6 +2178,38 @@ ALTER TABLE ONLY public."PollMessage"
ADD CONSTRAINT fk_poll_message_transfer_response_losing_registrar_id FOREIGN KEY (transfer_response_losing_registrar_id) REFERENCES public."Registrar"(registrar_id); ADD CONSTRAINT fk_poll_message_transfer_response_losing_registrar_id FOREIGN KEY (transfer_response_losing_registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: RegistrarPoc fk_registrar_poc_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."RegistrarPoc"
ADD CONSTRAINT fk_registrar_poc_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Spec11ThreatMatch fk_spec11_threat_match_domain_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Spec11ThreatMatch"
ADD CONSTRAINT fk_spec11_threat_match_domain_repo_id FOREIGN KEY (domain_repo_id) REFERENCES public."Domain"(repo_id);
--
-- Name: Spec11ThreatMatch fk_spec11_threat_match_registrar_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Spec11ThreatMatch"
ADD CONSTRAINT fk_spec11_threat_match_registrar_id FOREIGN KEY (registrar_id) REFERENCES public."Registrar"(registrar_id);
--
-- Name: Spec11ThreatMatch fk_spec11_threat_match_tld; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public."Spec11ThreatMatch"
ADD CONSTRAINT fk_spec11_threat_match_tld FOREIGN KEY (tld) REFERENCES public."Tld"(tld_name);
-- --
-- Name: DomainHistoryHost fka9woh3hu8gx5x0vly6bai327n; Type: FK CONSTRAINT; Schema: public; Owner: - -- Name: DomainHistoryHost fka9woh3hu8gx5x0vly6bai327n; Type: FK CONSTRAINT; Schema: public; Owner: -
-- --