-
Notifications
You must be signed in to change notification settings - Fork 2.4k
chore(storage): remove unused primed_dbis
#18415
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ use crate::{ | |
| Cursor, Error, Stat, TableObject, | ||
| }; | ||
| use ffi::{MDBX_txn_flags_t, MDBX_TXN_RDONLY, MDBX_TXN_READWRITE}; | ||
| use indexmap::IndexSet; | ||
| use parking_lot::{Mutex, MutexGuard}; | ||
| use std::{ | ||
| ffi::{c_uint, c_void}, | ||
|
|
@@ -94,7 +93,6 @@ where | |
|
|
||
| let inner = TransactionInner { | ||
| txn, | ||
| primed_dbis: Mutex::new(IndexSet::new()), | ||
| committed: AtomicBool::new(false), | ||
| env, | ||
| _marker: Default::default(), | ||
|
|
@@ -173,50 +171,25 @@ where | |
| /// | ||
| /// Any pending operations will be saved. | ||
| pub fn commit(self) -> Result<(bool, CommitLatency)> { | ||
| self.commit_and_rebind_open_dbs().map(|v| (v.0, v.1)) | ||
| } | ||
|
|
||
| pub fn prime_for_permaopen(&self, db: Database) { | ||
| self.inner.primed_dbis.lock().insert(db.dbi()); | ||
| } | ||
| let result = self.txn_execute(|txn| { | ||
| if K::IS_READ_ONLY { | ||
| #[cfg(feature = "read-tx-timeouts")] | ||
| self.env().txn_manager().remove_active_read_transaction(txn); | ||
|
|
||
| /// Commits the transaction and returns table handles permanently open until dropped. | ||
| pub fn commit_and_rebind_open_dbs(self) -> Result<(bool, CommitLatency, Vec<Database>)> { | ||
| let result = { | ||
| let result = self.txn_execute(|txn| { | ||
| if K::IS_READ_ONLY { | ||
| #[cfg(feature = "read-tx-timeouts")] | ||
| self.env().txn_manager().remove_active_read_transaction(txn); | ||
|
|
||
| let mut latency = CommitLatency::new(); | ||
| mdbx_result(unsafe { | ||
| ffi::mdbx_txn_commit_ex(txn, latency.mdb_commit_latency()) | ||
| }) | ||
| let mut latency = CommitLatency::new(); | ||
| mdbx_result(unsafe { ffi::mdbx_txn_commit_ex(txn, latency.mdb_commit_latency()) }) | ||
| .map(|v| (v, latency)) | ||
| } else { | ||
| let (sender, rx) = sync_channel(0); | ||
| self.env() | ||
| .txn_manager() | ||
| .send_message(TxnManagerMessage::Commit { tx: TxnPtr(txn), sender }); | ||
| rx.recv().unwrap() | ||
| } | ||
| })?; | ||
| } else { | ||
| let (sender, rx) = sync_channel(0); | ||
| self.env() | ||
| .txn_manager() | ||
| .send_message(TxnManagerMessage::Commit { tx: TxnPtr(txn), sender }); | ||
| rx.recv().unwrap() | ||
| } | ||
| })?; | ||
|
|
||
| self.inner.set_committed(); | ||
| result | ||
| }; | ||
| result.map(|(v, latency)| { | ||
| ( | ||
| v, | ||
| latency, | ||
| self.inner | ||
| .primed_dbis | ||
| .lock() | ||
| .iter() | ||
| .map(|&dbi| Database::new_from_ptr(dbi, self.env().clone())) | ||
| .collect(), | ||
| ) | ||
| }) | ||
| self.inner.set_committed(); | ||
| result | ||
| } | ||
|
|
||
| /// Opens a handle to an MDBX database. | ||
|
|
@@ -308,8 +281,6 @@ where | |
| { | ||
| /// The transaction pointer itself. | ||
| txn: TransactionPtr, | ||
| /// A set of database handles that are primed for permaopen. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very questionable description: Tables are "pemaopen" by default, and storing a DBI here doesn't have any effect on that. In fact, it's still possible to close the table handles elsewhere. Also, instead of arbitrarily calling |
||
| primed_dbis: Mutex<IndexSet<ffi::MDBX_dbi>>, | ||
| /// Whether the transaction has committed. | ||
| committed: AtomicBool, | ||
| env: Environment, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only used in a benchmark, which is a no-op anyway (
dbis the same after these 2 lines with the same DBI and environment pointer).