@@ -43,20 +43,22 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
43
43
return TStringBuilder () << settings.items (itemIdx).source_prefix () << " /permissions.pb" ;
44
44
}
45
45
46
- static bool IsView (TStringBuf schemeKey) {
47
- return schemeKey.EndsWith (NYdb::NDump::NFiles::CreateView ().FileName );
46
+ static TString ChangefeedDescriptionKeyFromSettings (const Ydb::Import::ImportFromS3Settings& settings, ui32 itemIdx, const TString& changefeedName) {
47
+ Y_ABORT_UNLESS (itemIdx < (ui32)settings.items_size ());
48
+ return TStringBuilder () << settings.items (itemIdx).source_prefix () << " /" << changefeedName << " /changefeed_description.pb" ;
48
49
}
49
50
50
- static bool NoObjectFound (Aws::S3::S3Errors errorType) {
51
- return errorType == S3Errors::RESOURCE_NOT_FOUND || errorType == S3Errors::NO_SUCH_KEY;
51
+ static TString TopicDescriptionKeyFromSettings (const Ydb::Import::ImportFromS3Settings& settings, ui32 itemIdx, const TString& changefeedName) {
52
+ Y_ABORT_UNLESS (itemIdx < (ui32)settings.items_size ());
53
+ return TStringBuilder () << settings.items (itemIdx).source_prefix () << " /" << changefeedName << " /topic_description.pb" ;
52
54
}
53
55
54
- static TString ChangefeedDescriptionKey ( const TString& changefeedPrefix ) {
55
- return TStringBuilder () << changefeedPrefix << " /changefeed_description.pb " ;
56
+ static bool IsView (TStringBuf schemeKey ) {
57
+ return schemeKey. EndsWith ( NYdb::NDump::NFiles::CreateView (). FileName ) ;
56
58
}
57
59
58
- static TString TopicDescriptionKey ( const TString& changefeedPrefix ) {
59
- return TStringBuilder () << changefeedPrefix << " /topic_description.pb " ;
60
+ static bool NoObjectFound (Aws::S3::S3Errors errorType ) {
61
+ return errorType == S3Errors::RESOURCE_NOT_FOUND || errorType == S3Errors::NO_SUCH_KEY ;
60
62
}
61
63
62
64
void HeadObject (const TString& key) {
@@ -148,8 +150,8 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
148
150
}
149
151
150
152
const auto contentLength = result.GetResult ().GetContentLength ();
151
- Y_ABORT_UNLESS (IndexDownloadedChangefeed < ChangefeedsKeys .size ());
152
- GetObject (ChangefeedDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]), std::make_pair (0 , contentLength - 1 ));
153
+ Y_ABORT_UNLESS (IndexDownloadedChangefeed < ChangefeedsNames .size ());
154
+ GetObject (ChangefeedDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]), std::make_pair (0 , contentLength - 1 ));
153
155
}
154
156
155
157
void HandleTopic (TEvExternalStorage::TEvHeadObjectResponse::TPtr& ev) {
@@ -164,8 +166,8 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
164
166
}
165
167
166
168
const auto contentLength = result.GetResult ().GetContentLength ();
167
- Y_ABORT_UNLESS (IndexDownloadedChangefeed < ChangefeedsKeys .size ());
168
- GetObject (TopicDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]), std::make_pair (0 , contentLength - 1 ));
169
+ Y_ABORT_UNLESS (IndexDownloadedChangefeed < ChangefeedsNames .size ());
170
+ GetObject (TopicDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]), std::make_pair (0 , contentLength - 1 ));
169
171
}
170
172
171
173
void GetObject (const TString& key, const std::pair<ui64, ui64>& range) {
@@ -340,11 +342,11 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
340
342
341
343
auto nextStep = [this ]() {
342
344
Become (&TThis::StateDownloadTopics);
343
- HeadObject (TopicDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]));
345
+ HeadObject (TopicDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]));
344
346
};
345
347
346
348
if (NeedValidateChecksums) {
347
- StartValidatingChecksum (ChangefeedDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]), msg.Body , nextStep);
349
+ StartValidatingChecksum (ChangefeedDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]), msg.Body , nextStep);
348
350
} else {
349
351
nextStep ();
350
352
}
@@ -376,16 +378,16 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
376
378
*item.Changefeeds .MutableChangefeeds (IndexDownloadedChangefeed)->MutableTopic () = std::move (topic);
377
379
378
380
auto nextStep = [this ]() {
379
- if (++IndexDownloadedChangefeed >= ChangefeedsKeys .size ()) {
381
+ if (++IndexDownloadedChangefeed >= ChangefeedsNames .size ()) {
380
382
Reply ();
381
383
} else {
382
384
Become (&TThis::StateDownloadChangefeeds);
383
- HeadObject (ChangefeedDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]));
385
+ HeadObject (ChangefeedDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]));
384
386
}
385
387
};
386
388
387
389
if (NeedValidateChecksums) {
388
- StartValidatingChecksum (TopicDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]), msg.Body , nextStep);
390
+ StartValidatingChecksum (TopicDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]), msg.Body , nextStep);
389
391
} else {
390
392
nextStep ();
391
393
}
@@ -414,22 +416,22 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
414
416
}
415
417
416
418
const auto & objects = result.GetResult ().GetContents ();
417
- ChangefeedsKeys .clear ();
418
- ChangefeedsKeys .reserve (objects.size ());
419
+ ChangefeedsNames .clear ();
420
+ ChangefeedsNames .reserve (objects.size ());
419
421
420
422
for (const auto & obj : objects) {
421
423
const TFsPath& path = obj.GetKey ();
422
424
if (path.GetName () == " changefeed_description.pb" ) {
423
- ChangefeedsKeys .push_back (path.Dirname ());
425
+ ChangefeedsNames .push_back (path.Parent (). GetName ());
424
426
}
425
427
}
426
428
427
- if (!ChangefeedsKeys .empty ()) {
429
+ if (!ChangefeedsNames .empty ()) {
428
430
auto & item = ImportInfo->Items .at (ItemIdx);
429
- Resize (item.Changefeeds .MutableChangefeeds (), ChangefeedsKeys .size ());
431
+ Resize (item.Changefeeds .MutableChangefeeds (), ChangefeedsNames .size ());
430
432
431
- Y_ABORT_UNLESS (IndexDownloadedChangefeed < ChangefeedsKeys .size ());
432
- HeadObject (ChangefeedDescriptionKey (ChangefeedsKeys [IndexDownloadedChangefeed]));
433
+ Y_ABORT_UNLESS (IndexDownloadedChangefeed < ChangefeedsNames .size ());
434
+ HeadObject (ChangefeedDescriptionKeyFromSettings (ImportInfo-> Settings , ItemIdx, ChangefeedsNames [IndexDownloadedChangefeed]));
433
435
} else {
434
436
Reply ();
435
437
}
@@ -633,7 +635,7 @@ class TSchemeGetter: public TActorBootstrapped<TSchemeGetter> {
633
635
const TString MetadataKey;
634
636
TString SchemeKey;
635
637
const TString PermissionsKey;
636
- TVector<TString> ChangefeedsKeys ;
638
+ TVector<TString> ChangefeedsNames ;
637
639
ui64 IndexDownloadedChangefeed = 0 ;
638
640
639
641
const ui32 Retries;
0 commit comments