Skip to content

Feature Request: Iterator::Refresh() with a snapshot #10487

Closed

Description

@rockeet

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.

Activity

  1. cbi42 commented on Aug 5, 2022

    @cbi42
    Contributor

    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-L82
    So 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?

  2. rockeet commented on Aug 6, 2022

    @rockeet
    ContributorAuthor

    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.

  3. cbi42 commented on Aug 11, 2022

    @cbi42
    Contributor

    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.

  4. rockeet commented on Aug 11, 2022

    @rockeet
    ContributorAuthor

    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.

    Very Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions