yiguolei commented on code in PR #66810:
URL: https://github.com/apache/doris/pull/66810#discussion_r3802814872
##########
be/src/exec/sink/writer/paimon/paimon_jni_memory_manager.cpp:
##########
@@ -126,10 +144,64 @@ class PaimonJniMemoryManager::Impl {
}
private:
+ Status _reserve_memory_or_wait(int64_t bytes) const {
+ constexpr auto RETRY_INTERVAL = std::chrono::milliseconds(100);
+ bool waiting = false;
+ std::chrono::steady_clock::time_point wait_start;
+
+ while (true) {
+ auto* task_controller = _resource_context->task_controller();
+ if (task_controller->is_cancelled()) {
+ return Status::Cancelled(
+ "Paimon JNI native page allocation stopped because the
query was "
+ "cancelled");
+ }
+ auto* fragment_mgr = ExecEnv::GetInstance()->fragment_mgr();
+ if (fragment_mgr != nullptr && fragment_mgr->shutting_down()) {
+ return Status::Cancelled(
+ "Paimon JNI native page allocation stopped because
FragmentMgr is "
+ "shutting down");
+ }
+
+ auto status =
thread_context()->thread_mem_tracker_mgr->try_reserve(bytes);
+ if (status.ok()) {
+ if (waiting) {
+ const auto waited_ms =
std::chrono::duration_cast<std::chrono::milliseconds>(
+
std::chrono::steady_clock::now() - wait_start)
+ .count();
+ LOG(INFO) << "Paimon JNI native page allocation resumed
after waiting "
Review Comment:
需要输出query id
--
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]