mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Delete applications even when index is missing
This makes the deletion mapreduce more resilient in the face of data integrity violations (which exist on sandbox but hopefully not in production). Even when the domain application index doesn't exist, we still want to delete the domain application itself, as its continuing presence will cause problems after the code for domain applications is deleted. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=228521794
This commit is contained in:
parent
ce29e73879
commit
02174a2cff
2 changed files with 42 additions and 5 deletions
|
@ -75,20 +75,34 @@ public class KillAllDomainApplicationsAction implements Runnable {
|
|||
getContext().incrementCounter("applications already deleted");
|
||||
return;
|
||||
}
|
||||
|
||||
Key<DomainApplication> applicationKey = Key.create(application);
|
||||
DomainApplicationIndex dai =
|
||||
ofy().load().key(DomainApplicationIndex.createKey(application)).now();
|
||||
EppResourceIndex eri =
|
||||
ofy().load().entity(EppResourceIndex.create(applicationKey)).now();
|
||||
if (dai == null || eri == null) {
|
||||
|
||||
if (dai == null) {
|
||||
logger.atSevere().log(
|
||||
"Missing index(es) for application %s; skipping.", applicationKey);
|
||||
getContext().incrementCounter("missing indexes");
|
||||
return;
|
||||
"Missing domain application index for application %s.", applicationKey);
|
||||
getContext().incrementCounter("missing domain application indexes");
|
||||
} else {
|
||||
ofy().delete().entity(dai);
|
||||
}
|
||||
|
||||
// This case shouldn't be possible except in extremely rare circumstances, as this
|
||||
// mapreduce itself is relying on EPP resource indexes to load the domain
|
||||
// applications to delete.
|
||||
if (eri == null) {
|
||||
logger.atSevere().log(
|
||||
"Missing EPP resource index for application %s.", applicationKey);
|
||||
getContext().incrementCounter("missing EPP resource indexes");
|
||||
} else {
|
||||
ofy().delete().entity(eri);
|
||||
}
|
||||
|
||||
// Delete the application, its descendents, and the indexes.
|
||||
ofy().delete().keys(ofy().load().ancestor(application).keys());
|
||||
ofy().delete().entities(dai, eri);
|
||||
logger.atInfo().log("Deleted domain application %s.", applicationKey);
|
||||
getContext().incrementCounter("applications deleted");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue