Allow number of commit log buckets to be increased

Also increases the number of commit log buckets on alpha to 397 and correspondingly
reduces the frequency of commit log diff exporting to once every 3 minutes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191440586
This commit is contained in:
mcilwain 2018-04-03 07:58:58 -07:00 committed by Ben McIlwain
parent 951ba78cef
commit 377fe5f573
4 changed files with 109 additions and 9 deletions

View file

@ -17,6 +17,7 @@ package google.registry.model.ofy;
import static com.google.common.base.Preconditions.checkArgument;
import static org.joda.time.DateTimeZone.UTC;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.googlecode.objectify.Key;
@ -71,12 +72,11 @@ public class CommitLogCheckpoint extends ImmutableObject {
}
/**
* Creates a CommitLogCheckpoint for the given wall time and bucket checkpoint times, specified
* as a map from bucket ID to bucket commit timestamp.
* Creates a CommitLogCheckpoint for the given wall time and bucket checkpoint times, specified as
* a map from bucket ID to bucket commit timestamp.
*/
public static CommitLogCheckpoint create(
DateTime checkpointTime,
ImmutableMap<Integer, DateTime> bucketTimestamps) {
DateTime checkpointTime, ImmutableMap<Integer, DateTime> bucketTimestamps) {
checkArgument(
Objects.equals(CommitLogBucket.getBucketIds().asList(), bucketTimestamps.keySet().asList()),
"Bucket ids are incorrect: %s",
@ -87,6 +87,20 @@ public class CommitLogCheckpoint extends ImmutableObject {
return instance;
}
/**
* Creates a CommitLogCheckpoint for the given wall time and bucket checkpoint times. Test only.
*
* <p>This lacks validation on the bucketTimestamps map.
*/
@VisibleForTesting
public static CommitLogCheckpoint createForTest(
DateTime checkpointTime, ImmutableMap<Integer, DateTime> bucketTimestamps) {
CommitLogCheckpoint instance = new CommitLogCheckpoint();
instance.checkpointTime = checkpointTime.getMillis();
instance.bucketTimestamps = ImmutableList.copyOf(bucketTimestamps.values());
return instance;
}
/** Creates a key for the CommitLogCheckpoint for the given wall time. */
public static Key<CommitLogCheckpoint> createKey(DateTime checkpointTime) {
return Key.create(