[
https://issues.apache.org/jira/browse/HDDS-14800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18064981#comment-18064981
]
Priyesh K commented on HDDS-14800:
----------------------------------
Thanks for the feedback everyone. [~weichiu] [~erose] [~ayarovoy]
The
[fix|https://github.com/priyeshkaratha/ozone/commit/d8edbcb464b65f693f80928169cbba5f2c3afd5c#diff-64055e087acc645f03dab3958822ba6177b29d1be548a4d1e21e50260e463a3b]
addresses all the concerns raised here by working at two levels
1. Fast-fail check ({{{}isClosed(){}}}) {{RDBStoreAbstractIterator.hasNext()}}
now checks if the RocksDB is closed before calling any iterator methods. This
ensures the scanner stops immediately after {{failVolume()}} is triggered,
without attempting further DB operations.
2. Reference counting via {{acquire()/release}} {{RDBStoreAbstractIterator}}
now calls {{RocksDatabase.acquire()}} when an iterator is created and releases
it when the iterator is closed. {{RocksDatabase.waitAndClose()}} already spins
until the counter reaches zero before physically closing the DB. This
eliminates the TOCTOU race that a simple {{isClosed()}} check alone cannot
prevent.
So fixing {{RDBStoreAbstractIterator}} covers both scanners without touching
either scanner class.
cc : [~Sammi]
> Check DB open state during one container scanning in
> BackgroundContainerDataScanner
> ------------------------------------------------------------------------------------
>
> Key: HDDS-14800
> URL: https://issues.apache.org/jira/browse/HDDS-14800
> Project: Apache Ozone
> Issue Type: Sub-task
> Reporter: Sammi Chen
> Assignee: Priyesh K
> Priority: Major
>
> StorageVolumeChecker and BackgroundContainerDataScanner are running in
> parallel.
> When StorageVolumeChecker detects a volume check fails twice(configurable),
> it will fail the volume, close the rocksdb for this volume.
> Since BackgroundContainerDataScanner doesn't get notified for DB close, so it
> should check the DB open/close state during a container's scan, before
> calling rocksdb APIs.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]