Summary:
This change adds a new and exciting protocol to Thrift. It uses
RFC-compliant JSON as the wire protocol and is fully human readable.
(once a little whitespace has been inserted.) Unlike the existing
JSON protocol for Java, which is intended to allow Thrift data to be
transferred to scripting languages, this protocol is lossless and fully
read-write. It was written by Chad Walters of Powerset and reviewed
by David Reiss.
Tested by running make check.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665482 13f79535-47bb-0310-9956-ffa450edef68
Summary:
The upcoming TJSONProtocol handles string and binary types quite differently.
This change makes that distinction in all parts of the C++ binding.
Java already distinguished between string and binary, but this change
also updates the Java skip method to skip over strings as binary
so we don't get encoding errors when skipping binary data.
Reviewed By: mcslee
Test Plan: make check
Revert Plan: ok
Other Notes:
I just pulled this out of Chad Walters' JSON patch.
The only other change was adding readBinary (or was it writeBinary)
to TDenseProtocol. Maybe inheriting from TBinaryProtocol wasn't a good idea.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665481 13f79535-47bb-0310-9956-ffa450edef68
Summary: Use comment trick in params that are unused to prevent warnings
Reviewed By: dreiss
Test Plan: Generate C++ code and compile -W -Wall
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665469 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- Expanded tabs to spaces where spaces were the norm.
- Deleted almost all trailing whitespace.
- Added newlines to the ends of a few files.
- Ran dos2unix on one file or two.
Reviewed By: mcslee
Test Plan: git diff -b
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665467 13f79535-47bb-0310-9956-ffa450edef68
Summary:
There were some weird cases where the implicit conversion from
const char* to std::string was causing the wrong constructor to be called.
There wasn't really a clean workaround, so we're dropping the string
constructors.
Reviewed By: mcslee
Test Plan:
Ran the test.
Grepped around the /projects tree for uses that had to fixed,
and fixed them.
Revert Plan: ok
Other Notes:
This risk was pointed out by Ben Maurer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665461 13f79535-47bb-0310-9956-ffa450edef68
Summary:
This didn't get updated when the interface changed,
and the cast silenced the warning message. Stupid C.
Reviewed By: mcslee
Test Plan: Trust Chad Walters.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665457 13f79535-47bb-0310-9956-ffa450edef68
Chad Walters is writing a JSON protocol for Thrift, but he wants
borrow to always succeed. That would be a pain to implement,
but here is a first step: borrow will almost always work with
TBufferedTransport.
Reviewed by: mcslee
Test Plan: Ran the DenseProtocol test and Zlib test, but more needs to be done.
Other Notes:
Also reviewed by Chad Walters, and maybe Ben Maurer.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665455 13f79535-47bb-0310-9956-ffa450edef68
Summary:
I don't know what I was thinking when I first wrote this.
It makes sense that the transport might not want to allocate its own memory,
so the protocol is expected to provide a buffer for the data.
However, if the transport already has the data buffered,
there is no need to memcpy it; it can just return a pointer into its buffer.
The new interface still requires the protocol to provide a buffer,
but allows the transport to return a pointer to an interal buffer.
In addition, I made len a pass-by-pointer parameter so that
the transport can return more than the requested data if it has it
available in its buffers.
Reviewed By: mcslee
Test Plan: Ran the DenseProtocol test and the Zlib test.
Revert Plan: ok
Other Notes:
Also got this reviewed by Chad Walters from Powerset.
Ben Maurer suggested making len a reference parameter.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665454 13f79535-47bb-0310-9956-ffa450edef68
the threadpoolserver should just crash if an unknown exception type is thrown.
This should probably be true for all server types, will put this on the TODO list.
reviewed by jwang
test plan: network selector servers in production
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665412 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Ben Maurer suggested that it would make sense for Thrift to build as
a single project, with one configure.ac and multiple Makefile.am.
He was also kind enough to do the heavy lifting, and this commit
is the application of his patch (with minor modifications).
The most significant visible change from this diff is that
in order to buidl one of the thrift sub-projects (i.e.: the compiler,
the C++ library, or the Python library) you must run bootstrap.sh
and configure in the Thrift root, then make in the specific project.
Users who want to build and install the Python library but
can't run configure because they don't have Boost can simply
run setup.py directly.
Reviewed By: mcslee
Test Plan: Built Thrift from scratch.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665409 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- it should be possible to specify a zero timeout if the pendingTaskQueue
is already full
Reviewed By: marc
Test Plan:
- Tested in search
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665406 13f79535-47bb-0310-9956-ffa450edef68
Summary: const so that catching via "catch (const TTransportException& e)" works
properly, and throw() for good convention.
Reviewed By: mcslee
Test Plan: still compiles
Revert: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665403 13f79535-47bb-0310-9956-ffa450edef68
Reviewed By: boz
Test Plan:
dreiss@dreiss-vmware:safe_concurrency:thrift/test$ nl -ba guard_test.cc
1 #include "../lib/cpp/src/concurrency/Mutex.h"
2 using facebook::thrift::concurrency::Guard;
3 void test() {
4 facebook::thrift::concurrency::Mutex m;
5 Guard(m);
6 Guard g1(m);
7
8 facebook::thrift::concurrency::ReadWriteMutex rwm;
9 facebook::thrift::concurrency::RWGuard(m);
10 facebook::thrift::concurrency::RWGuard g2(rwm);
11 }
dreiss@dreiss-vmware:safe_concurrency:thrift/test$ g++ -c guard_test.cc
guard_test.cc: In function ‘void test()’:
guard_test.cc:5: error: ‘incorrect_use_of_Guard’ was not declared in this scope
guard_test.cc:9: error: ‘incorrect_use_of_RWGuard’ is not a member of ‘facebook::thrift::concurrency’
dreiss@dreiss-vmware:safe_concurrency:thrift/test$
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665402 13f79535-47bb-0310-9956-ffa450edef68
Summary: O_APPEND means that even if the file pointer is in the middle of the file, the next write will go to the end of the file. So when initializing the TThriftTransport to be written to, we need to truncate the file after the last good event. I'm pretty sure this was what was causing queuemap log corruption when the multiplexer is restarted.
The corruption doesn't necessarily go away at the next chunk boundary because of the offset being recalculated. I think it's good to have the offset recalculated, but then we shouldn't use the old chunk boundary data there, but rather use the newly calculated offset to determine the padding (could be an entire chunk, but that's okay -- way better than corruption)
Reviewed By: mcslee
Test Plan: Wrote to a ThriftFile using local scribe instance. Printed it. Then cat'd garbage to it from the command line. Then wrote to it again. Then printed it again. Seems to work fine, whereas with old scribe binary the later entries were corrupted.
Revert: OK
DiffCamp Revision: 4683
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665388 13f79535-47bb-0310-9956-ffa450edef68
Summary: "Default TApplicationException" is pretty meaningless; if we have this
extra type information, we might as well present it.
Reviewed By: mcslee
Test Plan: caught a couple of INVALID_MESSAGE_TYPE tapplicationexceptions
Revert: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665383 13f79535-47bb-0310-9956-ffa450edef68
Summary: Such that users can supply an event handler to a server that will be used to signal various events that take place inside the server core.
Reviewed By: dreiss
Test Plan: Rebuilt all servers, work by default
Other Notes: Partially submitted and also reviewed by Dave Simpson at Powerset
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665371 13f79535-47bb-0310-9956-ffa450edef68
Summary: Need to pass hints including AI_ADDRCONFIG to getaddrinfo to make sure no IPv6 addresses come back on non-IPv6 enabled systems
Reviewed By: mcslee
Other Notes: Submitted by Paul Saab
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665368 13f79535-47bb-0310-9956-ffa450edef68
Summary: This allows the event loop to be shared across different components of a program of for a separate thread in a TNonblockingServer to safely use its own libevent code without conflicts.
Reviewed By: mcslee
Test Plan: Updated test/ committed here
Other Notes: submitted by Ben Maurer, patched in by mcslee with slight modifications
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665364 13f79535-47bb-0310-9956-ffa450edef68
Summary: Need to use IPv6 compliant constructs here. Submitted by Paul Saab.
Reviewed By: dreiss
Test Plan: Rebuild Thrift TNonblockingServer with this patch and verify behaves just the same
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665353 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- unflushed data should be flushed when transport is closed
- this diff calls flush for TBufferedTransport and TFramedTransport
Reviewed By: dreiss
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665323 13f79535-47bb-0310-9956-ffa450edef68
Summary: "Porting" this feature from PHP; I find it useful in the Synapse client.
Reviewed By: mcslee
Test Plan: It compiles, ship it!
Revert: svn
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665304 13f79535-47bb-0310-9956-ffa450edef68
Summary: Same thing as the previous PHP change. Also includes a new constructor for easy building of a TSocketPool with a single host (for later filling in via addServer) without extra std::vector boxing/unboxing.
Reviewed By: mcslee
Test Plan: Synapse c++ client at r62896 uses this.
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 909
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665297 13f79535-47bb-0310-9956-ffa450edef68
Summary:
just some simple styling changes. moving using boost::shared_ptr to .cpp
and using the full path name in .h
Reviewed by: boz, dreiss
Test Plan: compiled and tested on the adfinder
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665289 13f79535-47bb-0310-9956-ffa450edef68
Summary: we need to use a shared_ptr instead of an old fashioned one if we're
going to stick with this PIMPL model
Reviewed By: dreiss, marc
Test Plan: test program didn't fail or leak memory, foreman (fb303 client)
worked without problem
Revert Plan: just make sure you find some other solution to this problem
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665280 13f79535-47bb-0310-9956-ffa450edef68
Summary: also added myself to CONTRIBUTORS.
Reviewed By: marc
Test Plan: the following program no longer leaks memory (valgrind):
int main(int argc, char **argv){
Mutex mu;
mu.lock();
mu.unlock();
}
Revert Plan: ok
Notes: this is kind of important
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665279 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- make dist is no fun. Had to add a lot of stuff to Makefile.am to
make sure stuff got included in the tarball.
- Added a permanent NEWS file with the release notes for this release.
- clean.sh removes ylwrap also.
- Gave it a real version for make dist.
- Added ACLOCAL_AMFLAGS to lib/cpp/Makefile.am to make it easier to
work on configure.ac.
- Made concurrency_test a non-installed binary because
no one wants to install it.
- Dropped some symlinks that were annoying make dist.
- Updated README.
Test Plan:
./bootstrap.sh && ./configure && make dist
Compared contents of tarball to source tree.
Did this from a fresh git tree so no gross untracked files would be around.
On devrs: ./bootstrap.sh && ./configure && make install DESTDIR=/tmp/relinst1
Made sure concurrency_test was built but not installed.
Checked zlib URL with firefox.
Reviewed By: mcslee
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665274 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Same as the last (reverted) zlib patch,
but this time with way more awesome support for building
with no zlib headers installed.
Reviewed By: mcslee
Test Plan:
- Did lots of really pathological stuff in my VMware.
- On devrs004:
./bootstrap.sh && ./configure && make && make install DESTDIR=/tmp/tzinst && echo "Yay"
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665269 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- Totally re-did the libevent check.
- Thrift now compiles and instals cleanly without libevent.
- (libevent is still needed to build libthriftnb.)
Reviewed By: mcslee
Test Plan:
- Ran configure and make in various configurations in my VMware.
- Clean build and install of Thrift on devrs004 (into /tmp).
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665267 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Add a new transport to the C++ library: TZLibTransport.
This wraps another transport (just like TBufferedTransport),
compresses the data written to it, and uncompresses the data it reads.
Reviewed By: mcslee
Test Plan:
For ax_lib_zlib.m4
- Ran ./bootstrap.sh.
- Looked at configure.
- Ran ./configure.
- Looked at config.status
- Ran ./configure --with-zlib=/usr.
- Looked at config.status
- Changed configure.ac to AC_LIB_ZLIB(1.2.4)
- Ran ./configure.
- Watched it fail.
For TZlibTransport
- test/ZlibTest.cpp
- Code coverage (hotness) report sent with review.
- 100% line coverage for all the good stuff.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665262 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- TDenseProtocol now includes a part of the struct fingerprint in
the serialized message, to protect from unserialzing trash.
- A lot of cleanups and commenting for TDenseProtocol.
- A lot of test cases for same.
Reviewed By: mcslee
Test Plan: test/DenseProtoTest.cpp
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665257 13f79535-47bb-0310-9956-ffa450edef68
Reviewed By: mcslee
Test Plan:
test/DenseProtoTest.cpp
Still have to test:
- Bounds checking.
- borrow/consume on TBuffered and TFramed.
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665252 13f79535-47bb-0310-9956-ffa450edef68
Summary:
To support the upcoming variable-length encoding of integers in
TDenseProtocol, augment Thrift transports with two new methods:
borrow and consume. Borrow copies some data out of the transport
without consuming it, and consume... consumes it.
Reviewed By: mcslee
Test Plan:
Thrift compiles.
Should check in variable-length integer code for TDenseProtocol
right after this (git ruulz).
Revert Plan: revert stuff that uses these methods also.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665251 13f79535-47bb-0310-9956-ffa450edef68
Summary:
- Made some stuff in TBinaryProtocol protected instead of private.
- Added a preliminary version of TDenseProtocol. This is still
super highly experimental and gross, and I wrote a super scary
comment to explain that to anyone foolish enough to try to use
this in its current state.
Reviewed By: mcslee
Test Plan: test/DenseProtoTest.cpp
Revert Plan: ok
Memcache Impact:
Save memory if/when people use it.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665247 13f79535-47bb-0310-9956-ffa450edef68
Summary:
Local reflection typespecs for structs now have a dummy T_STOP field at the end
so we don't have to check the size on every iteration.
They also contain information about which fields are optional.
Also put a static pointer to the reflection in each structure.
Reviewed By: mcslee
Test Plan: test/DenseLinkingTest.thrift
Revert Plan: ok
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665246 13f79535-47bb-0310-9956-ffa450edef68
Also, checking in changes to the php generation code I made awhile ago, but forgot to check in
Reviewed By: aditya, mcslee
Test Plan: Compiled thrift and falcon, and confirmed that falcon's print binary still worked
Revert Plan: revertible
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665245 13f79535-47bb-0310-9956-ffa450edef68