mirror of
https://github.com/google/nomulus
synced 2026-01-05 13:07:04 +00:00
Use the primary DB for DomainInfoFlow (#2750)
This avoids potential replication lag issues when requesting info on domains that were just created.
This commit is contained in:
@@ -31,6 +31,7 @@ import google.registry.flows.ExtensionManager;
|
|||||||
import google.registry.flows.FlowModule.RegistrarId;
|
import google.registry.flows.FlowModule.RegistrarId;
|
||||||
import google.registry.flows.FlowModule.Superuser;
|
import google.registry.flows.FlowModule.Superuser;
|
||||||
import google.registry.flows.FlowModule.TargetId;
|
import google.registry.flows.FlowModule.TargetId;
|
||||||
|
import google.registry.flows.MutatingFlow;
|
||||||
import google.registry.flows.TransactionalFlow;
|
import google.registry.flows.TransactionalFlow;
|
||||||
import google.registry.flows.annotations.ReportingSpec;
|
import google.registry.flows.annotations.ReportingSpec;
|
||||||
import google.registry.flows.custom.DomainInfoFlowCustomLogic;
|
import google.registry.flows.custom.DomainInfoFlowCustomLogic;
|
||||||
@@ -53,6 +54,8 @@ import google.registry.model.eppinput.ResourceCommand;
|
|||||||
import google.registry.model.eppoutput.EppResponse;
|
import google.registry.model.eppoutput.EppResponse;
|
||||||
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
import google.registry.model.eppoutput.EppResponse.ResponseExtension;
|
||||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||||
|
import google.registry.persistence.IsolationLevel;
|
||||||
|
import google.registry.persistence.PersistenceModule;
|
||||||
import google.registry.util.Clock;
|
import google.registry.util.Clock;
|
||||||
import jakarta.inject.Inject;
|
import jakarta.inject.Inject;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@@ -62,8 +65,12 @@ import org.joda.time.DateTime;
|
|||||||
* An EPP flow that returns information about a domain.
|
* An EPP flow that returns information about a domain.
|
||||||
*
|
*
|
||||||
* <p>The registrar that owns the domain, and any registrar presenting a valid authInfo for the
|
* <p>The registrar that owns the domain, and any registrar presenting a valid authInfo for the
|
||||||
* domain, will get a rich result with all of the domain's fields. All other requests will be
|
* domain, will get a rich result with all the domain's fields. All other requests will be answered
|
||||||
* answered with a minimal result containing only basic information about the domain.
|
* with a minimal result containing only basic information about the domain.
|
||||||
|
*
|
||||||
|
* <p>This implements {@link MutatingFlow} instead of {@link TransactionalFlow} as a workaround so
|
||||||
|
* that the common workflow of "create domain, then immediately get domain info" does not run into
|
||||||
|
* replication lag issues where the info command claims the domain does not exist.
|
||||||
*
|
*
|
||||||
* @error {@link google.registry.flows.FlowUtils.NotLoggedInException}
|
* @error {@link google.registry.flows.FlowUtils.NotLoggedInException}
|
||||||
* @error {@link google.registry.flows.FlowUtils.UnknownCurrencyEppException}
|
* @error {@link google.registry.flows.FlowUtils.UnknownCurrencyEppException}
|
||||||
@@ -76,7 +83,8 @@ import org.joda.time.DateTime;
|
|||||||
* @error {@link DomainFlowUtils.TransfersAreAlwaysForOneYearException}
|
* @error {@link DomainFlowUtils.TransfersAreAlwaysForOneYearException}
|
||||||
*/
|
*/
|
||||||
@ReportingSpec(ActivityReportField.DOMAIN_INFO)
|
@ReportingSpec(ActivityReportField.DOMAIN_INFO)
|
||||||
public final class DomainInfoFlow implements TransactionalFlow {
|
@IsolationLevel(PersistenceModule.TransactionIsolationLevel.TRANSACTION_REPEATABLE_READ)
|
||||||
|
public final class DomainInfoFlow implements MutatingFlow {
|
||||||
|
|
||||||
@Inject ExtensionManager extensionManager;
|
@Inject ExtensionManager extensionManager;
|
||||||
@Inject ResourceCommand resourceCommand;
|
@Inject ResourceCommand resourceCommand;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class FlowModuleTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void givenNonMutatingFlow_thenReplicaTmIsUsed() throws EppException {
|
void givenNonMutatingFlow_thenReplicaTmIsUsed() throws EppException {
|
||||||
String eppInputXmlFilename = "domain_info.xml";
|
String eppInputXmlFilename = "domain_check.xml";
|
||||||
FlowModule flowModule =
|
FlowModule flowModule =
|
||||||
new FlowModule.Builder().setEppInput(getEppInput(eppInputXmlFilename)).build();
|
new FlowModule.Builder().setEppInput(getEppInput(eppInputXmlFilename)).build();
|
||||||
JpaTransactionManager tm =
|
JpaTransactionManager tm =
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class DomainInfoFlowTest extends ResourceFlowTestCase<DomainInfoFlow, Domain> {
|
|||||||
ImmutableMap<String, String> substitutions,
|
ImmutableMap<String, String> substitutions,
|
||||||
boolean expectHistoryAndBilling)
|
boolean expectHistoryAndBilling)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assertMutatingFlow(false);
|
assertMutatingFlow(true);
|
||||||
String expected =
|
String expected =
|
||||||
loadFile(expectedXmlFilename, updateSubstitutions(substitutions, "ROID", "2FF-TLD"));
|
loadFile(expectedXmlFilename, updateSubstitutions(substitutions, "ROID", "2FF-TLD"));
|
||||||
if (inactive) {
|
if (inactive) {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||||
|
<command>
|
||||||
|
<check>
|
||||||
|
<domain:check
|
||||||
|
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
|
||||||
|
<domain:name>%DOMAIN%</domain:name>
|
||||||
|
</domain:check>
|
||||||
|
</check>
|
||||||
|
<clTRID>ABC-12345</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
||||||
Reference in New Issue
Block a user