Skip to content

Commit

Permalink
*: bulk upgrade
Browse files Browse the repository at this point in the history
* upgrade stable feature `return_position_impl_trait_in_trait`
* upgrade lazy_cell rust-lang/rust/pull/105587
* upgrade core_io_borrowed_buf rust-lang/rust/pull/117694
* fix return position lifetime annotation

Signed-off-by: Neil Shen <[email protected]>
  • Loading branch information
overvenus committed Dec 16, 2023
1 parent 8bddd71 commit 19e305f
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cmd/tikv-ctl/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use engine_traits::{
CF_WRITE, DATA_CFS,
};
use file_system::read_dir;
use futures::{executor::block_on, future, stream, Stream, StreamExt, TryStreamExt};
use futures::{executor::block_on, future, stream::{self, BoxStream}, Stream, StreamExt, TryStreamExt};
use grpcio::{ChannelBuilder, Environment};
use kvproto::{
debugpb::{Db as DbType, *},
Expand Down Expand Up @@ -55,7 +55,7 @@ pub const METRICS_ROCKSDB_RAFT: &str = "rocksdb_raft";
pub const METRICS_JEMALLOC: &str = "jemalloc";
pub const LOCK_FILE_ERROR: &str = "IO error: While lock file";

type MvccInfoStream = Pin<Box<dyn Stream<Item = result::Result<(Vec<u8>, MvccInfo), String>>>>;
type MvccInfoStream = BoxStream<'static, result::Result<(Vec<u8>, MvccInfo), String>>;

fn get_engine_type(dir: &str) -> EngineType {
let mut entries = read_dir(dir).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion cmd/tikv-ctl/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2016 TiKV Project Authors. Licensed under Apache-2.0.

#![feature(once_cell)]
#![feature(lazy_cell)]
#![feature(let_chains)]

#[macro_use]
Expand Down
1 change: 0 additions & 1 deletion components/test_raftstore-v2/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2022 TiKV Project Authors. Licensed under Apache-2.0.
#![allow(incomplete_features)]
#![feature(type_alias_impl_trait)]
#![feature(return_position_impl_trait_in_trait)]
#![feature(let_chains)]

mod cluster;
Expand Down
16 changes: 8 additions & 8 deletions components/test_raftstore-v2/src/transport_simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::sync::{Arc, RwLock};

use engine_traits::{KvEngine, RaftEngine};
use futures::Future;
use futures::future::{FutureExt, BoxFuture};
use kvproto::{
raft_cmdpb::{RaftCmdRequest, RaftCmdResponse},
raft_serverpb::RaftMessage,
Expand Down Expand Up @@ -64,30 +64,30 @@ impl<C: Transport> Transport for SimulateTransport<C> {
}
}

pub trait SnapshotRouter<E: KvEngine> {
pub trait SnapshotRouter<EK: KvEngine> {
fn snapshot(
&mut self,
req: RaftCmdRequest,
) -> impl Future<Output = std::result::Result<RegionSnapshot<E::Snapshot>, RaftCmdResponse>> + Send;
) -> BoxFuture<'static, std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>>;
}

impl<EK: KvEngine, ER: RaftEngine> SnapshotRouter<EK> for RaftRouter<EK, ER> {
fn snapshot(
&mut self,
req: RaftCmdRequest,
) -> impl Future<Output = std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>> + Send
) -> BoxFuture<'static, std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>>
{
self.snapshot(req)
self.snapshot(req).boxed()
}
}

impl<E: KvEngine, C: SnapshotRouter<E>> SnapshotRouter<E> for SimulateTransport<C> {
impl<EK: KvEngine, C: SnapshotRouter<EK>> SnapshotRouter<EK> for SimulateTransport<C> {
fn snapshot(
&mut self,
req: RaftCmdRequest,
) -> impl Future<Output = std::result::Result<RegionSnapshot<E::Snapshot>, RaftCmdResponse>> + Send
) -> BoxFuture<'static, std::result::Result<RegionSnapshot<EK::Snapshot>, RaftCmdResponse>>
{
self.ch.snapshot(req)
self.ch.snapshot(req).boxed()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#![feature(type_alias_impl_trait)]
#![feature(impl_trait_in_assoc_type)]
#![allow(incomplete_features)]
#![feature(return_position_impl_trait_in_trait)]
#![feature(core_io_borrowed_buf)]

#[macro_use(fail_point)]
extern crate fail;
Expand Down
4 changes: 2 additions & 2 deletions src/server/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub trait Debugger {
start: &[u8],
end: &[u8],
limit: u64,
) -> Result<impl Iterator<Item = raftstore::Result<(Vec<u8>, MvccInfo)>> + Send>;
) -> Result<impl Iterator<Item = raftstore::Result<(Vec<u8>, MvccInfo)>> + Send + 'static>;

/// Compact the cf[start..end) in the db.
fn compact(
Expand Down Expand Up @@ -887,7 +887,7 @@ where
start: &[u8],
end: &[u8],
limit: u64,
) -> Result<impl Iterator<Item = raftstore::Result<(Vec<u8>, MvccInfo)>> + Send> {
) -> Result<impl Iterator<Item = raftstore::Result<(Vec<u8>, MvccInfo)>> + Send + 'static> {
if end.is_empty() && limit == 0 {
return Err(Error::InvalidArgument("no limit and to_key".to_owned()));
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/debug2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ impl<ER: RaftEngine> Debugger for DebuggerImplV2<ER> {
start: &[u8],
end: &[u8],
limit: u64,
) -> Result<impl Iterator<Item = raftstore::Result<(Vec<u8>, MvccInfo)>> + Send> {
) -> Result<impl Iterator<Item = raftstore::Result<(Vec<u8>, MvccInfo)>> + Send + 'static> {
if end.is_empty() && limit == 0 {
return Err(Error::InvalidArgument("no limit and to_key".to_owned()));
}
Expand Down
1 change: 0 additions & 1 deletion src/server/service/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ where
let debugger = self.debugger.clone();

let res = self.pool.spawn(async move {
let req = req;
debugger
.compact(
req.get_db(),
Expand Down
1 change: 0 additions & 1 deletion src/storage/txn/actions/prewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ fn async_commit_timestamps(
#[cfg(not(feature = "failpoints"))]
let injected_fallback = false;

let max_commit_ts = max_commit_ts;
if (!max_commit_ts.is_zero() && min_commit_ts > max_commit_ts) || injected_fallback {
warn!("commit_ts is too large, fallback to normal 2PC";
"key" => log_wrappers::Value::key(key.as_encoded()),
Expand Down

0 comments on commit 19e305f

Please sign in to comment.