-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move session lastUseTime parameter from PooledSession to Sessio…
…nImpl class. Fix updation of the parameter for chained RPCs within one transaction. (#2704) * fix: prevent illegal negative timeout values into thread sleep() method while retrying exceptions in unit tests. * For details on issue see - #2206 * Fixing lint issues. * refactor: move session lastUseTime parameter from PooledSession to SessionImpl class. Fix updation of the parameter for chained RPCs within one transaction. * chore: add clock instances in callees of SessionImpl. * chore: partially fix failing unit tests in SessionPoolTest and SessionPoolMaintainerTest. * chore: fix failing tests in SessionPoolStressTest. * chore: update lastUseTime for methods in SessionPoolTransactionContext. Add a couple of unit tests for testing the new behaviour. * chore: lint errors. * chore: fix tests in DatabaseClientImplTest by passing the mocked clock instance. * fix: update session lastUseTime field for AbstractReadContext class. Fix the unit test to test this change. * fix: failing tests in TransactionRunnerImplTest. * fix: failing test in SessionPoolMaintainerTest. * refactor: move FakeClock to a new class. * refactor: move Clock to a new class. * chore: resolving PR comments. * chore: address review comments. * chore: updating lastUseTime state in TransactionRunnerImpl. Removing redundant updates from SessionPool class. * chore: remove redundant update statements from SessionPool class. Add more unit tests. * chore: add more tests for TransactionRunner. * chore: remove dead code from constructor of SessionPoolTransactionContext. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java Co-authored-by: Knut Olav Løite <[email protected]> * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java Co-authored-by: Knut Olav Løite <[email protected]> * Update google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java Co-authored-by: Knut Olav Løite <[email protected]> * chore: fixing precondition errors due to null clock. --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e320753
commit e75a281
Showing
13 changed files
with
1,009 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
google-cloud-spanner/src/main/java/com/google/cloud/spanner/Clock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.cloud.spanner; | ||
|
||
import org.threeten.bp.Instant; | ||
|
||
/** | ||
* Wrapper around current time so that we can fake it in tests. TODO(user): Replace with Java 8 | ||
* Clock. | ||
*/ | ||
class Clock { | ||
Instant instant() { | ||
return Instant.now(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.