Skip to content

Commit fb73ed5

Browse files
fix(datastore): update emulator zip checksum for 2.3.1 (#14592)
Fixes #12058. `LocalDatastoreHelper` still hands `e0d1170519cf52e2e5f9f93892cdf70c` to `DownloadableEmulatorRunner`, and that is the checksum of the *2.0.2* archive, not the 2.3.1 one it now points at. Found the culprit while going through the file history: `e17b57b6` moved `MIN_VERSION` to 2.0.2 and set the checksum that matched, then `9eb86f06` (#1698) moved `MIN_VERSION` on to 2.3.1 and didn't bring the checksum along. `curl -I` on the old zip still reports `ETag: e0d1170519cf52e2e5f9f93892cdf70c`, which is how I spotted it. Since `downloadZipFile()` compares the two and re-fetches on mismatch, the condition was true on every call and each `start()` pulled ~36 MB again even with a perfectly good copy sitting in `java.io.tmpdir`. Verified against the real artifact rather than just eyeballing the string. The 2.3.1 zip is 37,929,131 bytes; downloading it and running `md5sum` gives `7c1f5a3276241a8f78cb1a837daaaa47`, and GCS agrees (`ETag` plus the `x-goog-hash` md5, base64 `fB9aMnYkGo94yxqDfaqqRw==`). I also replayed the check from `BaseEmulatorHelper` over the downloaded file: the old constant makes it re-download, the new one lets it use the cached copy. The second commit is a separate small thing I ran into in the same constructor, so it's easy to drop if you'd rather keep this to one change: the gcloud command line is built from the raw `builder.consistency` while the downloadable runner's uses `getConsistency()`. `newBuilder().build()` leaves `builder.consistency` at 0.0 while `getConsistency()` resolves to `DEFAULT_CONSISTENCY` (0.9), so the two runners disagree for the same helper. Using `getConsistency()` in both makes them match. --------- Co-authored-by: rootkiller6788 <rootkiller6788@users.noreply.github.com>
1 parent 40b2b1a commit fb73ed5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/testing/LocalDatastoreHelper.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> {
6565
// Downloadable emulator settings
6666
private static final String BIN_NAME = "cloud-datastore-emulator/cloud_datastore_emulator";
6767
private static final String FILENAME = "cloud-datastore-emulator-" + MIN_VERSION + ".zip";
68-
private static final String MD5_CHECKSUM = "e0d1170519cf52e2e5f9f93892cdf70c";
68+
private static final String MD5_CHECKSUM = "7c1f5a3276241a8f78cb1a837daaaa47";
6969
private static final String BIN_CMD_PORT_FLAG = "--port=";
7070
private static final URL EMULATOR_URL;
7171
private static final String EMULATOR_URL_ENV_VAR = "DATASTORE_EMULATOR_URL";
@@ -176,7 +176,7 @@ private LocalDatastoreHelper(Builder builder) {
176176
} else {
177177
// At most one of --consistency | --use-firestore-in-datastore-mode can be specified.
178178
// --consistency will be ignored with --use-firestore-in-datastore-mode.
179-
gcloudCommand.add(CONSISTENCY_FLAG + builder.consistency);
179+
gcloudCommand.add(CONSISTENCY_FLAG + getConsistency());
180180
}
181181
if (!builder.storeOnDisk) {
182182
gcloudCommand.add("--no-store-on-disk");

0 commit comments

Comments
 (0)