-
Notifications
You must be signed in to change notification settings - Fork 116
Introduce KeySpacePath.importData to import previously exported data #3578
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: main
Are you sure you want to change the base?
Conversation
6a071ed to
abd67ac
Compare
abd67ac to
287ff3f
Compare
...main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImpl.java
Show resolved
Hide resolved
| } | ||
|
|
||
| // Store the data | ||
| byte[] keyBytes = keyTuple.pack(); |
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.
Should we add some fdb timer metrics for future use (imported_count)?
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.
Yeah, I think a timer around importFuture makes sense.
...record-layer-core/src/test/java/com/apple/foundationdb/record/test/FDBDatabaseExtension.java
Outdated
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImportDataTest.java
Outdated
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImportDataTest.java
Outdated
Show resolved
Hide resolved
...main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImpl.java
Outdated
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImportDataTest.java
Outdated
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImportDataTest.java
Show resolved
Hide resolved
...com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathImportDataTest.java
Outdated
Show resolved
Hide resolved
|
|
||
| verifySingleKey(dataPath, Tuple.from("item"), Tuple.from("final_value")); | ||
| } | ||
|
|
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.
Additional potential tests:
- Large data (or any out of band error) during import
- Import into partial path (no leaves in import data) + some remainders
- import where data is of the wrong type
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.
- Yes, a test of more data than can be inserted into a single transaction would make sense, but not if I move it to
ResolvedKeySpacePathand just have it take a singleDataInKeySpacePath. - I'm not sure what you mean by a partial path.
- If by
datayou mean the value, there is no validation, and it is notKeySpacePaths responsibility to know what is in the data. If you mean the object in the path, that should be validated above this call, and should be trust-worthy by the time you get aDataInKeySpacePath. Ideally this would be validated when you create theKeySpacePath, but it is covered in the serialization work, and I explain a bit more on the situation there: https://github.com/FoundationDB/fdb-record-layer/pull/3747/files#diff-15120b2e222e6bb7c2647b670f676b719cce8602e410487604bc87e9ea30a3b0R179
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.
By the second bullet I meant importing into the middle of the path, as when you have a path defined for /company/employee/id/profile and the import only has /company/employee
In doing this, I had to rework the test for overwriting data, and in doing so, I decided it would be better to have 3 tests.
Now all will both run by copying back to the same cluster, and copying between clusters.
Also needed equals & hashCode & toString on DataInKeySpacePathTest so added tests for those
| /** The amount of time checking if a {@link com.google.common.collect.RangeSet} is empty. */ | ||
| RANGE_SET_IS_EMPTY("range set is empty"), | ||
| /** The amount of time importing a single KeyValue into a path. */ | ||
| IMPORT_DATA("import KeyValue"), |
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.
Is this being used?
This introduces a new
KeySpacePath.importDatathat will importDataInKeySpacePathas gathered byKeySpacePath.exportAllData.The new method works when importing data exported from other clusters.
Resolves: #3573
Resolves: #3751 -- I thought I was going to pull this out, but went back and resolved it with a mapPipelined cursor.