-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Export Import sst files #3822
Export Import sst files #3822
Conversation
Introduce a new API ExportColumnFamilyTables to export all the live sst files of a particular column family and metadata information to be used to import these sst files. This is part 1 of the change for #3469 " Add support for taking snapshot of a CF and creating a CF from a given CF snapshot" Partially Solves #3469
This change adds support to import external sst files from one column family, as is, onto another column family. The files are imported at the same level and with same sequence number as at the source. This is part 2 of the change for #3469 " Add support for taking snapshot of a CF and creating a CF from a given CF snapshot" Partially Solves #3469
Thank you for your contribution! |
We though about using ingest API to get the files in level by level. But,
ended up adding a new API for few reasons.
(1) The level and seqnum for the file is specified in import. So, we need
additional argument to send in other than just the filename in current
Ingest API.
(2) It is OK to Import overlapping files in level L0 (Ingest disallows this)
(3) It supports sst file having a column family ID and name in its
properties. Ingest errors out when CF id does not match.
(4) It may not have all the table property fields that files generated with
sstfilewriter has.
…On Tue, May 8, 2018 at 1:59 PM Siying Dong ***@***.***> wrote:
Thank you for your contribution!
Can you explain why do we need a new Import() API? Can user create a
column family and use the existing bulk loading API to load the file into
it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjDWRZ3bOU3MOkt74bMvc2n0jJ3fVUfiks5twgctgaJpZM4T1xeW>
.
|
(5) And as we add the files at their existing levels at source, we may end
up overlap with existing files at that level. Import has additional checks
for this. Ingest does not have to deal with this.
On Tue, May 8, 2018 at 2:28 PM Venki Pallipadi <
venkatesh.pallipadi@gmail.com> wrote:
…
We though about using ingest API to get the files in level by level. But,
ended up adding a new API for few reasons.
(1) The level and seqnum for the file is specified in import. So, we need
additional argument to send in other than just the filename in current
Ingest API.
(2) It is OK to Import overlapping files in level L0 (Ingest disallows
this)
(3) It supports sst file having a column family ID and name in its
properties. Ingest errors out when CF id does not match.
(4) It may not have all the table property fields that files generated
with sstfilewriter has.
On Tue, May 8, 2018 at 1:59 PM Siying Dong ***@***.***>
wrote:
> Thank you for your contribution!
> Can you explain why do we need a new Import() API? Can user create a
> column family and use the existing bulk loading API to load the file into
> it?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#3822 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AjDWRZ3bOU3MOkt74bMvc2n0jJ3fVUfiks5twgctgaJpZM4T1xeW>
> .
>
|
Thanks for reviewing this. Do you have any comments? Thanks. |
Sorry for the delay. It makes sense. We'll take another look. |
Friendly ping. Any feedback on this?
…On Fri, May 25, 2018 at 2:38 PM Siying Dong ***@***.***> wrote:
Sorry for the delay. It makes sense. We'll take another look.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjDWRZGp697E4DdFnpU3niEvxxS2kYrqks5t2HnXgaJpZM4T1xeW>
.
|
@siying - Any update on this. We are thinking of having this feature in one of our upcoming releases and want to get blessing on the general idea. This has been working ok in our tests for a while. |
Any feedback on this @siying ? |
@siying Would appreciate if you or someone in rocksdb team can look at this PR. We want to use this to speed up the time for reshuffling data when nodes are added/removed in our distributed key/value store implementation. Specifically pls note our proposal above for updating the sequence number and to ingest sstables of a different column family without updating the column family ID. |
Do you mind sharing more details about your use case? In particular, are you planning to export all files from a column family and import all of those files to a column family in a different DB? Also, will the target column family be empty before the import happens, or it'll have existing data? |
On Tue, Aug 14, 2018 at 12:51 PM, Andrew Kryczka ***@***.***> wrote:
Do you mind sharing more details about your use case? In particular, are
you planning to export all files from a column family and import all of
those files to a column family in a different DB? Also, will the target
column family be empty before the import happens, or it'll have existing
data?
Yes we plan to export all files from a column family on one node and add it
to a new column family in a different node.
… —
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJbj9kcbI4oHG53NQXe2cv3aNnvEjmZ0ks5uQyo1gaJpZM4T1xeW>
.
|
Thanks @sachja. Have you considered using multiple DB instances rather than multiple column families? Or are there limitations preventing it (e.g., there's no way to guarantee consistency across DB instances)? I will bring this up in our team meeting next week. It seems a reasonable feature to me. One thing I'm thinking about is whether we should have a more specific API, like |
On Tue, Aug 14, 2018 at 9:15 PM, Andrew Kryczka ***@***.***> wrote:
Thanks @sachja <https://github.com/sachja>. Have you considered using
multiple DB instances rather than multiple column families? Or are there
limitations preventing it (e.g., there's no way to guarantee consistency
across DB instances)?
We have upto 1024 instances per node. We do not need consistency across DB
instances but we want to share the WAL for performance reason. We
opportunistically batch updates across the instances to write a big batch.
if we have one WAL per instance we will be doing much smaller writes
affecting throughput and SSD endurance. Pls let us know if there is a
different way to think about the performance problem.
I will bring this up in our team meeting next week. It seems a reasonable
feature to me. One thing I'm thinking about is whether we should have a
more specific API, like ExportColumnFamily and ImportColumnFamily, that
only allows full CFs to be exported/imported. That's because the API
ImportExternalFile is a bit confusing with IngestExternalFile, and also
it sounds like we don't need the API to be so general.
Makes sense. We can convert this to API that only exports full CF to be
exported/imported.
Can you also comment on following :
If incoming sequence number is higher than current local sequence number,
local sequence
number will be updated to reflect this.
As the sst files is are being moved across Column Families, Column Family
name in sst file header
will no longer match the actual column family on destination DB. The API
does not modify Column
Family name or id in the sst files being imported.
… —
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJbj9gnQbgE8xIvV7kJjTfkZWX6AmyOCks5uQ6B2gaJpZM4T1xeW>
.
|
Andrew,
Any updates on this?
Thanks.
…On Wed, Aug 15, 2018 at 6:37 AM sachja ***@***.***> wrote:
On Tue, Aug 14, 2018 at 9:15 PM, Andrew Kryczka ***@***.***>
wrote:
> Thanks @sachja <https://github.com/sachja>. Have you considered using
> multiple DB instances rather than multiple column families? Or are there
> limitations preventing it (e.g., there's no way to guarantee consistency
> across DB instances)?
>
We have upto 1024 instances per node. We do not need consistency across DB
instances but we want to share the WAL for performance reason. We
opportunistically batch updates across the instances to write a big batch.
if we have one WAL per instance we will be doing much smaller writes
affecting throughput and SSD endurance. Pls let us know if there is a
different way to think about the performance problem.
> I will bring this up in our team meeting next week. It seems a reasonable
> feature to me. One thing I'm thinking about is whether we should have a
> more specific API, like ExportColumnFamily and ImportColumnFamily, that
> only allows full CFs to be exported/imported. That's because the API
> ImportExternalFile is a bit confusing with IngestExternalFile, and also
> it sounds like we don't need the API to be so general.
>
Makes sense. We can convert this to API that only exports full CF to be
exported/imported.
Can you also comment on following :
If incoming sequence number is higher than current local sequence number,
local sequence
number will be updated to reflect this.
As the sst files is are being moved across Column Families, Column Family
name in sst file header
will no longer match the actual column family on destination DB. The API
does not modify Column
Family name or id in the sst files being imported.
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#3822 (comment)>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AJbj9gnQbgE8xIvV7kJjTfkZWX6AmyOCks5uQ6B2gaJpZM4T1xeW
>
> .
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjDWRTN5vbioMqDF15DkvVtVPeDIBOl_ks5uRCQugaJpZM4T1xeW>
.
|
I assume #5495 is merged, so we can close this one. Let me know if I misread them. |
This is a review request for code change needed for - #3469
"Add support for taking snapshot of a column family and creating column family from a given CF snapshot"
We have an implementation for this that we have been testing internally. We have two new APIs that together provide this functionality.
(1) ExportColumnFamilyFiles() - This API is modelled after CreateCheckpoint() as below.
// Gets the live set of SST files for a particular Column Family in
// export_tables_dir and metadata about the files in metadata_vec.
// The SST files will be created through hard links when the directory is in
// the same partition as the db, copied otherwise.
// The directory should not already exist and will be created by this API.
// The directory will be an absolute path. Triggers a flush.
virtual Status ExportColumnFamilyFiles(
ColumnFamilyHandle* column_family,
std::vector* metadata_vec,
const std::string& export_files_dir);
Internally, the API will DisableFileDeletions(), GetColumnFamilyMetaData(), Parse through
metadata, creating links/copies of all the sst files, EnableFileDeletions() and complete the call by
returning the list of file metadata.
(2) ImportExternalFile() - This API is modelled after IngestExternalFile() as below.
// ImportExternalFile() will import external SST files into the specified
// column family.
//
// (1) External SST files can be created using SstFileWriter.
// (2) External SST files can be exported from a particular column family in
// an existing DB.
virtual Status ImportExternalFile(
ColumnFamilyHandle* column_family,
const std::vector& external_file_metadata,
const ImportExternalFileOptions& options);
Internally, this API parses all the sst files and adds it to the specified column family, at the same
level and with same sequence number as in the metadata. Also performs safety checks with respect to
overlaps between the sst files being imported or between existing data and new files being imported.
If incoming sequence number is higher than current local sequence number, local sequence
number is updated to reflect this.
Note, as the sst files is are being moved across Column Families, Column Family name in sst file
will no longer match the actual column family on destination DB. The API does not modify Column
Family name or id in the sst files being imported.