Action to delete all cross-tld entities.

Plus refactoring of the KillAllXXXActions and tests to share
common code.

This essentially completes the KillAll []s. We can now reliably
clean out everything except for:
 * Lock - harmless to leave alone or delete from the gae console
 * GaeUserIdConverter - same
 * RdeRevision - filed [] to track, but harmless if not cleaned up
 * ForeignKeyHostIndex of renamed hosts - tracked in []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120781975
This commit is contained in:
cgoldfeder 2016-04-25 22:09:58 -07:00 committed by Justine Tunney
parent ac2f17e10f
commit a41677aea1
9 changed files with 508 additions and 205 deletions

View file

@ -47,7 +47,7 @@ public class KillAllEppResourcesAction implements MapreduceAction {
@Inject KillAllEppResourcesAction() {}
@Override
public void run() {
public final void run() {
checkArgument( // safety
RegistryEnvironment.get() == RegistryEnvironment.CRASH
|| RegistryEnvironment.get() == RegistryEnvironment.UNITTEST,
@ -61,25 +61,26 @@ public class KillAllEppResourcesAction implements MapreduceAction {
ImmutableList.of(EppResourceInputs.createIndexInput()))));
}
/**
* Mapper to delete an {@link EppResourceIndex}, its referent, all descendants of each referent,
* and the {@link ForeignKeyIndex} or {@link DomainApplicationIndex} of the referent, as
* appropriate.
*
* <p>This will delete:
* <ul>
* <li>All {@link ForeignKeyIndex} types
* <li>{@link DomainApplicationIndex}
* <li>{@link EppResourceIndex}
* <li>All {@link EppResource} types
* <li>{@code HistoryEntry}
* <li>All {@code BillingEvent} types
* <li>All {@code PollMessage} types
* </ul>
*/
static class KillAllEppResourcesMapper extends Mapper<EppResourceIndex, Key<?>, Key<?>> {
private static final long serialVersionUID = 8205309000002507407L;
/**
* Delete an {@link EppResourceIndex}, its referent, all descendants of each referent, and the
* {@link ForeignKeyIndex} or {@link DomainApplicationIndex} of the referent, as appropriate.
*
* <p>This will delete:
* <ul>
* <li>All {@link ForeignKeyIndex} types
* <li>{@link DomainApplicationIndex}
* <li>{@link EppResourceIndex}
* <li>All {@link EppResource} types
* <li>{@code HistoryEntry}
* <li>All {@code BillingEvent} types
* <li>All {@code PollMessage} types
* </ul>
*/
@Override
public void map(final EppResourceIndex eri) {
Key<EppResourceIndex> eriKey = Key.create(eri);