@@ -222,38 +222,41 @@ TStatus RemoveDirectoryRecursive(
222
222
223
223
TStatus RemovePathRecursive (
224
224
const TDriver& driver,
225
- const TString& path ,
225
+ const TSchemeEntry& entry ,
226
226
const TRemoveDirectoryRecursiveSettings& settings
227
227
) {
228
228
TSchemeClient schemeClient (driver);
229
- auto entity = schemeClient.DescribePath (path).ExtractValueSync ();
230
- if (!entity.IsSuccess ()) {
231
- if (settings.NotExistsIsOk_ && entity.GetStatus () == EStatus::SCHEME_ERROR && entity.GetIssues ().ToString ().find (" Path not found" ) != TString::npos) {
232
- return TStatus (EStatus::SUCCESS, {});
233
- }
234
- return entity;
235
- }
236
-
237
229
TTableClient tableClient (driver);
238
230
TTopicClient topicClient (driver);
239
231
NQuery::TQueryClient queryClient (driver);
240
232
NCoordination::TClient coordinationClient (driver);
241
233
auto remover = NInternal::CreateDefaultRemover (schemeClient, tableClient, topicClient, queryClient, coordinationClient, settings);
242
- return remover (entity. GetEntry () );
234
+ return remover (entry );
243
235
}
244
236
245
237
TStatus RemovePathRecursive (
246
238
const TDriver& driver,
247
- const TSchemeEntry& entry ,
239
+ const TString& path ,
248
240
const TRemoveDirectoryRecursiveSettings& settings
249
241
) {
250
242
TSchemeClient schemeClient (driver);
251
- TTableClient tableClient (driver);
252
- TTopicClient topicClient (driver);
253
- NQuery::TQueryClient queryClient (driver);
254
- NCoordination::TClient coordinationClient (driver);
255
- auto remover = NInternal::CreateDefaultRemover (schemeClient, tableClient, topicClient, queryClient, coordinationClient, settings);
256
- return remover (entry);
243
+ const auto entity = schemeClient.DescribePath (path).ExtractValueSync ();
244
+ if (!entity.IsSuccess ()) {
245
+ if (settings.NotExistsIsOk_ && entity.GetStatus () == EStatus::SCHEME_ERROR && entity.GetIssues ().ToString ().find (" Path not found" ) != TString::npos) {
246
+ return TStatus (EStatus::SUCCESS, {});
247
+ }
248
+ return entity;
249
+ }
250
+
251
+ auto entry = entity.GetEntry ();
252
+ entry.Name = path;
253
+ switch (entry.Type ) {
254
+ case NYdb::NScheme::ESchemeEntryType::ColumnStore:
255
+ case NYdb::NScheme::ESchemeEntryType::Directory:
256
+ return RemoveDirectoryRecursive (driver, path, settings);
257
+ default :
258
+ return RemovePathRecursive (driver, entity.GetEntry (), settings);
259
+ }
257
260
}
258
261
259
262
namespace NInternal {
0 commit comments