-
Notifications
You must be signed in to change notification settings - Fork 40
Replace DistributedStorage with DistributedTransactionManager in Data Loader export #3140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @inv-jishnu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request initiates a significant architectural shift within the ScalarDB Data Loader by migrating its data export capabilities to leverage the DistributedTransactionManager. This change is a foundational step towards a more unified and robust data access strategy, ensuring that export operations benefit from transactional guarantees. While currently focused solely on export, this refactoring sets the stage for subsequent updates to other Data Loader components, aiming for a consistent transactional approach throughout the system. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively refactors the data loader's export functionality to use DistributedTransactionManager instead of DistributedStorage, which is a good step towards unifying data access patterns. The changes are well-contained to the export logic and are consistently applied across the affected classes and their corresponding unit tests. The Javadoc comments have also been helpfully updated to reflect the new transactional behavior.
I have a couple of suggestions for improvement: one regarding error logging for better diagnostics, and another to correct a minor issue in a test setup for clarity. Overall, this is a solid refactoring.
data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataexport/ExportManager.java
Outdated
Show resolved
Hide resolved
...loader/core/src/test/java/com/scalar/db/dataloader/core/dataexport/CsvExportManagerTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the data loader export functionality to use DistributedTransactionManager instead of DistributedStorage. The changes are well-implemented and consistent across the modified files. I've identified a few areas for improvement, mainly related to documentation clarity, code consistency, and a minor bug in a test file. Overall, this is a solid refactoring effort.
data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataexport/ExportManager.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataexport/ExportManager.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/dao/ScalarDbDao.java
Outdated
Show resolved
Hide resolved
data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/dao/ScalarDbDao.java
Outdated
Show resolved
Hide resolved
...loader/core/src/test/java/com/scalar/db/dataloader/core/dataexport/CsvExportManagerTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(apart from AI review comments ) LGTM. Thank you.
@inv-jishnu Best to add the reason why this PR is necessary in the PR description as well, not just what it does. This PR is reviewed by a lot of members so they need the context.
feeblefakie
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
komamitsu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
| TableMetadataService metaDataService = | ||
| new TableMetadataService(storageFactory.getStorageAdmin()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use DistributedTransactionAdmin in TableMetadataService:
| TableMetadataService metaDataService = | |
| new TableMetadataService(storageFactory.getStorageAdmin()); | |
| TableMetadataService metaDataService = | |
| new TableMetadataService(transactionFactory.getTransactionAdmin()); |
I think we can replace all usages of the storage API with the transaction API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
This pull request refactors the ScalarDB Data Loader export functionality to use the DistributedTransactionManager instead of the DistributedStorage interface.
Currently, only the export functionality has been migrated to use the transactional API. Other components of the Data Loader that still depend on DistributedStorage—such as certain import operations and internal utilities—will be updated in future PRs to ensure a consistent data access approach across all modules.
This migration is required for ScalarDB Cluster compatibility, since the DistributedStorage interface is not supported in clustered environments. By using DistributedTransactionManager, the export process can now operate seamlessly in both standalone and clustered ScalarDB deployments.
Related issues and/or PRs
NA
Changes made
Replaced all usages of DistributedStorage in export-related classes with DistributedTransactionManager.
Updated constructors and factory methods in ExportManager and its concrete subclasses (CsvExportManager, JsonExportManager, JsonLinesExportManager) to use DistributedTransactionManager.
Modified logic for reading data during export to use transaction-based reads.
Updated corresponding unit tests to mock or inject DistributedTransactionManager instead of DistributedStorage.
Cleaned up related Javadoc comments and updated descriptions to reflect the new transactional behaviour.
Checklist
Additional notes (optional)
There are still usage of DistributerStorage in the other sections including table metadata usage in import which will be removed in later PRs
Release notes
Replaced DistributedStorage with DistributedTransactionManager in Data Loader export