GitHub user sihuazhou opened a pull request: https://github.com/apache/flink/pull/5465
[FLINK-8639][State Backends]Fix always need to seek multiple times when iterator RocksDBMapState ## What is the purpose of the change This PR addressed issue [FLINK-8639](https://issues.apache.org/jira/browse/FLINK-8639). Currently, almost every time we want to iterator a RocksDBMapState we need to do seek at least 2 times (Seek is a poor performance action for rocksdb cause it can't use the bloomfilter). This is because `RocksDBMapIterator` use a `cacheEntries` to cache the seek values every time and the `cacheEntries`'s init size is 1. ## Brief change log - Change CACHE_SIZE_BASE from 1 to 32. - Compare in reverse order in function underSameKey(). ## Verifying this change This change is already covered by existing tests. ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): (no) - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no) - The serializers: (no) - The runtime per-record code paths (performance sensitive): (no) - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no) - The S3 file system connector: (no) ## Documentation - Does this pull request introduce a new feature? (no) You can merge this pull request into a Git repository by running: $ git pull https://github.com/sihuazhou/flink improve_rocksdb_base_mapstate Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/5465.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #5465 ---- commit 753855ec2957492ba6c2eb272fdc5ffe7c769608 Author: summerleafs <summerleafs@...> Date: 2018-02-12T14:28:04Z 1, Removed CACHE_SIZE_BASE, CACHE_SIZE_LIMIT. 2, Compare in reverse order in function underSameKey(). commit e33b807ba151265e0fd86d52701965dc5ffcb7be Author: summerleafs <summerleafs@...> Date: 2018-02-12T14:50:28Z change CACHE_SIZE_BASE from 1 to 32. ---- ---