-
Notifications
You must be signed in to change notification settings - Fork 37
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
base: master
Are you sure you want to change the base?
Conversation
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/main/java/com/scalar/db/dataloader/core/dataimport/dao/ScalarDBManager.java
Outdated
Show resolved
Hide resolved
DATA_LOADER_ERROR_CRUD_EXCEPTION( | ||
Category.INTERNAL_ERROR, | ||
"0047", | ||
"something went wrong while trying to save the data", |
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.
"something went wrong while trying to save the data", | |
"Something went wrong while trying to save the data", |
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.
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?", |
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.
Same as above
* @throws ScalarDBDaoException if something goes wrong while reading the data | ||
*/ | ||
public Optional<Result> get( | ||
String namespace, |
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.
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(); |
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.
How about using try-with-resources considering failures of scanner.all()
?
if (limit > 0) { | ||
buildableScanAll.limit(limit); | ||
} | ||
return buildableScanAll.build(); |
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.
If no partitionKey is given, sortOrders
should be ignored?
*/ | ||
private Get createGetWith( | ||
String namespace, String tableName, Key partitionKey, Key clusteringKey) { | ||
if (clusteringKey != null) { |
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.
[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; |
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.
These should have @Nullable
annotations.
BTW, maybe this can be divided into ScalarDbStorageManger
and ScalarDbTransactionManger
?
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
Additional notes (optional)
Road map to merge remaining data loader core files. Current status
General
Export
Import
Release notes
NA