From 94ccd00bc21a21de6b82b523f089f2bdd2c9979a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:03:51 +0000 Subject: [PATCH] chore(deps): Bump twox-hash from 1.6.3 to 2.0.1 (#19258) Signed-off-by: dependabot[bot] Signed-off-by: Bugen Zhao Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Bugen Zhao Co-authored-by: xxchan --- Cargo.lock | 6 +++--- src/batch/Cargo.toml | 2 +- src/common/Cargo.toml | 2 +- src/common/src/array/bool_array.rs | 4 +--- src/common/src/array/decimal_array.rs | 4 +--- src/common/src/array/utf8_array.rs | 4 +--- src/storage/backup/Cargo.toml | 2 +- src/storage/backup/src/lib.rs | 5 +---- 8 files changed, 10 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e38b9366b81ac..33261a2eb7eff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10502,7 +10502,7 @@ dependencies = [ "serde", "serde_json", "thiserror 1.0.63", - "twox-hash 1.6.3", + "twox-hash 2.0.1", ] [[package]] @@ -10546,7 +10546,7 @@ dependencies = [ "tokio-postgres", "tokio-stream 0.1.15", "tracing", - "twox-hash 1.6.3", + "twox-hash 2.0.1", "workspace-hack", ] @@ -10804,7 +10804,7 @@ dependencies = [ "tracing-futures", "tracing-opentelemetry", "tracing-subscriber", - "twox-hash 1.6.3", + "twox-hash 2.0.1", "url", "uuid", "workspace-hack", diff --git a/src/batch/Cargo.toml b/src/batch/Cargo.toml index 169eaf5c3605d..c501f2df4962e 100644 --- a/src/batch/Cargo.toml +++ b/src/batch/Cargo.toml @@ -56,7 +56,7 @@ tokio-postgres = "0.7" tokio-stream = { workspace = true } tonic = { workspace = true } tracing = "0.1" -twox-hash = "1" +twox-hash = "2" [target.'cfg(not(madsim))'.dependencies] workspace-hack = { path = "../workspace-hack" } diff --git a/src/common/Cargo.toml b/src/common/Cargo.toml index 0aa9498a7acc2..8a554137dccdd 100644 --- a/src/common/Cargo.toml +++ b/src/common/Cargo.toml @@ -121,7 +121,7 @@ tracing = "0.1" tracing-futures = { version = "0.2", features = ["futures-03"] } tracing-opentelemetry = { workspace = true } tracing-subscriber = "0.3.17" -twox-hash = "1" +twox-hash = "2" url = "2" uuid = { version = "1", features = ["v4"] } diff --git a/src/common/src/array/bool_array.rs b/src/common/src/array/bool_array.rs index 7ed0e4b703a22..3fe80e127beaf 100644 --- a/src/common/src/array/bool_array.rs +++ b/src/common/src/array/bool_array.rs @@ -257,8 +257,6 @@ mod tests { fn test_bool_array_hash() { use std::hash::BuildHasher; - use twox_hash::RandomXxHashBuilder64; - use super::super::test_util::{hash_finish, test_hash}; const ARR_NUM: usize = 2; @@ -286,7 +284,7 @@ mod tests { .map(|v| helper_test_builder(v.clone())) .collect_vec(); - let hasher_builder = RandomXxHashBuilder64::default(); + let hasher_builder = twox_hash::xxhash64::RandomState::default(); let mut states = vec![hasher_builder.build_hasher(); ARR_LEN]; vecs.iter().for_each(|v| { v.iter() diff --git a/src/common/src/array/decimal_array.rs b/src/common/src/array/decimal_array.rs index e1614cd28bac6..57aa2c5d995d3 100644 --- a/src/common/src/array/decimal_array.rs +++ b/src/common/src/array/decimal_array.rs @@ -70,8 +70,6 @@ mod tests { fn test_decimal_array_hash() { use std::hash::BuildHasher; - use twox_hash::RandomXxHashBuilder64; - use super::super::test_util::{hash_finish, test_hash}; const ARR_NUM: usize = 3; @@ -118,7 +116,7 @@ mod tests { }) .collect_vec(); - let hasher_builder = RandomXxHashBuilder64::default(); + let hasher_builder = twox_hash::xxhash64::RandomState::default(); let mut states = vec![hasher_builder.build_hasher(); ARR_LEN]; vecs.iter().for_each(|v| { v.iter() diff --git a/src/common/src/array/utf8_array.rs b/src/common/src/array/utf8_array.rs index 749a9efe3da13..bf39fba72df9b 100644 --- a/src/common/src/array/utf8_array.rs +++ b/src/common/src/array/utf8_array.rs @@ -332,8 +332,6 @@ mod tests { fn test_utf8_array_hash() { use std::hash::BuildHasher; - use twox_hash::RandomXxHashBuilder64; - use super::super::test_util::{hash_finish, test_hash}; const ARR_NUM: usize = 3; @@ -368,7 +366,7 @@ mod tests { let arrs = vecs.iter().map(Utf8Array::from_iter).collect_vec(); - let hasher_builder = RandomXxHashBuilder64::default(); + let hasher_builder = twox_hash::xxhash64::RandomState::default(); let mut states = vec![hasher_builder.build_hasher(); ARR_LEN]; vecs.iter().for_each(|v| { v.iter() diff --git a/src/storage/backup/Cargo.toml b/src/storage/backup/Cargo.toml index 3fd7d7ecde5ce..23a2c99567c48 100644 --- a/src/storage/backup/Cargo.toml +++ b/src/storage/backup/Cargo.toml @@ -29,7 +29,7 @@ risingwave_pb = { workspace = true } serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror = "1" -twox-hash = "1" +twox-hash = "2" [dev-dependencies] risingwave_hummock_sdk = { workspace = true } diff --git a/src/storage/backup/src/lib.rs b/src/storage/backup/src/lib.rs index 847efba5f26be..93f18516ef934 100644 --- a/src/storage/backup/src/lib.rs +++ b/src/storage/backup/src/lib.rs @@ -31,7 +31,6 @@ pub mod meta_snapshot_v2; pub mod storage; use std::collections::{HashMap, HashSet}; -use std::hash::Hasher; use itertools::Itertools; use risingwave_common::RW_VERSION; @@ -92,9 +91,7 @@ pub struct MetaSnapshotManifest { } pub fn xxhash64_checksum(data: &[u8]) -> u64 { - let mut hasher = twox_hash::XxHash64::with_seed(0); - hasher.write(data); - hasher.finish() + twox_hash::XxHash64::oneshot(0, data) } pub fn xxhash64_verify(data: &[u8], checksum: u64) -> BackupResult<()> {