Check for sessions while getting JT grant

Test Plan:
unit tests

Revert Plan:

Reviewers: dms, aching, pyang

Reviewed By: dms

Task ID: 1128546
Fix test cases TestAvatarTxIds, TestRPC

Summary:
-for TestAvatarTxIds, I notice that there is a problem with starting
MiniAvatarCluster, when the standby starts before primary saves the
namespace, and then the standby would fail because of image timestamp.

Fixed this, and now MiniAvatarCluster waits to starts the standby until
the primary is initialized. - > reused isInitialized logic used for
failover.

This bug could potentially reveal itself in other avatar unit tests.

-TestRPC

Client call was not processing NoRouteToHostException, and
PortUnreachableException, -> when these two are thrown, the Invoker
should recheck the dns at the next call, but it wasn't doing it, since
both exceptions were treated as local exceptions.

-Added some logging to TestsAvatarTxIds, cuz it's very hard to parse
that huge log :)

Test Plan: ant test those two testcases

Reviewers: hkuang, pritam

Reviewed By: hkuang
Fix bug in locality computation

Summary:
The locality computation thread was never being started because the
default boolean value is false.

Test Plan: Ran test hive queries and inspected the logs.

Reviewers: dms, aching, pyang

Reviewed By: dms
Fix reading the parent path from image

Summary:
This patch changes the reading of the parent path for directories from
the image. Now, the UTF8 class is used to obtain a string from the byte
form. With this patch, we directly read stored bytes, and split them
directly, using the path separator.

Reviewers: hkuang

Reviewed By: hkuang

Task ID: 1142900
Fix NPE when exiting safemode

Test Plan: existing tests

Reviewers: tomasz, pritam

Reviewed By: tomasz

Task ID: 1142708
Use a ConcurrentHashMap instead of a HashMap to avoid race conditions.

Test Plan: mvn test

Reviewers: kannan, hkuang, pritam, mbautin

Reviewed By: hkuang

CC: hbase-eng@, mattwkelly

Task ID: 1131404
Splitting DFSClient into multiple classes

Summary:
Similar to the current master of the Apache HDFS repository, the DFSClient
class is now split into: DFSClient, BlockReader, DFSInputStream and
DFSOutputStream.
This was done trough:
* Passing a DFSClient instance reference to DFSInputStream and
DFSOutputStream classes.
* Changing most of the DFSClient fields protection from private to
protected.
Besides touching these 4 files, all the other files (including tests)
that used the modified classes were updated.

Test Plan: By compiling and then running "ant test".

Reviewers: sdong, hkuang

Reviewed By: sdong

Task ID: 1110209
[Raid] Merge Murali's raid changes into chunk

Summary:
Contain the following changes.
1. in DistributedRaidFileSystem.java: we should try and cache the parity information in ExtsFsInputStream.
2. in Decoder.java: invoke the ParallelStreamReader constructor with the
min(bufSize, limit).
3. in ParallelStreamReader.java: the constructor should take in a
blockSize parameter. This will save about 30ms when reading 100KB data.
4. in Decoder.java: do the arraycopy instead of reading one by one. This
will save about 10 ms when reading 100KB data.

Test Plan: ant test

Reviewers: weiyan, hkuang

Reviewed By: weiyan

Task ID: 1125574
Disallow DataNode to format itself when data.dir is not empty

Summary:
When a data dir is not empty, the data node should exit rather than
automatically reformat the data dir. Otherwise leads to inconsistent
behaviour and potential data loss.

Test Plan:
Set data.dir in hdfs-site.xml to a non-empty directory, containing
data that does not belong to the DataNode. Attempt to start DataNode
and verify that an error message is logged and DataNode shuts down.

Revert Plan:

Reviewers: hkuang

Reviewed By: hkuang

Task ID: 1139555