Limit shadow requests per destination

Summary: We track number of shadow requests sent but not replied (i.e. inflight).

Test Plan: unit test attached

Reviewed By: bwatling@fb.com

Subscribers: sathya, trunkagent, alikhtarov

FB internal diff: D1666202

Tasks: 5213015

Signature: t1:1666202:1415647047:5dde052ce6bfc61925ed53ea092c5bb3e6bcbaba
Stubs for extra startup/cleanup routines

Summary:
Allows running arbitrary code on startup and cleanup; used internally.

Test Plan:
build

Reviewed By: pavlo@fb.com, alikhtarov@fb.com

Subscribers: trunkagent, zhuohuang, alikhtarov

FB internal diff: D1664952

Tasks: 5479973

Signature: t1:1664952:1415649208:318f051fea07bd8d5ebb1ec8b65ca5b1c2482134
DynamicAtomicTokenBucket

Summary:
Allows changing burst/rate on every consume() call.

Test Plan: unit test

Reviewed By: mshneer@fb.com

Subscribers: trunkagent, mcduff, hitesh, mshneer, fugalh, alikhtarov

FB internal diff: D1667293

Signature: t1:1667293:1415390158:fcf412d58458f4454f48af4ca219ced5eade7bb5
Add notMacro, minor refactoring

Summary: I have no idea how I missed @not :-( Adding it here. Also there is no point in using "asInt/asBool" after we checked the type of dynamic.

Test Plan: unit test attached

Reviewed By: sameen@fb.com

Subscribers: sameen, alikhtarov

FB internal diff: D1672385

Signature: t1:1672385:1415692949:5ecc4fa1c670d76d83bf5c9895c4b383d210b74b
Use folly::IPAddress::hash instead of gethostid

Summary: find a non-loopback ipv4 or ipv6 address and feed it to folly::IPAddress::hash

Test Plan:
1)
fbconfig -r mcrouter
fbmake runtests

2)
compare hostids on different hosts

Reviewed By: pavlo@fb.com

Subscribers: njormrod, folly-diffs@, trunkagent, ps, bmatheny, alikhtarov

FB internal diff: D1668944

Tasks: 5557721

Signature: t1:1668944:1415736928:fb4b042a575c0b00f52780f3abf54bf7630b3a97
folly::Singleton-based McrouterManager

Summary: Introduces a Singleton which keeps a map persistence_id => mcrouter_t*. Makes mcrouter instance not know if it's managed by McrouterManager.

Test Plan: unit tests

Reviewed By: pavlo@fb.com

Subscribers: trunkagent, alikhtarov, njormrod, folly-diffs@

FB internal diff: D1673274

Signature: t1:1673274:1415735863:c990a6a526f9525c68cc23892d690a9b3cb94ace
Add the serialization option to serialize the integer as string

Summary:

Test Plan: unit tests

Reviewed By: andrii@fb.com

Subscribers: trunkagent, ruibalp, zhuohuang, alikhtarov

FB internal diff: D1676700

Tasks: 5594155

Signature: t1:1676700:1415832334:88866ace7026282f2eb955cd43e5965dd26e73d5
Ensure onWriteQuiescence_ is called only in STREAMING state

Summary: We shouldn't invoke onWriteQuiescence_ after invoking onTerminate.

Test Plan: -- add new unit test and ran all existing tests

Reviewed By: alikhtarov@fb.com

Subscribers: trunkagent, alikhtarov

FB internal diff: D1678327

Tasks: 5602180

Signature: t1:1678327:1415921548:bf10e67c53a152a823fa839d65543abee2bacff8
Work around ASAN bug with no-return function

Summary:
While trying to get HHVM running with ASAN (using gcc), I found that a
helper function for non-returning functions would consume boundless amounts of
memory here.  This works around it by making the function possibly-returning.

Unfortunately I haven't been able to figure out the root cause (nor reduce this
to a reportable test case), but this at least gets HHVM running with ASAN for
the time being.

Test Plan:
Run www on ASAN-itized HHVM.  objdump the non-ASAN build to make
sure this doesn't change the generated code.

Reviewed By: meyering@fb.com

Subscribers: trunkagent, alikhtarov, mcl

FB internal diff: D1682440

Signature: t1:1682440:1416001466:14a68b26b4fa64c36f592cd3ea2f0cf412847952
Pass empty value in umbrella protocol

Summary: Empty value and absent value are different results. We should distiguish them in umbrella.

Test Plan: unit test

Reviewed By: alikhtarov@fb.com

Subscribers: alikhtarov

FB internal diff: D1682669

Signature: t1:1682669:1416003063:bc4ba1005c8de85badefc96bc0246cbb9866d3b8
Move Acceptor to wangle

Summary:
Initial pass at moving acceptor to wangle.  Involves moving most of the config stuff from proxygen/lib/services, and *all* of the ssl stuff from proxygen/lib/ssl.

Only minor changes:
* Acceptor can be overriden to use thrift socket types, so I don't have to change TTransportException everywhere just yet
* proxygen::Exception to std::runtime_exception in a few spots - looks like it is entirely bad config exceptions, so it should be okay
* Just used std::chrono directly instead of stuff in Time.h (which is just typedefs and simple helpers)

Test Plan:
used in D1539327

fbconfig -r proxygen/httpserver; fbmake runtests

Probably other projects are broken, will iterate to fix

None of the failling tests look related

Reviewed By: dcsommer@fb.com

Subscribers: oleksandr, netego-diffs@, hphp-diffs@, ps, trunkagent, doug, fugalh, alandau, bmatheny, njormrod, mshneer, folly-diffs@

FB internal diff: D1638358

Tasks: 5002353

Signature: t1:1638358:1414526683:87a405e3c24711078707c00b62a50b0e960bf126
Track number of hard TKOs

Summary: this diff adds tracking of number of hard TKOs to TkoTracker. It is useful when we want to know (or limit in the future) not only soft TKOs.

Test Plan: unit tests, run mcrouter and see the log is correct

Reviewed By: bwatling@fb.com

Subscribers: bwatling, trunkagent, alikhtarov

FB internal diff: D1677432

Signature: t1:1677432:1415902381:731d8a0826c50c40f1241a56bd1ccd17ccfaf236
Add 'stats suspect_servers'

Summary: now we can check the list of "suspect" servers, i.e those servers that are marked TKO or down.

Test Plan: unit tests, send "stats suspect_servers" to mcrouter

Reviewed By: bwatling@fb.com

Subscribers: bwatling, trunkagent, alikhtarov

FB internal diff: D1677488

Signature: t1:1677488:1415902486:18e967f5f5db814b1fd7f5839f0163ac3d9b3a2e
Simplify proxy_monitor

Summary: This code is deprecated and will go away soon.

Test Plan: unit tests

Reviewed By: sdmich@fb.com

Subscribers: bwatling, trunkagent, alikhtarov

FB internal diff: D1677785

Signature: t1:1677785:1415838892:8866f80ce29df32e69870246837bf310e9c52b6a
ProxyClientShared accessor by key

Summary:
Needed for internal deprecated use, will be removed eventually.

Test Plan: unit tests

Reviewed By: bwatling@fb.com

Subscribers: trunkagent, alikhtarov

FB internal diff: D1677861

Signature: t1:1677861:1415900155:fa84eaf7194de0f41efad390d50c21dce06c5bd9
Remove mc_res_remote_error hack

Summary: the logic of returning mc_res_remote_errors with custom error string was removed from TAO. Corresponding diff: D1403530 . So we don't need to separately handle those cases.

Test Plan: mcrouter unit tests, tao unit tests

Reviewed By: bwatling@fb.com

Subscribers: trunkagent, alikhtarov

FB internal diff: D1677906

Signature: t1:1677906:1415899547:513174916359f7875928e9973f3418b8e16a09d7
Cleanup errors logic

Summary:
Depends on D1677906

this diff tries to simplify and unify error-handling logic:
isError - everything that is not success. miss counts for success.
isFailoverError - everything that might return success if we send the request to different server/later to the same server
isSoftTkoError - errors that should trigger soft TKO logic
isHardTkoError - errors that should trigger hard TKO logic

Test Plan: mcrouter and tao unit tests

Reviewed By: bwatling@fb.com

Subscribers: bwatling, trunkagent, vikas, alikhtarov

FB internal diff: D1677932

Signature: t1:1677932:1415902651:a03f5a03689fe2e2b08144f14c3d08bda2096c25
Remove router_monitor

Summary:
this diff moves logic of handling TKO probes to mcrouter, so router_monitor is not used.

Depends on D1677932, D1677906, D1677888, D1677861, D1677488, D1677432

Test Plan: tao unit tests

Reviewed By: bwatling@fb.com

Subscribers: trunkagent, alikhtarov

FB internal diff: D1678024

Signature: t1:1678024:1415901644:9f626632e1105bc23e454170071bfddcbff92925
Remove proxy_client_monitor

Summary:
Since we removed router_monitor, there is no need in proxy_client_monitor.
Depends on D1678024

Test Plan:
mcrouter unit tests, tao tests

Reviewed By: bwatling@fb.com

Subscribers: trunkagent, alikhtarov

FB internal diff: D1678093

Signature: t1:1678093:1415902196:94df1809d4d2ca0cfde4ca6a5be3ecce0a053787
Fix mcc mc_res_remote_error non-TKO

Summary:
I removed mc_res_remote_error from both soft and hard TKO errors. Old mcc client returns mc_res_remote_error for disconnect event, but doesn't call on_down if we were already in "down" or "failing" state. Thus, this hack calls "on_up" for mc_res_remote_error even when we're not going to have "on_down" event afterwards.
Since we're not missing "on_up" event on reconfigure anymore, this code gives us nothing except crashes.

Test Plan: mcrouter unit tests

Reviewed By: stepan@fb.com

Subscribers: alikhtarov

FB internal diff: D1693624

Tasks: 5658281

Signature: t1:1693624:1416469651:dc63d0fa71cb6394eb0016a55aeb868c512d1a22