Add sleep in remote pull operator

Summary:
Added a hidden flag, a int32 value, that represents the number of
milliseconds the thread that pulls remote results should sleep in case when the
local results are exhausted but there are still some remote results that are
pending.

Reviewers: teon.banek, florijan

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1198
This commit is contained in:
Matija Santl 2018-02-14 15:20:28 +01:00
parent 796946ad1b
commit 9eb01f363f
2 changed files with 10 additions and 1 deletions

View File

@ -24,6 +24,9 @@
#include "query/path.hpp"
#include "utils/exceptions.hpp"
DEFINE_HIDDEN_int32(remote_pull_sleep, 2,
"Sleep between remote result pulling in milliseconds");
// macro for the default implementation of LogicalOperator::Accept
// that accepts the visitor and visits it's input_ operator
#define ACCEPT_WITH_INPUT(class_name) \
@ -2830,11 +2833,15 @@ bool PullRemote::PullRemoteCursor::Pull(Frame &frame, Context &context) {
break;
}
// If there are no remote results available, pull and return local
// If there are no remote results available, try to pull and return local
// results.
if (input_cursor_ && input_cursor_->Pull(frame, context)) {
return true;
}
// If there aren't any local/remote results available, sleep.
std::this_thread::sleep_for(
std::chrono::milliseconds(FLAGS_remote_pull_sleep));
}
}

View File

@ -26,6 +26,8 @@
#include "utils/hashing/fnv.hpp"
#include "utils/visitor.hpp"
DECLARE_int32(remote_pull_sleep);
namespace database {
class GraphDbAccessor;
}