You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2023/10/23 17:57:00 UTC
[jira] [Comment Edited] (SPARK-45533) Use `j.l.r.Cleaner` instead of `finalize` for `RocksDBIterator/LevelDBIterator`
[ https://issues.apache.org/jira/browse/SPARK-45533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17778768#comment-17778768 ]
Yang Jie edited comment on SPARK-45533 at 10/23/23 5:56 PM:
------------------------------------------------------------
[~zhaomin] Some refactoring work is needed, taking `RocksDB` as an example, in terms of resources, only close `RocksIterator` in `RocksDBIterator.ResourceCleaner`, the run method probably needs to do two things:
1. Remove the items in `iteratorTracker`, the corresponding `removeIf` method needs to be modified, changed to compare `RocksIterator`
2. Close `RocksIterator` when `_db` is not null, the run method does not need to reset other states.
The corresponding code logic may need to be moved from RocksDB to `RocksDBIterator.ResourceCleaner`.
For the close method of `RocksDB`, call `cleanable.clean()` when `closed` is false, then reset the state.
Also, I think it should be acceptable to only deal with the elements in `iteratorTracker` when `closed` is false.
was (Author: luciferyang):
Some refactoring work is needed, taking `RocksDB` as an example, in terms of resources, only close `RocksIterator` in `RocksDBIterator.ResourceCleaner`, the run method probably needs to do two things:
1. Remove the items in `iteratorTracker`, the corresponding `removeIf` method needs to be modified, changed to compare `RocksIterator`
2. Close `RocksIterator` when `_db` is not null, the run method does not need to reset other states.
The corresponding code logic may need to be moved from RocksDB to `RocksDBIterator.ResourceCleaner`.
For the close method of `RocksDB`, call `cleanable.clean()` when `closed` is false, then reset the state.
Also, I think it should be acceptable to only deal with the elements in `iteratorTracker` when `closed` is false.
> Use `j.l.r.Cleaner` instead of `finalize` for `RocksDBIterator/LevelDBIterator`
> -------------------------------------------------------------------------------
>
> Key: SPARK-45533
> URL: https://issues.apache.org/jira/browse/SPARK-45533
> Project: Spark
> Issue Type: Sub-task
> Components: Spark Core
> Affects Versions: 4.0.0
> Reporter: Yang Jie
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org