-
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 Control file module files and validation #2445
base: master
Are you sure you want to change the base?
Conversation
DATA_LOADER_MISSING_COLUMN_MAPPING( | ||
Category.USER_ERROR, | ||
"0159", | ||
"No mapping found for column '%s' in table '%s' in the control file. \\nControl file validation set at 'FULL'. All columns need to be mapped.", |
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.
"No mapping found for column '%s' in table '%s' in the control file. \\nControl file validation set at 'FULL'. All columns need to be mapped.", | |
"No mapping found for column '%s' in table '%s' in the control file. Control file validation set at 'FULL'. All columns need to be mapped.", |
Ignore this comment if the newline is really necessary.
DATA_LOADER_ERROR_CRUD_EXCEPTION( | ||
Category.INTERNAL_ERROR, | ||
"0047", | ||
"Something went wrong while trying to save the data. Details %s", |
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. Details %s", | |
"Something went wrong while trying to save the data. Details: %s", |
DATA_LOADER_ERROR_SCAN( | ||
Category.INTERNAL_ERROR, | ||
"0048", | ||
"Something went wrong while scanning. Are you sure you are running in the correct transaction mode? Details %s", |
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 scanning. Are you sure you are running in the correct transaction mode? Details %s", | |
"Something went wrong while scanning. Are you sure you are running in the correct transaction mode? Details: %s", |
@JsonProperty("namespace") | ||
private String namespace; | ||
|
||
/** The name of the table in ScalarDB. */ |
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.
namespace
above is also just the name of a namespace. How about renaming this to table
as well or the above namespace
to namespaceName
for consistency?
""), | ||
DATA_LOADER_CONTROL_FILE_MISSING_DATA_MAPPINGS( | ||
Category.USER_ERROR, "0160", "The control file is missing data mappings", "", ""), | ||
DATA_LOADER__MISSING_NAMESPACE_OR_TABLE( |
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.
DATA_LOADER__MISSING_NAMESPACE_OR_TABLE( | |
DATA_LOADER_MISSING_NAMESPACE_OR_TABLE( |
String namespace, | ||
String table, | ||
Key partitionKey, | ||
Key clusteringKey, |
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.
Key clusteringKey, | |
@Nullable Key clusteringKey, |
Java is a poor language unable to represent nullable or non-nullable with type, and @Nullable
annotation is very helpful for us.
logger.info(String.format(GET_COMPLETED_MSG, loggingKey)); | ||
return result; | ||
} catch (CrudException e) { | ||
throw new ScalarDBDaoException("error GET " + loggingKey, e.getCause()); |
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.
throw new ScalarDBDaoException("error GET " + loggingKey, e.getCause()); | |
throw new ScalarDBDaoException("error GET " + loggingKey, e); |
Just including e
would be a bit better not to lose the context.
logger.info(SCAN_START_MSG); | ||
Scanner scanner = storage.scan(scan); | ||
List<Result> allResults = scanner.all(); | ||
scanner.close(); |
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.
It's possible this close isn't called if scanner.all()
throws an exception. How about using try-with-resources statement for scanner
?
/* Distributed storage for ScalarDB connection that is running in storage mode. */ | ||
@Nullable private final DistributedStorage storage; | ||
/* Distributed Transaction manager for ScalarDB connection that is running in transaction mode */ | ||
private final DistributedTransactionManager transactionManager; |
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 3 variables should have @Nullable
annotation as well.
} | ||
|
||
/** @return storage for ScalarDB connection that is running in storage mode */ | ||
public DistributedStorage getDistributedStorage() { |
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.
public DistributedStorage getDistributedStorage() { | |
@Nullable public DistributedStorage getDistributedStorage() { |
Description
This PR adds files related to control file and its validation. A control file is used to map column names specified in import source file to actual table columns.
Related issues and/or PRs
Please review and merge this PR once the following PRs are merged
Changes made
I have added files related to control file and its validation
Checklist
Additional notes (optional)
Road map to merge remaining data loader core files. Current status
General
Export
Import
Release notes
NA