From 560873f85f61e25fbbf6df1a4793a4f0e224f68a Mon Sep 17 00:00:00 2001 From: Tom Andersen Date: Mon, 19 Jun 2023 15:49:50 -0400 Subject: [PATCH 1/4] Backend has changed behavour casuing test to fail. --- .../com/google/cloud/firestore/TransactionOptions.java | 6 +++--- .../com/google/cloud/firestore/TransactionRunner.java | 4 +--- .../java/com/google/cloud/firestore/it/ITSystemTest.java | 9 ++++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java index 14dd408194..8c754a2c28 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java @@ -91,7 +91,7 @@ public TransactionOptionsType getType() { /** * A {@link Timestamp} specifying the time documents are to be read at. If null, the server will * read documents at the most up to date available. If non-null, the specified {@code Timestamp} - * may not be more than 60 seconds in the past (evaluated when the request is processed by the + * may not be more than 270 seconds in the past (evaluated when the request is processed by the * server). * * @return The specific time to read documents at. A null value means reading the most up to date @@ -239,10 +239,10 @@ public TimestampOrBuilder getReadTime() { } /** - * Specify to read documents at the given time. This may not be more than 60 seconds in the past + * Specify to read documents at the given time. This may not be more than 270 seconds in the past * from when the request is processed by the server. * - * @param readTime The specific time to read documents at. Must not be older than 60 seconds. A + * @param readTime The specific time to read documents at. Must not be older than 270 seconds. A * null value means read most up to date data. * @return {@code this} builder */ diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionRunner.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionRunner.java index 420f41e08e..c247b1bed5 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionRunner.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionRunner.java @@ -126,9 +126,7 @@ public ApiFuture apply(Void input) { final SettableApiFuture backoff = SettableApiFuture.create(); // Add a backoff delay. At first, this is 0. firestoreExecutor.schedule( - () -> { - backoff.set(null); - }, + () -> backoff.set(null), nextBackoffAttempt.getRandomizedRetryDelay().toMillis(), TimeUnit.MILLISECONDS); diff --git a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITSystemTest.java b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITSystemTest.java index 51e561ff73..ef036998ef 100644 --- a/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITSystemTest.java +++ b/google-cloud-firestore/src/test/java/com/google/cloud/firestore/it/ITSystemTest.java @@ -1559,12 +1559,15 @@ public void readOnlyTransaction_failureWhenAttemptReadOlderThan60Seconds() throws ExecutionException, InterruptedException, TimeoutException { final DocumentReference documentReference = randomColl.add(SINGLE_FIELD_MAP).get(); - // Exception isn't thrown until 5 minutes. - final long tenMinutes = System.currentTimeMillis() / 1000 - 600; + // Exception isn't thrown until 60 minutes. + // To ensure we exceed this, we use 120 minutes. + // If this test fails, we should likely be update documentation to reflect new value. See all + // usages of "Read Time" on proto, and within SDK. + final long twoHours = System.currentTimeMillis() / 1000 - 7200; final TransactionOptions options = TransactionOptions.createReadOnlyOptionsBuilder() .setReadTime( - com.google.protobuf.Timestamp.newBuilder().setSeconds(tenMinutes).setNanos(0)) + com.google.protobuf.Timestamp.newBuilder().setSeconds(twoHours).setNanos(0)) .build(); final ApiFuture runTransaction = From 8f09e09a9699b46067c309c39d1f5b0ac3efd297 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 19 Jun 2023 19:54:16 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../java/com/google/cloud/firestore/TransactionOptions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java index 8c754a2c28..96983586a5 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java @@ -239,8 +239,8 @@ public TimestampOrBuilder getReadTime() { } /** - * Specify to read documents at the given time. This may not be more than 270 seconds in the past - * from when the request is processed by the server. + * Specify to read documents at the given time. This may not be more than 270 seconds in the + * past from when the request is processed by the server. * * @param readTime The specific time to read documents at. Must not be older than 270 seconds. A * null value means read most up to date data. From 82c1bc6d517e3ce88073687c0fef73e79c92ae83 Mon Sep 17 00:00:00 2001 From: Tom Andersen Date: Tue, 20 Jun 2023 12:56:47 -0400 Subject: [PATCH 3/4] Update maximum minutes in past. --- .../java/com/google/cloud/firestore/TransactionOptions.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java index 96983586a5..441664700a 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java @@ -91,7 +91,7 @@ public TransactionOptionsType getType() { /** * A {@link Timestamp} specifying the time documents are to be read at. If null, the server will * read documents at the most up to date available. If non-null, the specified {@code Timestamp} - * may not be more than 270 seconds in the past (evaluated when the request is processed by the + * may not be more than 60 minutes in the past (evaluated when the request is processed by the * server). * * @return The specific time to read documents at. A null value means reading the most up to date @@ -239,10 +239,10 @@ public TimestampOrBuilder getReadTime() { } /** - * Specify to read documents at the given time. This may not be more than 270 seconds in the + * Specify to read documents at the given time. This may not be more than 60 minutes in the * past from when the request is processed by the server. * - * @param readTime The specific time to read documents at. Must not be older than 270 seconds. A + * @param readTime The specific time to read documents at. Must not be older than 60 minutes. A * null value means read most up to date data. * @return {@code this} builder */ From f28732a86e6392f829aeccd6a3b647f45062097c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Tue, 20 Jun 2023 16:59:18 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../java/com/google/cloud/firestore/TransactionOptions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java index 441664700a..57d13e0ede 100644 --- a/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java +++ b/google-cloud-firestore/src/main/java/com/google/cloud/firestore/TransactionOptions.java @@ -239,8 +239,8 @@ public TimestampOrBuilder getReadTime() { } /** - * Specify to read documents at the given time. This may not be more than 60 minutes in the - * past from when the request is processed by the server. + * Specify to read documents at the given time. This may not be more than 60 minutes in the past + * from when the request is processed by the server. * * @param readTime The specific time to read documents at. Must not be older than 60 minutes. A * null value means read most up to date data.