github-actions[bot] commented on code in PR #63286:
URL: https://github.com/apache/doris/pull/63286#discussion_r3247417279


##########
cloud/src/recycler/recycler.cpp:
##########
@@ -249,26 +249,30 @@ void Recycler::instance_scanner_callback() {
     std::this_thread::sleep_for(
             
std::chrono::seconds(config::recycler_sleep_before_scheduling_seconds));
     while (!stopped()) {
-        std::vector<InstanceInfoPB> instances;
-        get_all_instances(txn_kv_.get(), instances);
-        // TODO(plat1ko): delete job recycle kv of non-existent instances
-        LOG(INFO) << "Recycler get instances: " << [&instances] {
-            std::stringstream ss;
-            for (auto& i : instances) ss << ' ' << i.instance_id();
-            return ss.str();
-        }();
-        if (!instances.empty()) {
-            // enqueue instances
-            std::lock_guard lock(mtx_);
-            for (auto& instance : instances) {
-                if (instance_filter_.filter_out(instance.instance_id())) 
continue;
-                auto [_, success] = 
pending_instance_set_.insert(instance.instance_id());
-                // skip instance already in pending queue
-                if (success) {
-                    pending_instance_queue_.push_back(std::move(instance));
+        if (config::enable_recycler) {
+            std::vector<InstanceInfoPB> instances;
+            get_all_instances(txn_kv_.get(), instances);
+            // TODO(plat1ko): delete job recycle kv of non-existent instances
+            LOG(INFO) << "Recycler get instances: " << [&instances] {
+                std::stringstream ss;
+                for (auto& i : instances) ss << ' ' << i.instance_id();
+                return ss.str();
+            }();
+            if (!instances.empty()) {
+                // enqueue instances

Review Comment:
   When `enable_recycler` is false, the scanner reaches this `wait_for` and 
sleeps for `recycle_interval_seconds` before checking the flag again. 
`update_config` only writes the config value; it does not notify 
`Recycler::notifier_`, so if an operator re-enables the recycler just after 
this wait starts, scanning can remain stopped until the default 3600s interval 
expires. For a dynamic enable/disable switch, please make the disabled state 
poll a short interval or add a config-change wakeup path so re-enabling resumes 
recycler scheduling promptly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to