Skip to content

Commit

Permalink
Merge pull request #21 from OferMania/timeout2
Browse files Browse the repository at this point in the history
Adds timeoutIntervals, which controls the variable in BasicTransport
  • Loading branch information
OferMania authored Oct 8, 2019
2 parents 04c5ab6 + 056ba3b commit df08de3
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ make-rc-unit-test.patch
flaky-test_fix.patch
async-transaction.patch
plus_one.patch
transport-timeout-interval.patch
89 changes: 89 additions & 0 deletions patches/transport-timeout-interval.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Adds timeoutIntervals argument.

This controls the variable of same name in BasicTransport.cc

From: Ofer Gill <[email protected]>
---
src/BasicTransport.cc | 6 ++++++
src/OptionParser.cc | 5 +++++
src/OptionParser.h | 13 ++++++++++++-
3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/BasicTransport.cc b/src/BasicTransport.cc
index 5253669a..8073d8f0 100644
--- a/src/BasicTransport.cc
+++ b/src/BasicTransport.cc
@@ -15,6 +15,7 @@
#include <algorithm>

#include "BasicTransport.h"
+#include "OptionParser.h"
#include "Service.h"
#include "TimeTrace.h"
#include "WorkerManager.h"
@@ -110,6 +111,11 @@ BasicTransport::BasicTransport(Context* context, const ServiceLocator* locator,
timerInterval = Cycles::fromMicroseconds(2000);
nextTimeoutCheck = Cycles::rdtsc() + timerInterval;

+ if ((context->options != NULL) &&
+ (context->options->getTimeoutIntervals() != 0)) {
+ timeoutIntervals = context->options->getTimeoutIntervals();
+ }
+
LOG(NOTICE, "BasicTransport parameters: maxDataPerPacket %u, "
"roundTripBytes %u, grantIncrement %u, pingIntervals %d, "
"timeoutIntervals %d, timerInterval %.2f ms",
diff --git a/src/OptionParser.cc b/src/OptionParser.cc
index 0b89f4db..ac233aac 100644
--- a/src/OptionParser.cc
+++ b/src/OptionParser.cc
@@ -231,6 +231,11 @@ OptionParser::setup(int argc, char* argv[])
"How long transports should wait (ms) before declaring that a "
"client connection for each rpc session is dead."
"0 means use transport-specific default.")
+ ("timeoutIntervals",
+ ProgramOptions::value<uint32_t>(&options.timeoutIntervals)->
+ default_value(0),
+ "How many intervals (attempts) in an rpc session to try with the "
+ "client connection before declaring that session is dead.")
("dpdkPort",
ProgramOptions::value<int>(&options.dpdkPort)->
default_value(-1),
diff --git a/src/OptionParser.h b/src/OptionParser.h
index b715995b..0bd52f97 100644
--- a/src/OptionParser.h
+++ b/src/OptionParser.h
@@ -48,6 +48,7 @@ class CommandLineOptions {
, externalStorageLocator()
, pcapFilePath()
, sessionTimeout(0)
+ , timeoutIntervals(0)
, portTimeout(0)
, clusterName()
, configDir()
@@ -118,6 +119,15 @@ class CommandLineOptions {
return sessionTimeout;
}

+ /**
+ * Returns the number of intervals (attempts) the transport should use
+ * in an rpc session before assuming the connection has failed.
+ */
+ uint32_t getTimeoutIntervals() const
+ {
+ return timeoutIntervals;
+ }
+
/**
* Returns the time (in ms) after which transports should assume that
* the client for the lisning port is dead.
@@ -168,7 +178,8 @@ class CommandLineOptions {
string externalStorageLocator; ///< See getExternalStorageLocator().
string pcapFilePath; ///< Packet log file, "" to disable.
uint32_t sessionTimeout; ///< See getSessionTimeout().
- int32_t portTimeout; ///< See getSessionTimeout().
+ uint32_t timeoutIntervals; ///< See getTimeoutIntervals().
+ int32_t portTimeout; ///< See getPortTimeout().
string clusterName; ///< See getClusterName().
string configDir; ///< See getConfigDir().
int dpdkPort; ///< See getDpdkPort().

0 comments on commit df08de3

Please sign in to comment.