Fix EPP update NS delete bug (#1665)

This commit is contained in:
Lai Jiang 2022-06-10 12:42:31 -04:00 committed by GitHub
parent 48cc12e016
commit 199d02a4cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 19 deletions

View file

@ -50,7 +50,6 @@ import com.google.common.collect.Ordering;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.flogger.FluentLogger; import com.google.common.flogger.FluentLogger;
import com.google.common.net.InternetDomainName; import com.google.common.net.InternetDomainName;
import google.registry.config.RegistryEnvironment;
import google.registry.dns.DnsQueue; import google.registry.dns.DnsQueue;
import google.registry.flows.EppException; import google.registry.flows.EppException;
import google.registry.flows.ExtensionManager; import google.registry.flows.ExtensionManager;
@ -150,7 +149,6 @@ public final class DomainUpdateFlow implements TransactionalFlow {
private static final FluentLogger logger = FluentLogger.forEnclosingClass(); private static final FluentLogger logger = FluentLogger.forEnclosingClass();
private boolean isNsDelete;
@Inject ResourceCommand resourceCommand; @Inject ResourceCommand resourceCommand;
@Inject ExtensionManager extensionManager; @Inject ExtensionManager extensionManager;
@Inject EppInput eppInput; @Inject EppInput eppInput;
@ -205,16 +203,6 @@ public final class DomainUpdateFlow implements TransactionalFlow {
EntityChanges.newBuilder().setSaves(entitiesToSave.build()).build()) EntityChanges.newBuilder().setSaves(entitiesToSave.build()).build())
.build()); .build());
persistEntityChanges(entityChanges); persistEntityChanges(entityChanges);
// Ideally we would like to reload the persisted entity and show what is actually persisted, but
// reloading in the current session will only give back the cached version in Hibernate. It is
// impossible to see what is actually persisted in the DB because PSQL doesn't support
// READ_UNCOMMITTED. So even if we call flush here and query with another entitymanager at
// READ_UNCOMMITTED isolation level, PSQL won't show us the new data. Therefore, we have to make
// do with trusting that the to-be-persisted entity is persisted as-is by the transaction
// manager.
if (isNsDelete) {
logger.atInfo().log("Nameservers to persist:\n%s", newDomain.getNameservers());
}
return responseBuilder.build(); return responseBuilder.build();
} }
@ -252,12 +240,6 @@ public final class DomainUpdateFlow implements TransactionalFlow {
throws EppException { throws EppException {
AddRemove add = command.getInnerAdd(); AddRemove add = command.getInnerAdd();
AddRemove remove = command.getInnerRemove(); AddRemove remove = command.getInnerRemove();
if (RegistryEnvironment.get() != RegistryEnvironment.PRODUCTION
&& !remove.getNameservers().isEmpty()) {
isNsDelete = true;
logger.atInfo().log("Current nameservers:\n%s", tm().loadByEntity(domain).getNsHosts());
logger.atInfo().log("Nameservers to remove:\n%s", remove.getNameservers());
}
checkSameValuesNotAddedAndRemoved(add.getNameservers(), remove.getNameservers()); checkSameValuesNotAddedAndRemoved(add.getNameservers(), remove.getNameservers());
checkSameValuesNotAddedAndRemoved(add.getContacts(), remove.getContacts()); checkSameValuesNotAddedAndRemoved(add.getContacts(), remove.getContacts());
checkSameValuesNotAddedAndRemoved(add.getStatusValues(), remove.getStatusValues()); checkSameValuesNotAddedAndRemoved(add.getStatusValues(), remove.getStatusValues());

View file

@ -53,7 +53,7 @@ public class VKey<T> extends ImmutableObject implements Serializable {
Serializable sqlKey; Serializable sqlKey;
// The objectify key for the referenced entity. // The objectify key for the referenced entity.
Key<T> ofyKey; @Insignificant Key<T> ofyKey;
Class<? extends T> kind; Class<? extends T> kind;