Open source Mcrouter initial commit
Remove deprecated --async-client option

Test Plan: runtests/make check, all pass apart from the known delayed destructor bug that's not in public fbthrift yet

Reviewed By: pavlo@fb.com

FB internal diff: D1404776
Open source build: lib order and missing thrift dependency

Summary:
- Some versions of gcc actually depend on the order of object file and -l arguments. AM_LDFLAGS is not the right place for libraries, as it ends up before any object files on the command line.
- Thrift uses boost_thread functions, but (incorrectly) only links against it if --enable-boost-thread is specified.  Workaround in Mcrouter build directly for now.

Test Plan: build open source, make check

Reviewed By: pavlo@fb.com

FB internal diff: D1404673
Open source script fix for gflags

Summary: gflags.so doesn't contain correct RPATH to find glog.so, so force the linker to include it

Test Plan: install_facebook.sh works now

Reviewed By: gunjan@fb.com

FB internal diff: D1404905
Fix open source build: add lib crypto

Summary: MD5 lives in libcrypto.

Test Plan: build open source

Reviewed By: stepan@fb.com

FB internal diff: D1405014
Fix open source build

Summary: O_CREAT needs third argument, mode

Test Plan: build mcrouter

Reviewed By: gunjan@fb.com

FB internal diff: D1407061
Minor fix for open source

Summary: newer python complains McrouterClient is not defined

Test Plan: run unit tests

Reviewed By: gunjan@fb.com

FB internal diff: D1407818
Remove McStringData

Summary:
Historically this class did some useful things, like reference an external mc_msg_t.
Now it's just a thin wrapper around IOBuf, and we can remove it for simplicity and performance.

Test Plan:
Built all affected projects and ran unit tests
Ran tao server unit tests
Will watch for contbuild errors

Reviewed By: andrii@fb.com

Subscribers: ios-diffs@lists, scottg, zhuohuang

FB internal diff: D1396402
More open source build fixes

Summary:
- Added missing packages to Ubuntu 12.04 script
- Use gtest-1.6.0 from folly installation
- Depend on libthrift directly

Test Plan: make distclean && ./scripts/install_facebook.sh

Reviewed By: pavlo@fb.com

FB internal diff: D1411387
Add license headers to .c and .cpp files as well

Test Plan: builds

Reviewed By: pavlo@fb.com

Subscribers: vikas, scottg

FB internal diff: D1411487
Add IOBufUtil.cpp/.h to open source build

Test Plan: build it

Reviewed By: gunjan@fb.com

FB internal diff: D1411857

@override-unit-failures
Revert "[mcrouter] Fix BigValueRoute creation"

Summary:
This reverts commit 2f1cebbbe726e28b88399d253a52c50f567c12b7.

Test Plan: revert

Reviewed By: pt@fb.com, liranuna@fb.com, pavlo@fb.com

FB internal diff: D1412468
Don't make client timeouts internal events

Summary:
Internal timeouts are not considered as real events for the purpose of stopping the event loop with EVLOOP_ONCE flag,
so if the only events that happened were some internal timeouts, event_base_loop() will still block.

For some reason this didn't show in fbcode, only with open source build which links against system libevent-2.0

We want these to happen as normal events.

Test Plan: open source test doesn't hang now

Reviewed By: pavlo@fb.com

FB internal diff: D1415354
Fix Failover route handle

Summary: Sometimes the server returns mc_res_local_error when that happens we should not be failing over.

Test Plan: Checked that we no longer failover

Reviewed By: pavlo@fb.com

FB internal diff: D1415358

Tasks: 4496384
Failover on mc_res_try_again and mc_res_busy

Summary: Title

Test Plan: The tests passes now.

Reviewed By: meyering@fb.com

Subscribers: meyering

FB internal diff: D1416945
Check if the spool is writable at startup

Summary: Title

Test Plan:
Checked that it works, runtests

_bin/mcrouter/mcrouter --use-asynclog-version2 --async-dir=/var/spool/mcrouter/ fabric-region -> Not writable

sudo _bin/mcrouter/mcrouter --use-asynclog-version2  --async-dir=/var/spool/mcrouter/ fabric-region -> writable

Reviewed By: alikhtarov@fb.com

Subscribers: trunkagent

FB internal diff: D1407395

Tasks: 2243842
Raise default soft TKO limit

Summary: If we want to launch this, we'll probably have to set custom values for different routers anyway. In the meantime, raising the value means that we won't fail to soft TKO boxes is we happen to shut down more than 10 at a time

Test Plan: visual inspection

Reviewed By: meisner@fb.com

Subscribers: sameen

FB internal diff: D1413913
Refactor McOpList

Summary: Make sure we don't use List<> with ton of entries, which should noticeably improve gdb experience.

Test Plan:
fbmake + gdb
stack trace now looks sane : https://phabricator.fb.com/P12821665

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

FB internal diff: D1415324
Fix global TKO for TKOs lasting more than a minute

Summary: In the case where a global TKO lasts more than a minute, only one proxy is sending probes to the down destination. After a minute the other proxies close their connections due to inactivity, and part of this involves resetting TKO state. We change this so only the responsible thread does this

Test Plan: fbmake runtests

Reviewed By: pavlo@fb.com

Subscribers: gunjan, sameen

FB internal diff: D1421963
Add RootRoute, proper BigValueRoute creation

Summary: create BigValueRoute only once - as the root of route handle tree.

Test Plan: mcrouter unit tests, check big value route is created only once.

Reviewed By: alikhtarov@fb.com

FB internal diff: D1413135