common/spanner: introduce debug module and nested transaction warning#2517
Conversation
callmehiphop
left a comment
There was a problem hiding this comment.
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)
|
|
||
| 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.
bjwatson
left a comment
There was a problem hiding this comment.
@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).
| 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 |
| 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 startThe 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! |
| * 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.
Without this, it's difficult to create an informational/delegated retry function, that wraps the default and logs the outcome / does some additional logic
Without this, it's difficult to create an informational/delegated retry function, that wraps the default and logs the outcome / does some additional logic
Fixes #2361