IMPALA-491: Fixed worker process failure test and clients-in-use metric accounting.

Fixing the worker process failure test revealed a bug in our clients-in-use metrics
accounting in the client cache in the presence of node failures.
The pathological sequence causing leading to an incorrect metric was:
1. ClientConnection c'tor checks out an existing client and updates metrics
2. Existing client connection has broken pipe (or some other TException)
3. Recover by calling ClientConnection::Reopen()
4. Reopen() internally tries to create a new client connection, but the connection
   fails because the remote side is dead.
5. ClientConnection::client_ is set to NULL and therefore its d'tor
   does not properly decrement the clients-in-use for the client
   checked out in step 1.

Change-Id: I911210b23c4a024a4a8a84365a3d12268767b031
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3804
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
BufferedTupleStream: allow interleaved reads/writes and return rows FIFO

Adds support to read from the BufferedTupleStream before all rows have been
added. To do this, at least two pinned buffers may be needed so the c'tor
takes a parameter to indicate if this behavior is enabled.

The stream will also now return rows in the order in which they were inserted.
Instead of maintaining separate lists of pinned and unpinned blocks, we just
keep a single list to easily maintain the FIFO ordering.

This also attempts to clarify the buffer management configuration by separating
pinning behavior from PrepareForRead() and the delete-on-read behavior. Now
pinning is set with Pin()/Unpin() (not PrepareForRead()/Unpin()) and there is
a separate c'tor parameter to specify if blocks should be deleted after reading.

Change-Id: Ic7628ff13ad4329461de0742c80cd91d1f385089
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3785
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
Fixed LIKE predicate %% pattern error

Before:
Query: select count(*) from functional.alltypes where date_string_col
like "%%"
+----------+
| count(*) |
+----------+
| 0        |
+----------+
After:
Query: select count(*) from functional.alltypes where date_string_col
like "%%"
+----------+
| count(*) |
+----------+
| 7300     |
+----------+

Change-Id: Ic2f047ba3b03eeebe9477892da95a1d06dc27da7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3768
Reviewed-by: Paden Tomasello <paden.tomasello@cloudera.com>
Tested-by: jenkins
Refactored impala-shell

This is a reorganization of the existing impala-shell.

The basic idea was to split up the shell into two components: one part
soley responsible for the CLI functionality, and another to represent
the impala client/connection that would interact with the Beeswax api and
execute queries, fetch results, etc.

One major change was to redo how the existing shell handled cancellation,
which was to create a thread for each rpc, so that Ctrl+C would not interrupt
the system calls and break the socket connection. In the new approach,
a new client instance is created to close the query and if the socket connection is
broken, the client reconnects. Cancellation currently works.

Change-Id: I0f371f68552c065b2317f967c6cf7483b44be3df
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3316
Reviewed-by: Abdullah Yousufi <abdullah.yousufi@cloudera.com>
Tested-by: jenkins