GitHub user sihuazhou opened a pull request: https://github.com/apache/flink/pull/6020
[FLINK-9373][state] Always call RocksIterator.status() to check the internal error of RocksDB ## What is the purpose of the change Currently, when using RocksIterator we only use the `iterator.isValid()` to check whether we have reached the end of the iterator. But that is not enough, if we refer to RocksDB's wiki https://github.com/facebook/rocksdb/wiki/Iterator#error-handling we should find that even if `iterator.isValid()=true`, there may also exist some internal errors. A safer way to use the `RocksIterator` is to always call the `iterator.status()` to check the internal error of RocksDB. There is one case from user email seems to lost data because of this http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/Missing-MapState-when-Timer-fires-after-restored-state-td20134.html (I'm not so sure yet) ## Brief change log - *Always call RocksIterator.status() to check the internal error of RocksDB* ## Verifying this change This change is a trivial rework / code cleanup without any test coverage. ## 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 FLINK-9373 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/6020.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 #6020 ---- commit b1d531949d521bb7d72cd389dfe72a4a5cf1bfc9 Author: sihuazhou <summerleafs@...> Date: 2018-05-16T07:47:05Z Always call RocksIterator.status() to check the internal error of RocksDB ---- ---