Class BulkQueryEntities
- java.lang.Object
-
- google.registry.model.bulkquery.BulkQueryEntities
-
public class BulkQueryEntities extends java.lang.Object
Utilities for managing an alternative JPA entity model optimized for bulk loading multi-level entities such asDomainBase
andDomainHistory
.In a bulk query for a multi-level JPA entity type, the JPA framework only generates a bulk query (SELECT * FROM table) for the base table. Then, for each row in the base table, additional queries are issued to load associated rows in child tables. This can be very slow when an entity type has multiple child tables.
We have defined an alternative entity model for
DomainBase
andDomainHistory
, where the base table as well as the child tables are mapped to single-level entity types. The idea is to load each of these types using a bulk query, and assemble them into the target type in memory in a pipeline. The main use case is Datastore-Cloud SQL validation during the Registry database migration, where we will need the full database snapshots frequently.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.ImmutableList<java.lang.String>
JPA_ENTITIES_NEW
static com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String>
JPA_ENTITIES_REPLACEMENTS
The JPA entity classes in persistence.xml to replace when creating theJpaTransactionManager
for bulk query.
-
Constructor Summary
Constructors Constructor Description BulkQueryEntities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DomainBase
assembleDomainBase(DomainBaseLite domainBaseLite, com.google.common.collect.ImmutableSet<GracePeriod> gracePeriods, com.google.common.collect.ImmutableSet<DelegationSignerData> delegationSignerData, com.google.common.collect.ImmutableSet<VKey<HostResource>> nsHosts)
static DomainHistory
assembleDomainHistory(DomainHistoryLite domainHistoryLite, com.google.common.collect.ImmutableSet<DomainDsDataHistory> dsDataHistories, com.google.common.collect.ImmutableSet<VKey<HostResource>> domainHistoryHosts, com.google.common.collect.ImmutableSet<GracePeriod.GracePeriodHistory> gracePeriodHistories, com.google.common.collect.ImmutableSet<DomainTransactionRecord> transactionRecords)
-
-
-
Field Detail
-
JPA_ENTITIES_REPLACEMENTS
public static final com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> JPA_ENTITIES_REPLACEMENTS
The JPA entity classes in persistence.xml to replace when creating theJpaTransactionManager
for bulk query.
-
JPA_ENTITIES_NEW
public static final com.google.common.collect.ImmutableList<java.lang.String> JPA_ENTITIES_NEW
-
-
Method Detail
-
assembleDomainBase
public static DomainBase assembleDomainBase(DomainBaseLite domainBaseLite, com.google.common.collect.ImmutableSet<GracePeriod> gracePeriods, com.google.common.collect.ImmutableSet<DelegationSignerData> delegationSignerData, com.google.common.collect.ImmutableSet<VKey<HostResource>> nsHosts)
-
assembleDomainHistory
public static DomainHistory assembleDomainHistory(DomainHistoryLite domainHistoryLite, com.google.common.collect.ImmutableSet<DomainDsDataHistory> dsDataHistories, com.google.common.collect.ImmutableSet<VKey<HostResource>> domainHistoryHosts, com.google.common.collect.ImmutableSet<GracePeriod.GracePeriodHistory> gracePeriodHistories, com.google.common.collect.ImmutableSet<DomainTransactionRecord> transactionRecords)
-
-