-
Notifications
You must be signed in to change notification settings - Fork 606
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
Conversation
There was a problem hiding this 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.
This comment was marked as spam.
Sorry, something went wrong.
There was a problem hiding this 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).
packages/spanner/src/database.js
Outdated
@@ -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.
This comment was marked as spam.
Sorry, something went wrong.
bump |
packages/spanner/src/database.js
Outdated
@@ -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.
This comment was marked as spam.
Sorry, something went wrong.
Looking at this code, it is not clear to me exactly when would this warning be triggered? |
The user opts in to this warning behavior by using the popular export DEBUG=@google-cloud/spanner; npm start The line itself will be printed to their terminal any time a transaction is started. |
Oh so this would be printed every time a transaction is started and not just if we detect nested transactions? |
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 |
@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. |
fe87bc5
to
f526847
Compare
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.
|
@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. |
CLAs look good, thanks! |
packages/spanner/src/database.js
Outdated
@@ -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.
This comment was marked as spam.
Sorry, something went wrong.
Fixes #2361