diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 91bb69e63c..48ad11d440 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:bf5639d265d70f6137d57d42ae781a6f4e26d4085ff4e018e71350480f9b3996 + digest: sha256:944c07e458ce227ca49a423affedf088e31e2ee70908dd21682238d58f1beb60 diff --git a/.github/workflows/conformance.yaml b/.github/workflows/conformance.yaml new file mode 100644 index 0000000000..66d9c10c71 --- /dev/null +++ b/.github/workflows/conformance.yaml @@ -0,0 +1,41 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + push: + branches: + - main + pull_request: +name: conformance +jobs: + conformance: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + with: + repository: googleapis/cloud-bigtable-clients-test + ref: main + path: cloud-bigtable-clients-test + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 8 + - uses: actions/setup-go@v4 + with: + go-version: '>=1.20.2' + - run: java -version + - run: go version + - run: .kokoro/conformance.sh diff --git a/.kokoro/conformance.sh b/.kokoro/conformance.sh new file mode 100755 index 0000000000..41405ef858 --- /dev/null +++ b/.kokoro/conformance.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Maven & Java version +mvn -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +RETURN_CODE=0 +set +e + +# Build and start the proxy in a separate process +pushd . +cd test-proxy +mvn clean install -DskipTests +nohup java -Dport=9999 -jar target/google-cloud-bigtable-test-proxy-0.0.1-SNAPSHOT.jar & +proxyPID=$! +popd + +# Run the conformance test +pushd . +cd cloud-bigtable-clients-test/tests +eval "go test -v -skip `cat ../../test-proxy/known_failures.txt` -proxy_addr=:9999" +RETURN_CODE=$? +popd + +# Stop the proxy +kill $proxyPID + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/CHANGELOG.md b/CHANGELOG.md index a3ed79caa1..64381fa247 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [2.20.4](https://github.com/googleapis/java-bigtable/compare/v2.20.3...v2.20.4) (2023-04-17) + + +### Documentation + +* Make delete examples consistent with other languages ([#1710](https://github.com/googleapis/java-bigtable/issues/1710)) ([2d80188](https://github.com/googleapis/java-bigtable/commit/2d80188c65f454e037b758426b8747b5992db0de)) + + +### Dependencies + +* Update actions/setup-go action to v4 ([#1700](https://github.com/googleapis/java-bigtable/issues/1700)) ([1fd13ba](https://github.com/googleapis/java-bigtable/commit/1fd13ba9fdfa0322ee419f405c92ebe3979d85c7)) +* Update dependency com.google.cloud:google-cloud-monitoring-bom to v3.16.0 ([#1712](https://github.com/googleapis/java-bigtable/issues/1712)) ([f3bb088](https://github.com/googleapis/java-bigtable/commit/f3bb088cd670805e5c6975e7154ee7e1e320acc6)) +* Update dependency org.graalvm.buildtools:junit-platform-native to v0.9.21 ([#1704](https://github.com/googleapis/java-bigtable/issues/1704)) ([d60c946](https://github.com/googleapis/java-bigtable/commit/d60c94630f60d01241eecf9e3061ed197435b55e)) +* Update dependency org.graalvm.buildtools:native-maven-plugin to v0.9.21 ([#1705](https://github.com/googleapis/java-bigtable/issues/1705)) ([8f3d69d](https://github.com/googleapis/java-bigtable/commit/8f3d69d2498a7c0b5f760a40054e17d07502764d)) +* Update shared dependencies ([#1703](https://github.com/googleapis/java-bigtable/issues/1703)) ([076b411](https://github.com/googleapis/java-bigtable/commit/076b411b3c834c4ed1b98551f08befab78743c8f)) +* Upgrade maven-enforcer-plugin to 3.3.0, remove duplicate entry in pom ([#1702](https://github.com/googleapis/java-bigtable/issues/1702)) ([392fc69](https://github.com/googleapis/java-bigtable/commit/392fc697b9b75d172ba5bfd98ead45a6074c47f7)) + ## [2.20.3](https://github.com/googleapis/java-bigtable/compare/v2.20.2...v2.20.3) (2023-04-03) diff --git a/README.md b/README.md index 72e6c23203..17a6c823e6 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.11.0 + 26.12.0 pom import @@ -34,14 +34,15 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: ``` -If you are using Maven without BOM, add this to your dependencies: +If you are using Maven without the BOM, add this to your dependencies: + ```xml com.google.cloud google-cloud-bigtable - 2.20.2 + 2.20.3 ``` @@ -49,20 +50,20 @@ If you are using Maven without BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.11.0') +implementation platform('com.google.cloud:libraries-bom:26.12.0') implementation 'com.google.cloud:google-cloud-bigtable' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigtable:2.20.2' +implementation 'com.google.cloud:google-cloud-bigtable:2.20.3' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.20.2" +libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.20.3" ``` @@ -501,6 +502,14 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-bigtable/tree | Write Conditionally | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/WriteConditionally.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/WriteConditionally.java) | | Write Increment | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/WriteIncrement.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/WriteIncrement.java) | | Write Simple | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/WriteSimple.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/WriteSimple.java) | +| Batch Delete Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/BatchDeleteExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/BatchDeleteExample.java) | +| Conditional Delete Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/ConditionalDeleteExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/ConditionalDeleteExample.java) | +| Delete Column Family Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteColumnFamilyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteColumnFamilyExample.java) | +| Delete From Column Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnExample.java) | +| Delete From Column Family Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnFamilyExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnFamilyExample.java) | +| Delete From Row Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromRowExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromRowExample.java) | +| Delete Table Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteTableExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteTableExample.java) | +| Drop Row Range Example | [source code](https://github.com/googleapis/java-bigtable/blob/main/samples/snippets/src/main/java/com/example/bigtable/deletes/DropRowRangeExample.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-bigtable&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/bigtable/deletes/DropRowRangeExample.java) | @@ -600,7 +609,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-bigtable/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-bigtable.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.20.2 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigtable/2.20.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 @@ -608,7 +617,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [developer-console]: https://console.developers.google.com/ [create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects [cloud-cli]: https://cloud.google.com/cli -[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting +[troubleshooting]: https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md [contributing]: https://github.com/googleapis/java-bigtable/blob/main/CONTRIBUTING.md [code-of-conduct]: https://github.com/googleapis/java-bigtable/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct [license]: https://github.com/googleapis/java-bigtable/blob/main/LICENSE diff --git a/google-cloud-bigtable-bom/pom.xml b/google-cloud-bigtable-bom/pom.xml index 9a7c6f9346..4d74b4af4b 100644 --- a/google-cloud-bigtable-bom/pom.xml +++ b/google-cloud-bigtable-bom/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom com.google.cloud @@ -63,42 +63,42 @@ com.google.cloud google-cloud-bigtable - 2.20.3 + 2.20.4 com.google.cloud google-cloud-bigtable-emulator - 0.157.3 + 0.157.4 com.google.cloud google-cloud-bigtable-emulator-core - 0.157.3 + 0.157.4 com.google.api.grpc grpc-google-cloud-bigtable-admin-v2 - 2.20.3 + 2.20.4 com.google.api.grpc grpc-google-cloud-bigtable-v2 - 2.20.3 + 2.20.4 com.google.api.grpc proto-google-cloud-bigtable-admin-v2 - 2.20.3 + 2.20.4 com.google.api.grpc proto-google-cloud-bigtable-v2 - 2.20.3 + 2.20.4 com.google.cloud google-cloud-bigtable-stats - 2.20.3 + 2.20.4 diff --git a/google-cloud-bigtable-deps-bom/pom.xml b/google-cloud-bigtable-deps-bom/pom.xml index 661c285d25..33afb68af8 100644 --- a/google-cloud-bigtable-deps-bom/pom.xml +++ b/google-cloud-bigtable-deps-bom/pom.xml @@ -13,7 +13,7 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom @@ -66,14 +66,14 @@ com.google.cloud google-cloud-shared-dependencies - 3.6.0 + 3.7.0 pom import com.google.cloud google-cloud-monitoring-bom - 3.15.0 + 3.16.0 diff --git a/google-cloud-bigtable-emulator-core/pom.xml b/google-cloud-bigtable-emulator-core/pom.xml index 3455de1ff1..13ce1689ea 100644 --- a/google-cloud-bigtable-emulator-core/pom.xml +++ b/google-cloud-bigtable-emulator-core/pom.xml @@ -7,11 +7,11 @@ google-cloud-bigtable-parent com.google.cloud - 2.20.3 + 2.20.4 google-cloud-bigtable-emulator-core - 0.157.3 + 0.157.4 A Java wrapper for the Cloud Bigtable emulator. diff --git a/google-cloud-bigtable-emulator/pom.xml b/google-cloud-bigtable-emulator/pom.xml index 8d6da712cc..eec14844d2 100644 --- a/google-cloud-bigtable-emulator/pom.xml +++ b/google-cloud-bigtable-emulator/pom.xml @@ -5,7 +5,7 @@ 4.0.0 google-cloud-bigtable-emulator - 0.157.3 + 0.157.4 Google Cloud Java - Bigtable Emulator https://github.com/googleapis/java-bigtable @@ -14,7 +14,7 @@ com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 scm:git:git@github.com:googleapis/java-bigtable.git @@ -81,14 +81,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom import @@ -99,7 +99,7 @@ com.google.cloud google-cloud-bigtable-emulator-core - 0.157.3 + 0.157.4 diff --git a/google-cloud-bigtable-stats/pom.xml b/google-cloud-bigtable-stats/pom.xml index a6d67db419..8ab2416a68 100644 --- a/google-cloud-bigtable-stats/pom.xml +++ b/google-cloud-bigtable-stats/pom.xml @@ -5,7 +5,7 @@ com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 4.0.0 @@ -13,7 +13,7 @@ through Stackdriver. Built-in metrics will be implemented with shaded OpenCensus so it won't interfere with customer's application metrics. --> google-cloud-bigtable-stats - 2.20.3 + 2.20.4 Experimental project to shade OpenCensus dependencies. @@ -21,7 +21,7 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import diff --git a/google-cloud-bigtable/pom.xml b/google-cloud-bigtable/pom.xml index 2c88e4d4d8..f6ebed4539 100644 --- a/google-cloud-bigtable/pom.xml +++ b/google-cloud-bigtable/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-bigtable - 2.20.3 + 2.20.4 jar Google Cloud Bigtable https://github.com/googleapis/java-bigtable @@ -12,11 +12,11 @@ com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 - 2.20.3 + 2.20.4 google-cloud-bigtable @@ -37,11 +37,9 @@ Also, this property will be augmented by `internal-bigtable-prod-batch-it-prop-helper` profile --> batch-bigtable.googleapis.com:443 - - 1.54.0 - 3.21.12 - ${protobuf.version} + + 1.54.1 + 3.22.3 @@ -49,14 +47,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom import @@ -607,33 +605,6 @@ - - org.apache.maven.plugins - maven-enforcer-plugin - 3.1.0 - - - enforce-declared-grpc-and-proto-version - - enforce - - - - - - io.grpc:*:[${grpc.version}] - com.google.protobuf:*:[${protobuf.version}] - - - io.grpc:* - com.google.protobuf:* - - - - - - - org.xolstice.maven.plugins protobuf-maven-plugin @@ -648,11 +619,11 @@ - com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} + com.google.protobuf:protoc:${test-protoc.version}:exe:${os.detected.classifier} grpc-java - io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:${test-protoc-grpc.version}:exe:${os.detected.classifier} @@ -678,7 +649,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.2.1 + 3.3.0 diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java index 4b1988735a..15a6384986 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/Version.java @@ -20,6 +20,6 @@ @InternalApi("For internal use only") public final class Version { // {x-version-update-start:google-cloud-bigtable:current} - public static String VERSION = "2.20.3"; + public static String VERSION = "2.20.4"; // {x-version-update-end} } diff --git a/grpc-google-cloud-bigtable-admin-v2/pom.xml b/grpc-google-cloud-bigtable-admin-v2/pom.xml index d8a0d7ce5e..79b2225c7d 100644 --- a/grpc-google-cloud-bigtable-admin-v2/pom.xml +++ b/grpc-google-cloud-bigtable-admin-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigtable-admin-v2 - 2.20.3 + 2.20.4 grpc-google-cloud-bigtable-admin-v2 GRPC library for grpc-google-cloud-bigtable-admin-v2 com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom import diff --git a/grpc-google-cloud-bigtable-v2/pom.xml b/grpc-google-cloud-bigtable-v2/pom.xml index da21ded083..307b38fc5b 100644 --- a/grpc-google-cloud-bigtable-v2/pom.xml +++ b/grpc-google-cloud-bigtable-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-bigtable-v2 - 2.20.3 + 2.20.4 grpc-google-cloud-bigtable-v2 GRPC library for grpc-google-cloud-bigtable-v2 com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom import diff --git a/pom.xml b/pom.xml index e07b065746..5c6c371293 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ google-cloud-bigtable-parent pom - 2.20.3 + 2.20.4 Google Cloud Bigtable Parent https://github.com/googleapis/java-bigtable @@ -153,27 +153,27 @@ com.google.api.grpc proto-google-cloud-bigtable-v2 - 2.20.3 + 2.20.4 com.google.api.grpc proto-google-cloud-bigtable-admin-v2 - 2.20.3 + 2.20.4 com.google.api.grpc grpc-google-cloud-bigtable-v2 - 2.20.3 + 2.20.4 com.google.api.grpc grpc-google-cloud-bigtable-admin-v2 - 2.20.3 + 2.20.4 com.google.cloud google-cloud-bigtable - 2.20.3 + 2.20.4 diff --git a/proto-google-cloud-bigtable-admin-v2/pom.xml b/proto-google-cloud-bigtable-admin-v2/pom.xml index 9135aefe07..20858f177c 100644 --- a/proto-google-cloud-bigtable-admin-v2/pom.xml +++ b/proto-google-cloud-bigtable-admin-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigtable-admin-v2 - 2.20.3 + 2.20.4 proto-google-cloud-bigtable-admin-v2 PROTO library for proto-google-cloud-bigtable-admin-v2 com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom import diff --git a/proto-google-cloud-bigtable-v2/pom.xml b/proto-google-cloud-bigtable-v2/pom.xml index 0b54c3e05f..0d39f90ce3 100644 --- a/proto-google-cloud-bigtable-v2/pom.xml +++ b/proto-google-cloud-bigtable-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-bigtable-v2 - 2.20.3 + 2.20.4 proto-google-cloud-bigtable-v2 PROTO library for proto-google-cloud-bigtable-v2 com.google.cloud google-cloud-bigtable-parent - 2.20.3 + 2.20.4 @@ -18,14 +18,14 @@ com.google.cloud google-cloud-bigtable-deps-bom - 2.20.3 + 2.20.4 pom import com.google.cloud google-cloud-bigtable-bom - 2.20.3 + 2.20.4 pom import diff --git a/renovate.json b/renovate.json index 7494258c9a..a5826e23a4 100644 --- a/renovate.json +++ b/renovate.json @@ -52,7 +52,9 @@ "^com.google.truth:truth", "^org.mockito:mockito-core", "^org.objenesis:objenesis", - "^com.google.cloud:google-cloud-conformance-tests" + "^com.google.cloud:google-cloud-conformance-tests", + "^io.grpc:protoc-gen-grpc-java", + "^com.google.protobuf:protoc" ], "semanticCommitType": "test", "semanticCommitScope": "deps" @@ -80,14 +82,14 @@ ], "regexManagers": [ { - "fileMatch": ["^pom\\.xml$"], - "matchStrings": ["\\(?.*?)\\<\\/grpc\\.version\\>"], + "fileMatch": ["^.*\/pom\\.xml$"], + "matchStrings": ["\\(?.*?)\\<\\/test\\-protoc\\-grpc\\.version\\>"], "depNameTemplate": "io.grpc:protoc-gen-grpc-java", "datasourceTemplate": "maven" }, { - "fileMatch": ["^pom\\.xml$"], - "matchStrings": ["\\(?.*?)\\<\\/protobuf\\.version\\>"], + "fileMatch": ["^.*\/pom\\.xml$"], + "matchStrings": ["\\(?.*?)\\<\\/test\\-protoc\\.version\\>"], "depNameTemplate": "com.google.protobuf:protoc", "datasourceTemplate": "maven" } diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 7e407955ed..eb2e7498cd 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-bigtable - 2.20.2 + 2.20.3 diff --git a/samples/native-image-sample/pom.xml b/samples/native-image-sample/pom.xml index 954eb06312..bd4382f8cf 100644 --- a/samples/native-image-sample/pom.xml +++ b/samples/native-image-sample/pom.xml @@ -29,7 +29,7 @@ com.google.cloud libraries-bom - 26.11.0 + 26.12.0 pom import @@ -89,7 +89,7 @@ org.graalvm.buildtools junit-platform-native - 0.9.20 + 0.9.21 test @@ -99,7 +99,7 @@ org.graalvm.buildtools native-maven-plugin - 0.9.20 + 0.9.21 true com.example.bigtable.NativeImageBigtableSample diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 1011de9c95..4cd895bf35 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-bigtable - 2.20.3 + 2.20.4 diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index d072f99023..d36368b3e7 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 26.11.0 + 26.12.0 pom import diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/BatchDeleteExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/BatchDeleteExample.java new file mode 100644 index 0000000000..2b814c4e42 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/BatchDeleteExample.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_streaming_and_batching] +import com.google.api.gax.batching.Batcher; +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.bigtable.data.v2.BigtableDataClient; +import com.google.cloud.bigtable.data.v2.models.Query; +import com.google.cloud.bigtable.data.v2.models.Row; +import com.google.cloud.bigtable.data.v2.models.RowMutationEntry; +import java.io.IOException; + +public class BatchDeleteExample { + public void batchDelete(String projectId, String instanceId, String tableId) + throws InterruptedException, IOException { + try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) { + try (Batcher batcher = dataClient.newBulkMutationBatcher(tableId)) { + ServerStream rows = dataClient.readRows(Query.create(tableId)); + for (Row row : rows) { + batcher.add( + RowMutationEntry.create(row.getKey()).deleteCells("cell_plan", "data_plan_05gb")); + } + // Blocks until mutations are applied on all submitted row entries. + batcher.flush(); + } + } + } +} +// [END bigtable_streaming_and_batching] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/ConditionalDeleteExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/ConditionalDeleteExample.java new file mode 100644 index 0000000000..4fac36404c --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/ConditionalDeleteExample.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_delete_check_and_mutate] +import com.google.cloud.bigtable.data.v2.BigtableDataClient; +import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation; +import com.google.cloud.bigtable.data.v2.models.Filters; +import com.google.cloud.bigtable.data.v2.models.Mutation; +import java.io.IOException; + +public class ConditionalDeleteExample { + public void conditionalDelete(String projectId, String instanceId, String tableId) + throws IOException { + try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) { + Filters.Filter condition = Filters.FILTERS.value().exactMatch("PQ2A.190405.004"); + Mutation mutation = Mutation.create().deleteCells("stats_summary", "os_build"); + dataClient.checkAndMutateRow( + ConditionalRowMutation.create(tableId, "phone#4c410523#20190502") + .condition(condition) + .then(mutation)); + } + } +} +// [END bigtable_delete_check_and_mutate] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteColumnFamilyExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteColumnFamilyExample.java new file mode 100644 index 0000000000..e3648fb0a1 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteColumnFamilyExample.java @@ -0,0 +1,35 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_delete_column_family] +import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; +import com.google.cloud.bigtable.admin.v2.models.ModifyColumnFamiliesRequest; +import java.io.IOException; + +public class DeleteColumnFamilyExample { + public void deleteColumnFamily( + String projectId, String instanceId, String tableId, String columnFamily) throws IOException { + try (BigtableTableAdminClient tableAdminClient = + BigtableTableAdminClient.create(projectId, instanceId)) { + ModifyColumnFamiliesRequest modifyColumnFamiliesRequest = + ModifyColumnFamiliesRequest.of(tableId).dropFamily(columnFamily); + tableAdminClient.modifyFamilies(modifyColumnFamiliesRequest); + } + } +} +// [END bigtable_delete_column_family] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnExample.java new file mode 100644 index 0000000000..7403272d19 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnExample.java @@ -0,0 +1,34 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_delete_from_column] +import com.google.cloud.bigtable.data.v2.BigtableDataClient; +import com.google.cloud.bigtable.data.v2.models.Mutation; +import com.google.cloud.bigtable.data.v2.models.RowMutation; +import java.io.IOException; + +public class DeleteFromColumnExample { + public void deleteFromColumnCells(String projectId, String instanceId, String tableId) + throws IOException { + try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) { + Mutation mutation = Mutation.create().deleteCells("cell_plan", "data_plan_01gb"); + dataClient.mutateRow(RowMutation.create(tableId, "phone#4c410523#20190501", mutation)); + } + } +} +// [END bigtable_delete_from_column] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnFamilyExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnFamilyExample.java new file mode 100644 index 0000000000..db89c04e4b --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromColumnFamilyExample.java @@ -0,0 +1,33 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_delete_from_column_family] +import com.google.cloud.bigtable.data.v2.BigtableDataClient; +import com.google.cloud.bigtable.data.v2.models.RowMutation; +import java.io.IOException; + +public class DeleteFromColumnFamilyExample { + public void deleteFromColumnFamily(String projectId, String instanceId, String tableId) + throws IOException { + try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) { + dataClient.mutateRow( + RowMutation.create(tableId, "phone#5c10102#20190501").deleteFamily("stats_summary")); + } + } +} +// [END bigtable_delete_from_column_family] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromRowExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromRowExample.java new file mode 100644 index 0000000000..029298497f --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteFromRowExample.java @@ -0,0 +1,34 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_delete_from_row] +import com.google.cloud.bigtable.data.v2.BigtableDataClient; +import com.google.cloud.bigtable.data.v2.models.Mutation; +import com.google.cloud.bigtable.data.v2.models.RowMutation; +import java.io.IOException; + +public class DeleteFromRowExample { + public void deleteFromRow(String projectId, String instanceId, String tableId) + throws IOException { + try (BigtableDataClient dataClient = BigtableDataClient.create(projectId, instanceId)) { + Mutation mutation = Mutation.create().deleteRow(); + dataClient.mutateRow(RowMutation.create(tableId, "phone#4c410523#20190501", mutation)); + } + } +} +// [END bigtable_delete_from_row] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteTableExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteTableExample.java new file mode 100644 index 0000000000..bdded5fbef --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/DeleteTableExample.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_delete_table] +import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; +import java.io.IOException; + +public class DeleteTableExample { + public void deleteTable(String projectId, String instanceId, String tableId) throws IOException { + try (BigtableTableAdminClient tableAdminClient = + BigtableTableAdminClient.create(projectId, instanceId)) { + tableAdminClient.deleteTable(tableId); + } + } +} +// [END bigtable_delete_table] diff --git a/samples/snippets/src/main/java/com/example/bigtable/deletes/DropRowRangeExample.java b/samples/snippets/src/main/java/com/example/bigtable/deletes/DropRowRangeExample.java new file mode 100644 index 0000000000..0575fb38ec --- /dev/null +++ b/samples/snippets/src/main/java/com/example/bigtable/deletes/DropRowRangeExample.java @@ -0,0 +1,31 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +// [START bigtable_drop_row_range] +import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; +import java.io.IOException; + +public class DropRowRangeExample { + public void dropRowRange(String projectId, String instanceId, String tableId) throws IOException { + try (BigtableTableAdminClient tableAdminClient = + BigtableTableAdminClient.create(projectId, instanceId)) { + tableAdminClient.dropRowRange(tableId, "phone#4c410523"); + } + } +} +// [END bigtable_drop_row_range] diff --git a/samples/snippets/src/test/java/com/example/bigtable/MobileTimeSeriesBaseTest.java b/samples/snippets/src/test/java/com/example/bigtable/MobileTimeSeriesBaseTest.java index c31ec11ce2..00aec60498 100644 --- a/samples/snippets/src/test/java/com/example/bigtable/MobileTimeSeriesBaseTest.java +++ b/samples/snippets/src/test/java/com/example/bigtable/MobileTimeSeriesBaseTest.java @@ -170,7 +170,9 @@ public static void writePlanData() throws IOException { public static void cleanupTable() throws IOException { try (BigtableTableAdminClient adminClient = BigtableTableAdminClient.create(projectId, instanceId)) { - adminClient.deleteTable(TABLE_ID); + if (adminClient.exists(TABLE_ID)) { + adminClient.deleteTable(TABLE_ID); + } } catch (Exception e) { System.out.println("Error during afterClass: \n" + e.toString()); throw (e); diff --git a/samples/snippets/src/test/java/com/example/bigtable/deletes/DeletesTest.java b/samples/snippets/src/test/java/com/example/bigtable/deletes/DeletesTest.java new file mode 100644 index 0000000000..bff3c74a1f --- /dev/null +++ b/samples/snippets/src/test/java/com/example/bigtable/deletes/DeletesTest.java @@ -0,0 +1,188 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.bigtable.deletes; + +import com.example.bigtable.MobileTimeSeriesBaseTest; +import com.google.api.gax.rpc.ServerStream; +import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; +import com.google.cloud.bigtable.data.v2.BigtableDataClient; +import com.google.cloud.bigtable.data.v2.models.Query; +import com.google.cloud.bigtable.data.v2.models.Row; +import com.google.cloud.bigtable.data.v2.models.RowCell; +import com.google.common.truth.Truth; +import java.io.IOException; +import java.util.List; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +/* + * These tests are order dependent because they delete rows and cells from a table. + * They are prefixed with `testN_` to signal the order in which they should run. + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class DeletesTest extends MobileTimeSeriesBaseTest { + public static BigtableDataClient bigtableDataClient; + + @BeforeClass + public static void beforeClass() throws IOException { + initializeVariables(); + createTable(); + writeStatsData(); + writePlanData(); + bigtableDataClient = BigtableDataClient.create(projectId, instanceId); + } + + @AfterClass + public static void afterClass() throws IOException { + cleanupTable(); + } + + @Test + public void test1_testDeleteFromColumn() throws IOException { + String rowKey = "phone#4c410523#20190501"; + Row row = bigtableDataClient.readRow(TABLE_ID, rowKey); + String qualifier = "data_plan_01gb"; + List cells = row.getCells(COLUMN_FAMILY_NAME_PLAN, qualifier); + + Truth.assertThat(cells).isNotEmpty(); + + DeleteFromColumnExample deleteFromColumnExample = new DeleteFromColumnExample(); + deleteFromColumnExample.deleteFromColumnCells(projectId, instanceId, TABLE_ID); + row = bigtableDataClient.readRow(TABLE_ID, rowKey); + List cellsAfterDelete = row.getCells(COLUMN_FAMILY_NAME_PLAN, qualifier); + + Truth.assertThat(cellsAfterDelete).isEmpty(); + } + + @Test + public void test2_testDeleteFromRow() throws IOException { + String rowKey = "phone#4c410523#20190501"; + Row row = bigtableDataClient.readRow(TABLE_ID, rowKey); + + Truth.assertThat(row).isNotNull(); + + DeleteFromRowExample deleteFromRowExample = new DeleteFromRowExample(); + deleteFromRowExample.deleteFromRow(projectId, instanceId, TABLE_ID); + row = bigtableDataClient.readRow(TABLE_ID, rowKey); + + Truth.assertThat(row).isNull(); + } + + @Test + public void test3_testStreamingAndBatching() throws IOException, InterruptedException { + String rowKey = "phone#4c410523#20190502"; + Row row = bigtableDataClient.readRow(TABLE_ID, rowKey); + String qualifier = "data_plan_05gb"; + List cells = row.getCells(COLUMN_FAMILY_NAME_PLAN, qualifier); + + Truth.assertThat(cells).isNotEmpty(); + + BatchDeleteExample batchDeleteExample = new BatchDeleteExample(); + batchDeleteExample.batchDelete(projectId, instanceId, TABLE_ID); + row = bigtableDataClient.readRow(TABLE_ID, rowKey); + List cellsAfterDelete = row.getCells(COLUMN_FAMILY_NAME_PLAN, qualifier); + + Truth.assertThat(cellsAfterDelete).isEmpty(); + } + + @Test + public void test4_testCheckAndMutate() throws IOException { + String rowKey = "phone#4c410523#20190502"; + Row row = bigtableDataClient.readRow(TABLE_ID, rowKey); + String qualifier = "os_build"; + List cells = row.getCells(COLUMN_FAMILY_NAME_STATS, qualifier); + + Truth.assertThat(cells).isNotEmpty(); + + ConditionalDeleteExample conditionalDeleteExample = new ConditionalDeleteExample(); + conditionalDeleteExample.conditionalDelete(projectId, instanceId, TABLE_ID); + row = bigtableDataClient.readRow(TABLE_ID, rowKey); + List cellsAfterDelete = row.getCells(COLUMN_FAMILY_NAME_STATS, qualifier); + + Truth.assertThat(cellsAfterDelete).isEmpty(); + } + + @Test + public void test5_testDropRowRange() throws IOException { + String rowPrefix = "phone#4c410523"; + Query query = Query.create(TABLE_ID).prefix(rowPrefix); + ServerStream rows = bigtableDataClient.readRows(query); + int rowCount = 0; + for (Row ignored : rows) { + rowCount++; + } + + Truth.assertThat(rowCount).isGreaterThan(1); + + DropRowRangeExample dropRowRangeExample = new DropRowRangeExample(); + dropRowRangeExample.dropRowRange(projectId, instanceId, TABLE_ID); + rows = bigtableDataClient.readRows(query); + rowCount = 0; + for (Row ignored : rows) { + rowCount++; + } + + Truth.assertThat(rowCount).isEqualTo(0); + } + + @Test + public void test6_testDeleteFromColumnFamily() throws IOException { + String rowKey = "phone#5c10102#20190501"; + Row row = bigtableDataClient.readRow(TABLE_ID, rowKey); + List cells = row.getCells(COLUMN_FAMILY_NAME_STATS); + + Truth.assertThat(cells).isNotEmpty(); + + DeleteFromColumnFamilyExample deleteFromColumnFamilyExample = + new DeleteFromColumnFamilyExample(); + deleteFromColumnFamilyExample.deleteFromColumnFamily(projectId, instanceId, TABLE_ID); + row = bigtableDataClient.readRow(TABLE_ID, rowKey); + List cellsAfterDelete = row.getCells(COLUMN_FAMILY_NAME_STATS); + + Truth.assertThat(cellsAfterDelete).isEmpty(); + } + + @Test + public void test7_testDeleteColumnFamily() throws IOException { + try (BigtableTableAdminClient tableAdminClient = + BigtableTableAdminClient.create(projectId, instanceId)) { + Truth.assertThat(tableAdminClient.getTable(TABLE_ID).getColumnFamilies().size()).isEqualTo(2); + + DeleteColumnFamilyExample deleteColumnFamilyExample = new DeleteColumnFamilyExample(); + deleteColumnFamilyExample.deleteColumnFamily( + projectId, instanceId, TABLE_ID, COLUMN_FAMILY_NAME_STATS); + + Truth.assertThat(tableAdminClient.getTable(TABLE_ID).getColumnFamilies().size()).isEqualTo(1); + } + } + + @Test + public void test8_testDeleteTable() throws IOException { + try (BigtableTableAdminClient tableAdminClient = + BigtableTableAdminClient.create(projectId, instanceId)) { + Truth.assertThat(tableAdminClient.exists(TABLE_ID)).isTrue(); + + DeleteTableExample deleteTableExample = new DeleteTableExample(); + deleteTableExample.deleteTable(projectId, instanceId, TABLE_ID); + + Truth.assertThat(tableAdminClient.exists(TABLE_ID)).isFalse(); + } + } +} diff --git a/test-proxy/known_failures.txt b/test-proxy/known_failures.txt new file mode 100644 index 0000000000..ba99db16b4 --- /dev/null +++ b/test-proxy/known_failures.txt @@ -0,0 +1 @@ +TestMutateRow_Generic_DeadlineExceeded\|TestMutateRows_Retry_ExponentialBackoff\|TestSampleRowKeys_Generic_DeadlineExceeded diff --git a/test-proxy/pom.xml b/test-proxy/pom.xml index 162785dc7e..4f7d573104 100644 --- a/test-proxy/pom.xml +++ b/test-proxy/pom.xml @@ -12,11 +12,11 @@ google-cloud-bigtable-parent com.google.cloud - 2.20.3 + 2.20.4 - 2.20.3 + 2.20.4 diff --git a/versions.txt b/versions.txt index 10506013e2..75d7eefd92 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -google-cloud-bigtable:2.20.3:2.20.3 -grpc-google-cloud-bigtable-admin-v2:2.20.3:2.20.3 -grpc-google-cloud-bigtable-v2:2.20.3:2.20.3 -proto-google-cloud-bigtable-admin-v2:2.20.3:2.20.3 -proto-google-cloud-bigtable-v2:2.20.3:2.20.3 -google-cloud-bigtable-emulator:0.157.3:0.157.3 -google-cloud-bigtable-emulator-core:2.20.3:2.20.3 +google-cloud-bigtable:2.20.4:2.20.4 +grpc-google-cloud-bigtable-admin-v2:2.20.4:2.20.4 +grpc-google-cloud-bigtable-v2:2.20.4:2.20.4 +proto-google-cloud-bigtable-admin-v2:2.20.4:2.20.4 +proto-google-cloud-bigtable-v2:2.20.4:2.20.4 +google-cloud-bigtable-emulator:0.157.4:0.157.4 +google-cloud-bigtable-emulator-core:2.20.4:2.20.4