Skip to content

Conversation

@laurynas-biveinis
Copy link
Contributor

This is a second batch of cleanups from the repeatable read snapshot work.

  • Make rdb_get_rocksdb_db return reference instead of pointer, update callers
    and callees. Inline this function in ha_rocksdb_proto.h, move rdb declaration
    there to support inlining in detail namespace as documentation that it should
    not be accessed directly. Update ha_rocksdb.cc itself to use
    rdb_get_rocksdb_db instead of rdb. Remove many redudant rdb != nullptr checks
    and asserts.
  • Introduce rdb_snapshot_unique_ptr with a custom deleter and a factory function
    get_rdb_snapshot to manager global RocksDB snapshots
  • Make Rdb_explicit_snapshot create the snapshot itself, by calling
    get_rdb_snapshot, instead of receiving one through parameters, simplify its
    signature.
  • Replace rocksdb::ManagedSnapshot uses with rdb_snapshot_unique_ptr ones.
  • Remove rarely-used explicit transaction snapshot assignment code from
    acquire_snapshot and move it to the few callers where it may happen.
    Add new method Rdb_transaction::has_explicit_or_read_only_snapshot to support
    this.
  • For Rdb_transaction, make m_insert_count, m_update_count, m_delete_count,
    m_auto_incr_map, & m_rollback_only fields private instead of protected. Move
    their reset at the end of committed or rolledback transactions to on_finish
    method in the base class. Remove redundant m_writes_at_last_savepoint reset in
    set_initial_savepoint.
  • Add several asserts.
@laurynas-biveinis
Copy link
Contributor Author

Needs rebasing

…ference

This is a second batch of cleanups from the repeatable read snapshot work.

- Make rdb_get_rocksdb_db return reference instead of pointer, update callers
  and callees. Inline this function in ha_rocksdb_proto.h, move rdb declaration
  there to support inlining in detail namespace as documentation that it should
  not be accessed directly. Update ha_rocksdb.cc itself to use
  rdb_get_rocksdb_db instead of rdb. Remove many redudant rdb != nullptr checks
  and asserts.
- Introduce rdb_snapshot_unique_ptr with a custom deleter and a factory function
  get_rdb_snapshot to manager global RocksDB snapshots
- Make Rdb_explicit_snapshot create the snapshot itself, by calling
  get_rdb_snapshot, instead of receiving one through parameters, simplify its
  signature.
- Replace rocksdb::ManagedSnapshot uses with rdb_snapshot_unique_ptr ones.
- Remove rarely-used explicit transaction snapshot assignment code from
  acquire_snapshot and move it to the few callers where it may happen.
  Add new method Rdb_transaction::has_explicit_or_read_only_snapshot to support
  this.
- For Rdb_transaction, make m_insert_count, m_update_count, m_delete_count,
  m_auto_incr_map, & m_rollback_only fields private instead of protected. Move
  their reset at the end of committed or rolledback transactions to on_finish
  method in the base class. Remove redundant m_writes_at_last_savepoint reset in
  set_initial_savepoint.
- Add several asserts.
@laurynas-biveinis
Copy link
Contributor Author

@luqun , rebased & ready for review

@laurynas-biveinis laurynas-biveinis marked this pull request as ready for review January 31, 2025 14:11
@facebook-github-bot
Copy link

@luqun has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@laurynas-biveinis laurynas-biveinis deleted the cleanup-rdb-snapshots branch March 12, 2025 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants