Add indexes on contacts in the Domain table (#1145)

These indexes are used to find if a contact is linked to a domain in
during a contact delete.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1145)
<!-- Reviewable:end -->
This commit is contained in:
Lai Jiang 2021-05-13 10:47:35 -04:00 committed by GitHub
parent f3a5a5aebd
commit 8cfefcef6e
8 changed files with 4029 additions and 3919 deletions

View file

@ -405,15 +405,18 @@ public final class EppResourceUtils {
.setParameter("fkRepoId", key.getSqlKey())
.setParameter("now", now.toDate());
}
return (ImmutableSet<VKey<DomainBase>>)
query
.setMaxResults(limit)
.getResultStream()
.map(
repoId ->
DomainBase.createVKey(
Key.create(DomainBase.class, (String) repoId)))
.collect(toImmutableSet());
@SuppressWarnings("unchecked")
ImmutableSet<VKey<DomainBase>> domainBaseKeySet =
(ImmutableSet<VKey<DomainBase>>)
query
.setMaxResults(limit)
.getResultStream()
.map(
repoId ->
DomainBase.createVKey(
Key.create(DomainBase.class, (String) repoId)))
.collect(toImmutableSet());
return domainBaseKeySet;
});
}
}

View file

@ -54,12 +54,16 @@ import org.joda.time.DateTime;
@Table(
name = "Domain",
indexes = {
@Index(columnList = "adminContact"),
@Index(columnList = "autorenewEndTime"),
@Index(columnList = "billingContact"),
@Index(columnList = "creationTime"),
@Index(columnList = "currentSponsorRegistrarId"),
@Index(columnList = "deletionTime"),
@Index(columnList = "domainName"),
@Index(columnList = "techContact"),
@Index(columnList = "tld"),
@Index(columnList = "autorenewEndTime")
@Index(columnList = "registrantContact")
})
@WithStringVKey
@ExternalMessagingName("domain")