@@ -37,7 +37,7 @@ namespace {
37
37
void Run (TTestBasicRuntime& runtime, TTestEnv& env, const std::variant<TVector<TString>, TTablesWithAttrs>& tablesVar, const TString& request,
38
38
Ydb::StatusIds::StatusCode expectedStatus = Ydb::StatusIds::SUCCESS,
39
39
const TString& dbName = " /MyRoot" , bool serverless = false , const TString& userSID = " " , const TString& peerName = " " ,
40
- const TVector<TString>& cdcStreams = {}) {
40
+ const TVector<TString>& cdcStreams = {}, bool checkAutoDropping = false ) {
41
41
42
42
TTablesWithAttrs tables;
43
43
@@ -150,6 +150,40 @@ namespace {
150
150
const ui64 exportId = txId;
151
151
TestGetExport (runtime, schemeshardId, exportId, dbName, expectedStatus);
152
152
153
+ if (!runtime.GetAppData ().FeatureFlags .GetEnableExportAutoDropping () && checkAutoDropping) {
154
+ auto desc = DescribePath (runtime, " /MyRoot" );
155
+ Cerr << " desc: " << desc.GetPathDescription ().ChildrenSize ()<< Endl;
156
+ UNIT_ASSERT (desc.GetPathDescription ().ChildrenSize () > 1 );
157
+
158
+ bool foundExportDir = false ;
159
+ bool foundOriginalTable = false ;
160
+
161
+ for (size_t i = 0 ; i < desc.GetPathDescription ().ChildrenSize (); ++i) {
162
+ const auto & child = desc.GetPathDescription ().GetChildren (i);
163
+ const auto & name = child.GetName ();
164
+
165
+ if (name.StartsWith (" Table" )) {
166
+ foundOriginalTable = true ;
167
+ } else if (name.StartsWith (" export-" )) {
168
+ foundExportDir = true ;
169
+ auto exportDirDesc = DescribePath (runtime, " /MyRoot/" + name);
170
+ UNIT_ASSERT (exportDirDesc.GetPathDescription ().ChildrenSize () >= 1 );
171
+ UNIT_ASSERT_EQUAL (exportDirDesc.GetPathDescription ().GetChildren (0 ).GetName (), " 0" );
172
+ }
173
+ }
174
+
175
+ UNIT_ASSERT (foundExportDir);
176
+ UNIT_ASSERT (foundOriginalTable);
177
+ } else if (checkAutoDropping) {
178
+ auto desc = DescribePath (runtime, " /MyRoot" );
179
+ Cerr << " desc: " << desc.GetPathDescription ().ChildrenSize ()<< Endl;
180
+ for (size_t i = 0 ; i < desc.GetPathDescription ().ChildrenSize (); ++i) {
181
+ const auto & child = desc.GetPathDescription ().GetChildren (i);
182
+ const auto & name = child.GetName ();
183
+ UNIT_ASSERT (!name.StartsWith (" export-" ));
184
+ }
185
+ }
186
+
153
187
TestForgetExport (runtime, schemeshardId, ++txId, dbName, exportId);
154
188
env.TestWaitNotification (runtime, exportId, schemeshardId);
155
189
@@ -1201,6 +1235,7 @@ partitioning_settings {
1201
1235
ui64 txId = 100 ;
1202
1236
1203
1237
THashSet<ui64> statsCollected;
1238
+ Runtime ().GetAppData ().FeatureFlags .SetEnableExportAutoDropping (true );
1204
1239
Runtime ().SetObserverFunc ([&](TAutoPtr<IEventHandle>& ev) {
1205
1240
if (ev->GetTypeRewrite () == TEvDataShard::EvPeriodicTableStats) {
1206
1241
statsCollected.insert (ev->Get <TEvDataShard::TEvPeriodicTableStats>()->Record .GetDatashardId ());
@@ -1286,7 +1321,7 @@ partitioning_settings {
1286
1321
Y_UNIT_TEST (CheckItemProgress) {
1287
1322
Env (); // Init test env
1288
1323
ui64 txId = 100 ;
1289
-
1324
+ Runtime (). GetAppData (). FeatureFlags . SetEnableExportAutoDropping ( true );
1290
1325
TBlockEvents<NKikimr::NWrappers::NExternalStorage::TEvPutObjectRequest> blockPartition01 (Runtime (), [](auto && ev) {
1291
1326
return ev->Get ()->Request .GetKey () == " /data_01.csv" ;
1292
1327
});
@@ -2773,17 +2808,41 @@ attributes {
2773
2808
}
2774
2809
)" , S3Port ());
2775
2810
2811
+ Env ();
2812
+ Runtime ().GetAppData ().FeatureFlags .SetEnableExportAutoDropping (true );
2813
+
2776
2814
Run (Runtime (), Env (), TVector<TString>{
2777
2815
R"(
2778
2816
Name: "Table"
2779
2817
Columns { Name: "key" Type: "Utf8" }
2780
2818
Columns { Name: "value" Type: "Utf8" }
2781
2819
KeyColumnNames: ["key"]
2782
2820
)" ,
2783
- }, request, Ydb::StatusIds::SUCCESS, " /MyRoot" );
2821
+ }, request, Ydb::StatusIds::SUCCESS, " /MyRoot" , false , " " , " " , {}, true );
2822
+ }
2823
+
2824
+ Y_UNIT_TEST (DisableAutoDropping) {
2825
+ auto request = Sprintf (R"(
2826
+ ExportToS3Settings {
2827
+ endpoint: "localhost:%d"
2828
+ scheme: HTTP
2829
+ items {
2830
+ source_path: "/MyRoot/Table"
2831
+ destination_prefix: ""
2832
+ }
2833
+ }
2834
+ )" , S3Port ());
2835
+
2836
+ Env ();
2837
+ Runtime ().GetAppData ().FeatureFlags .SetEnableExportAutoDropping (false );
2784
2838
2785
- auto desc = DescribePath (Runtime (), " /MyRoot" );
2786
- UNIT_ASSERT_EQUAL (desc.GetPathDescription ().ChildrenSize (), 1 );
2787
- UNIT_ASSERT_EQUAL (desc.GetPathDescription ().GetChildren (0 ).GetName (), " Table" );
2839
+ Run (Runtime (), Env (), TVector<TString>{
2840
+ R"(
2841
+ Name: "Table"
2842
+ Columns { Name: "key" Type: "Utf8" }
2843
+ Columns { Name: "value" Type: "Utf8" }
2844
+ KeyColumnNames: ["key"]
2845
+ )" ,
2846
+ }, request, Ydb::StatusIds::SUCCESS, " /MyRoot" , false , " " , " " , {}, true );
2788
2847
}
2789
2848
}
0 commit comments