Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump rust toolchain edition to 2021 #180

Merged
merged 7 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
name = "ceresdb"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"
resolver = "2"
edition = "2021"
jiacai2050 marked this conversation as resolved.
Show resolved Hide resolved

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[workspace.package]
edition = "2021"

[workspace]
# In alphabetical order
members = [
Expand Down
4 changes: 3 additions & 1 deletion analytic_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "analytic_engine"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
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
4 changes: 3 additions & 1 deletion arrow_deps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "arrow_deps"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2021"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "benchmarks"
version = "0.1.0"
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion catalog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "catalog"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion catalog_impls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "catalog_impls"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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
4 changes: 3 additions & 1 deletion ceresdbproto_deps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "ceresdbproto_deps"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion cluster/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "cluster"
version = "0.1.0"
edition = "2021"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion common_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "common_types"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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: 3 additions & 1 deletion common_util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "common_util"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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
4 changes: 3 additions & 1 deletion components/arena/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "arena"
version = "0.1.0"
authors = ["Ruihang Xia <xrh262829@antgroup.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion components/bytes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[package]
name = "bytes"
version = "0.1.0"
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
4 changes: 3 additions & 1 deletion components/logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name = "logger"
version = "0.1.0"
authors = ["CeresDB Authors <ceresdbservice@gmail.com>"]
edition = "2018"

[package.edition]
workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
Loading