this is a race condition, here is how it happens:
doMetrics() calls getStorefilesIndexSize() which gets a view of the storefiles ConcurrentSkipListMap at some point in time. Working on this snapshot it calls each store file in turn asking for the index size.
In another thread, the compaction completion code finishes, first thing it does is:
- remove store files from the storefiles list.
- do some stuff
- close the aforementioned store files, which causes the this.reader to become null.
Back in thread #1, we run into the this.reader == null, and we throw the exception.
So we need to do either of:
- sync on this map, use a synced versin of the map
- allow the ability to check this metrics without causing a RS abort when we hit an exception. Either catch it, or prevent it from happening.