Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
Noticed the following methods in Tablet could be a little more efficient:
- lookupLogEntries(KeyExtent, SortedMap)
- lookupScanFiles(KeyExtent, SortedMap, VolumeManager)
- lookupFlushID(KeyExtent, SortedMap)
- lookupCompactID(KeyExtent, SortedMap)
Each of these methods iterates over the SortedMap of KeyValues which a collection of columns from this tablet's row in metadata.
Some of them iterate over the "headMap" to consume keys they don't care about. Others always iterate over all of the values in the map. All of these methods only care about some sequence of values in the map and could use methods like tailMap or subMap.
I doubt there would be a noticeable improvement (since the number of key-value pairs for a tablet shouldn't ever really be more than a hundred or so), but since we already have the sorted structure, it would be nice to use it.
It would also be nice to write some unit tests for these methods while we're at it.