diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index b9c5b09c7..b49924db5 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -14,4 +14,4 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest digest: sha256:1fb09a3eb66af09221da69087fd1b4d075bc7c79e508d0708f5dc0f842069da2 -# created: 2024-02-05T19:43:08.106031548Z +# created: 2024-02-05T19:43:08.106031548Z \ No newline at end of file diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml index 44ab091e1..97998e463 100644 --- a/.github/blunderbuss.yml +++ b/.github/blunderbuss.yml @@ -1,9 +1,9 @@ # Configuration for the Blunderbuss GitHub app. For more info see # https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss assign_issues: - - maitrimangal + - michaelpri10 assign_prs: - - maitrimangal + - michaelpri10 assign_prs_by: - labels: - samples diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 46e11116d..2cd50ab00 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -14,7 +14,6 @@ branchProtectionRules: - units (8) - units (11) - 'Kokoro - Test: Integration' - - Kokoro - Against Pub/Sub Lite samples - cla/google - OwlBot Post Processor - 'Kokoro - Test: Java GraalVM Native Image' diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml new file mode 100644 index 000000000..62c5fa4a0 --- /dev/null +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -0,0 +1,22 @@ +on: + pull_request: +name: Unmanaged dependency check +jobs: + unmanaged_dependency_check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + - name: Install modules + shell: bash + run: | + # No argument to build.sh installs the modules in local Maven + # repository + .kokoro/build.sh + - name: Unmanaged dependency check + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@unmanaged-dependencies-check-latest + with: + bom-path: google-cloud-pubsub-bom/pom.xml diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg index fb5bb678f..90d9a20a0 100644 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17:22.3.3" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.24.0" } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg index 59efee340..948177be8 100644 --- a/.kokoro/presubmit/graalvm-native.cfg +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/graalvm:22.3.3" + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.24.0" } env_vars: { diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a883226a..92946f184 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [1.126.4](https://github.com/googleapis/java-pubsub/compare/v1.126.3...v1.126.4) (2024-02-09) + + +### Bug Fixes + +* Message ordering fix for [#1889](https://github.com/googleapis/java-pubsub/issues/1889) ([#1903](https://github.com/googleapis/java-pubsub/issues/1903)) ([22a87c6](https://github.com/googleapis/java-pubsub/commit/22a87c67f07b55266e277f83f5ceb17d9f32f67e)) + +## [1.126.3](https://github.com/googleapis/java-pubsub/compare/v1.126.2...v1.126.3) (2024-02-08) + + +### Dependencies + +* Update dependency com.google.cloud:google-cloud-core to v2.32.0 ([#1885](https://github.com/googleapis/java-pubsub/issues/1885)) ([a2063cf](https://github.com/googleapis/java-pubsub/commit/a2063cf8f1f792f5ad1994bff00f367b399c0ff2)) + ## [1.126.2](https://github.com/googleapis/java-pubsub/compare/v1.126.1...v1.126.2) (2024-01-26) diff --git a/README.md b/README.md index 9873ea9d1..89680132d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.30.0 + 26.31.0 pom import @@ -44,7 +44,7 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-pubsub - 1.126.1 + 1.126.3 ``` @@ -59,13 +59,13 @@ implementation 'com.google.cloud:google-cloud-pubsub' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-pubsub:1.126.2' +implementation 'com.google.cloud:google-cloud-pubsub:1.126.3' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.126.2" +libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.126.3" ``` @@ -409,7 +409,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-pubsub/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.126.2 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-pubsub/1.126.3 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/google-cloud-pubsub-bom/pom.xml b/google-cloud-pubsub-bom/pom.xml index b8d3fc0a3..795bf000c 100644 --- a/google-cloud-pubsub-bom/pom.xml +++ b/google-cloud-pubsub-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-pubsub-bom - 1.126.3-SNAPSHOT + 1.126.4 pom com.google.cloud @@ -52,17 +52,17 @@ com.google.cloud google-cloud-pubsub - 1.126.3-SNAPSHOT + 1.126.4 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.108.3-SNAPSHOT + 1.108.4 com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.108.3-SNAPSHOT + 1.108.4 diff --git a/google-cloud-pubsub/pom.xml b/google-cloud-pubsub/pom.xml index 14dca02b0..cb705395d 100644 --- a/google-cloud-pubsub/pom.xml +++ b/google-cloud-pubsub/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-pubsub - 1.126.3-SNAPSHOT + 1.126.4 jar Google Cloud Pub/Sub https://github.com/googleapis/java-pubsub @@ -11,7 +11,7 @@ com.google.cloud google-cloud-pubsub-parent - 1.126.3-SNAPSHOT + 1.126.4 google-cloud-pubsub diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java index 635bc92d5..1810badd2 100644 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java +++ b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/MessageDispatcher.java @@ -31,6 +31,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -92,8 +93,8 @@ class MessageDispatcher { private final LinkedBlockingQueue pendingAcks = new LinkedBlockingQueue<>(); private final LinkedBlockingQueue pendingNacks = new LinkedBlockingQueue<>(); private final LinkedBlockingQueue pendingReceipts = new LinkedBlockingQueue<>(); - private final ConcurrentMap outstandingReceipts = - new ConcurrentHashMap(); + private final LinkedHashMap outstandingReceipts = + new LinkedHashMap(); private final AtomicInteger messageDeadlineSeconds = new AtomicInteger(); private final AtomicBoolean extendDeadline = new AtomicBoolean(true); private final Lock jobLock; @@ -397,7 +398,9 @@ void processReceivedMessages(List messages) { if (this.exactlyOnceDeliveryEnabled.get()) { // For exactly once deliveries we don't add to outstanding batch because we first // process the receipt modack. If that is successful then we process the message. - outstandingReceipts.put(message.getAckId(), new ReceiptCompleteData(outstandingMessage)); + synchronized (outstandingReceipts) { + outstandingReceipts.put(message.getAckId(), new ReceiptCompleteData(outstandingMessage)); + } } else if (pendingMessages.putIfAbsent(message.getAckId(), ackHandler) != null) { // putIfAbsent puts ackHandler if ackID isn't previously mapped, then return the // previously-mapped element. @@ -417,33 +420,36 @@ void processReceivedMessages(List messages) { } void notifyAckSuccess(AckRequestData ackRequestData) { - - if (outstandingReceipts.containsKey(ackRequestData.getAckId())) { - outstandingReceipts.get(ackRequestData.getAckId()).notifyReceiptComplete(); - List outstandingBatch = new ArrayList<>(); - - for (Iterator> it = - outstandingReceipts.entrySet().iterator(); - it.hasNext(); ) { - Map.Entry receipt = it.next(); - // If receipt is complete then add to outstandingBatch to process the batch - if (receipt.getValue().isReceiptComplete()) { - it.remove(); - if (pendingMessages.putIfAbsent( - receipt.getKey(), receipt.getValue().getOutstandingMessage().ackHandler) - == null) { - outstandingBatch.add(receipt.getValue().getOutstandingMessage()); + synchronized (outstandingReceipts) { + if (outstandingReceipts.containsKey(ackRequestData.getAckId())) { + outstandingReceipts.get(ackRequestData.getAckId()).notifyReceiptComplete(); + List outstandingBatch = new ArrayList<>(); + + for (Iterator> it = + outstandingReceipts.entrySet().iterator(); + it.hasNext(); ) { + Map.Entry receipt = it.next(); + // If receipt is complete then add to outstandingBatch to process the batch + if (receipt.getValue().isReceiptComplete()) { + it.remove(); + if (pendingMessages.putIfAbsent( + receipt.getKey(), receipt.getValue().getOutstandingMessage().ackHandler) + == null) { + outstandingBatch.add(receipt.getValue().getOutstandingMessage()); + } + } else { + break; } - } else { - break; } + processBatch(outstandingBatch); } - processBatch(outstandingBatch); } } void notifyAckFailed(AckRequestData ackRequestData) { - outstandingReceipts.remove(ackRequestData.getAckId()); + synchronized (outstandingReceipts) { + outstandingReceipts.remove(ackRequestData.getAckId()); + } } private void processBatch(List batch) { diff --git a/grpc-google-cloud-pubsub-v1/pom.xml b/grpc-google-cloud-pubsub-v1/pom.xml index 686abc578..ab59fe1ad 100644 --- a/grpc-google-cloud-pubsub-v1/pom.xml +++ b/grpc-google-cloud-pubsub-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.108.3-SNAPSHOT + 1.108.4 grpc-google-cloud-pubsub-v1 GRPC library for grpc-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.126.3-SNAPSHOT + 1.126.4 diff --git a/owlbot.py b/owlbot.py index 6cb015af0..1ef474bc4 100644 --- a/owlbot.py +++ b/owlbot.py @@ -1211,6 +1211,8 @@ ".github/sync-repo-settings.yaml", ".github/blunderbuss.yml", '.kokoro/requirements.in', - '.kokoro/requirements.txt' + '.kokoro/requirements.txt', + '.kokoro/presubmit/graalvm-native.cfg', + '.kokoro/presubmit/graalvm-native-17.cfg' ] ) diff --git a/pom.xml b/pom.xml index 628287c8e..227cd7d2d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-pubsub-parent pom - 1.126.3-SNAPSHOT + 1.126.4 Google Cloud Pub/Sub Parent https://github.com/googleapis/java-pubsub @@ -13,8 +13,8 @@ com.google.cloud - google-cloud-shared-config - 1.7.1 + sdk-platform-java-config + 3.24.0 @@ -61,7 +61,7 @@ com.google.cloud google-cloud-shared-dependencies - 3.23.0 + ${google-cloud-shared-dependencies.version} pom import @@ -69,17 +69,17 @@ com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.108.3-SNAPSHOT + 1.108.4 com.google.api.grpc grpc-google-cloud-pubsub-v1 - 1.108.3-SNAPSHOT + 1.108.4 com.google.cloud google-cloud-pubsub - 1.126.3-SNAPSHOT + 1.126.4 @@ -104,7 +104,7 @@ com.google.truth truth - 1.3.0 + 1.4.0 test diff --git a/proto-google-cloud-pubsub-v1/pom.xml b/proto-google-cloud-pubsub-v1/pom.xml index 581378af5..e06710a62 100644 --- a/proto-google-cloud-pubsub-v1/pom.xml +++ b/proto-google-cloud-pubsub-v1/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-pubsub-v1 - 1.108.3-SNAPSHOT + 1.108.4 proto-google-cloud-pubsub-v1 PROTO library for proto-google-cloud-pubsub-v1 com.google.cloud google-cloud-pubsub-parent - 1.126.3-SNAPSHOT + 1.126.4 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 038b328af..e40c9caaa 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -44,7 +44,7 @@ com.google.cloud google-cloud-pubsub - 1.126.1 + 1.126.3 @@ -69,7 +69,7 @@ com.google.truth truth - 1.3.0 + 1.4.0 test @@ -80,7 +80,7 @@ com.google.cloud google-cloud-core - 2.31.0 + 2.32.0 tests diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index b766b6326..e114bce2d 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -30,7 +30,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> com.google.cloud libraries-bom - 26.30.0 + 26.31.0 pom import @@ -56,7 +56,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> com.google.truth truth - 1.3.0 + 1.4.0 test @@ -107,7 +107,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.junit.vintage junit-vintage-engine - 5.10.1 + 5.10.2 test @@ -134,7 +134,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.graalvm.buildtools native-maven-plugin - 0.9.28 + 0.10.0 true pubsub.NativeImagePubSubSample diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 965d9d592..52c09eace 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -43,7 +43,7 @@ com.google.cloud google-cloud-pubsub - 1.126.3-SNAPSHOT + 1.126.4 @@ -73,13 +73,13 @@ com.google.truth truth - 1.3.0 + 1.4.0 test com.google.cloud google-cloud-core - 2.31.0 + 2.32.0 tests diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 26215fd06..34c2c4bde 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -45,7 +45,7 @@ com.google.cloud libraries-bom - 26.30.0 + 26.31.0 pom import @@ -92,13 +92,13 @@ com.google.truth truth - 1.3.0 + 1.4.0 test com.google.cloud google-cloud-core - 2.31.0 + 2.32.0 tests diff --git a/versions.txt b/versions.txt index fc723dc08..451bc8f07 100644 --- a/versions.txt +++ b/versions.txt @@ -1,6 +1,6 @@ # Format: # module:released-version:current-version -google-cloud-pubsub:1.126.2:1.126.3-SNAPSHOT -grpc-google-cloud-pubsub-v1:1.108.2:1.108.3-SNAPSHOT -proto-google-cloud-pubsub-v1:1.108.2:1.108.3-SNAPSHOT +google-cloud-pubsub:1.126.4:1.126.4 +grpc-google-cloud-pubsub-v1:1.108.4:1.108.4 +proto-google-cloud-pubsub-v1:1.108.4:1.108.4