mirror of
https://github.com/google/nomulus.git
synced 2025-07-06 11:13:35 +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 = "techContact"),
|
||||
@Index(columnList = "tld"),
|
||||
@Index(columnList = "registrantContact")
|
||||
@Index(columnList = "registrantContact"),
|
||||
@Index(columnList = "dnsRefreshRequestTime")
|
||||
})
|
||||
@WithStringVKey
|
||||
@ExternalMessagingName("domain")
|
||||
|
@ -213,7 +214,8 @@ public class DomainBase extends DomainContent
|
|||
.setSmdId(domainContent.getSmdId())
|
||||
.setSubordinateHosts(domainContent.getSubordinateHosts())
|
||||
.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.OnLoad;
|
||||
import com.googlecode.objectify.condition.IfNull;
|
||||
import google.registry.dns.RefreshDnsAction;
|
||||
import google.registry.flows.ResourceFlowUtils;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.EppResource.ResourceWithTransferData;
|
||||
|
@ -303,6 +304,35 @@ public class DomainContent extends EppResource
|
|||
*/
|
||||
@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
|
||||
void load() {
|
||||
// Reconstitute all of the contacts so that they have VKeys.
|
||||
|
@ -967,6 +997,11 @@ public class DomainContent extends EppResource
|
|||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setDnsRefreshRequestTime(Optional<DateTime> dnsRefreshRequestTime) {
|
||||
getInstance().dnsRefreshRequestTime = dnsRefreshRequestTime.orElse(null);
|
||||
return thisCastToDerived();
|
||||
}
|
||||
|
||||
public B setSmdId(String smdId) {
|
||||
getInstance().smdId = smdId;
|
||||
return thisCastToDerived();
|
||||
|
|
|
@ -173,6 +173,7 @@ public class DomainBaseTest extends EntityTestCase {
|
|||
"registrar",
|
||||
null))
|
||||
.setAutorenewEndTime(Optional.of(fakeClock.nowUtc().plusYears(2)))
|
||||
.setDnsRefreshRequestTime(Optional.of(fakeClock.nowUtc()))
|
||||
.build()));
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ import google.registry.testing.DatabaseHelper;
|
|||
import google.registry.testing.DualDatabaseTest;
|
||||
import google.registry.testing.TestOfyOnly;
|
||||
import google.registry.testing.TestSqlOnly;
|
||||
import java.util.Optional;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
/** Tests for {@link DomainHistory}. */
|
||||
|
@ -245,6 +247,7 @@ public class DomainHistoryTest extends EntityTestCase {
|
|||
.asBuilder()
|
||||
.setNameservers(host.createVKey())
|
||||
.setDsData(ImmutableSet.of(DelegationSignerData.create(1, 2, 3, new byte[] {0, 1, 2})))
|
||||
.setDnsRefreshRequestTime(Optional.of(DateTime.parse("2020-03-09T16:40:00Z")))
|
||||
.build();
|
||||
jpaTm().transact(() -> jpaTm().insert(domain));
|
||||
return domain;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue