Skip to content

Commit

Permalink
Work around possible compiler bug causing bogus lifetime errors to be…
Browse files Browse the repository at this point in the history
… printed occasionally (MystenLabs#2963)

Co-authored-by: Mark Logan <[email protected]>
  • Loading branch information
mystenmark and mlogan authored Jul 5, 2022
1 parent 29226e5 commit 73b011c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/sui-storage/src/mutex_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<'b, K: Hash + 'b> MutexTable<K> {
guards
}

pub async fn acquire_lock<'a>(&'a self, k: &K) -> LockGuard<'a> {
pub async fn acquire_lock<'a, 'key>(&'a self, k: &'key K) -> LockGuard<'a> {
let lock_idx = self.get_lock_idx(k);
LockGuard(self.lock_table[lock_idx].lock().await)
}
Expand Down
13 changes: 8 additions & 5 deletions crates/sui-storage/src/write_ahead_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ pub trait WriteAheadLog<'a, C> {
///
/// Err(e) => An error occurred.
#[must_use]
async fn begin_tx(&'a self, tx: &TransactionDigest, cert: &C)
-> SuiResult<Option<Self::Guard>>;
async fn begin_tx<'b>(
&'a self,
tx: &'b TransactionDigest,
cert: &'b C,
) -> SuiResult<Option<Self::Guard>>;

/// Recoverable TXes are TXes that we find in the log at start up (which indicates we crashed
/// while processing them) or implicitly dropped TXes (which can happen because we errored
Expand Down Expand Up @@ -258,10 +261,10 @@ where

#[must_use]
#[instrument(level = "debug", name = "begin_tx", skip_all)]
async fn begin_tx(
async fn begin_tx<'b>(
&'a self,
tx: &TransactionDigest,
cert: &C,
tx: &'b TransactionDigest,
cert: &'b C,
) -> SuiResult<Option<DBTxGuard<'a, C>>> {
let mutex_guard = self.mutex_table.acquire_lock(tx).await;
trace!(digest = ?tx, "acquired tx lock");
Expand Down

0 comments on commit 73b011c

Please sign in to comment.