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

common/spanner: introduce debug module and nested transaction warning #2517

Merged
merged 5 commits into from
Oct 10, 2017

Conversation

stephenplusplus
Copy link
Contributor

@stephenplusplus stephenplusplus commented Aug 9, 2017

Fixes #2361

@stephenplusplus stephenplusplus added api: spanner Issues related to the Spanner API. core labels Aug 9, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 9, 2017
@stephenplusplus stephenplusplus added status: do not merge and removed cla: yes This human has signed the Contributor License Agreement. labels Aug 9, 2017
Copy link
Contributor

@callmehiphop callmehiphop left a comment

Choose a reason for hiding this comment

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

Would it be worth the trouble to integrate with a user-specified logger? I'm mostly curious as to whether or not we would want to integrate with google-cloud-logging (I'm not very familiar with it, so it might not even be possible)

@@ -2702,7 +2702,7 @@ var spanner = new Spanner(env);
});

describe('read only', function() {
it('should run a read only transaction', function(done) {
it.only('should run a read only transaction', function(done) {

This comment was marked as spam.

Copy link

@bjwatson bjwatson left a comment

Choose a reason for hiding this comment

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

@vkedia Are these changes sufficient for Node, given the complexities of enforcing this more strongly?

I also believe that the docs will be updated to make it clear that nested transactions aren't supported (if this hasn't been done already).

@@ -892,6 +892,11 @@ Database.prototype.runTransaction = function(options, runFn) {

options = extend({}, options);

this.debug([
'Stating a transaction. Note that nested transactions are not currently',

This comment was marked as spam.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 10, 2017
@stephenplusplus
Copy link
Contributor Author

bump

@@ -892,6 +892,11 @@ Database.prototype.runTransaction = function(options, runFn) {

options = extend({}, options);

this.debug([
'Starting a transaction. Note that nested transactions are not currently',

This comment was marked as spam.

@vkedia
Copy link
Contributor

vkedia commented Sep 11, 2017

Looking at this code, it is not clear to me exactly when would this warning be triggered?

@stephenplusplus
Copy link
Contributor Author

The user opts in to this warning behavior by using the popular debug module. When they start their app, it would look like:

export DEBUG=@google-cloud/spanner; npm start

The line itself will be printed to their terminal any time a transaction is started.

@vkedia
Copy link
Contributor

vkedia commented Sep 12, 2017

Oh so this would be printed every time a transaction is started and not just if we detect nested transactions?

@stephenplusplus
Copy link
Contributor Author

Right, we couldn't come up with a semi-reliable way to detect nested transactions without an API redesign. By always warning, in the worst case, it's excess noise to the user. But, by using the debug module, the user is expecting to receive a steady stream of output, so I wouldn't expect this to stand out in a way that's overly obtrusive.

@vkedia
Copy link
Contributor

vkedia commented Sep 19, 2017

@stephenplusplus I am not sure how much utility this would have on top of documentation. It just seems strange that we are telling them something which they might even know exist. It might infact confuse users and they might worry why they are getting this warning and maybe they are doing something wrong.
I would say let us not merge this and instead just document this (if not already documented).

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Sep 21, 2017
@stephenplusplus stephenplusplus added docs and removed status: do not merge cla: no This human has *not* signed the Contributor License Agreement. labels Sep 21, 2017
@stephenplusplus
Copy link
Contributor Author

@vkedia updated the docs to make the same mention. Feel free to fork this PR if you have a better idea for the implementation, or words to use to explain.

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 21, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling b900f6c on stephenplusplus:spp--2361 into badd1b8 on GoogleCloudPlatform:master.

@@ -787,6 +787,8 @@ Database.prototype.runStream = function(query, options) {
* atomically at a single logical point in time across columns, rows, and tables
* in a database.
*
* Note that Cloud Spanner does not support nested transactions.

This comment was marked as spam.

@stephenplusplus stephenplusplus merged commit 623d302 into googleapis:master Oct 10, 2017
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 5fb7905 on stephenplusplus:spp--2361 into badd1b8 on GoogleCloudPlatform:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants