fn process_write(
        mut self,
        snapshot: S,
        mut context: WriteContext<'_, L>,
    ) -> Result<WriteResult> {
        let mut txn = MvccTxn::new(self.start_ts, context.concurrency_manager);
        let mut reader = ReaderWithStats::new(
            SnapshotReader::new(self.start_ts, snapshot, !self.ctx.get_not_fill_cache()),
            &mut context.statistics,
        );

        let ctx = mem::take(&mut self.ctx);
        let keys = mem::take(&mut self.keys);

        let rows = keys.len();
        let mut released_locks = ReleasedLocks::new(self.start_ts, TimeStamp::zero());
        for key in keys {
            fail_point!("pessimistic_rollback", |err| Err(
                crate::storage::mvcc::Error::from(crate::storage::mvcc::txn::make_txn_error(
                    err,
                    &key,
                    self.start_ts
                ))
                .into()
            ));
            let released_lock: MvccResult<_> = if let Some(lock) = reader.load_lock(&key)? {
                if lock.lock_type == LockType::Pessimistic
                    && lock.ts == self.start_ts
                    && lock.for_update_ts <= self.for_update_ts
                {
                    Ok(txn.unlock_key(key, true))
                } else {
                    Ok(None)
                }
            } else {
                Ok(None)
            };
            released_locks.push(released_lock?);
        }
        released_locks.wake_up(context.lock_mgr);

        let mut write_data = WriteData::from_modifies(txn.into_modifies());
        write_data.set_allowed_on_disk_almost_full();
        Ok(WriteResult {
            ctx,
            to_be_write: write_data,
            rows,
            pr: ProcessResult::MultiRes { results: vec![] },
            lock_info: None,
            lock_guards: vec![],
            response_policy: ResponsePolicy::OnApplied,
        })
    }
/// Delete any pessimistic lock with small for_update_ts belongs to this transaction.
Delete any pessimistic lock with small for_update_ts belongs to this transaction.
Delete any pessimistic lock with small for_update_ts belongs to this transaction .
fn process_write(
        mut self,
        snapshot: S,
        mut context: WriteContext<'_, L>,
    ) -> Result<WriteResult> {
        let mut txn = MvccTxn::new(self.start_ts, context.concurrency_manager);
        let mut reader = ReaderWithStats::new(
            SnapshotReader::new(self.start_ts, snapshot, !self.ctx.get_not_fill_cache()),
            &mut context.statistics,
        );
        let ctx = mem::take(&mut self.ctx);
        let keys = mem::take(&mut self.keys);
        let rows = keys.len();
        let mut released_locks = ReleasedLocks::new(self.start_ts, TimeStamp::zero());
        for key in keys {
            fail_point!("pessimistic_rollback", |err| Err(
                crate::storage::mvcc::Error::from(crate::storage::mvcc::txn::make_txn_error(
                    err,
                    &key,
                    self.start_ts
                ))
                .into()
            ));
            let released_lock: MvccResult<_> = if let Some(lock) = reader.load_lock(&key)? {
                if lock.lock_type == LockType::Pessimistic
                    && lock.ts == self.start_ts
                    && lock.for_update_ts <= self.for_update_ts
                {
                    Ok(txn.unlock_key(key, true))
                } else {
                    Ok(None)
                }
            } else {
                Ok(None)
            };
            released_locks.push(released_lock?);
        }
        released_locks.wake_up(context.lock_mgr);
        let mut write_data = WriteData::from_modifies(txn.into_modifies());
        write_data.set_allowed_on_disk_almost_full();
        Ok(WriteResult {
            ctx,
            to_be_write: write_data,
            rows,
            pr: ProcessResult::MultiRes { results: vec![] },
            lock_info: None,
            lock_guards: vec![],
            response_policy: ResponsePolicy::OnApplied,
        })
    }
fn process_write ( mut self , snapshot : S , mut context : WriteContext < ' _ , L > , ) -> Result < WriteResult > { let mut txn = MvccTxn :: new ( self . start_ts , context . concurrency_manager ) ; let mut reader = ReaderWithStats :: new ( SnapshotReader :: new ( self . start_ts , snapshot , ! self . ctx . get_not_fill_cache ( ) ) , & mut context . statistics , ) ; let ctx = mem :: take ( & mut self . ctx ) ; let keys = mem :: take ( & mut self . keys ) ; let rows = keys . len ( ) ; let mut released_locks = ReleasedLocks :: new ( self . start_ts , TimeStamp :: zero ( ) ) ; for key in keys { fail_point ! ( " " err Err ( crate storage mvcc Error from ( crate storage mvcc txn make_txn_error ( err key self start_ts ) ) into ( ) ) ) ; let released_lock : MvccResult < _ > = if let Some ( lock ) = reader . load_lock ( & key ) ? { if lock . lock_type == LockType :: Pessimistic && lock . ts == self . start_ts && lock . for_update_ts <= self . for_update_ts { Ok ( txn . unlock_key ( key , true ) ) } else { Ok ( None ) } } else { Ok ( None ) } ; released_locks . push ( released_lock ? ) ; } released_locks . wake_up ( context . lock_mgr ) ; let mut write_data = WriteData :: from_modifies ( txn . into_modifies ( ) ) ; write_data . set_allowed_on_disk_almost_full ( ) ; Ok ( WriteResult { ctx , to_be_write : write_data , rows , pr : ProcessResult :: MultiRes { results : vec ! [ ] } , lock_info : None , lock_guards : vec ! [ ] , response_policy : ResponsePolicy :: OnApplied , } ) }
Delete any pessimistic lock with small for_update_ts belongs to this transaction.
Delete any pessimistic lock with small for_update_ts belongs to this transaction .
mut self
snapshot
S
context
WriteContext<'_, L>