Skip to content

Commit

Permalink
chore: bump rust toolchain edition to 2021 (apache#180)
Browse files Browse the repository at this point in the history
* chore: bump rust toolchain edition to 2021

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* remove per crate edition

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* bump toolchain to nightly-2022-08-08

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* Revert "remove per crate edition"

This reverts commit 8dee2d6.

* use workspace edition setting

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* also set edition for table_kv component

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* make clippy happy

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
  • Loading branch information
waynexia authored Aug 9, 2022
1 parent f4784b4 commit 521497f
Show file tree
Hide file tree
Showing 31 changed files with 75 additions and 84 deletions.
2 changes: 1 addition & 1 deletion analytic_engine/src/compaction/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ impl ScheduleWorker {
let table_options = table_data.table_options();
let compaction_strategy = table_options.compaction_strategy;
let picker = self.picker_manager.get_picker(compaction_strategy);
let picker_ctx = match new_picker_context(&*table_options) {
let picker_ctx = match new_picker_context(&table_options) {
Some(v) => v,
None => {
warn!("No valid context can be created, compaction request will be ignored, table_id:{}, table_name:{}",
Expand Down
2 changes: 1 addition & 1 deletion analytic_engine/src/instance/alter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl Instance {
options
);
let mut table_opts =
table_options::merge_table_options_for_alter(&options, &*current_table_options)
table_options::merge_table_options_for_alter(&options, &current_table_options)
.map_err(|e| Box::new(e) as _)
.context(InvalidOptions {
space_id: space_table.space().id,
Expand Down
14 changes: 4 additions & 10 deletions analytic_engine/src/instance/flush_compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,7 @@ impl Instance {
// process sampling memtable and frozen memtable
if let Some(sampling_mem) = &mems_to_flush.sampling_mem {
if let Some(seq) = self
.dump_sampling_memtable(
&*table_data,
request_id,
sampling_mem,
&mut files_to_level0,
)
.dump_sampling_memtable(table_data, request_id, sampling_mem, &mut files_to_level0)
.await?
{
flushed_sequence = seq;
Expand All @@ -481,7 +476,7 @@ impl Instance {
}
for mem in &mems_to_flush.memtables {
let file = self
.dump_normal_memtable(&*table_data, request_id, mem)
.dump_normal_memtable(table_data, request_id, mem)
.await?;
if let Some(file) = file {
let sst_size = file.meta.size;
Expand Down Expand Up @@ -883,10 +878,9 @@ impl SpaceStore {
builder
.mut_ssts_of_level(input.level)
.extend_from_slice(&input.files);
let merge_iter = builder.build().await.context(BuildMergeIterator {
builder.build().await.context(BuildMergeIterator {
table: table_data.name.clone(),
})?;
merge_iter
})?
};

let record_batch_stream = if table_options.need_dedup() {
Expand Down
2 changes: 1 addition & 1 deletion analytic_engine/src/instance/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Instance {
scheduler_config,
));

let file_purger = FilePurger::start(&*bg_runtime, store);
let file_purger = FilePurger::start(&bg_runtime, store);

let instance = Arc::new(Instance {
space_store,
Expand Down
8 changes: 4 additions & 4 deletions analytic_engine/src/instance/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ impl Instance {

if need_merge_sort_streams(&table_data.table_options(), &request) {
let merge_iters = self
.build_merge_iters(table_data, &request, iter_options, &*table_options)
.build_merge_iters(table_data, &request, iter_options, &table_options)
.await?;
self.build_partitioned_streams(&request, merge_iters)
} else {
let chain_iters = self
.build_chain_iters(table_data, &request, &*table_options)
.build_chain_iters(table_data, &request, &table_options)
.await?;
self.build_partitioned_streams(&request, chain_iters)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ impl Instance {

let time_range = request.predicate.time_range();
let version = table_data.current_version();
let read_views = self.partition_ssts_and_memtables(time_range, version, &*table_options);
let read_views = self.partition_ssts_and_memtables(time_range, version, table_options);

let mut iters = Vec::with_capacity(read_views.len());
for read_view in read_views {
Expand Down Expand Up @@ -226,7 +226,7 @@ impl Instance {

let time_range = request.predicate.time_range();
let version = table_data.current_version();
let read_views = self.partition_ssts_and_memtables(time_range, version, &*table_options);
let read_views = self.partition_ssts_and_memtables(time_range, version, table_options);

let mut iters = Vec::with_capacity(read_views.len());
for read_view in read_views {
Expand Down
2 changes: 1 addition & 1 deletion analytic_engine/src/instance/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl Instance {
} = encode_ctx;

let sequence = self
.write_to_wal(worker_local, &**table_data, encoded_rows)
.write_to_wal(worker_local, table_data, encoded_rows)
.await?;

Self::write_to_memtable(
Expand Down
2 changes: 1 addition & 1 deletion analytic_engine/src/meta/meta_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl TryFrom<meta_pb::AddTableMeta> for AddTableMeta {
}

/// Meta data for dropping a table
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DropTableMeta {
/// Space id of the table
pub space_id: SpaceId,
Expand Down
1 change: 1 addition & 0 deletions analytic_engine/src/sst/parquet/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ struct ProjectAndFilterReader {
}

impl ProjectAndFilterReader {
#[allow(clippy::type_complexity)]
fn build_row_group_predicate(&self) -> Box<dyn Fn(&RowGroupMetaData, usize) -> bool + 'static> {
assert!(self.file_reader.is_some());

Expand Down
14 changes: 8 additions & 6 deletions analytic_engine/src/table/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,14 @@ impl TableVersion {
schema_version: schema::Version,
) -> Result<Option<MemTableForWrite>> {
// Find memtable by timestamp
let mutable = {
let inner = self.inner.read().unwrap();
match inner.memtable_for_write(write_lock, timestamp) {
Some(v) => v,
None => return Ok(None),
}
let memtable = self
.inner
.read()
.unwrap()
.memtable_for_write(write_lock, timestamp);
let mutable = match memtable {
Some(v) => v,
None => return Ok(None),
};

// We consider the schemas are same if they have the same version.
Expand Down
2 changes: 1 addition & 1 deletion analytic_engine/src/table/version_edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl TryFrom<meta_pb::AddFileMeta> for AddFile {
}

/// Meta data of the file to delete.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DeleteFile {
/// The level of the file intended to delete.
pub level: u16,
Expand Down
4 changes: 2 additions & 2 deletions analytic_engine/src/table_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub enum Error {

define_result!(Error);

#[derive(Debug, Clone, Deserialize, PartialEq)]
#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
pub enum UpdateMode {
Overwrite,
Append,
Expand All @@ -128,7 +128,7 @@ impl ToString for UpdateMode {
}
}

#[derive(Debug, Clone, Copy, Deserialize, PartialEq)]
#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)]
pub enum Compression {
Uncompressed,
Lz4,
Expand Down
13 changes: 5 additions & 8 deletions catalog_impls/src/table_based.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,10 @@ impl Inner {
assert_eq!(1, self.catalogs.len());

// Default catalog is not exists, create and store it.
let default_catalog = self
.create_catalog(CreateCatalogRequest {
catalog_name: consts::DEFAULT_CATALOG.to_string(),
})
.await?;

default_catalog
self.create_catalog(CreateCatalogRequest {
catalog_name: consts::DEFAULT_CATALOG.to_string(),
})
.await?
}
};

Expand All @@ -248,7 +245,7 @@ impl Inner {
schema_name: consts::DEFAULT_SCHEMA.to_string(),
schema_id,
},
&*catalog,
&catalog,
)
.await?;
}
Expand Down
7 changes: 2 additions & 5 deletions catalog_impls/src/volatile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,8 @@ where
Some(v) => v.clone(),
None => {
// Default catalog is not exists, create and store it.
let default_catalog = self
.create_catalog(consts::DEFAULT_CATALOG.to_string())
.await;

default_catalog
self.create_catalog(consts::DEFAULT_CATALOG.to_string())
.await
}
};

Expand Down
2 changes: 1 addition & 1 deletion common_types/src/column_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl ToString for ArrowFieldMetaKey {
}

/// Schema of column
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ColumnSchema {
/// Id of column
pub id: ColumnId,
Expand Down
2 changes: 1 addition & 1 deletion common_types/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub type Result<T> = std::result::Result<T, Error>;

/// String using [crate::bytes::Bytes] as storage so it can be cast into `Bytes`
/// and clone like `Bytes`.
#[derive(Debug, Clone, PartialEq, PartialOrd)]
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)]
pub struct StringBytes(Bytes);

impl StringBytes {
Expand Down
4 changes: 2 additions & 2 deletions common_util/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn duration_to_ms(d: Duration) -> u64 {
d.as_secs() * 1_000 + (nanos / 1_000_000)
}

#[derive(Clone, Debug, Copy, PartialEq, PartialOrd, Serialize, Deserialize)]
#[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum TimeUnit {
Nanoseconds,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl fmt::Display for TimeUnit {
}
}

#[derive(Clone, Debug, Copy, PartialEq, PartialOrd)]
#[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd)]
pub struct ReadableSize(pub u64);

impl ReadableSize {
Expand Down
14 changes: 7 additions & 7 deletions components/skiplist/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl<C: KeyComparator, A: Arena<Stats = BasicStats> + Clone> Skiplist<C, A> {
let mut level = self.height();
loop {
// Assume cursor.key < key
let next_ptr = (&*cursor).next_ptr(level);
let next_ptr = (*cursor).next_ptr(level);
if next_ptr.is_null() {
// cursor.key < key < END OF LIST
if level > 0 {
Expand Down Expand Up @@ -329,7 +329,7 @@ impl<C: KeyComparator, A: Arena<Stats = BasicStats> + Clone> Skiplist<C, A> {
) -> (*mut Node, *mut Node) {
loop {
// Assume before.key < key
let next_ptr = (&*before).next_ptr(level);
let next_ptr = (*before).next_ptr(level);
if next_ptr.is_null() {
return (before, ptr::null_mut());
}
Expand Down Expand Up @@ -439,7 +439,7 @@ impl<C: KeyComparator, A: Arena<Stats = BasicStats> + Clone> Skiplist<C, A> {
/// Returns if the skiplist is empty
pub fn is_empty(&self) -> bool {
let node = self.core.head.as_ptr();
let next_ptr = unsafe { (&*node).next_ptr(0) };
let next_ptr = unsafe { (*node).next_ptr(0) };
next_ptr.is_null()
}

Expand All @@ -448,7 +448,7 @@ impl<C: KeyComparator, A: Arena<Stats = BasicStats> + Clone> Skiplist<C, A> {
let mut node = self.core.head.as_ptr();
let mut count = 0;
loop {
let next_ptr = unsafe { (&*node).next_ptr(0) };
let next_ptr = unsafe { (*node).next_ptr(0) };
if !next_ptr.is_null() {
count += 1;
node = next_ptr;
Expand All @@ -464,7 +464,7 @@ impl<C: KeyComparator, A: Arena<Stats = BasicStats> + Clone> Skiplist<C, A> {
let mut node = self.core.head.as_ptr();
let mut level = self.height();
loop {
let next_ptr = unsafe { (&*node).next_ptr(level) };
let next_ptr = unsafe { (*node).next_ptr(level) };
if !next_ptr.is_null() {
node = next_ptr;
continue;
Expand Down Expand Up @@ -570,7 +570,7 @@ impl<T: AsRef<Skiplist<C, A>>, C: KeyComparator, A: Arena<Stats = BasicStats> +
pub fn next(&mut self) {
assert!(self.valid());
unsafe {
self.cursor = (&*self.cursor).next_ptr(0);
self.cursor = (*self.cursor).next_ptr(0);
}
}

Expand All @@ -595,7 +595,7 @@ impl<T: AsRef<Skiplist<C, A>>, C: KeyComparator, A: Arena<Stats = BasicStats> +

pub fn seek_to_first(&mut self) {
unsafe {
self.cursor = (&*self.list.as_ref().core.head.as_ptr()).next_ptr(0);
self.cursor = (*self.list.as_ref().core.head.as_ptr()).next_ptr(0);
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/skiplist/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ fn test_basic() {
];

for (key, value) in &table {
list.put(&key_with_ts(*key, 0), value);
list.put(&key_with_ts(key, 0), value);
}

assert_eq!(list.get(&key_with_ts("key", 0)), None);
assert_eq!(list.len(), 5);
assert!(!list.is_empty());
for (key, value) in &table {
let get_key = key_with_ts(*key, 0);
let get_key = key_with_ts(key, 0);
assert_eq!(list.get(&get_key), Some(&value[..]), "{}", key);
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/table_kv/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl ObkvConfig {
}

/// Obkv server log level.
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Debug)]
#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug)]
#[serde(rename_all = "lowercase")]
pub enum ObLogLevel {
None = 7,
Expand Down
2 changes: 1 addition & 1 deletion query_engine/src/df_execution_extension/prom_align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl fmt::Display for ExtractTsidExpr {

impl PhysicalExpr for ExtractTsidExpr {
fn as_any(&self) -> &dyn Any {
&*self
self
}

fn data_type(&self, _input_schema: &ArrowSchema) -> ArrowResult<DataType> {
Expand Down
6 changes: 3 additions & 3 deletions query_engine/src/logical_optimizer/order_by_primary_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ mod tests {

let rule = OrderByPrimaryKeyRule;
let optimized_plan = rule
.do_optimize(&*plan)
.do_optimize(&plan)
.expect("Optimize plan")
.expect("Succeed to optimize plan");
let expected_plan = {
Expand Down Expand Up @@ -394,7 +394,7 @@ mod tests {
};

let rule = OrderByPrimaryKeyRule;
let optimized_plan = rule.do_optimize(&*plan).expect("Optimize plan");
let optimized_plan = rule.do_optimize(&plan).expect("Optimize plan");
assert!(optimized_plan.is_none());
}

Expand All @@ -411,7 +411,7 @@ mod tests {
};

let rule = OrderByPrimaryKeyRule;
let optimized_plan = rule.do_optimize(&*plan).expect("Optimize plan");
let optimized_plan = rule.do_optimize(&plan).expect("Optimize plan");
assert!(optimized_plan.is_none());
}
}
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2022-01-06
nightly-2022-08-08
Loading

0 comments on commit 521497f

Please sign in to comment.