Filter missing dsData digests during replay (#1439)

This is a result of bad data (we should never allow a null digest) and
we'll need to fix that separately, but this allows us to not fail on
this during replay
This commit is contained in:
gbrodman 2021-11-30 15:37:42 -05:00 committed by GitHub
parent 7af9531d52
commit a46907df0e
2 changed files with 4 additions and 0 deletions

View file

@ -14,6 +14,8 @@
package google.registry.model.domain;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import com.googlecode.objectify.Key;
import google.registry.model.EppResource;
import google.registry.model.EppResource.ForeignKeyedEppResource;
@ -168,6 +170,7 @@ public class DomainBase extends DomainContent
@Override
public void beforeSqlSaveOnReplay() {
fullyQualifiedDomainName = DomainNameUtils.canonicalizeDomainName(fullyQualifiedDomainName);
dsData = dsData.stream().filter(datum -> datum.getDigest() != null).collect(toImmutableSet());
}
@Override

View file

@ -317,6 +317,7 @@ public class DomainHistory extends HistoryEntry implements SqlEntity {
domainHistory.nsHosts = nullToEmptyImmutableCopy(domainHistory.domainContent.nsHosts);
domainHistory.dsDataHistories =
nullToEmptyImmutableCopy(domainHistory.domainContent.getDsData()).stream()
.filter(dsData -> dsData.getDigest() != null)
.map(dsData -> DomainDsDataHistory.createFrom(domainHistory.id, dsData))
.collect(toImmutableSet());
domainHistory.gracePeriodHistories =