Disable memcache completely

We've determined that getting correctness semantics right, even
in the few cases that it is possible to do so (see linked bug for
audit) is not worth the bother in terms of highly complicated code
and potential bugs. This CL turns off memcache at the Ofy level
but doesn't rip out the annotations etc. so that we can quickly
turn it back on if this turns out to have been a mistake.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155227761
This commit is contained in:
cgoldfeder 2017-05-05 12:31:00 -07:00 committed by Ben McIlwain
parent 608e121a37
commit 275d6ddc10
7 changed files with 3 additions and 133 deletions

View file

@ -25,7 +25,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.persistResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResource;
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
import static google.registry.testing.MemcacheHelper.setMemcacheContents;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@ -35,7 +34,6 @@ import com.googlecode.objectify.Key;
import com.googlecode.objectify.VoidWork;
import google.registry.model.EntityTestCase;
import google.registry.model.common.EntityGroupRoot;
import google.registry.model.ofy.RequestCapturingAsyncDatastoreService;
import google.registry.model.registrar.Registrar.State;
import google.registry.model.registrar.Registrar.Type;
import google.registry.testing.ExceptionRule;
@ -396,13 +394,4 @@ public class RegistrarTest extends EntityTestCase {
assertThat(Registrar.loadByClientId("registrar")).isNotNull();
assertThat(ofy().getSessionKeys()).contains(Key.create(registrar));
}
@Test
public void testLoadByClientId_usesMemcache() {
setMemcacheContents(Key.create(registrar));
int numPreviousReads = RequestCapturingAsyncDatastoreService.getReads().size();
Registrar.loadByClientId("registrar");
int numReadsInLoad = RequestCapturingAsyncDatastoreService.getReads().size() - numPreviousReads;
assertThat(numReadsInLoad).isEqualTo(0);
}
}

View file

@ -24,7 +24,6 @@ import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newRegistry;
import static google.registry.testing.DatastoreHelper.persistPremiumList;
import static google.registry.testing.DatastoreHelper.persistReservedList;
import static google.registry.testing.MemcacheHelper.setMemcacheContents;
import static google.registry.util.DateTimeUtils.END_OF_TIME;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.money.CurrencyUnit.EUR;
@ -34,7 +33,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.googlecode.objectify.Key;
import google.registry.model.EntityTestCase;
import google.registry.model.ofy.RequestCapturingAsyncDatastoreService;
import google.registry.model.registry.Registry.RegistryNotFoundException;
import google.registry.model.registry.Registry.TldState;
import google.registry.model.registry.label.PremiumList;
@ -480,18 +478,4 @@ public class RegistryTest extends EntityTestCase {
.setEapFeeSchedule(ImmutableSortedMap.of(START_OF_TIME, Money.zero(EUR)))
.build();
}
@Test
public void testLoadHitsMemcache() {
Registry registry = Registry.get("tld");
// In unit tests the in-memory cache has a duration of 0, so even without this line we should
// expect this to hit memcache. Nevertheless, remove it from the cache explicitly so that if the
// unit test caching is ever set to nonzero this won't spuriously pass.
registry.invalidateInCache();
setMemcacheContents(Key.create(getCrossTldKey(), Registry.class, "tld"));
int numPreviousReads = RequestCapturingAsyncDatastoreService.getReads().size();
Registry.get("tld");
int numReadsForGet = RequestCapturingAsyncDatastoreService.getReads().size() - numPreviousReads;
assertThat(numReadsForGet).isEqualTo(0);
}
}