Skip to content

Commit

Permalink
Bump rust-toolchain to nightly-2021-07-28 (tikv#10638)
Browse files Browse the repository at this point in the history
* Bump rust-toolchain to `nightly-2021-07-28`

This will hopefully fix the incremental compilation issue
described in rust-lang/rust#87516

Signed-off-by: Aaron Hill <[email protected]>

* Fix new clippy lints

Some of the lints were not auto-fixable, or required
types/definitions to be renamed. I've allowed these lints
for now in 'scripts/clippy'.

Signed-off-by: Aaron Hill <[email protected]>

Co-authored-by: Ti Chi Robot <[email protected]>
  • Loading branch information
Aaron1011 and ti-chi-bot authored Aug 3, 2021
1 parent 9eb7fc1 commit 28292ee
Show file tree
Hide file tree
Showing 124 changed files with 346 additions and 342 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/tikv-ctl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ fn main() {

// Bypass the ldb command to RocksDB.
if let Some(cmd) = matches.subcommand_matches("ldb") {
run_ldb_command(&cmd, &cfg);
run_ldb_command(cmd, &cfg);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions components/backup/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl BackupRange {
|key, lock| {
Lock::check_ts_conflict(
Cow::Borrowed(lock),
&key,
key,
backup_ts,
&Default::default(),
)
Expand Down Expand Up @@ -507,8 +507,8 @@ impl<R: RegionInfoProvider> Progress<R> {
}
}
if info.role == StateRole::Leader {
let ekey = get_min_end_key(end_key.as_ref(), &region);
let skey = get_max_start_key(start_key.as_ref(), &region);
let ekey = get_min_end_key(end_key.as_ref(), region);
let skey = get_max_start_key(start_key.as_ref(), region);
assert!(!(skey == ekey && ekey.is_some()), "{:?} {:?}", skey, ekey);
let leader = find_peer(region, store_id).unwrap().to_owned();
let backup_range = BackupRange {
Expand Down
1 change: 1 addition & 0 deletions components/cdc/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ where
mod tests {
use super::*;

use std::assert_matches::assert_matches;
use std::sync::mpsc;
use std::time::Duration;

Expand Down
2 changes: 1 addition & 1 deletion components/cdc/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ impl<T: 'static + RaftStoreRouter<E>, E: KvEngine> Endpoint<T, E> {
for (region_id, _) in regions {
if let Some(region) = meta.regions.get(&region_id) {
if let Some((term, leader_id)) = meta.leaders.get(&region_id) {
let leader_store_id = find_store_id(&region, *leader_id);
let leader_store_id = find_store_id(region, *leader_id);
if leader_store_id.is_none() {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion components/cdc/src/old_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl<S: EngineSnapshot> OldValueReader<S> {
let mut opts = ReadOptions::new();
opts.set_fill_cache(false);
self.snapshot
.get_cf_opt(opts, CF_DEFAULT, &key)
.get_cf_opt(opts, CF_DEFAULT, key)
.unwrap()
.map(|v| v.deref().to_vec())
}
Expand Down
2 changes: 1 addition & 1 deletion components/cdc/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl TestSuiteBuilder {
for (id, worker) in &mut endpoints {
let sim = cluster.sim.wl();
let raft_router = sim.get_server_router(*id);
let cdc_ob = obs.get(&id).unwrap().clone();
let cdc_ob = obs.get(id).unwrap().clone();
let cm = sim.get_concurrency_manager(*id);
let env = Arc::new(Environment::new(1));
let mut cdc_endpoint = cdc::Endpoint::new(
Expand Down
2 changes: 1 addition & 1 deletion components/cloud/aws/src/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl Config {

impl BlobConfig for Config {
fn name(&self) -> &'static str {
&STORAGE_NAME
STORAGE_NAME
}

fn url(&self) -> io::Result<url::Url> {
Expand Down
2 changes: 1 addition & 1 deletion components/cloud/gcp/src/gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn deserialize_service_account_info(

impl BlobConfig for Config {
fn name(&self) -> &'static str {
&STORAGE_NAME
STORAGE_NAME
}

fn url(&self) -> io::Result<url::Url> {
Expand Down
2 changes: 1 addition & 1 deletion components/cloud/src/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl BucketConf {
let path = none_to_empty(self.prefix.clone());
if let Some(ep) = &self.endpoint {
let mut u =
url::Url::parse(&ep).map_err(|e| format!("invalid endpoint {}: {}", &ep, e))?;
url::Url::parse(ep).map_err(|e| format!("invalid endpoint {}: {}", &ep, e))?;
u.set_path(&format!(
"{}/{}",
&self.bucket.trim_end_matches('/'),
Expand Down
5 changes: 3 additions & 2 deletions components/concurrency_manager/benches/lock_table.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0.

#![feature(test)]
#![feature(bench_black_box)]

use concurrency_manager::ConcurrencyManager;
use criterion::*;
Expand Down Expand Up @@ -58,7 +59,7 @@ fn bench_point_check(c: &mut Criterion) {
thread_rng().fill_bytes(&mut buf[..]);
let key = Key::from_raw(&buf);
let _ = cm.read_key_check(&key, |l| {
Lock::check_ts_conflict(Cow::Borrowed(&l), &key, 1.into(), &ts_set)
Lock::check_ts_conflict(Cow::Borrowed(l), &key, 1.into(), &ts_set)
});
})
});
Expand All @@ -84,7 +85,7 @@ fn bench_range_check(c: &mut Criterion) {
let end_key = Key::from_raw(&[start + 25]);
// The key range is roughly 1/10 the key space.
let _ = cm.read_range_check(Some(&start_key), Some(&end_key), |key, l| {
Lock::check_ts_conflict(Cow::Borrowed(&l), &key, 1.into(), &ts_set)
Lock::check_ts_conflict(Cow::Borrowed(l), key, 1.into(), &ts_set)
});
})
});
Expand Down
4 changes: 2 additions & 2 deletions components/encryption/src/crypter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl<'k> AesGcmCrypter<'k> {
&self.key.0,
Some(self.iv.as_slice()),
&[], /* AAD */
&pt,
pt,
&mut tag.0,
)?;
Ok((ciphertext, tag))
Expand All @@ -175,7 +175,7 @@ impl<'k> AesGcmCrypter<'k> {
&self.key.0,
Some(self.iv.as_slice()),
&[], /* AAD */
&ct,
ct,
&tag.0,
)?;
Ok(plaintext)
Expand Down
2 changes: 1 addition & 1 deletion components/encryption/src/encrypted_file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<'a> EncryptedFile<'a> {

// Encrypt the content.
let encrypted_content = master_key
.encrypt(&plaintext_content)?
.encrypt(plaintext_content)?
.write_to_bytes()
.unwrap();
let header = Header::new(&encrypted_content, Version::V1);
Expand Down
4 changes: 2 additions & 2 deletions components/encryption/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl<R> CrypterReader<R> {
mode: Mode,
iv: Option<Iv>,
) -> Result<(CrypterReader<R>, Iv)> {
crate::verify_encryption_config(method, &key)?;
crate::verify_encryption_config(method, key)?;
let iv = iv.unwrap_or_else(Iv::new_ctr);
let (cipher, crypter) = create_aes_ctr_crypter(method, key, mode, iv)?;
let block_size = cipher.block_size();
Expand Down Expand Up @@ -178,7 +178,7 @@ impl<W: Write> EncrypterWriter<W> {
key: &[u8],
iv: Iv,
) -> Result<EncrypterWriter<W>> {
crate::verify_encryption_config(method, &key)?;
crate::verify_encryption_config(method, key)?;
let (cipher, crypter) = create_aes_ctr_crypter(method, key, Mode::Encrypt, iv)?;
let block_size = cipher.block_size();
Ok(EncrypterWriter {
Expand Down
4 changes: 2 additions & 2 deletions components/engine_rocks/src/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl ImportExt for RocksEngine {
// Prior to v5.2.0, TiKV use `write_global_seqno=true` for ingestion. For backward
// compatibility, in case TiKV is retrying an ingestion job generated by older
// version, it needs to reset the global seqno to 0.
set_external_sst_file_global_seq_no(&self.as_inner(), cf, file, 0)?;
set_external_sst_file_global_seq_no(self.as_inner(), cf, file, 0)?;
f.sync_all()
.map_err(|e| format!("sync {}: {:?}", file, e))?;
Ok(())
Expand All @@ -34,7 +34,7 @@ impl ImportExt for RocksEngine {
// the manual memtable flush was taken.
let _did_nonblocking_memtable_flush = self
.as_inner()
.ingest_external_file_optimized(&cf, &opts.0, files)?;
.ingest_external_file_optimized(cf, &opts.0, files)?;
Ok(())
}
}
Expand Down
8 changes: 4 additions & 4 deletions components/engine_rocks/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ impl MiscExt for RocksEngine {
}
DeleteStrategy::DeleteByKey => {
for r in ranges {
self.delete_all_in_range_cf_by_key(cf, &r)?;
self.delete_all_in_range_cf_by_key(cf, r)?;
}
}
DeleteStrategy::DeleteByWriter { sst_path } => {
Expand Down Expand Up @@ -320,7 +320,7 @@ impl MiscExt for RocksEngine {
let handle = util::get_cf_handle(self.as_inner(), cf)?;
Ok(crate::util::get_cf_num_files_at_level(
self.as_inner(),
&handle,
handle,
level,
))
}
Expand All @@ -329,15 +329,15 @@ impl MiscExt for RocksEngine {
let handle = util::get_cf_handle(self.as_inner(), cf)?;
Ok(crate::util::get_cf_num_immutable_mem_table(
self.as_inner(),
&handle,
handle,
))
}

fn get_cf_compaction_pending_bytes(&self, cf: &str) -> Result<Option<u64>> {
let handle = util::get_cf_handle(self.as_inner(), cf)?;
Ok(crate::util::get_cf_compaction_pending_bytes(
self.as_inner(),
&handle,
handle,
))
}

Expand Down
2 changes: 1 addition & 1 deletion components/engine_rocks/src/mvcc_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl MvccPropertiesExt for RocksEngine {
start_key: &[u8],
end_key: &[u8],
) -> Option<MvccProperties> {
let collection = match self.get_range_properties_cf(cf, &start_key, &end_key) {
let collection = match self.get_range_properties_cf(cf, start_key, end_key) {
Ok(c) if !c.is_empty() => c,
_ => return None,
};
Expand Down
18 changes: 9 additions & 9 deletions components/engine_rocks/src/range_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl RangePropertiesExt for RocksEngine {
let start = &range.start_key;
let end = &range.end_key;
let (_, keys) =
get_range_entries_and_versions(self, CF_WRITE, &start, &end).unwrap_or_default();
get_range_entries_and_versions(self, CF_WRITE, start, end).unwrap_or_default();
Ok(keys)
}

Expand Down Expand Up @@ -65,8 +65,8 @@ impl RangePropertiesExt for RocksEngine {
.join(", ");
info!(
"range contains too many keys";
"start" => log_wrappers::Value::key(&range.start_key),
"end" => log_wrappers::Value::key(&range.end_key),
"start" => log_wrappers::Value::key(range.start_key),
"end" => log_wrappers::Value::key(range.end_key),
"total_keys" => total_keys,
"memtable" => mem_keys,
"ssts_keys" => ssts,
Expand Down Expand Up @@ -100,18 +100,18 @@ impl RangePropertiesExt for RocksEngine {
let (_, mem_size) = box_try!(self.get_approximate_memtable_stats_cf(cfname, &range));
total_size += mem_size;

let collection = box_try!(self.get_range_properties_cf(cfname, &start_key, &end_key));
let collection = box_try!(self.get_range_properties_cf(cfname, start_key, end_key));
for (_, v) in collection.iter() {
let props = box_try!(RangeProperties::decode(v.user_collected_properties()));
total_size += props.get_approximate_size_in_range(&start_key, &end_key);
total_size += props.get_approximate_size_in_range(start_key, end_key);
}

if large_threshold != 0 && total_size > large_threshold {
let ssts = collection
.iter()
.map(|(k, v)| {
let props = RangeProperties::decode(v.user_collected_properties()).unwrap();
let size = props.get_approximate_size_in_range(&start_key, &end_key);
let size = props.get_approximate_size_in_range(start_key, end_key);
format!(
"{}:{}",
Path::new(&*k)
Expand All @@ -125,8 +125,8 @@ impl RangePropertiesExt for RocksEngine {
.join(", ");
info!(
"range size is too large";
"start" => log_wrappers::Value::key(&range.start_key),
"end" => log_wrappers::Value::key(&range.end_key),
"start" => log_wrappers::Value::key(range.start_key),
"end" => log_wrappers::Value::key(range.end_key),
"total_size" => total_size,
"memtable" => mem_size,
"ssts_size" => ssts,
Expand Down Expand Up @@ -168,7 +168,7 @@ impl RangePropertiesExt for RocksEngine {
) -> Result<Vec<Vec<u8>>> {
let start_key = &range.start_key;
let end_key = &range.end_key;
let collection = box_try!(self.get_range_properties_cf(cfname, &start_key, &end_key));
let collection = box_try!(self.get_range_properties_cf(cfname, start_key, end_key));

let mut keys = vec![];
for (_, v) in collection.iter() {
Expand Down
2 changes: 1 addition & 1 deletion components/engine_rocks/src/raw_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn adjust_dynamic_level_bytes(
cf_descs: &[CColumnFamilyDescriptor],
cf_options: &mut CFOptions<'_>,
) {
if let Some(ref cf_desc) = cf_descs
if let Some(cf_desc) = cf_descs
.iter()
.find(|cf_desc| cf_desc.name() == cf_options.cf)
{
Expand Down
2 changes: 1 addition & 1 deletion components/engine_rocks/src/rocks_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ mod tests {
}

let shared_block_cache = false;
flush_engine_properties(&engine.as_inner(), "kv", shared_block_cache);
flush_engine_properties(engine.as_inner(), "kv", shared_block_cache);
let handle = engine.as_inner().cf_handle("default").unwrap();
let info = engine
.as_inner()
Expand Down
2 changes: 1 addition & 1 deletion components/engine_rocks/src/ttl_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl TablePropertiesCollector for TtlPropertiesCollector {
return;
}

let expire_ts = match get_expire_ts(&value) {
let expire_ts = match get_expire_ts(value) {
Ok(ts) => ts,
Err(e) => {
error!("failed to get expire ts";
Expand Down
4 changes: 2 additions & 2 deletions components/engine_rocks/src/write_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ impl WriteBatchExt for RocksEngine {
}

fn write_batch(&self) -> Self::WriteBatch {
Self::WriteBatch::new(Arc::clone(&self.as_inner()))
Self::WriteBatch::new(Arc::clone(self.as_inner()))
}

fn write_batch_with_cap(&self, cap: usize) -> Self::WriteBatch {
Self::WriteBatch::with_capacity(Arc::clone(&self.as_inner()), cap)
Self::WriteBatch::with_capacity(Arc::clone(self.as_inner()), cap)
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/engine_traits_tests/src/ctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn new_engine_readonly_dir() {
fs::set_permissions(&path, perms).unwrap();

let path = path.to_str().unwrap();
let err = KvTestEngine::new_engine(&path, None, ALL_CFS, None);
let err = KvTestEngine::new_engine(path, None, ALL_CFS, None);

assert!(err.is_err());
}
Expand All @@ -93,7 +93,7 @@ fn new_engine_opt_readonly_dir() {
.iter()
.map(|cf| CFOptions::new(cf, ColumnFamilyOptions::new()))
.collect();
let err = KvTestEngine::new_engine_opt(&path, db_opts, cf_opts);
let err = KvTestEngine::new_engine_opt(path, db_opts, cf_opts);

assert!(err.is_err());
}
Loading

0 comments on commit 28292ee

Please sign in to comment.