Skip to content

Commit 0578c7d

Browse files
authored
feat(spanner): Point-In-Time Recovery (lite) throttled DB update (#5562)
Update the "com_google_googleapis" package to a recent snapshot. This includes the `UpdateDatabaseDdlMetadata.throttled` field, and requires adding `table_reference.proto` to the cmake lists. The `UpdateDatabaseDdlMetadata.throttled` field indicates that the `UpdateDatabase()` operation is throttled, e.g., due to resource constraints. When resources become available the operation will resume and the field will be false again. This only updates an integration test. No samples are required for this field.
1 parent 3aca9a8 commit 0578c7d

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

bazel/google_cloud_cpp_deps.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def google_cloud_cpp_deps():
7575
http_archive(
7676
name = "com_google_googleapis",
7777
urls = [
78-
"https://github.com/googleapis/googleapis/archive/59f97e6044a1275f83427ab7962a154c00d915b5.tar.gz",
78+
"https://github.com/googleapis/googleapis/archive/370e9f9ac14dbc73f56e15257bccc06dfebd4196.tar.gz",
7979
],
80-
strip_prefix = "googleapis-59f97e6044a1275f83427ab7962a154c00d915b5",
81-
sha256 = "5e785c25b1d57973e7481b4da226d7c73056ea22c7545bf6d14dbebf6e99b073",
80+
strip_prefix = "googleapis-370e9f9ac14dbc73f56e15257bccc06dfebd4196",
81+
sha256 = "71ebb74007fd32626896fa2056c31d436c5e96774ac160482b5f25df5a90c6b9",
8282
build_file = "@com_github_googleapis_google_cloud_cpp//bazel:googleapis.BUILD",
8383
)
8484

external/googleapis/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ cmake_minimum_required(VERSION 3.5)
1919
# Give application developers a hook to configure the version and hash
2020
# downloaded from GitHub.
2121
set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_URL
22-
"https://github.com/googleapis/googleapis/archive/59f97e6044a1275f83427ab7962a154c00d915b5.tar.gz"
22+
"https://github.com/googleapis/googleapis/archive/370e9f9ac14dbc73f56e15257bccc06dfebd4196.tar.gz"
2323
)
2424
set(GOOGLE_CLOUD_CPP_GOOGLEAPIS_SHA256
25-
"5e785c25b1d57973e7481b4da226d7c73056ea22c7545bf6d14dbebf6e99b073")
25+
"71ebb74007fd32626896fa2056c31d436c5e96774ac160482b5f25df5a90c6b9")
2626

2727
set(GOOGLEAPIS_CPP_SOURCE
2828
"${CMAKE_BINARY_DIR}/external/googleapis/src/googleapis_download")
@@ -67,6 +67,7 @@ set(GOOGLEAPIS_CPP_PROTO_FILES
6767
"google/cloud/bigquery/v2/model.proto"
6868
"google/cloud/bigquery/v2/model_reference.proto"
6969
"google/cloud/bigquery/v2/standard_sql.proto"
70+
"google/cloud/bigquery/v2/table_reference.proto"
7071
"google/pubsub/v1/pubsub.proto"
7172
"google/spanner/admin/database/v1/backup.proto"
7273
"google/spanner/admin/database/v1/common.proto"
@@ -229,6 +230,7 @@ google_cloud_cpp_grpcpp_library(
229230
"${GOOGLEAPIS_CPP_SOURCE}/google/cloud/bigquery/v2/model.proto"
230231
"${GOOGLEAPIS_CPP_SOURCE}/google/cloud/bigquery/v2/model_reference.proto"
231232
"${GOOGLEAPIS_CPP_SOURCE}/google/cloud/bigquery/v2/standard_sql.proto"
233+
"${GOOGLEAPIS_CPP_SOURCE}/google/cloud/bigquery/v2/table_reference.proto"
232234
PROTO_PATH_DIRECTORIES
233235
"${GOOGLEAPIS_CPP_SOURCE}"
234236
"${PROTO_INCLUDE_DIR}")

google/cloud/spanner/integration_tests/database_admin_integration_test.cc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ inline namespace SPANNER_CLIENT_NS {
2929
namespace {
3030

3131
using ::google::cloud::testing_util::IsProtoEqual;
32+
using ::testing::Contains;
3233
using ::testing::EndsWith;
3334
using ::testing::HasSubstr;
3435

@@ -155,25 +156,25 @@ TEST_F(DatabaseAdminClientTest, DatabaseBasicCRUD) {
155156
ASSERT_STATUS_OK(get_ddl_result);
156157
EXPECT_EQ(0, get_ddl_result->statements_size());
157158

158-
auto constexpr kCreateTableStatement = R"""(
159-
CREATE TABLE Singers (
160-
SingerId INT64 NOT NULL,
161-
FirstName STRING(1024),
162-
LastName STRING(1024),
163-
SingerInfo BYTES(MAX)
164-
) PRIMARY KEY (SingerId)
165-
)""";
166-
167-
auto update_future =
168-
client_.UpdateDatabase(database_, {kCreateTableStatement});
159+
std::vector<std::string> statements;
160+
statements.emplace_back(R"""(
161+
CREATE TABLE Singers (
162+
SingerId INT64 NOT NULL,
163+
FirstName STRING(1024),
164+
LastName STRING(1024),
165+
SingerInfo BYTES(MAX)
166+
) PRIMARY KEY (SingerId)
167+
)""");
168+
auto update_future = client_.UpdateDatabase(database_, statements);
169169
auto metadata = update_future.get();
170170
ASSERT_STATUS_OK(metadata);
171171
EXPECT_THAT(metadata->database(), EndsWith(database_.database_id()));
172-
EXPECT_EQ(1, metadata->statements_size());
173-
EXPECT_EQ(1, metadata->commit_timestamps_size());
172+
EXPECT_EQ(statements.size(), metadata->statements_size());
173+
EXPECT_EQ(statements.size(), metadata->commit_timestamps_size());
174174
if (metadata->statements_size() >= 1) {
175-
EXPECT_THAT(metadata->statements(0), HasSubstr("CREATE TABLE"));
175+
EXPECT_THAT(metadata->statements(), Contains(HasSubstr("CREATE TABLE")));
176176
}
177+
EXPECT_FALSE(metadata->throttled());
177178

178179
EXPECT_TRUE(DatabaseExists()) << "Database " << database_;
179180
auto drop_status = client_.DropDatabase(database_);

0 commit comments

Comments
 (0)