Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(spanner): switch order of ListBackupOperations() filter conjuncts #7746

Merged
merged 1 commit into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ TEST_F(BackupIntegrationTest, BackupRestore) {

// List the backup operations
std::ostringstream backup_op_filter;
backup_op_filter << "(metadata.database:" << db.database_id() << ") AND "
<< "(metadata.@type:type.googleapis.com/"
<< "google.spanner.admin.database.v1.CreateBackupMetadata)";
backup_op_filter << "(metadata.@type=type.googleapis.com/"
<< "google.spanner.admin.database.v1.CreateBackupMetadata)"
<< " AND (metadata.database=" << db.FullName() << ")";
google::spanner::admin::database::v1::ListBackupOperationsRequest lreq;
lreq.set_parent(in.FullName());
lreq.set_filter(backup_op_filter.str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ TEST_F(BackupIntegrationTest, BackupRestore) {

// List the backup operations
std::ostringstream backup_op_filter;
backup_op_filter << "(metadata.database:" << db.database_id() << ") AND "
<< "(metadata.@type:type.googleapis.com/"
<< "google.spanner.admin.database.v1.CreateBackupMetadata)";
backup_op_filter << "(metadata.@type=type.googleapis.com/"
<< "google.spanner.admin.database.v1.CreateBackupMetadata)"
<< " AND (metadata.database=" << db.FullName() << ")";
std::vector<std::string> db_names;
for (auto const& operation : database_admin_client_.ListBackupOperations(
in, backup_op_filter.str())) {
Expand Down
8 changes: 5 additions & 3 deletions google/cloud/spanner/samples/samples.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1138,11 +1138,12 @@ void ListBackupOperations(
std::string const& project_id, std::string const& instance_id,
std::string const& database_id) {
google::cloud::spanner::Instance in(project_id, instance_id);
google::cloud::spanner::Database database(in, database_id);
google::spanner::admin::database::v1::ListBackupOperationsRequest request;
request.set_parent(in.FullName());
request.set_filter(std::string("(metadata.database:") + database_id +
") AND " + "(metadata.@type:type.googleapis.com/" +
"google.spanner.admin.database.v1.CreateBackupMetadata)");
request.set_filter(std::string("(metadata.@type=type.googleapis.com/") +
"google.spanner.admin.database.v1.CreateBackupMetadata)" +
" AND (metadata.database=" + database.FullName() + ")");
for (auto const& operation : client.ListBackupOperations(request)) {
if (!operation) throw std::runtime_error(operation.status().message());
google::spanner::admin::database::v1::CreateBackupMetadata metadata;
Expand Down Expand Up @@ -3589,6 +3590,7 @@ void SampleBanner(std::string const& name) {
<< absl::FormatTime("%Y-%m-%dT%H:%M:%SZ", absl::Now(),
absl::UTCTimeZone())
<< std::endl;
GCP_LOG(DEBUG) << "Running " << name << " sample";
}

std::string PickConfig(google::cloud::spanner_admin::InstanceAdminClient client,
Expand Down