Temporarily change RDE to ignore bad transfer data

Because RDE reads from the commit logs to get its data, the bad transfer data resulting from a bug in the system is currently preventing proper RDE operation even for domains which have been fixed in Datastore. This CL adds a check to see if the transfer data is messed up (i.e. it doesn't have valid gaining and losing registrars), and if so, omits it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141074673
This commit is contained in:
mountford 2016-12-05 11:20:00 -08:00 committed by Ben McIlwain
parent 11584c31d8
commit fbbcf41503

View file

@ -18,6 +18,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
import com.google.common.base.Ascii;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.contact.ContactResource;
@ -223,8 +224,13 @@ final class DomainResourceToXjcConverter {
// domain name object's validity period (expiry date) if the
// transfer caused or causes a change in the validity period.
if (model.getTransferData() != TransferData.EMPTY) {
bean.setTrnData(
convertTransferData(model.getTransferData(), model.getRegistrationExpirationTime()));
// Temporary check to make sure that there really was a transfer. A bug caused spurious
// empty transfer records to get generated for deleted domains.
// TODO(b/33289763): remove the hasGainingAndLosingRegistrars check in February 2017
if (hasGainingAndLosingRegistrars(model)) {
bean.setTrnData(convertTransferData(model.getTransferData(),
model.getRegistrationExpirationTime()));
}
}
break;
@ -235,6 +241,12 @@ final class DomainResourceToXjcConverter {
return bean;
}
private static boolean hasGainingAndLosingRegistrars(DomainResource model) {
return
!Strings.isNullOrEmpty(model.getTransferData().getGainingClientId())
&& !Strings.isNullOrEmpty(model.getTransferData().getLosingClientId());
}
/** Converts {@link TransferData} to {@link XjcRdeDomainTransferDataType}. */
private static XjcRdeDomainTransferDataType convertTransferData(
TransferData model, DateTime domainExpires) {