Skip to content

Commit 37583d5

Browse files
stanislav-shchetininqyryq
authored andcommitted
ExportToFs / ImportFromFs API (ydb-platform#28072)
1 parent 82640d0 commit 37583d5

File tree

4 files changed

+120
-1
lines changed

4 files changed

+120
-1
lines changed

ydb/public/api/grpc/ydb_export_v1.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ service ExportService {
1414
// Exports data to S3.
1515
// Method starts an asynchronous operation that can be cancelled while it is in progress.
1616
rpc ExportToS3(Export.ExportToS3Request) returns (Export.ExportToS3Response);
17+
18+
// Exports data to file system.
19+
// Method starts an asynchronous operation that can be cancelled while it is in progress.
20+
rpc ExportToFs(ExportToFsRequest) returns (ExportToFsResponse);
1721
}

ydb/public/api/grpc/ydb_import_v1.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ service ImportService {
1111
// Method starts an asynchronous operation that can be cancelled while it is in progress.
1212
rpc ImportFromS3(Import.ImportFromS3Request) returns (Import.ImportFromS3Response);
1313

14+
// Imports data from file system.
15+
// Method starts an asynchronous operation that can be cancelled while it is in progress.
16+
rpc ImportFromFs(Import.ImportFromFsRequest) returns (Import.ImportFromFsResponse);
17+
1418
// List objects from existing export stored in S3 bucket
1519
rpc ListObjectsInS3Export(Import.ListObjectsInS3ExportRequest) returns (Import.ListObjectsInS3ExportResponse);
1620

ydb/public/api/protos/ydb_export.proto

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,54 @@ message EncryptionSettings {
181181
bytes key = 1 [(Ydb.sensitive) = true];
182182
}
183183
}
184+
185+
/// File system (FS)
186+
message ExportToFsSettings {
187+
message Item {
188+
// Database path to a table to be exported
189+
string source_path = 1 [(required) = true];
190+
191+
/* The tables are exported to one or more files in FS.
192+
The files are saved to the destination_path directory. */
193+
string destination_path = 2 [(required) = true];
194+
}
195+
196+
// Base path on FS where to write export
197+
// Path to the mounted directory in the case of NFS
198+
// Example: /mnt/exports
199+
string base_path = 1 [(required) = true];
200+
201+
// List of items to export
202+
repeated Item items = 2;
203+
204+
// Optional description
205+
string description = 3 [(length).le = 128];
206+
207+
// Number of retries for failed operations
208+
uint32 number_of_retries = 4;
209+
210+
// Codec used to compress data. Codecs are available:
211+
// - zstd.
212+
// - zstd-N, where N is compression level, e.g. zstd-3.
213+
string compression = 5;
214+
}
215+
216+
message ExportToFsResult {
217+
}
218+
219+
message ExportToFsMetadata {
220+
ExportToFsSettings settings = 1;
221+
ExportProgress.Progress progress = 2;
222+
repeated ExportItemProgress items_progress = 3;
223+
}
224+
225+
message ExportToFsRequest {
226+
Ydb.Operations.OperationParams operation_params = 1;
227+
ExportToFsSettings settings = 2 [(required) = true];
228+
}
229+
230+
message ExportToFsResponse {
231+
// operation.result = ExportToFsResult
232+
// operation.metadata = ExportToFsMetadata
233+
Ydb.Operations.Operation operation = 1;
234+
}

ydb/public/api/protos/ydb_import.proto

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ message ImportFromS3Settings {
4545
The S3 object name begins with a prefix, followed by:
4646
* '/data_PartNumber', where 'PartNumber' represents the index of the part, starting at zero;
4747
* '/scheme.pb' - object with information about scheme, indexes, etc;
48-
* '/permissions.pb' - object with information about ACL and owner.
48+
* '/permissions.pb' - object with information about ACL and owner;
49+
* '/metadata.json' - object with metadata about the backup.
4950
*/
5051

5152
// The S3 object prefix can be either provided explicitly
@@ -121,6 +122,65 @@ message ImportFromS3Response {
121122
Ydb.Operations.Operation operation = 1;
122123
}
123124

125+
/// File system (FS)
126+
message ImportFromFsSettings {
127+
message Item {
128+
/* YDB tables in FS are stored in a directory structure (see ydb_export.proto).
129+
The directory contains:
130+
* '/data_PartNumber', where 'PartNumber' represents the index of the part, starting at zero;
131+
* '/scheme.pb' - object with information about scheme, indexes, etc;
132+
* '/permissions.pb' - object with information about ACL and owner;
133+
* '/metadata.json' - object with metadata about the backup.
134+
The path in FS is specified relative to base_path.
135+
Example: "my_export/table1"
136+
*/
137+
string source_path = 1 [(required) = true];
138+
139+
// Database path to a table to import to.
140+
string destination_path = 2 [(required) = true];
141+
}
142+
143+
// Base path on FS where the export is located
144+
// Path to the mounted directory in the case of NFS
145+
// Example: /mnt/exports
146+
string base_path = 1 [(required) = true];
147+
148+
repeated Item items = 2; // Empty collection means import of all export objects
149+
150+
// Optional description
151+
string description = 3 [(length).le = 128];
152+
153+
// Number of retries for failed file operations
154+
uint32 number_of_retries = 4;
155+
156+
// Prevent importing of ACL and owner. If true, objects are created with empty ACL
157+
// and their owner will be the user who started the import.
158+
bool no_acl = 5;
159+
160+
// Skip checksum validation during import
161+
bool skip_checksum_validation = 6;
162+
}
163+
164+
message ImportFromFsResult {
165+
}
166+
167+
message ImportFromFsMetadata {
168+
ImportFromFsSettings settings = 1;
169+
ImportProgress.Progress progress = 2;
170+
repeated ImportItemProgress items_progress = 3;
171+
}
172+
173+
message ImportFromFsRequest {
174+
Ydb.Operations.OperationParams operation_params = 1;
175+
ImportFromFsSettings settings = 2 [(required) = true];
176+
}
177+
178+
message ImportFromFsResponse {
179+
// operation.result = ImportFromFsResult
180+
// operation.metadata = ImportFromFsMetadata
181+
Ydb.Operations.Operation operation = 1;
182+
}
183+
124184
message ListObjectsInS3ExportSettings {
125185
message Item {
126186
// Database object path

0 commit comments

Comments
 (0)