Skip to content

Conversation

brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented Jun 3, 2025

Description

This PR adds a scanner API to the transaction abstraction for iteratively retrieving results. It simply merges the add-scanner-api-to-transaction-abstraction feature branch into the master branch, and the code has already been reviewed.

Related issues and/or PRs

Changes made

  • Merged the add-scanner-api-to-transaction-abstraction feature branch to the master branch

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

N/A

Release notes

Added a scanner API to the transaction abstraction for iteratively retrieving results.

@brfrn169 brfrn169 self-assigned this Jun 3, 2025
@brfrn169 brfrn169 added the enhancement New feature or request label Jun 3, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates a new scanner API into the transaction abstraction layer by adding the getScanner method to various transaction and transaction manager implementations. Key changes include:

  • Adding a getScanner(Scan) method override in DecoratedTwoPhaseCommitTransactionManager, DecoratedTwoPhaseCommitTransaction, DecoratedDistributedTransactionManager, DecoratedDistributedTransaction, and active transaction managed classes.
  • Introducing new scanner interfaces and implementations in CrudOperable and its related abstractions.
  • Minor updates to documentation and integration tests to support the scanner API.

Reviewed Changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
core/src/main/java/com/scalar/db/common/DecoratedTwoPhaseCommitTransactionManager.java Added delegation for getScanner to the underlying transaction manager
core/src/main/java/com/scalar/db/common/DecoratedTwoPhaseCommitTransaction.java Added getScanner override delegating to the underlying transaction
core/src/main/java/com/scalar/db/common/DecoratedDistributedTransactionManager.java Added getScanner override for distributed transactions
core/src/main/java/com/scalar/db/common/DecoratedDistributedTransaction.java Added getScanner override delegating to the underlying distributed transaction
core/src/main/java/com/scalar/db/common/ActiveTransactionManagedTwoPhaseCommitTransactionManager.java Added synchronized getScanner override
core/src/main/java/com/scalar/db/common/ActiveTransactionManagedDistributedTransactionManager.java Added synchronized getScanner override
core/src/main/java/com/scalar/db/common/AbstractTransactionManagerCrudOperableScanner.java Introduced new abstract scanner class for TransactionManagerCrudOperable
core/src/main/java/com/scalar/db/common/AbstractTransactionCrudOperableScanner.java Introduced new abstract scanner class for TransactionCrudOperable
core/src/main/java/com/scalar/db/common/AbstractCrudOperableScanner.java Added implementation for iterator semantics over scanner results
core/src/java/api classes Updated scanner interfaces in TransactionManagerCrudOperable, TransactionCrudOperable, Scanner, and CrudOperable with comprehensive Javadoc comments to describe scanner behavior
Integration tests Added @test annotations to previously disabled test methods to ensure proper scanner-related behavior validation

* (e.g., a conflict error). You can retry the transaction from the beginning
* @throws CrudException if the transaction CRUD operation fails due to transient or nontransient
* faults. You can try retrying the transaction from the beginning, but the transaction may
* still fail if the cause is nontranient
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

Consider correcting the spelling of 'nontranient' to 'nontransient' in the documentation to improve clarity.

Suggested change
* still fail if the cause is nontranient
* still fail if the cause is nontransient

Copilot uses AI. Check for mistakes.

* (e.g., a conflict error). You can retry the transaction from the beginning
* @throws CrudException if the transaction CRUD operation fails due to transient or nontransient
* faults. You can try retrying the transaction from the beginning, but the transaction may
* still fail if the cause is nontranient
Copy link
Preview

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

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

Consider correcting the spelling of 'nontranient' to 'nontransient' in the documentation to improve clarity.

Suggested change
* still fail if the cause is nontranient
* still fail if the cause is nontransient

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

Besides the two typos picked up by Copilot above.
LGTM, thank you.

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!
Fixing the typos?

@brfrn169
Copy link
Collaborator Author

brfrn169 commented Jun 4, 2025

@feeblefakie @Torch3333 I’ll fix the typo in a separate PR, since the same typo also exists in the existing code. Thanks!

@brfrn169 brfrn169 merged commit a70034d into master Jun 4, 2025
56 checks passed
@brfrn169 brfrn169 deleted the add-scanner-api-to-transaction-abstraction branch June 4, 2025 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants