Skip to content

Commit 4489b82

Browse files
committed
MGM: Don't reset the counters in the DrainFs destructor as this might clear
a properly set "drained" flag, whe the file system is properly drained and not in "empty" configstatus.
1 parent 0d1e95d commit 4489b82

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mgm/drain/DrainFs.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ DrainFs::DrainFs(eos::common::ThreadPool& thread_pool, eos::IFsView* fs_view,
5555
DrainFs::~DrainFs()
5656
{
5757
eos_static_debug("msg=\"fsid=%u destroying fs drain object", mFsId);
58-
ResetCounters();
5958
}
6059

6160
//------------------------------------------------------------------------------
@@ -210,14 +209,15 @@ DrainFs::UpdateFinishedJob(const eos::IFileMD::id_t fid)
210209
void
211210
DrainFs::SuccessfulDrain()
212211
{
213-
eos_notice("msg=\"complete drain\" fsid=%d", mFsId);
212+
eos_notice("msg=\"successful drain\" fsid=%d", mFsId);
214213
eos::common::RWMutexReadLock fs_rd_lock(FsView::gFsView.ViewMutex);
215214
FileSystem* fs = FsView::gFsView.mIdView.lookupByID(mFsId);
216215

217216
if (fs) {
218217
mStatus = eos::common::DrainStatus::kDrained;
219218
eos::common::FileSystemUpdateBatch batch;
220219
batch.setDrainStatusLocal(mStatus);
220+
batch.setLongLongLocal("local.drain.progress", 100);
221221
batch.setLongLongLocal("local.drain.bytesleft", 0);
222222
batch.setLongLongLocal("local.drain.timeleft", 0);
223223
batch.setLongLongLocal("local.drain.failed", 0);
@@ -226,8 +226,6 @@ DrainFs::SuccessfulDrain()
226226
if (!gOFS->Shutdown) {
227227
// If drain done and the system is not shutting down then set the
228228
// file system to "empty" state
229-
batch.setLongLongLocal("local.drain.progress", 100);
230-
batch.setLongLongLocal("local.drain.failed", 0);
231229
batch.setStringDurable("configstatus", "empty");
232230
FsView::gFsView.StoreFsConfig(fs);
233231
}
@@ -517,10 +515,11 @@ DrainFs::ResetCounters()
517515

518516
if (fs) {
519517
common::FileSystemUpdateBatch batch;
518+
batch.setLongLongLocal("local.drain.progress", 0);
520519
batch.setLongLongLocal("local.drain.bytesleft", 0);
521-
batch.setLongLongLocal("local.drain.files", 0);
522520
batch.setLongLongLocal("local.drain.timeleft", 0);
523-
batch.setLongLongLocal("local.drain.progress", 0);
521+
batch.setLongLongLocal("local.drain.failed", 0);
522+
batch.setLongLongLocal("local.drain.files", 0);
524523
batch.setDrainStatusLocal(eos::common::DrainStatus::kNoDrain);
525524
fs->applyBatch(batch);
526525
}

0 commit comments

Comments
 (0)