This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
rgw_sal_motr, motr_gc: [CORTX-33148] add MotrGC, MotrGC::GCWorker infra code #356
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a50508
rgw_sal_motr, motr_gc: [CORTX-33148] Add MotrGC class
sumedhak27 543a44d
rgw_sal_motr, motr_gc: [CORTX-33148] Add MotrGC::GCWorker class
sumedhak27 cbc95ae
rgw_sal_motr, motr_gc: [CORTX-33148] implement MotrGC::start_processor()
sumedhak27 76ae806
rgw_sal_motr: [CORTX-33148] fix init_metadata_cache bug
sumedhak27 bc6b0e4
motr_gc: [CORTX-33148] partially implement MotrGC::initialize()
sumedhak27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=2 sw=2 expandtab ft=cpp | ||
|
||
/* | ||
* Garbage Collector implementation for the CORTX Motr backend | ||
* | ||
* Copyright (C) 2022 Seagate Technology LLC and/or its Affiliates | ||
* | ||
* This is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License version 2.1, as published by the Free Software | ||
* Foundation. See file COPYING. | ||
* | ||
*/ | ||
|
||
#include "gc.h" | ||
jjxsg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
void *MotrGC::entry() { | ||
std::unique_lock<std::mutex> lk(mtx); | ||
ldpp_dout(dpp, 10) << __func__ << ": Motr GC started" << dendl; | ||
|
||
do { | ||
ldpp_dout(dpp, 10) << __func__ << ": In a Motr GC loop." << dendl; | ||
cv.wait_for(lk, std::chrono::milliseconds(gc_interval * 10)); | ||
} while (! stop_signalled); | ||
|
||
ldpp_dout(dpp, 0) << __func__ << ": Stop signalled called.#" | ||
<< stop_signalled << dendl; | ||
return nullptr; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- | ||
// vim: ts=2 sw=2 expandtab ft=cpp | ||
|
||
/* | ||
* Garbage Collector Classes for the CORTX Motr backend | ||
* | ||
* Copyright (C) 2022 Seagate Technology LLC and/or its Affiliates | ||
* | ||
* This is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License version 2.1, as published by the Free Software | ||
* Foundation. See file COPYING. | ||
* | ||
*/ | ||
|
||
#ifndef __MOTR_GC_H__ | ||
sachinpunadikar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define __MOTR_GC_H__ | ||
|
||
#include "rgw_sal_motr.h" | ||
#include "common/Thread.h" | ||
#include <mutex> | ||
#include <condition_variable> | ||
|
||
class MotrGC : public Thread { | ||
private: | ||
const DoutPrefixProvider *dpp; | ||
rgw::sal::Store *store; | ||
jjxsg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::mutex mtx; | ||
std::condition_variable cv; | ||
bool stop_signalled = false; | ||
uint32_t gc_interval = 60*60; // default: 24*60*60 sec | ||
uint32_t gc_obj_min_wait = 60*60; // 60*60sec default | ||
|
||
public: | ||
MotrGC(const DoutPrefixProvider *_dpp, rgw::sal::Store* _store) : | ||
dpp(_dpp), store(_store) {} | ||
|
||
void *entry() override; | ||
|
||
void signal_stop() { | ||
std::lock_guard<std::mutex> lk_guard(mtx); | ||
stop_signalled = true; | ||
cv.notify_all(); | ||
} | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to add more files in future. Better to add cmakelist in motr directory and add that directory here.
ref. https://github.com/Seagate/cortx-rgw/blob/main/src/rgw/store/dbstore/CMakeLists.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tried adding a subdirectory, but the compilation failed initially, I did not try to resolve it.
Will try it again in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The below code works but I have to repeat the lines from
src/rgw/CMakeLists.txt
in the new file,does anyone know how to avoid that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andriytk @siningwuseagate can you please help here?