You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Iterator::Refresh() with a snapshot #10487
Current Iterator::Refresh() does not support snapshot, we have no way to refresh an iterator to a specified snapshot, instead we create a new iterator, but creating new iterator is heavy.
Refresh iterator to a specified snapshot, we can avoid creating new iterator thus improving performance.
I seeked for a feature to avoid creating new iterator when I need to update an iterator to a specified snapshot, then I found Refresh, I expect Refresh is much lighter than creating new iterator.
As an online service, super version change should be much less frequent than snapshot change, so Refresh with snapshot is much lighter in most cases. If super version is really changed, with carefully coding, the Refresh computation should be still lighter than creating a new iterator.
Hi @rockeet, I agree this is a reasonable feature to add, and optimizing the part where superversion is not changed should be easier to implement. It's not planned yet, so I'll leave it as up-for-grabs for now.
Hi @rockeet, I agree this is a reasonable feature to add, and optimizing the part where superversion is not changed should be easier to implement. It's not planned yet, so I'll leave it as up-for-grabs for now.
Activity
cbi42 commentedon Aug 5, 2022
I see the current
Refresh()is actually pretty heavyweight and takes similar amount of work as creating a new iterator when superversion number is changed: https://github.com/facebook/rocksdb/blob/f28d0c2020d0314e66aed240f379f2a795b6c940/db/arena_wrapped_db_iter.cc#L62-L82So supporting iterator refresh to a new snapshot might only get performance benefit when superversion number is not changed. Is that the performance improvement you expected? Or you expect some improvements could be done when superversion changes too?
rockeet commentedon Aug 6, 2022
I seeked for a feature to avoid creating new iterator when I need to update an iterator to a specified snapshot, then I found Refresh, I expect Refresh is much lighter than creating new iterator.
As an online service, super version change should be much less frequent than snapshot change, so Refresh with snapshot is much lighter in most cases. If super version is really changed, with carefully coding, the Refresh computation should be still lighter than creating a new iterator.
cbi42 commentedon Aug 11, 2022
Hi @rockeet, I agree this is a reasonable feature to add, and optimizing the part where superversion is not changed should be easier to implement. It's not planned yet, so I'll leave it as up-for-grabs for now.
rockeet commentedon Aug 11, 2022
Very Thanks!
Add new Iterator API Refresh(const snapshot*) (meta#10594)
Add new Iterator API Refresh(const snapshot*) (meta#10594)