Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

feat: add SessionPoolOptions with labels to MakeConnection() #1109

Merged
merged 2 commits into from
Nov 26, 2019

Conversation

devbww
Copy link
Contributor

@devbww devbww commented Nov 22, 2019

Moves SessionPoolOptions out of the internal namespace,
and adds a std::map<std::string, std::string> labels field.
Plumbs those labels through to the BatchCreateSessions()
call.

Fixes #421.


This change is Reviewable

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 22, 2019
@codecov
Copy link

codecov bot commented Nov 22, 2019

Codecov Report

Merging #1109 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1109      +/-   ##
=========================================
+ Coverage   87.95%     88%   +0.05%     
=========================================
  Files         163     164       +1     
  Lines       12299   12315      +16     
=========================================
+ Hits        10817   10838      +21     
+ Misses       1482    1477       -5
Impacted Files Coverage Δ
google/cloud/spanner/client.h 100% <ø> (ø) ⬆️
google/cloud/spanner/internal/session_pool.h 100% <ø> (ø) ⬆️
google/cloud/spanner/internal/session_pool.cc 95.86% <100%> (+0.03%) ⬆️
google/cloud/spanner/internal/session_pool_test.cc 100% <100%> (ø) ⬆️
google/cloud/spanner/samples/samples.cc 86.37% <100%> (+0.28%) ⬆️
google/cloud/spanner/client_test.cc 94.23% <100%> (+0.01%) ⬆️
google/cloud/spanner/client.cc 84.68% <100%> (+0.42%) ⬆️
google/cloud/spanner/internal/connection_impl.cc 96.32% <100%> (ø) ⬆️
...gle/cloud/spanner/internal/connection_impl_test.cc 98.95% <100%> (ø) ⬆️
google/cloud/spanner/value.h 92.7% <0%> (-0.11%) ⬇️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56682fb...74141cd. Read the comment docs.

@devbww devbww marked this pull request as ready for review November 22, 2019 23:19
@devbww devbww requested a review from mr-salty November 22, 2019 23:19
@devbww devbww force-pushed the labels branch 2 times, most recently from 5f13550 to edcedd7 Compare November 25, 2019 20:15
@mr-salty
Copy link
Contributor


google/cloud/spanner/client.h, line 549 at r2 (raw file):

/**
 * @copydoc MakeConnection(Database const&, ConnectionOptions const&, SessionPoolOptions)

clang-tidy thinks this line should wrap

Copy link
Contributor

@mr-salty mr-salty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: after fixing the clang-tidy thing (and assuming the other build failure was bogus)

Reviewed 10 of 12 files at r1, 3 of 3 files at r2.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @devbww)


google/cloud/spanner/client.h, line 558 at r2 (raw file):

    Database const& db, ConnectionOptions const& connection_options,
    SessionPoolOptions session_pool_options,

FWIW, ConnectionOptions is const & (and probably Database as well) because if it's not, we get a clang-tidy warning about "moving a trivial type" or similar, and then if you remove the move it complains about it being copied.

So, I'm guessing SessionPoolOptions doesn't have that issue due to the map, but it seems really odd that these are different, and that will show up at the call site ...(db, conn_options, std::move(pool_options));

IDK what we can/should do about it, although Greg mentioned tweaking clang-tidy warnings about this in the past.


google/cloud/spanner/internal/session_pool.h, line 27 at r2 (raw file):

#include "google/cloud/status_or.h"
#include <google/spanner/v1/spanner.pb.h>
#include <chrono>

this can be deleted

Moves `SessionPoolOptions` out of the `internal` namespace,
and adds a `std::map<std::string, std::string> labels` field.
Plumbs those labels through to the `BatchCreateSessions()`
call.

Fixes googleapis#421.
@devbww
Copy link
Contributor Author

devbww commented Nov 26, 2019

clang-tidy thinks this line should wrap

Fixed in #1122.

@devbww
Copy link
Contributor Author

devbww commented Nov 26, 2019

this can be deleted

Done.

@devbww
Copy link
Contributor Author

devbww commented Nov 26, 2019

So, I'm guessing SessionPoolOptions doesn't have that issue due to the map, but it seems really odd that these are different, and that will show up at the call site

Ack, although for now it is what it is.

Copy link
Contributor Author

@devbww devbww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 12 of 13 files reviewed, 3 unresolved discussions (waiting on @mr-salty)


google/cloud/spanner/client.h, line 549 at r2 (raw file):

Previously, mr-salty (Todd Derr) wrote…

clang-tidy thinks this line should wrap

Done.


google/cloud/spanner/client.h, line 558 at r2 (raw file):

Previously, mr-salty (Todd Derr) wrote…
    Database const& db, ConnectionOptions const& connection_options,
    SessionPoolOptions session_pool_options,

FWIW, ConnectionOptions is const & (and probably Database as well) because if it's not, we get a clang-tidy warning about "moving a trivial type" or similar, and then if you remove the move it complains about it being copied.

So, I'm guessing SessionPoolOptions doesn't have that issue due to the map, but it seems really odd that these are different, and that will show up at the call site ...(db, conn_options, std::move(pool_options));

IDK what we can/should do about it, although Greg mentioned tweaking clang-tidy warnings about this in the past.

Done.


google/cloud/spanner/internal/session_pool.h, line 27 at r2 (raw file):

Previously, mr-salty (Todd Derr) wrote…

this can be deleted

Done.

Copy link
Contributor Author

@devbww devbww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dismissed @mr-salty from 3 discussions.
Reviewable status: 12 of 13 files reviewed, all discussions resolved (waiting on @mr-salty)

@devbww devbww merged commit 5481d0e into googleapis:master Nov 26, 2019
@devbww devbww deleted the labels branch November 26, 2019 05:12
devjgm pushed a commit to devjgm/google-cloud-cpp that referenced this pull request May 7, 2020
…pis/google-cloud-cpp-spanner#1109)

Moves `SessionPoolOptions` out of the `internal` namespace,
and adds a `std::map<std::string, std::string> labels` field.
Plumbs those labels through to the `BatchCreateSessions()`
call.

Fixes googleapis/google-cloud-cpp-spanner#421.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "labels" in the client.
3 participants