From 05e7a0e724aab01c2a505da8574d1567958e9132 Mon Sep 17 00:00:00 2001 From: congyi wang <58715567+wcy-fdu@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:35:07 +0800 Subject: [PATCH] refactor(storage): OpenDAL backend use batch delete (#8054) Approved-By: Li0k Co-Authored-By: congyi <15605187270@163.com> Co-Authored-By: congyi wang <58715567+wcy-fdu@users.noreply.github.com> --- Cargo.lock | 278 ++++++++++++------ src/object_store/Cargo.toml | 2 +- .../opendal_engine/opendal_object_store.rs | 39 ++- src/object_store/src/object/s3.rs | 35 --- 4 files changed, 198 insertions(+), 156 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 40c161022f6b3..6893607881919 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,19 +372,20 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad5c83079eae9969be7fadefe640a1c566901f05ff91ab221de4b6f68d9507e" +checksum = "ad445822218ce64be7a341abfb0b1ea43b5c23aa83902542a4542e78309d8e5e" dependencies = [ "async-stream-impl", "futures-core", + "pin-project-lite", ] [[package]] name = "async-stream-impl" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" +checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" dependencies = [ "proc-macro2", "quote", @@ -492,9 +493,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "autotools" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8138adefca3e5d2e73bfba83bd6eeaf904b26a7ac1b4a19892cfe16cc7e1701" +checksum = "aef8da1805e028a172334c3b680f93e71126f2327622faef2ec3d893c0a4ad77" dependencies = [ "cc", ] @@ -520,7 +521,7 @@ dependencies = [ "http", "hyper", "ring", - "time 0.3.18", + "time 0.3.17", "tokio", "tower", "tracing", @@ -683,7 +684,7 @@ dependencies = [ "percent-encoding", "regex", "ring", - "time 0.3.18", + "time 0.3.17", "tracing", ] @@ -821,7 +822,7 @@ dependencies = [ "itoa", "num-integer", "ryu", - "time 0.3.18", + "time 0.3.17", ] [[package]] @@ -851,9 +852,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e246206a63c9830e118d12c894f56a82033da1a2361f5544deeee3df85c99d9" +checksum = "2fb79c228270dcf2426e74864cabc94babb5dbab01a4314e702d2f16540e1591" dependencies = [ "async-trait", "axum-core", @@ -899,18 +900,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "backon" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cd1a59bc091e593ee9ed62df4e4a07115e00a0e0a52fd7e0e04540773939b80" -dependencies = [ - "futures", - "pin-project", - "rand 0.8.5", - "tokio", -] - [[package]] name = "backon" version = "0.4.0" @@ -963,6 +952,12 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + [[package]] name = "bcc" version = "0.0.33" @@ -992,25 +987,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bincode" -version = "2.0.0-rc.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bb50c5a2ef4b9b1e7ae73e3a73b52ea24b20312d629f9c4df28260b7ad2c3c4" -dependencies = [ - "bincode_derive", - "serde", -] - -[[package]] -name = "bincode_derive" -version = "2.0.0-rc.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a45a23389446d2dd25dc8e73a7a3b3c43522b630cac068927f0649d43d719d2" -dependencies = [ - "virtue", -] - [[package]] name = "bit-vec" version = "0.6.3" @@ -1103,9 +1079,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f0778972c64420fdedc63f09919c8a88bda7b25135357fd25a5d9f3257e832" +checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" dependencies = [ "memchr", "serde", @@ -1207,9 +1183,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77df041dc383319cc661b428b6961a005db4d6808d5e12536931b1ca9556055" +checksum = "6031a462f977dd38968b6f23378356512feeace69cef817e1a4475108093cec3" dependencies = [ "serde", ] @@ -1523,6 +1499,12 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "const-oid" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" + [[package]] name = "const-random" version = "0.1.15" @@ -1822,9 +1804,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.59+curl-7.86.0" +version = "0.4.60+curl-7.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cfce34829f448b08f55b7db6d0009e23e2e86a34e8c2b366269bf5799b4a407" +checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f" dependencies = [ "cc", "libc", @@ -1970,6 +1952,17 @@ dependencies = [ "uuid", ] +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -2017,6 +2010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] @@ -2076,7 +2070,7 @@ dependencies = [ "rust_decimal", "serde", "thiserror", - "time 0.3.18", + "time 0.3.17", ] [[package]] @@ -2829,9 +2823,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -3255,6 +3249,9 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] [[package]] name = "lexical-core" @@ -3328,9 +3325,9 @@ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libflate" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05605ab2bce11bcfc0e9c635ff29ef8b2ea83f29be257ee7d730cac3ee373093" +checksum = "97822bf791bd4d5b403713886a5fbe8bf49520fe78e323b0dc480ca1a03e50b0" dependencies = [ "adler32", "crc32fast", @@ -3339,9 +3336,9 @@ dependencies = [ [[package]] name = "libflate_lz77" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39a734c0493409afcd49deee13c006a04e3586b9761a03543c6272c9c51f2f5a" +checksum = "a52d3a8bfc85f250440e4424db7d857e241a3aebbbe301f3eb606ab15c39acbf" dependencies = [ "rle-decode-fast", ] @@ -3496,7 +3493,7 @@ dependencies = [ "ahash 0.7.6", "async-channel", "async-task", - "bincode 1.3.3", + "bincode", "bytes", "downcast-rs", "futures-util", @@ -3688,9 +3685,9 @@ dependencies = [ [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "2af2c65375e552a67fe3829ca63e8a7c27a378a62824594f43b2851d682b5ec2" dependencies = [ "libc", ] @@ -3884,27 +3881,28 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ + "autocfg", "bitflags", "cfg-if", "libc", + "memoffset 0.6.5", + "pin-utils", ] [[package]] name = "nix" -version = "0.25.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "autocfg", "bitflags", "cfg-if", "libc", - "memoffset 0.6.5", - "pin-utils", + "static_assertions", ] [[package]] @@ -3970,6 +3968,23 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2399c9463abc5f909349d8aa9ba080e0b88b3ce2885389b60b993f39b1a56905" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.5", + "smallvec", + "zeroize", +] + [[package]] name = "num-complex" version = "0.4.3" @@ -4055,18 +4070,18 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" +checksum = "3e0072973714303aa6e3631c7e8e777970cf4bdd25dc4932e41031027b8bcc4e" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" +checksum = "0629cbd6b897944899b1f10496d9c4a7ac5878d45fd61bc22e9e79bfbbc29597" dependencies = [ "proc-macro-crate 1.3.0", "proc-macro2", @@ -4112,16 +4127,15 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "opendal" -version = "0.26.2" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c40ed33cc9fed187ce8293587416e0afd6ac9fcde17f2a20ad0dca14dd685ebe" +checksum = "ef6f7b936f2f8483e19643357cb50d9ec9a49c506971ef69ca676913cf5afd91" dependencies = [ "anyhow", "async-compat", "async-trait", - "backon 0.2.0", + "backon", "base64 0.21.0", - "bincode 2.0.0-rc.2", "bytes", "flagset", "futures", @@ -4138,7 +4152,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "time 0.3.18", + "time 0.3.17", "tokio", "ureq", "uuid", @@ -4486,6 +4500,15 @@ dependencies = [ "base64 0.13.1", ] +[[package]] +name = "pem-rfc7468" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -4610,6 +4633,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff33bdbdfc54cc98a2eca766ebdec3e1b8fb7387523d5c9c9a2891da856f719" +dependencies = [ + "der", + "pkcs8", + "spki", + "zeroize", +] + +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.26" @@ -4721,9 +4766,9 @@ dependencies = [ [[package]] name = "pprof" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e20150f965e0e4c925982b9356da71c84bcd56cb66ef4e894825837cbcf6613e" +checksum = "196ded5d4be535690899a4631cc9f18cdc41b7ebf24a79400f46f48e49a11059" dependencies = [ "backtrace", "cfg-if", @@ -4731,7 +4776,7 @@ dependencies = [ "inferno", "libc", "log", - "nix 0.24.3", + "nix 0.26.2", "once_cell", "parking_lot 0.12.1", "smallvec", @@ -4898,7 +4943,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "time 0.3.18", + "time 0.3.17", "url", ] @@ -5347,12 +5392,12 @@ dependencies = [ [[package]] name = "reqsign" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0154ced5e44389686689a3c96c49ca5a70ad9c708e0989982adae2e0378bbf" +checksum = "ef4d5fefeaaa1e64f4aabb79da4ea68bf6d0e7935ad927728280d2a8e95735fc" dependencies = [ "anyhow", - "backon 0.4.0", + "backon", "base64 0.21.0", "bytes", "dirs", @@ -5365,12 +5410,14 @@ dependencies = [ "once_cell", "percent-encoding", "quick-xml 0.27.1", + "rand 0.8.5", + "rsa", "rust-ini", "serde", "serde_json", "sha1", "sha2", - "time 0.3.18", + "time 0.3.17", "ureq", ] @@ -5427,9 +5474,9 @@ checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" [[package]] name = "rgb" -version = "0.8.35" +version = "0.8.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7495acf66551cdb696b7711408144bcd3194fc78e32f3a09e809bfe7dd4a7ce3" +checksum = "20ec2d3e3fc7a92ced357df9cebd5a10b6fb2aa1ee797bf7e9ce2f17dffc8f59" dependencies = [ "bytemuck", ] @@ -6508,6 +6555,27 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" +[[package]] +name = "rsa" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b3896c9b7790b70a9aa314a30e4ae114200992a19c96cbe0ca6070edd32ab8" +dependencies = [ + "byteorder", + "digest", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "sha2", + "signature", + "subtle", + "zeroize", +] + [[package]] name = "rust-ini" version = "0.18.0" @@ -6803,7 +6871,7 @@ dependencies = [ "serde", "serde_json", "serde_with_macros", - "time 0.3.18", + "time 0.3.17", ] [[package]] @@ -6940,6 +7008,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + [[package]] name = "simd-json" version = "0.7.0" @@ -6974,7 +7052,7 @@ dependencies = [ "num-bigint", "num-traits", "thiserror", - "time 0.3.18", + "time 0.3.17", ] [[package]] @@ -7006,9 +7084,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -7090,6 +7168,16 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sqllogictest" version = "0.11.2" @@ -7423,9 +7511,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.18" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af0097eaf301d576d0b2aead7a59facab6d53cc636340f0291fab8446a2e8613" +checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa", "libc", @@ -7876,7 +7964,7 @@ dependencies = [ "sharded-slab", "smallvec", "thread_local", - "time 0.3.18", + "time 0.3.17", "tracing", "tracing-core", "tracing-log", @@ -8109,12 +8197,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "virtue" -version = "0.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b60dcd6a64dd45abf9bd426970c9843726da7fc08f44cd6fcebf68c21220a63" - [[package]] name = "waker-fn" version = "1.1.0" @@ -8571,7 +8653,7 @@ dependencies = [ "stable_deref_trait", "strum", "syn", - "time 0.3.18", + "time 0.3.17", "tokio", "tokio-stream", "tokio-util", diff --git a/src/object_store/Cargo.toml b/src/object_store/Cargo.toml index ae646f7cb6467..cef14075d12b6 100644 --- a/src/object_store/Cargo.toml +++ b/src/object_store/Cargo.toml @@ -21,7 +21,7 @@ fail = "0.5" futures = { version = "0.3", default-features = false, features = ["alloc"] } hyper = "0.14" itertools = "0.10" -opendal = "0.26.2" +opendal = "0.27.2" prometheus = { version = "0.13", features = ["process"] } random-string = "1.0" risingwave_common = { path = "../common" } diff --git a/src/object_store/src/object/opendal_engine/opendal_object_store.rs b/src/object_store/src/object/opendal_engine/opendal_object_store.rs index eca30c3fe16c3..63c35b3b33f6d 100644 --- a/src/object_store/src/object/opendal_engine/opendal_object_store.rs +++ b/src/object_store/src/object/opendal_engine/opendal_object_store.rs @@ -150,9 +150,7 @@ impl ObjectStore for OpendalObjectStore { /// Deletes the objects with the given paths permanently from the storage. If an object /// specified in the request is not found, it will be considered as successfully deleted. async fn delete_objects(&self, paths: &[String]) -> ObjectResult<()> { - for path in paths { - self.op.object(path).delete().await?; - } + self.op.batch().remove(paths.to_vec()).await?; Ok(()) } @@ -287,29 +285,26 @@ mod tests { obj_store.delete(&path).await.unwrap(); } - // Currently OpenDAL does not support delete objects operation, but they are planning this - // feature. So let's not delete this unit test now. https://github.com/datafuselabs/opendal/issues/1279 - - // #[tokio::test] - // async fn test_memory_delete_objects() { - // let block1 = Bytes::from("123456"); - // let block2 = Bytes::from("987654"); - // let store = OpendalObjectStore::new_memory_engine().unwrap(); - // store.upload("/abc", block1).await.unwrap(); - // store.upload("/klm", block2).await.unwrap(); + #[tokio::test] + async fn test_memory_delete_objects() { + let block1 = Bytes::from("123456"); + let block2 = Bytes::from("987654"); + let store = OpendalObjectStore::new_memory_engine().unwrap(); + store.upload("abc", block1).await.unwrap(); + store.upload("/klm", block2).await.unwrap(); - // assert_eq!(store.list("").await.unwrap().len(), 2); + assert_eq!(store.list("").await.unwrap().len(), 2); - // let str_list = [ - // String::from("/abc"), - // String::from("/klm"), - // String::from("/xyz"), - // ]; + let str_list = [ + String::from("abc"), + String::from("klm"), + String::from("xyz"), + ]; - // store.delete_objects(&str_list).await.unwrap(); + store.delete_objects(&str_list).await.unwrap(); - // assert_eq!(store.list("").await.unwrap().len(), 0); - // } + assert_eq!(store.list("").await.unwrap().len(), 0); + } #[tokio::test] async fn test_memory_read_multi_block() { diff --git a/src/object_store/src/object/s3.rs b/src/object_store/src/object/s3.rs index 9f11db934ccc3..278a149c70502 100644 --- a/src/object_store/src/object/s3.rs +++ b/src/object_store/src/object/s3.rs @@ -29,7 +29,6 @@ use futures::future::try_join_all; use futures::stream; use hyper::Body; use itertools::Itertools; -use random_string::generate; use tokio::io::AsyncRead; use tokio::task::JoinHandle; @@ -292,7 +291,6 @@ pub struct S3ObjectStore { part_size: usize, /// For S3 specific metrics. metrics: Arc, - object_store_use_batch_delete: bool, } #[async_trait::async_trait] @@ -433,12 +431,6 @@ impl ObjectStore for S3ObjectStore { async fn delete_objects(&self, paths: &[String]) -> ObjectResult<()> { // AWS restricts the number of objects per request to 1000. const MAX_LEN: usize = 1000; - if !self.object_store_use_batch_delete { - for path in paths { - self.delete(path).await?; - } - return Ok(()); - } // If needed, split given set into subsets of size with no more than `MAX_LEN` objects. for start_idx /* inclusive */ in (0..paths.len()).step_by(MAX_LEN) { @@ -531,7 +523,6 @@ impl S3ObjectStore { bucket, part_size: S3_PART_SIZE, metrics, - object_store_use_batch_delete: true, } } @@ -566,36 +557,11 @@ impl S3ObjectStore { let client = Client::new(&sdk_config); Self::configure_bucket_lifecycle(&client, bucket.as_str()).await; - // check whether use batch delete - let charset = "1234567890"; - let test_path = "risingwave_check_batch_delete/".to_string() + &generate(10, charset); - client - .put_object() - .bucket(&bucket) - .body(aws_sdk_s3::types::ByteStream::from(Bytes::from( - "test batch delete", - ))) - .key(&test_path) - .send() - .await - .unwrap(); - let obj_ids = vec![ObjectIdentifier::builder().key(&test_path).build()]; - - let delete_builder = Delete::builder().set_objects(Some(obj_ids)); - let object_store_use_batch_delete = client - .delete_objects() - .bucket(&bucket) - .delete(delete_builder.build()) - .send() - .await - .is_ok(); - Self { client, bucket: bucket.to_string(), part_size: S3_PART_SIZE, metrics, - object_store_use_batch_delete, } } @@ -630,7 +596,6 @@ impl S3ObjectStore { bucket: bucket.to_string(), part_size: MINIO_PART_SIZE, metrics, - object_store_use_batch_delete: true, } }