Skip to content

Conversation

@brfrn169
Copy link
Collaborator

@brfrn169 brfrn169 commented May 28, 2025

Description

This PR adds a scanner API implementation for single CRUD transactions.

Note that we are working on this feature in the add-scanner-api-to-transaction-abstraction feature branch.

Related issues and/or PRs

Changes made

  • Added a scanner API implementation for single CRUD transactions

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

N/A

@brfrn169 brfrn169 self-assigned this May 28, 2025
@brfrn169 brfrn169 requested a review from Copilot May 28, 2025 07:32
Copy link
Contributor

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 introduces a full implementation of the getScanner API for single CRUD transactions, augments unit tests to cover its behavior, and removes a placeholder integration test.

  • Implement getScanner in SingleCrudOperationTransactionManager with proper exception wrapping.
  • Add comprehensive unit tests for one(), all(), iterator(), and error scenarios on the scanner.
  • Remove the disabled placeholder integration test without replacing it.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
integration-test/src/main/java/.../SingleCrudOperationTransactionIntegrationTestBase.java Removed a disabled stub test for getScanner without adding a real one.
core/src/test/java/.../SingleCrudOperationTransactionManagerTest.java Added unit tests covering scanner methods and error propagation.
core/src/main/java/com/scalar/db/transaction/singlecrudoperation/SingleCrudOperationTransactionManager.java Implemented getScanner and wrapped storage scanner calls into CrudException.
Comments suppressed due to low confidence (1)

integration-test/src/main/java/com/scalar/db/transaction/singlecrudoperation/SingleCrudOperationTransactionIntegrationTestBase.java:412

  • The disabled placeholder test for getScanner was removed without adding an actual integration test to verify scanner behavior against a real storage backend. Consider adding an end-to-end integration test that exercises getScanner on committed records.
@Disabled("Implement later")


return new AbstractTransactionManagerCrudOperableScanner() {
@Override
public Optional<Result> one() throws CrudException {
Copy link

Copilot AI May 28, 2025

Choose a reason for hiding this comment

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

[nitpick] The try–catch logic for wrapping ExecutionException into CrudException is duplicated in one() and all(). Consider extracting a helper method (e.g. wrapCrud(Supplier<T>)) to reduce code duplication and improve readability.

Copilot uses AI. Check for mistakes.
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!

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.

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! 👍

@brfrn169 brfrn169 merged commit 8ea08fa into add-scanner-api-to-transaction-abstraction May 29, 2025
56 checks passed
@brfrn169 brfrn169 deleted the implement-scanner-for-single-crud-operation branch May 29, 2025 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants