1
0
mirror of https://github.com/google/nomulus synced 2026-01-08 15:21:46 +00:00

Drop FKs referencing DomainHistory (#2621)

- We never delete rows from DomainHistory (and even if we do in the
  future, they'll be old / the references won't matter)
- This is likely creating lock contention when lots of requests come
  through at once for domains with many DomainHistory entries
This commit is contained in:
gbrodman
2024-12-10 13:46:48 -05:00
committed by GitHub
parent fce126d426
commit c6a6bc7e25
19 changed files with 4939 additions and 5635 deletions

View File

@@ -45,10 +45,11 @@ import org.joda.time.DateTime;
@Index(columnList = "eventTime"),
@Index(columnList = "domainRepoId"),
@Index(columnList = "billingTime"),
@Index(columnList = "billing_event_id"),
@Index(columnList = "billing_recurrence_id")
@Index(columnList = "billingEventId"),
@Index(columnList = "billingRecurrenceId"),
@Index(columnList = "domainRepoId,domainHistoryRevisionId")
})
@AttributeOverride(name = "id", column = @Column(name = "billing_cancellation_id"))
@AttributeOverride(name = "id", column = @Column(name = "billingCancellationId"))
@WithVKey(Long.class)
public class BillingCancellation extends BillingBase {

View File

@@ -42,7 +42,9 @@ import org.joda.time.DateTime;
@Index(columnList = "syntheticCreationTime"),
@Index(columnList = "domainRepoId"),
@Index(columnList = "allocationToken"),
@Index(columnList = "cancellation_matching_billing_recurrence_id")
@Index(columnList = "cancellationMatchingBillingRecurrenceId"),
@Index(columnList = "domainRepoId,domainHistoryRevisionId"),
@Index(columnList = "domainRepoId,recurrenceHistoryRevisionId")
})
@AttributeOverride(name = "id", column = @Column(name = "billing_event_id"))
@WithVKey(Long.class)

View File

@@ -50,7 +50,8 @@ import org.joda.time.DateTime;
@Index(columnList = "domainRepoId"),
@Index(columnList = "recurrenceEndTime"),
@Index(columnList = "recurrenceLastExpansion"),
@Index(columnList = "recurrence_time_of_year")
@Index(columnList = "recurrenceTimeOfYear"),
@Index(columnList = "domainRepoId,domainHistoryRevisionId")
})
@AttributeOverride(name = "id", column = @Column(name = "billing_recurrence_id"))
@WithVKey(Long.class)

View File

@@ -180,7 +180,11 @@ public class GracePeriod extends GracePeriodBase {
/** Entity class to represent a historic {@link GracePeriod}. */
@Entity(name = "GracePeriodHistory")
@Table(indexes = @Index(columnList = "domainRepoId"))
@Table(
indexes = {
@Index(columnList = "domainRepoId"),
@Index(columnList = "domainRepoId,domainHistoryRevisionId")
})
public static class GracePeriodHistory extends GracePeriodBase {
@Id Long gracePeriodHistoryRevisionId;

View File

@@ -23,9 +23,12 @@ import jakarta.persistence.AccessType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
/** Entity class to represent a historic {@link DomainDsData}. */
@Entity
@Table(indexes = @Index(columnList = "domainRepoId,domainHistoryRevisionId"))
public class DomainDsDataHistory extends DomainDsDataBase {
@Id Long dsDataHistoryRevisionId;

View File

@@ -89,8 +89,9 @@ import org.joda.time.DateTime;
@Table(
indexes = {
@Index(columnList = "domainRepoId"),
@Index(columnList = "registrar_id"),
@Index(columnList = "eventTime")
@Index(columnList = "registrarId"),
@Index(columnList = "eventTime"),
@Index(columnList = "domainRepoId,domainHistoryRevisionId")
})
public abstract class PollMessage extends ImmutableObject
implements Buildable, TransferServerApproveEntity, UnsafeSerializable {

View File

@@ -29,6 +29,8 @@ import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Index;
import jakarta.persistence.Table;
import org.joda.time.DateTime;
/**
@@ -42,6 +44,7 @@ import org.joda.time.DateTime;
* uses HistoryEntry.otherClientId because the losing party in a transfer is always the otherClient.
*/
@Entity
@Table(indexes = @Index(columnList = "domainRepoId,historyRevisionId"))
public class DomainTransactionRecord extends ImmutableObject
implements Buildable, UnsafeSerializable {