[0.89-fb] [HBASE-8228] grab HLog.cacheFlushLock.writeLock() only while swapping the writers

Author: aaiyer

Summary:
 Saw a few scenarios in TitanShadow025 where the snapshot() took long. In all
 the cases that I saw, this was because there was a RollWriter happening in
 parallel. And, the rollWriter itself was blocked on a NN-failover.

 We do not expect NN failover to be happening in prod. But there is no reason
 why the rollWriter() should be holding the writeLock() when trying to create
 the new HLog/DUMMY write. This is done outside the updatesLock because it
 is not crutial.

 The crutial part is when we swap the oldWriter for the newWriter, created.
 We need to ensure that we grab the HLog.cacheFlushLock.writeLock() also for
 this period only.

Test Plan:
MR unit tests; push to titanshadow and look for the times it takes
to cause snapshots.

Reviewers: liyintang, rshroff, adela

Reviewed By: adela

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D758361

Task ID: 2237950

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/0.89-fb@1464135 13f79535-47bb-0310-9956-ffa450edef68
[HBASE-8245] Throttle region opens

Author: manukranthk

Summary: By throttling the region reassignments when a region server come back up after his regions are spread out, we can reduce the spiked in get latencies caused due to multiple region opens on the same region server at round about the same time.

Test Plan: Push onto Titan Shadow's master and cause a RegionServer failure and bring him up after a while. By going through the logs we can understand the working of the idea.

Reviewers: aaiyer, rshroff, liyintang

Reviewed By: rshroff

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D752483

Task ID: 2227053

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/0.89-fb@1464136 13f79535-47bb-0310-9956-ffa450edef68