Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce rdb_snapshot_unique_ptr & make rdb_get_rocksdb_db return reference #1509

Open
wants to merge 1 commit into
base: fb-mysql-8.0.32
Choose a base branch
from

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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants