Skip to content
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

Add ScalarDB Dao and related files #2417

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

inv-jishnu
Copy link
Contributor

@inv-jishnu inv-jishnu commented Dec 17, 2024

Description

I have added scalarDB dao and related files used in data loader

Related issues and/or PRs

Please review this PR once the PR #2397 is review and merged (Once the above PR is merged, I will merge the master to this one to resolve spotbugs issue).

Changes made

I have added scalarDB dao and related files used in data loader

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.
  • 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)

Road map to merge remaining data loader core files. Current status

  • General

  • Export

  • Import

    • Dto classes and utilities: 1 PR incoming
    • Import processor and task code: 2-3 PRs incoming
    • Code for Import transaction batch and data chunk import: 1 PR Incoming
    • ControlFile related Dtos: 1 PR incoming
    • Import logger: 1 PR incoming
    • Import Manager: 1 PR incoming

Release notes

NA

@inv-jishnu inv-jishnu marked this pull request as draft December 17, 2024 11:49
@inv-jishnu inv-jishnu changed the title ScalarDB Dao and related files Add ScalarDB Dao and related files Dec 17, 2024
@inv-jishnu inv-jishnu self-assigned this Dec 19, 2024
@ypeckstadt ypeckstadt marked this pull request as ready for review December 19, 2024 23:32
@ypeckstadt ypeckstadt added the enhancement New feature or request label Dec 19, 2024
DATA_LOADER_ERROR_CRUD_EXCEPTION(
Category.INTERNAL_ERROR,
"0047",
"something went wrong while trying to save the data",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"something went wrong while trying to save the data",
"Something went wrong while trying to save the data",

Copy link
Contributor

Choose a reason for hiding this comment

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

This error code document is build from these message definitions in CoreError. I think Details: %s is needed as well as other errors from the perspective of documentation.

DATA_LOADER_ERROR_SCAN(
Category.INTERNAL_ERROR,
"0048",
"Something went wrong while scanning. Are you sure you are running in the correct transaction mode?",
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

* @throws ScalarDBDaoException if something goes wrong while reading the data
*/
public Optional<Result> get(
String namespace,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the name of a namespace as well as the name of a table tableName below. This should be namespaceName for consistency? namespace and table would be also good since these are consistent.

try {
logger.info(SCAN_START_MSG);
Scanner scanner = storage.scan(scan);
List<Result> allResults = scanner.all();
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using try-with-resources considering failures of scanner.all()?

if (limit > 0) {
buildableScanAll.limit(limit);
}
return buildableScanAll.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

If no partitionKey is given, sortOrders should be ignored?

*/
private Get createGetWith(
String namespace, String tableName, Key partitionKey, Key clusteringKey) {
if (clusteringKey != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor] I think we can reduce the duplicated code by setting Clustering Key like this as well as createPutWith()

    Buildable buildable = ...

    if (clusteringKey != null) {
      buildable.clusteringKey(clusteringKey);
    }

public class ScalarDBManager {

/* Distributed storage for ScalarDB connection that is running in storage mode. */
private final DistributedStorage storage;
Copy link
Contributor

Choose a reason for hiding this comment

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

These should have @Nullable annotations.

BTW, maybe this can be divided into ScalarDbStorageManger and ScalarDbTransactionManger ?

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.

3 participants