Skip to content

Conversation

@scotthart
Copy link
Member

@scotthart scotthart commented Aug 12, 2025

This change is Reviewable

@scotthart scotthart requested a review from a team as a code owner August 12, 2025 15:06
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Aug 12, 2025
@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.03%. Comparing base (5afc916) to head (1812870).
⚠️ Report is 59 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15372   +/-   ##
=======================================
  Coverage   93.02%   93.03%           
=======================================
  Files        2403     2403           
  Lines      219441   219466   +25     
=======================================
+ Hits       204144   204172   +28     
+ Misses      15297    15294    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 584 to 586
if (current.has<spanner::ExcludeTransactionFromChangeStreamsOption>() &&
current.get<spanner::ExcludeTransactionFromChangeStreamsOption>()) {
begin.mutable_options()->set_exclude_txn_from_change_streams(true);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

With the knowledge that bool() == false, save yourself a second lookup by removing the has().

That said, this should have been taken care of by line 571, so methinks there is actually some call to transaction.cc:MakeOpts() missing, or falling short of the mark, when creating options.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reworked this change to use CommitOptions like the existing settings are using.

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't look right.

  • spanner::CommitOptions is a deprecated class, replaced by Options, so it shouldn't be extended. (Indeed, it should be removed/hidden in 3.0.)
  • The new ConnectionImplTest.CommitSuccessExcludeFromChangeStreamsExplicitTxn test passes without any of these changes. I can't see b/346858290 so I can't even guess what the issue might be.

Copy link
Member Author

Choose a reason for hiding this comment

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

I created a draft PR demonstrating the issue #15391

Copy link
Member Author

@scotthart scotthart 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: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @devbww)

Comment on lines 584 to 586
if (current.has<spanner::ExcludeTransactionFromChangeStreamsOption>() &&
current.get<spanner::ExcludeTransactionFromChangeStreamsOption>()) {
begin.mutable_options()->set_exclude_txn_from_change_streams(true);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Reworked this change to use CommitOptions like the existing settings are using.

Comment on lines 3265 to 3267
// Introduce additional scope here to ensure that when txn is destroyed
// the session_pool contained by the Connection is still present, such that,
// the session associated with the transaction can be returned to the pool.
Copy link
Contributor

Choose a reason for hiding this comment

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

Introducing a new scope here does not appear to change the lifetime of any object. It is at the end of its enclosing scope after all.

Copy link
Member Author

Choose a reason for hiding this comment

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

As usual, you're correct. The added scope hid the fact that it was the order of destruction that mattered.

diegomarquezp
diegomarquezp previously approved these changes Aug 13, 2025
Copy link
Member Author

@scotthart scotthart 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: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @devbww)

Comment on lines 584 to 586
if (current.has<spanner::ExcludeTransactionFromChangeStreamsOption>() &&
current.get<spanner::ExcludeTransactionFromChangeStreamsOption>()) {
begin.mutable_options()->set_exclude_txn_from_change_streams(true);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I created a draft PR demonstrating the issue #15391

Comment on lines 3265 to 3267
// Introduce additional scope here to ensure that when txn is destroyed
// the session_pool contained by the Connection is still present, such that,
// the session associated with the transaction can be returned to the pool.
Copy link
Member Author

Choose a reason for hiding this comment

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

As usual, you're correct. The added scope hid the fact that it was the order of destruction that mattered.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants