Resolve two race conditions relating to HA lock sessions

- Adds a check ensuring a slave commit has a running lock session when committing,
  or has explicitly opted out from having one.

- Moves lock session management into its own class, where timeouts and concurrent
  access can be tested in isolation.
Merge pull request #3191 from jakewins/2.2-slavesessions

[2.2] Resolve two race conditions relating to HA lock sessions
This chnage will expose a way to ask a lucene index to sample the percentage of different value
present in the index. I.e., it scans a given sample size of the indexed value by skipping at a
given frequency. The return percentage is computed as uniqueSampledValues / sampleSize.
Add a new CountsKey for index entry counts
OnlineIndexProxy will ensure that the index counts are updated [BROKEN]

- fix bug when generate LazyIndexUpdates to never construct 'overlapping updates'
- cleanup code in LazyIndexUpdates