Commit graph

54 commits

Author SHA1 Message Date
mcilwain
bb1b4bc0d4 Clean up third_party imports in BUILD files
This removes the following unnecessary imports:

//third_party/java/activation
//third_party/java/bouncycastle
//third_party/java/bouncycastle_bcpg
//third_party/java/dagger
//third_party/java/dnsjava
//third_party/java/jaxws_api
//third_party/java/jcommander
//third_party/java/joda_money
//third_party/java/joda_time
//third_party/java/json_simple
//third_party/java/junit
//third_party/java/mockito
//third_party/java/re2j
//third_party/java/servlet/servlet_api
//third_party/java/truth:truth8

The exact command run to generate this CL was:

build_cleaner '//third_party/java_src/gtld/...' -c '' --dep_restrictions='//third_party/java/activation,//third_party/java/bouncycastle,//third_party/java/bouncycastle_bcpg,//third_party/java/dagger,//third_party/java/dnsjava,//third_party/java/jaxws_api,//third_party/java/jcommander,//third_party/java/joda_money,//third_party/java/joda_time,//third_party/java/json_simple,//third_party/java/junit,//third_party/java/mockito,//third_party/java/re2j,//third_party/java/servlet/servlet_api,//third_party/java/truth:truth8'

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202344774
2018-07-14 01:11:51 -04:00
mcilwain
43ed2cd7b3 Clean up annotation imports in BUILD files
This affects JSR305, JSR330, and Guava annotations.

The exact command run to generate this CL was:

build_cleaner '//third_party/java_src/gtld/...' -c '' --dep_restrictions='//third_party/java/jsr330_inject,//third_party/java/jsr305_annotations,[]'

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202322747
2018-06-27 15:28:53 -04:00
mcilwain
4c7bc3b18c Improve internal build system speed
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202016862
2018-06-27 15:28:52 -04:00
mcilwain
8b263baefa Delete MultiplyingCloudDnsWriter
Now that the large zone re-signing test is complete, we no longer need it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199507075
2018-06-27 15:28:06 -04:00
jianglai
70b13596e4 Migrate to Flogger (green)
This is a 'green' Flogger migration CL. Green CLs are intended to be as
safe as possible and should be easy to review and submit.

No changes should be necessary to the code itself prior to submission,
but small changes to BUILD files may be required.

Changes within files are completely independent of each other, so this CL
can be safely split up for review using tools such as Rosie.

For more information, see []
Base CL: 197826149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198560170
2018-05-30 12:18:54 -04:00
jianglai
fc60890136 Migrate to internal FormattingLogger in preparation of migration to Flogger
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197744904
2018-05-30 12:18:54 -04:00
mcilwain
c989911526 Batch NORDN pull queue task deletions
They were failing because the maximum App Engine task batch size is 1,000, and
we currently have more than 4,000 tasks in the pull queue. We keep re-uploading
those to NORDN because we're unable to delete the tasks after successful upload,
so the leases expire and they get processed again.

Also renames TaskEnqueuer to TaskQueueUtils to reflect its newly expanded role.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197060903
2018-05-17 21:52:35 -04:00
mcilwain
96f66eacd5 Add logging statement to export commit log diffs action
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192548282
2018-04-23 14:28:27 -04:00
mcilwain
377fe5f573 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
2018-04-10 16:16:08 -04:00
mcilwain
54a8cd09ea Use some Java 8 features in commit log code
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190985373
2018-04-02 16:53:46 -04:00
guyben
2bbde9d9a9 Retry any Datastore reads in EppResource map-reduce input
Datastore has a non-zero chance of failing on reads. A map-reduce with too many
failures will eventually give up. As a result, any map-reduce that goes over a
large number of datastore entities is almost guaranteed to fail.

Since we expect to have a large number of EppResources, we make sure to wrap
all datastore reads with some retrying mechanism to reduce the number of
transient failures that propagate to Map-Reduce.

This feature already existed for CommitLogManifestReader, we refactor the code to use the same retrying mechanism in EppResource readers.

Also removed the transactNew around the reads because looking at the source - it doesn't actually do anything we need (doesn't retry on any failure other than concurrency failure)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190633281
2018-04-02 16:44:29 -04:00
mcilwain
81dc2bbbc3 Rationalize logging statements across codebase
This fixes up the following problems:
1. Using string concatenation instead of the formatting variant methods.
2. Logging or swallowing exception messages without logging the exception
   itself (this swallows the stack trace).
3. Unnecessary logging on re-thrown exceptions.
4. Unnecessary use of formatting variant methods when not necessary.
5. Complicated logging statements involving significant processing not being
   wrapped inside of a logging level check.
6. Redundant logging both of an exception itself and its message (this is
   unnecessary duplication).
7. Use of the base Logger class instead of our FormattingLogger class.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182419837
2018-01-19 14:56:45 -05:00
guyben
2c96633a20 Replace Stream.concat with Streams.concat
Stream.concat only accepts 2 parameters. Streams.concat on the other hand
accepts any number of parameters.

Moving to Streams.concat for all uses (2 or more) makes sense for uniformity
and convenience reasons.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179716648
2017-12-27 11:35:47 -05:00
guyben
8157928a35 Replace com.google.common.base.Function with java.util.function.Function
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179249159
2017-12-27 11:08:55 -05:00
jianglai
1c1f95992a Move backported JUnit file to third_party (part 2)
Last commit did not pick up all the changes because MOE incorrectly attributed some changes to the wrong commit. This commit should reconcile these. Also picked up some changes to how hamcrest library is depended upon in BUILD file, which should have been included in previous commits.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177637931
2017-12-02 11:37:46 -05:00
mcilwain
e2db3f914e Clean up some code quality issues
This removes some qualifiers that aren't necessary (e.g. public/abstract on interfaces, private on enum constructors, final on private methods, static on nested interfaces/enums), uses Java 8 lambdas and features where that's an improvement

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177182945
2017-12-01 22:14:06 -05:00
mcilwain
bbe2584da4 Refactor Guava functional methods to use lambdas
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177027488
2017-12-01 22:14:05 -05:00
mcilwain
cd314bdc75 Replace many Work and VoidWork usages with lambdas
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176153460
2017-11-21 18:45:12 -05:00
mcilwain
2aa897e698 Remove unnecessary generic type arguments
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175155365
2017-11-21 18:17:31 -05:00
mcilwain
1790914058 Add Runnable overrides to ease use of Java 8 language features
Runnable and Callable are both @FunctionalInterfaces. The difference is
that Callable requires a return value whereas Runnable does not, so in
situations where we don't care about a return value, rather than having to
add an unnecessary 'return null;' at the end of the lambda, we can simply
use a non-returning Runnable instead.

Unfortunately, owing to legacy reasons, Runnable is not declared to throw
checked exceptions whereas Callable is, so in situations where checked
exceptions are thrown we still need to have a 'return null;' call at the
end.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172935400
2017-10-24 16:53:47 -04:00
mcilwain
b01fa6b4c9 Use more efficient logging statements
The infofmt versions only perform string concatenation if info logging
is turned on, rather than doing so all of the time.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172889338
2017-10-24 16:53:47 -04:00
guyben
15e03a8b1a Count EppResources that don't have an "old enough" revision
DeleteOldCommitLogs uses the revisions of EPP resources to know which commit logs are still in use.

This means that if the revision list of some EPP resources is corrupt in any way, we might delete commit logs that are still needed.

Here we add a basic sanity check for the revision list: we check it has at least one revision older than the "threshold", where the "threshold" is the oldest date we need to be able to recreate using the commit logs.

If we find an error, we log it (and increment a counter). There's nothing we can to do fix it thought.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172780418
2017-10-24 16:53:47 -04:00
mcilwain
c0f8da0c6e Switch from Guava Optionals to Java 8 Optionals
This was a surprisingly involved change. Some of the difficulties included
java.util.Optional purposely not being Serializable (so I had to move a
few Optionals in mapreduce classes to @Nullable) and having to add the Truth
Java8 extension library for assertion support.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171863777
2017-10-24 16:53:47 -04:00
bbilbo
9a3877fdb2 Add a log message indicating that the restore is complete
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171719014
2017-10-24 16:53:47 -04:00
mcilwain
5edb7935ed Run automatic Java 8 conversion over codebase
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
2017-10-10 12:09:41 -04:00
bbilbo
3584bbde53 Allow restore commit logs action in the crash environment
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171042730
2017-10-05 11:43:23 -04:00
guyben
ccc51daa9f Add and fix mapreduce counters
Lessons from the first full run of the mapreduce.

Fixed the "old manifests still referenced" counter, since some of these
manifests could be new.

Added a debug "manifests incorrectly mapped multiple times" that is expected to never happen, but who knows? (this is a sort of sanity check for the mapreduce)

Added an "Epp resource revisions handled" that counts the total references, allowing for the possibility of the same manifest being referenced from multiple resources - this is expected to be equal to the map's "Epp resource revisions found" counter.

Added a "commit log manifests referenced multiple times" to see how often the same manifest is linked to from different epp resources.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166846879
2017-08-29 17:21:43 -04:00
guyben
f9a2415954 Check that CommitLogManifest exists before deletion
It appears that there are some possible flows where the reducer runs twice on
the same key. Either because of some error in a subsequent key that makes the
entire shard become ignored and retried, or possible some obscure error outside
of the transaction on that key.

The result however is that sometimes the reducer runs on a key that has already
been deleted. We need to check for that to prevent a null pointer exception.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166112173
2017-08-29 17:02:12 -04:00
guyben
cf94d69a3e Map over Key instead of actual instances when deleting old commit logs
Attempting to run DeleteOldCommitLogs in prod resulted in a lot of DatastoreTimeoutException errors. The assumption is that attempting to load so many CommitLogManifests (over 200 million of them), when each one has a slight possibility of failure, has a very high probability of error.

The shard aborts after 20 of these errors, and by eliminating as many loads as possible and retrying the remaining loads inside a transaction we are effectively eliminating any exceptions "leaking" out to the mapreduce framework, which will hopefully keep us bellow 20. At least, that's our best guess currently as to why the mapreduce fails.

EppResources are loaded in the map stage to get the revisions, and CommitLogManifests are only loaded in the reduce stage for sanity check so we don't accidentally delete resources we need in prod. Both of these are wrapped in transactNew to make sure they retry individually.

The only "load" not done inside a transaction is the EppResourceIndex, but there's no getting around that without rewriting the EppResourceInputs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164176764
2017-08-29 15:40:41 -04:00
mcilwain
d9613cf69a Add sanity check on commit log deletion
I know the query that finds commit logs already should ignore commit logs
that are too young, but this adds an explicit sanity check for safety's
sake, so we don't have to depend solely on an indexed query for safety.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162386413
2017-08-01 16:46:50 -04:00
guyben
268abbc383 Add option for dry run
The dry run does all the steps except the deletion. All the counters will
return the same values they would have returned on an actual run.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162379609
2017-08-01 16:45:28 -04:00
guyben
882db28ee0 Set the number of map shards to 20
This change is motivated by the sandbox run where we saw the backend instances overwhelmed by the 100 default shards to the point where they couldn't even answer a simple status request.

Production has 50 backend instances, so 20 will leave a lot of spare for other tasks.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162357857
2017-08-01 16:41:19 -04:00
guyben
e224a67eda Change @Auth to an AutoValue, and created a set of predefined Auths
We want to be safer and more explicit about the authentication needed by the many actions that exist.

As such, we make the 'auth' parameter required in @Action (so it's always clear who can run a specific action) and we replace the @Auth with an enum so that only pre-approved configurations that are aptly named and documented can be used.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162210306
2017-08-01 16:33:10 -04:00
guyben
944d7a91d1 Update DeleteOldCommitLogs to only delete unreferenced logs
Now instead of deleting "all logs older than X", we delete "all logs older than
X that don't have any EppResource.getRevision()" pointing to them.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161455827
2017-07-12 11:03:50 -04:00
mmuller
b733443eab Create nomulus tool restore command
Create a nomulus tool restoreCommitLogs command.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=157103177
2017-06-05 18:17:09 -04:00
mmuller
e6af34301d Move restore from backend to tools
Move the "restoreCommitLogs" command from the backend module to the tools
module so it's easier to access with nomulus.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156768389
2017-05-23 17:22:49 -04:00
mmuller
70e3271319 Add "toTime" parameter to RestoreCommitLogsAction web form
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155500640
2017-05-17 11:46:18 -04:00
mmuller
3eef5095d4 Deal with gaps and forks in commit history
If there are gaps or forks in the commit log history files, raise an exception
and display the possible sets of files in the log files.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=155219410
2017-05-17 11:30:36 -04:00
cgoldfeder
c596d23523 Add loadWithMemcache() to Ofy
Also clean up some minor uses of load() to standardize calls.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154067731
2017-04-26 10:57:41 -04:00
mcilwain
cdadb54acd Refer to Datastore everywhere correctly by its capitalized form
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147479683
2017-02-17 12:12:12 -05:00
nickfelt
5d4a88e5ce Add @VirtualEntity checking to Ofy's deleteWithoutBackup()
This was an oversight I noticed ages ago, so resurrecting some old local changes I had to correct it.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146812322
2017-02-08 17:31:07 -05:00
mmuller
b70f57b7c7 Update copyright year on all license headers
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=146111211
2017-02-02 16:27:22 -05:00
mcilwain
eaec03e670 Move ConfigModule and LocalTestConfig into RegistryConfig
This is the final preparatory step necessary in order to load and load
configuration from YAML in a static context and then provide it either via
Dagger (using ConfigModule) or through RegistryConfig's existing static
functions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143819983
2017-01-09 12:01:09 -05:00
jart
734130aa73 Restructure Maven dependencies in build
We're now using java_import_external instead of maven_jar. This allows
us to specify the relationships between jars, thereby allowing us to
eliminate scores of vendor BUILD files that did nothing but re-export
@foo//jar targets, thus addressing the concerns of djhworld on Hacker
News: https://news.ycombinator.com/item?id=12738072

We now have redundant failover mirrors, which is a feature I added to
Bazel 0.4.2 in ed7ced0018

A new standard naming convention is now being used for all Maven repos.
Those names are calculated from the group_artifact name using the
following algorithm that eliminates redundancy:
https://gist.github.com/jart/41bfd977b913c2301627162f1c038e55

The JSR330 dep has been removed from java targets if they also depend
on Dagger, since Dagger always exports JSR330.

Annotation processor dependencies should now be leaner and meaner, by
more appropriately managing what needs to be on the classpath at
runtime. This should trim down the production jar by >1MB. As it stands
currently in the open source world:

- backend_jar_deploy.jar: 50MB
- frontend_jar_deploy.jar: 30MB
- tools_jar_deploy.jar: 45MB

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143487929
2017-01-09 11:59:04 -05:00
mcilwain
28f6c770c8 Add MOE equivalence for sync on 2016-12-19
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=142449539
2017-01-09 11:59:04 -05:00
mcilwain
2b7d580bb3 Run buildifier on codebase to format BUILD files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140362453
2016-11-28 18:15:21 -05:00
jart
2e81de9954 Make essential Bazel packages publicly visible
This allows separate Bazel projects to reference Nomulus as an external
repository. They can then copy the []
directory structure into their own project and customize the Action
and Module lists for the GAE modules in their own deployment.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136863886
2016-10-24 11:57:00 -04:00
shikhman
f76bc70f91 Preserve test logs and test summary output for Kokoro CI runs
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135494972
2016-10-14 16:57:43 -04:00
mcilwain
e864fedab1 Remove trailing whitespace in files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135386752
2016-10-07 15:29:47 -04:00
Justine Tunney
7f3f03ee97 MOE strip compatible_with
This is an internal-only feature that breaks the open source build.

CL created with:

    dr-replace '(compatible_with.*)' '\1  # MOE:strip_line'

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=128852873
2016-08-02 19:14:28 -04:00