@@ -156,18 +156,28 @@ namespace NKikimr::NBlobDepot {
156156 STLOG (PRI_INFO, BLOB_DEPOT, BDTS06, " AddTrashToCollect" , (Id, Self->GetLogId ()), (Locator, locator));
157157 Self->TabletCounters ->Simple ()[NKikimrBlobDepot::COUNTER_TOTAL_S3_TRASH_OBJECTS] = ++TotalS3TrashObjects;
158158 Self->TabletCounters ->Simple ()[NKikimrBlobDepot::COUNTER_TOTAL_S3_TRASH_SIZE] = TotalS3TrashSize += locator.Len ;
159- DeleteQueue.push_back (locator);
159+ if (const ui32 generation = Self->Executor ()->Generation (); locator.Generation < generation) {
160+ DeleteQueueInPrevGenerations.push_back (locator);
161+ } else {
162+ Y_DEBUG_ABORT_UNLESS (locator.Generation == generation);
163+ DeleteQueueInCurrentGeneration.push_back (locator);
164+ }
160165 RunDeletersIfNeeded ();
161166 }
162167
163168 void TS3Manager::RunDeletersIfNeeded () {
164- while (!DeleteQueue.empty () && NumDeleteTxInFlight + ActiveDeleters.size () < MaxDeletesInFlight) {
169+ while (NumDeleteTxInFlight + ActiveDeleters.size () < MaxDeletesInFlight) {
170+ // create list of locators we are going to delete during this operation
165171 THashMap<TString, TS3Locator> locators;
166-
167- while (!DeleteQueue.empty () && locators.size () < MaxObjectsToDeleteAtOnce) {
168- const TS3Locator& locator = DeleteQueue.front ();
169- locators.emplace (locator.MakeObjectName (BasePath), locator);
170- DeleteQueue.pop_front ();
172+ for (auto *queue : {&DeleteQueueInPrevGenerations, &DeleteQueueInCurrentGeneration}) {
173+ while (!queue->empty () && locators.size () < MaxObjectsToDeleteAtOnce) {
174+ const TS3Locator& locator = queue->front ();
175+ locators.emplace (locator.MakeObjectName (BasePath), locator);
176+ queue->pop_front ();
177+ }
178+ }
179+ if (!locators) {
180+ break ;
171181 }
172182
173183 const TActorId actorId = Self->Register (new TDeleterActor (Self->SelfId (), locators, Self->GetLogId ()));
@@ -218,7 +228,15 @@ namespace NKikimr::NBlobDepot {
218228 }
219229
220230 if (!msg.LocatorsError .empty ()) {
221- DeleteQueue.insert (DeleteQueue.end (), msg.LocatorsError .begin (), msg.LocatorsError .end ());
231+ const ui32 generation = Self->Executor ()->Generation ();
232+ for (auto & locator : msg.LocatorsError ) {
233+ if (locator.Generation < generation) {
234+ DeleteQueueInPrevGenerations.push_back (locator);
235+ } else {
236+ Y_DEBUG_ABORT_UNLESS (locator.Generation == generation);
237+ DeleteQueueInCurrentGeneration.push_back (locator);
238+ }
239+ }
222240 RunDeletersIfNeeded ();
223241 }
224242 })
0 commit comments