I have gone through the flow for this API. I think there are some issues
1. In Store.rowAtOrBeforeFromStoreFile()
In case of the half store file, this reader just calls the actual file reader. But this will give the 1st key in the physical HFile(which is the 1st key in the bottom half file also). The getFirstKey() is not overriden in the HalfStoreFileReader.
2. In Store.rowAtOrBeforeFromStoreFile() itself
HFileScanner scanner = r.getHFileReader().getScanner(true, true, false);
In case of the half file, r will be the HalfStoreFileReader instance. But as we dont call getScanner() on "r", always it will get the actual HFileScanner for the HFile( The delegator in the HFileScanner instance in HalfStoreFileReader ).
3. Other than these 2 issues we need to correct the issue with the seekBefore() API in the HalfStoreFileReader.getScanner
I will address these issues and give a patch in some time.