mirror of
https://github.com/google/nomulus.git
synced 2025-07-06 19:23:31 +02:00
Add the DNS refresh request time field to the Domain tables (#1279)
* Add the DNS refresh request time field to the Domain tables This isn't used yet, but it will eventually be the replacement for the dns-pull task queue once we get further in the migration. * Merge branch 'master' into domain-dns-dirty
This commit is contained in:
parent
0909a1d6d4
commit
20b73222d4
5 changed files with 46 additions and 2 deletions
|
@ -65,7 +65,8 @@ import org.joda.time.DateTime;
|
||||||
@Index(columnList = "domainName"),
|
@Index(columnList = "domainName"),
|
||||||
@Index(columnList = "techContact"),
|
@Index(columnList = "techContact"),
|
||||||
@Index(columnList = "tld"),
|
@Index(columnList = "tld"),
|
||||||
@Index(columnList = "registrantContact")
|
@Index(columnList = "registrantContact"),
|
||||||
|
@Index(columnList = "dnsRefreshRequestTime")
|
||||||
})
|
})
|
||||||
@WithStringVKey
|
@WithStringVKey
|
||||||
@ExternalMessagingName("domain")
|
@ExternalMessagingName("domain")
|
||||||
|
@ -213,7 +214,8 @@ public class DomainBase extends DomainContent
|
||||||
.setSmdId(domainContent.getSmdId())
|
.setSmdId(domainContent.getSmdId())
|
||||||
.setSubordinateHosts(domainContent.getSubordinateHosts())
|
.setSubordinateHosts(domainContent.getSubordinateHosts())
|
||||||
.setStatusValues(domainContent.getStatusValues())
|
.setStatusValues(domainContent.getStatusValues())
|
||||||
.setTransferData(domainContent.getTransferData());
|
.setTransferData(domainContent.getTransferData())
|
||||||
|
.setDnsRefreshRequestTime(domainContent.getDnsRefreshRequestTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ import com.googlecode.objectify.annotation.IgnoreSave;
|
||||||
import com.googlecode.objectify.annotation.Index;
|
import com.googlecode.objectify.annotation.Index;
|
||||||
import com.googlecode.objectify.annotation.OnLoad;
|
import com.googlecode.objectify.annotation.OnLoad;
|
||||||
import com.googlecode.objectify.condition.IfNull;
|
import com.googlecode.objectify.condition.IfNull;
|
||||||
|
import google.registry.dns.RefreshDnsAction;
|
||||||
import google.registry.flows.ResourceFlowUtils;
|
import google.registry.flows.ResourceFlowUtils;
|
||||||
import google.registry.model.EppResource;
|
import google.registry.model.EppResource;
|
||||||
import google.registry.model.EppResource.ResourceWithTransferData;
|
import google.registry.model.EppResource.ResourceWithTransferData;
|
||||||
|
@ -303,6 +304,35 @@ public class DomainContent extends EppResource
|
||||||
*/
|
*/
|
||||||
@Index DateTime autorenewEndTime;
|
@Index DateTime autorenewEndTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When this domain's DNS was requested to be refreshed, or null if its DNS is up-to-date.
|
||||||
|
*
|
||||||
|
* <p>This will almost always be null except in the couple minutes' interval between when a
|
||||||
|
* DNS-affecting create or update operation takes place and when the {@link RefreshDnsAction}
|
||||||
|
* runs, which resets this back to null upon completion of the DNS refresh task. This is a {@link
|
||||||
|
* DateTime} rather than a simple dirty boolean so that the DNS refresh action can order by the
|
||||||
|
* DNS refresh request time and take action on the oldest ones first.
|
||||||
|
*
|
||||||
|
* <p>Note that this is a Cloud SQL-based replacement for the {@code dns-pull} task queue. The
|
||||||
|
* domains that have a non-null value for this field should be exactly the same as the tasks that
|
||||||
|
* would be in the {@code dns-pull} queue. Because this is Cloud SQL-specific, it is omitted from
|
||||||
|
* Datastore.
|
||||||
|
*
|
||||||
|
* <p>Note that in the {@link DomainHistory} table this value means something slightly different:
|
||||||
|
* It means that the given domain action requested a DNS update. Unlike on the {@code Domain}
|
||||||
|
* table, this value is not then subsequently nulled out once the DNS refresh is complete; rather,
|
||||||
|
* it remains as a permanent record of which actions were DNS-affecting and which were not.
|
||||||
|
*/
|
||||||
|
// TODO(mcilwain): Start using this field once we are further along in the DB migration.
|
||||||
|
@Ignore DateTime dnsRefreshRequestTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the DNS refresh request time iff this domain's DNS needs refreshing, otherwise absent.
|
||||||
|
*/
|
||||||
|
public Optional<DateTime> getDnsRefreshRequestTime() {
|
||||||
|
return Optional.ofNullable(dnsRefreshRequestTime);
|
||||||
|
}
|
||||||
|
|
||||||
@OnLoad
|
@OnLoad
|
||||||
void load() {
|
void load() {
|
||||||
// Reconstitute all of the contacts so that they have VKeys.
|
// Reconstitute all of the contacts so that they have VKeys.
|
||||||
|
@ -967,6 +997,11 @@ public class DomainContent extends EppResource
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public B setDnsRefreshRequestTime(Optional<DateTime> dnsRefreshRequestTime) {
|
||||||
|
getInstance().dnsRefreshRequestTime = dnsRefreshRequestTime.orElse(null);
|
||||||
|
return thisCastToDerived();
|
||||||
|
}
|
||||||
|
|
||||||
public B setSmdId(String smdId) {
|
public B setSmdId(String smdId) {
|
||||||
getInstance().smdId = smdId;
|
getInstance().smdId = smdId;
|
||||||
return thisCastToDerived();
|
return thisCastToDerived();
|
||||||
|
|
|
@ -173,6 +173,7 @@ public class DomainBaseTest extends EntityTestCase {
|
||||||
"registrar",
|
"registrar",
|
||||||
null))
|
null))
|
||||||
.setAutorenewEndTime(Optional.of(fakeClock.nowUtc().plusYears(2)))
|
.setAutorenewEndTime(Optional.of(fakeClock.nowUtc().plusYears(2)))
|
||||||
|
.setDnsRefreshRequestTime(Optional.of(fakeClock.nowUtc()))
|
||||||
.build()));
|
.build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ import google.registry.testing.DatabaseHelper;
|
||||||
import google.registry.testing.DualDatabaseTest;
|
import google.registry.testing.DualDatabaseTest;
|
||||||
import google.registry.testing.TestOfyOnly;
|
import google.registry.testing.TestOfyOnly;
|
||||||
import google.registry.testing.TestSqlOnly;
|
import google.registry.testing.TestSqlOnly;
|
||||||
|
import java.util.Optional;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
||||||
/** Tests for {@link DomainHistory}. */
|
/** Tests for {@link DomainHistory}. */
|
||||||
|
@ -245,6 +247,7 @@ public class DomainHistoryTest extends EntityTestCase {
|
||||||
.asBuilder()
|
.asBuilder()
|
||||||
.setNameservers(host.createVKey())
|
.setNameservers(host.createVKey())
|
||||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
||||||
|
.setDnsRefreshRequestTime(Optional.of(DateTime.parse("2020-03-09T16:40:00Z")))
|
||||||
.build();
|
.build();
|
||||||
jpaTm().transact(() -> jpaTm().insert(domain));
|
jpaTm().transact(() -> jpaTm().insert(domain));
|
||||||
return domain;
|
return domain;
|
||||||
|
|
|
@ -274,6 +274,7 @@
|
||||||
billing_contact text,
|
billing_contact text,
|
||||||
deletion_poll_message_id int8,
|
deletion_poll_message_id int8,
|
||||||
deletion_poll_message_history_id int8,
|
deletion_poll_message_history_id int8,
|
||||||
|
dns_refresh_request_time timestamptz,
|
||||||
domain_name text,
|
domain_name text,
|
||||||
idn_table_name text,
|
idn_table_name text,
|
||||||
last_transfer_time timestamptz,
|
last_transfer_time timestamptz,
|
||||||
|
@ -347,6 +348,7 @@
|
||||||
billing_contact text,
|
billing_contact text,
|
||||||
deletion_poll_message_id int8,
|
deletion_poll_message_id int8,
|
||||||
deletion_poll_message_history_id int8,
|
deletion_poll_message_history_id int8,
|
||||||
|
dns_refresh_request_time timestamptz,
|
||||||
domain_name text,
|
domain_name text,
|
||||||
idn_table_name text,
|
idn_table_name text,
|
||||||
last_transfer_time timestamptz,
|
last_transfer_time timestamptz,
|
||||||
|
@ -788,6 +790,7 @@ create index IDXc5aw4pk1vkd6ymhvkpanmoadv on "Domain" (domain_name);
|
||||||
create index IDXr22ciyccwi9rrqmt1ro0s59qf on "Domain" (tech_contact);
|
create index IDXr22ciyccwi9rrqmt1ro0s59qf on "Domain" (tech_contact);
|
||||||
create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld);
|
create index IDXrwl38wwkli1j7gkvtywi9jokq on "Domain" (tld);
|
||||||
create index IDXa7fu0bqynfb79rr80528b4jqt on "Domain" (registrant_contact);
|
create index IDXa7fu0bqynfb79rr80528b4jqt on "Domain" (registrant_contact);
|
||||||
|
create index IDXcws5mvmpl8o10wrhde780ors2 on "Domain" (dns_refresh_request_time);
|
||||||
create index IDXrh4xmrot9bd63o382ow9ltfig on "DomainHistory" (creation_time);
|
create index IDXrh4xmrot9bd63o382ow9ltfig on "DomainHistory" (creation_time);
|
||||||
create index IDXaro1omfuaxjwmotk3vo00trwm on "DomainHistory" (history_registrar_id);
|
create index IDXaro1omfuaxjwmotk3vo00trwm on "DomainHistory" (history_registrar_id);
|
||||||
create index IDXsu1nam10cjes9keobapn5jvxj on "DomainHistory" (history_type);
|
create index IDXsu1nam10cjes9keobapn5jvxj on "DomainHistory" (history_type);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue