diff --git a/Cargo.lock b/Cargo.lock index 8970189df4..2c5c28c1d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.10", + "getrandom", "once_cell", "version_check", ] @@ -34,9 +34,9 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "const-random", - "getrandom 0.2.10", + "getrandom", "once_cell", "version_check", ] @@ -408,10 +408,10 @@ dependencies = [ "hashbrown 0.14.0", "num-traits", "once_cell", - "rand 0.8.5", + "rand", "regex", "snafu", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -594,7 +594,7 @@ name = "backoff" version = "0.1.0" dependencies = [ "observability_deps", - "rand 0.8.5", + "rand", "snafu", "tokio", "workspace-hack", @@ -608,7 +608,7 @@ checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide 0.6.2", "object", @@ -627,15 +627,6 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -675,7 +666,7 @@ dependencies = [ "arrayref", "arrayvec", "cc", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq", "digest", ] @@ -781,7 +772,7 @@ dependencies = [ "parking_lot 0.12.1", "pdatastructs", "proptest", - "rand 0.8.5", + "rand", "tokio", "tokio-util", "trace", @@ -803,12 +794,6 @@ dependencies = [ "jobserver", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -825,7 +810,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -905,7 +890,7 @@ dependencies = [ "test_helpers", "trace_exporters", "trogging", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -963,7 +948,7 @@ checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" dependencies = [ "error-code", "str-buf", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1018,14 +1003,14 @@ dependencies = [ "observability_deps", "parquet_file", "predicate", - "rand 0.8.5", + "rand", "schema", "sharder", "test_helpers", "tokio", "tokio-util", "tracker", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -1051,7 +1036,7 @@ dependencies = [ "schema", "tokio", "tracker", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -1061,7 +1046,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" dependencies = [ - "crossbeam-utils 0.8.16", + "crossbeam-utils", ] [[package]] @@ -1095,8 +1080,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57ab2224a0311582eb03adba4caaf18644f7b1f10a760803a803b9b605187fc7" dependencies = [ "console-api", - "crossbeam-channel 0.5.8", - "crossbeam-utils 0.8.16", + "crossbeam-channel", + "crossbeam-utils", "futures", "hdrhistogram", "humantime", @@ -1129,7 +1114,7 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d7d6ab3c3a2282db210df5f02c4dab6e0a7057af0fb7ebd4070f30fe05c0ddb" dependencies = [ - "getrandom 0.2.10", + "getrandom", "once_cell", "proc-macro-hack", "tiny-keccak", @@ -1153,7 +1138,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c76f98bdfc7f66172e6c7065f981ebb576ffc903fe4c0561d9f0c2509226dc6" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1186,7 +1171,7 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1245,24 +1230,14 @@ dependencies = [ "cc", ] -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - [[package]] name = "crossbeam-channel" version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", + "cfg-if", + "crossbeam-utils", ] [[package]] @@ -1271,9 +1246,9 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", - "crossbeam-utils 0.8.16", + "crossbeam-utils", ] [[package]] @@ -1283,8 +1258,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", + "cfg-if", + "crossbeam-utils", "memoffset 0.8.0", "scopeguard", ] @@ -1295,19 +1270,8 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils 0.8.16", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", + "cfg-if", + "crossbeam-utils", ] [[package]] @@ -1316,7 +1280,7 @@ version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1372,7 +1336,7 @@ version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "hashbrown 0.12.3", "lock_api", "once_cell", @@ -1399,7 +1363,7 @@ dependencies = [ "sqlx", "test_helpers", "thiserror", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -1439,7 +1403,7 @@ dependencies = [ "parquet", "percent-encoding", "pin-project-lite", - "rand 0.8.5", + "rand", "smallvec", "sqlparser", "tempfile", @@ -1447,7 +1411,7 @@ dependencies = [ "tokio-stream", "tokio-util", "url", - "uuid 1.3.4", + "uuid", "xz2", "zstd", ] @@ -1478,7 +1442,7 @@ dependencies = [ "log", "object_store", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "tempfile", "url", ] @@ -1539,11 +1503,11 @@ dependencies = [ "md-5", "paste", "petgraph", - "rand 0.8.5", + "rand", "regex", "sha2", "unicode-segmentation", - "uuid 1.3.4", + "uuid", ] [[package]] @@ -1568,7 +1532,7 @@ dependencies = [ "arrow", "datafusion-common", "paste", - "rand 0.8.5", + "rand", ] [[package]] @@ -1607,7 +1571,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.3.4", + "uuid", ] [[package]] @@ -1650,7 +1614,7 @@ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1697,7 +1661,7 @@ version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1767,7 +1731,7 @@ version = "3.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ae6b3d9530211fb3b12a95374b8b0823be812f53d09e18c5675c0146b09642" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "rustix", "windows-sys 0.48.0", ] @@ -1778,7 +1742,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.2.16", "windows-sys 0.48.0", @@ -1793,7 +1757,7 @@ dependencies = [ "cc", "lazy_static", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1875,22 +1839,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" version = "0.3.28" @@ -2015,7 +1963,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -2046,26 +1994,15 @@ dependencies = [ "version_check", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -2494,7 +2431,7 @@ dependencies = [ "test_helpers", "tokio", "url", - "uuid 1.3.4", + "uuid", ] [[package]] @@ -2596,7 +2533,7 @@ dependencies = [ "tonic", "trace_exporters", "trogging", - "uuid 1.3.4", + "uuid", "wal", "wal_inspect", "workspace-hack", @@ -2617,7 +2554,7 @@ dependencies = [ "influxdb-line-protocol", "insta", "prost", - "rand 0.8.5", + "rand", "reqwest", "schema", "serde_json", @@ -2648,7 +2585,7 @@ dependencies = [ "hex", "integer-encoding", "observability_deps", - "rand 0.8.5", + "rand", "snafu", "snap", "test_helpers", @@ -2678,7 +2615,7 @@ dependencies = [ "backoff", "bytes", "criterion", - "crossbeam-utils 0.8.16", + "crossbeam-utils", "data_types", "datafusion", "datafusion_util", @@ -2707,7 +2644,7 @@ dependencies = [ "pin-project", "predicate", "prost", - "rand 0.8.5", + "rand", "schema", "service_grpc_catalog", "sharder", @@ -2718,7 +2655,7 @@ dependencies = [ "tokio-util", "tonic", "trace", - "uuid 1.3.4", + "uuid", "wal", "workspace-hack", ] @@ -2796,7 +2733,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -2816,15 +2753,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - [[package]] name = "iox_catalog" version = "0.1.0" @@ -2844,7 +2772,7 @@ dependencies = [ "parking_lot 0.12.1", "paste", "pretty_assertions", - "rand 0.8.5", + "rand", "serde", "siphasher", "snafu", @@ -2854,7 +2782,7 @@ dependencies = [ "test_helpers", "thiserror", "tokio", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -2875,7 +2803,7 @@ dependencies = [ "mutable_batch", "mutable_batch_lp", "parquet_file", - "rand 0.8.5", + "rand", "regex", "schema", "serde", @@ -2886,7 +2814,7 @@ dependencies = [ "toml", "tracing", "tracing-subscriber", - "uuid 1.3.4", + "uuid", ] [[package]] @@ -2989,7 +2917,7 @@ dependencies = [ "observability_deps", "parquet_file", "schema", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -3174,25 +3102,6 @@ dependencies = [ "workspace-hack", ] -[[package]] -name = "ipc-channel" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb1d9211085f0ea6f1379d944b93c4d07e8207aa3bcf49f37eda12b85081887" -dependencies = [ - "bincode", - "crossbeam-channel 0.4.4", - "fnv", - "lazy_static", - "libc", - "mio 0.6.23", - "rand 0.7.3", - "serde", - "tempfile", - "uuid 0.8.2", - "winapi 0.3.9", -] - [[package]] name = "ipnet" version = "2.7.2" @@ -3244,16 +3153,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -3433,12 +3332,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "md-5" version = "0.10.5" @@ -3530,25 +3423,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.8.6" @@ -3557,22 +3431,10 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.45.0", ] -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - [[package]] name = "mockito" version = "1.0.2" @@ -3584,7 +3446,7 @@ dependencies = [ "hyper", "lazy_static", "log", - "rand 0.8.5", + "rand", "regex", "serde_json", "serde_urlencoded", @@ -3614,7 +3476,7 @@ dependencies = [ "paste", "percent-encoding", "proptest", - "rand 0.8.5", + "rand", "schema", "snafu", "thiserror", @@ -3669,17 +3531,6 @@ dependencies = [ "prost", ] -[[package]] -name = "net2" -version = "0.2.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d0df99cfcd2530b2e694f6e17e7f37b8e26bb23983ac530c0c97408837c631" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "nix" version = "0.26.2" @@ -3687,7 +3538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.7.1", "pin-utils", @@ -3717,7 +3568,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3852,7 +3703,7 @@ dependencies = [ "parking_lot 0.12.1", "percent-encoding", "quick-xml 0.28.2", - "rand 0.8.5", + "rand", "reqwest", "ring", "rustls-pemfile", @@ -3928,7 +3779,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3974,12 +3825,12 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "instant", "libc", "redox_syscall 0.2.16", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3988,7 +3839,7 @@ version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall 0.2.16", "smallvec", @@ -4047,14 +3898,14 @@ dependencies = [ "parquet", "pbjson-types", "prost", - "rand 0.8.5", + "rand", "schema", "snafu", "test_helpers", "thiserror", "thrift", "tokio", - "uuid 1.3.4", + "uuid", "workspace-hack", "zstd", ] @@ -4224,7 +4075,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" dependencies = [ "phf_shared", - "rand 0.8.5", + "rand", ] [[package]] @@ -4281,7 +4132,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "196ded5d4be535690899a4631cc9f18cdc41b7ebf24a79400f46f48e49a11059" dependencies = [ "backtrace", - "cfg-if 1.0.0", + "cfg-if", "findshlibs", "inferno", "libc", @@ -4393,26 +4244,13 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "procspawn" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5a680d772408c77498b0339175746b5dae18724b26877b919e6ecabb680e83" -dependencies = [ - "ctor", - "findshlibs", - "ipc-channel", - "libc", - "serde", -] - [[package]] name = "prometheus" version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fnv", "lazy_static", "memchr", @@ -4431,8 +4269,8 @@ dependencies = [ "byteorder", "lazy_static", "num-traits", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand", + "rand_chacha", "rand_xorshift", "regex-syntax 0.6.29", "rusty-fork", @@ -4534,7 +4372,7 @@ dependencies = [ "pin-project", "predicate", "prost", - "rand 0.8.5", + "rand", "schema", "service_common", "service_grpc_catalog", @@ -4550,7 +4388,7 @@ dependencies = [ "trace_exporters", "trace_http", "tracker", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -4606,19 +4444,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - [[package]] name = "rand" version = "0.8.5" @@ -4626,18 +4451,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", ] [[package]] @@ -4647,16 +4462,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -4665,16 +4471,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.10", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -4683,7 +4480,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -4702,9 +4499,9 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ - "crossbeam-channel 0.5.8", + "crossbeam-channel", "crossbeam-deque", - "crossbeam-utils 0.8.16", + "crossbeam-utils", "num_cpus", ] @@ -4732,7 +4529,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.10", + "getrandom", "redox_syscall 0.2.16", "thiserror", ] @@ -4831,7 +4628,7 @@ dependencies = [ "spin 0.5.2", "untrusted", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -4844,7 +4641,7 @@ dependencies = [ "base64 0.21.2", "bytes", "criterion", - "crossbeam-utils 0.8.16", + "crossbeam-utils", "data_types", "dml", "flate2", @@ -4867,7 +4664,7 @@ dependencies = [ "paste", "pretty_assertions", "proptest", - "rand 0.8.5", + "rand", "schema", "serde", "serde_urlencoded", @@ -4984,7 +4781,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfc8644681285d1fb67a467fb3021bfea306b99b4146b166a1fe3ada965eece" dependencies = [ "bitflags", - "cfg-if 1.0.0", + "cfg-if", "clipboard-win", "fd-lock", "libc", @@ -4995,7 +4792,7 @@ dependencies = [ "unicode-segmentation", "unicode-width", "utf8parse", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5136,7 +4933,7 @@ dependencies = [ "observability_deps", "tokio", "tonic", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -5189,7 +4986,6 @@ dependencies = [ "parking_lot 0.12.1", "pin-project", "predicate", - "procspawn", "prost", "query_functions", "regex", @@ -5240,7 +5036,7 @@ dependencies = [ "parquet_file", "tokio", "tonic", - "uuid 1.3.4", + "uuid", "workspace-hack", ] @@ -5288,7 +5084,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -5299,7 +5095,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -5323,7 +5119,7 @@ dependencies = [ "mutable_batch", "mutable_batch_lp", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "siphasher", "workspace-hack", ] @@ -5399,7 +5195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5497,7 +5293,7 @@ dependencies = [ "once_cell", "paste", "percent-encoding", - "rand 0.8.5", + "rand", "rustls 0.20.8", "rustls-pemfile", "serde", @@ -5511,7 +5307,7 @@ dependencies = [ "thiserror", "tokio-stream", "url", - "uuid 1.3.4", + "uuid", "webpki-roots 0.22.6", "whoami", ] @@ -5523,7 +5319,7 @@ dependencies = [ "dotenvy", "either", "futures", - "rand 0.8.5", + "rand", "sqlx", "tokio", "workspace-hack", @@ -5637,7 +5433,7 @@ dependencies = [ "debugid", "memmap2", "stable_deref_trait", - "uuid 1.3.4", + "uuid", ] [[package]] @@ -5692,7 +5488,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ "autocfg", - "cfg-if 1.0.0", + "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix", @@ -5745,7 +5541,7 @@ dependencies = [ "once_cell", "parking_lot 0.12.1", "prost", - "rand 0.8.5", + "rand", "regex", "reqwest", "snafu", @@ -5784,7 +5580,7 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "once_cell", ] @@ -5874,7 +5670,7 @@ dependencies = [ "autocfg", "bytes", "libc", - "mio 0.8.6", + "mio", "num_cpus", "parking_lot 0.12.1", "pin-project-lite", @@ -6069,7 +5865,7 @@ dependencies = [ "indexmap", "pin-project", "pin-project-lite", - "rand 0.8.5", + "rand", "slab", "tokio", "tokio-util", @@ -6116,7 +5912,7 @@ dependencies = [ "chrono", "observability_deps", "parking_lot 0.12.1", - "rand 0.8.5", + "rand", "workspace-hack", ] @@ -6162,7 +5958,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -6278,7 +6074,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "static_assertions", ] @@ -6362,22 +6158,13 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.10", -] - [[package]] name = "uuid" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" dependencies = [ - "getrandom 0.2.10", + "getrandom", ] [[package]] @@ -6471,12 +6258,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -6489,7 +6270,7 @@ version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -6514,7 +6295,7 @@ version = "0.4.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -6621,12 +6402,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -6637,12 +6412,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -6655,7 +6424,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -6820,7 +6589,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -6840,7 +6609,7 @@ dependencies = [ "bytes", "cc", "chrono", - "crossbeam-utils 0.8.16", + "crossbeam-utils", "crypto-common", "datafusion", "datafusion-optimizer", @@ -6857,7 +6626,7 @@ dependencies = [ "futures-sink", "futures-task", "futures-util", - "getrandom 0.2.10", + "getrandom", "hashbrown 0.13.2", "heck", "indexmap", @@ -6881,8 +6650,8 @@ dependencies = [ "proptest", "prost", "prost-types", - "rand 0.8.5", - "rand_core 0.6.4", + "rand", + "rand_core", "regex", "regex-syntax 0.7.2", "reqwest", @@ -6915,9 +6684,9 @@ dependencies = [ "unicode-bidi", "unicode-normalization", "url", - "uuid 1.3.4", + "uuid", "webpki", - "winapi 0.3.9", + "winapi", "windows-sys 0.45.0", "windows-sys 0.48.0", "zstd", @@ -6925,16 +6694,6 @@ dependencies = [ "zstd-sys", ] -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "xz2" version = "0.1.7" diff --git a/service_grpc_influxrpc/Cargo.toml b/service_grpc_influxrpc/Cargo.toml index 9499baba29..a993c5fb58 100644 --- a/service_grpc_influxrpc/Cargo.toml +++ b/service_grpc_influxrpc/Cargo.toml @@ -13,9 +13,12 @@ datafusion_util = { path = "../datafusion_util" } generated_types = { path = "../generated_types" } observability_deps = { path = "../observability_deps" } predicate = { path = "../predicate" } +influxdb_storage_client = { path = "../influxdb_storage_client", optional = true } iox_query = { path = "../iox_query" } query_functions = { path = "../query_functions"} service_common = { path = "../service_common" } +service_grpc_testing = { path = "../service_grpc_testing", optional = true } +tokio = { version = "1.28", features = ["macros", "net", "parking_lot", "rt-multi-thread", "signal", "sync", "time"], optional = true } trace = { path = "../trace"} trace_http = { path = "../trace_http"} tracker = { path = "../tracker" } @@ -39,7 +42,6 @@ datafusion_util = { path = "../datafusion_util" } influxdb_storage_client = { path = "../influxdb_storage_client" } metric = { path = "../metric" } panic_logging = { path = "../panic_logging" } -procspawn = { version = "0.10", default-features = false, features = ["test-support", "safe-shared-libraries"] } schema = { path = "../schema" } service_grpc_testing = { path = "../service_grpc_testing" } test_helpers = { path = "../test_helpers" } @@ -48,3 +50,10 @@ trace_http = { path = "../trace_http" } # Crates.io dependencies, in alphabetical order parking_lot = "0.12" tokio = { version = "1.28", features = ["macros", "net", "parking_lot", "rt-multi-thread", "signal", "sync", "time"] } + +[features] +test-util = ["influxdb_storage_client", "service_grpc_testing", "tokio"] + +[[test]] +name = "log_on_panic" +required-features = ["test-util"] diff --git a/service_grpc_influxrpc/src/lib.rs b/service_grpc_influxrpc/src/lib.rs index 9d3bdb8e3d..bfa37ada2e 100644 --- a/service_grpc_influxrpc/src/lib.rs +++ b/service_grpc_influxrpc/src/lib.rs @@ -18,6 +18,10 @@ // Workaround for "unused crate" lint false positives. use workspace_hack as _; +// rustc doesn't seem to understand test-only requirements +#[cfg(test)] +use panic_logging as _; + /// `[0x00]` is the magic value that that the storage gRPC layer uses to /// encode a tag_key that means "measurement name" pub(crate) const TAG_KEY_MEASUREMENT: &[u8] = &[0]; @@ -35,6 +39,9 @@ mod query_completed_token; mod response_chunking; pub mod service; +#[cfg(any(test, feature = "test-util"))] +pub mod test_util; + use generated_types::storage_server::{Storage, StorageServer}; use service_common::QueryNamespaceProvider; use std::sync::Arc; diff --git a/service_grpc_influxrpc/src/service.rs b/service_grpc_influxrpc/src/service.rs index c9116c24bb..4ddcdec951 100644 --- a/service_grpc_influxrpc/src/service.rs +++ b/service_grpc_influxrpc/src/service.rs @@ -1717,30 +1717,18 @@ where #[cfg(test)] mod tests { + use crate::test_util::Fixture; + use super::*; use futures::Future; - use generated_types::{ - google::rpc::Status as GrpcStatus, i_ox_testing_client::IOxTestingClient, - tag_key_predicate::Value, - }; - use influxdb_storage_client::{ - connection::{Builder as ConnectionBuilder, Connection, GrpcConnection}, - generated_types::*, - Client as StorageClient, OrgAndBucket, - }; + use generated_types::{google::rpc::Status as GrpcStatus, tag_key_predicate::Value}; + use influxdb_storage_client::{generated_types::*, Client as StorageClient, OrgAndBucket}; use iox_query::test::TestChunk; use metric::{Attributes, Metric, U64Counter, U64Gauge}; - use panic_logging::SendPanicsToTracing; use service_common::test_util::TestDatabaseStore; - use std::{ - any::Any, - net::{IpAddr, Ipv4Addr, SocketAddr}, - num::NonZeroU64, - sync::Arc, - }; - use test_helpers::{assert_contains, maybe_start_logging, tracing::TracingCapture}; - use tokio::{pin, task::JoinHandle}; - use tokio_stream::wrappers::TcpListenerStream; + use std::{any::Any, num::NonZeroU64, sync::Arc}; + use test_helpers::{assert_contains, maybe_start_logging}; + use tokio::pin; fn to_str_vec(s: &[&str]) -> Vec { s.iter().map(|s| s.to_string()).collect() @@ -2608,84 +2596,6 @@ mod tests { grpc_request_metric_has_count(&fixture, "MeasurementTagValues", "server_error", 1); } - procspawn::enable_test_support!(); - - #[test] - fn test_log_on_panic() { - // libtest (i.e. the standard library test fixture) sets panic hooks. This will race w/ our own panic hooks. To - // prevent that, we spawn a dedicated process with its own panic hooks that is isolated from the remaining - // tests. - - procspawn::spawn((), |_| { - // do NOT write to stdout (default behavior) - std::panic::set_hook(Box::new(|_| {})); - - let rt = tokio::runtime::Builder::new_current_thread() - .enable_all() - .build() - .unwrap(); - rt.block_on(test_log_on_panic_inner()); - }) - .join() - .unwrap(); - } - - async fn test_log_on_panic_inner() { - // Send a message to a route that causes a panic and ensure: - // 1. We don't use up all executors 2. The panic message - // message ends up in the log system - - // Normally, the global panic logger is set at program start - let _f = SendPanicsToTracing::new(); - - // capture all tracing messages - let tracing_capture = TracingCapture::new(); - - // Start a test gRPC server on a randomally allocated port - let mut fixture = Fixture::new().await.expect("Connecting to test server"); - - let request = TestErrorRequest {}; - - // Test response from storage server - let response = fixture.iox_client.test_error(request).await; - - match &response { - Ok(_) => { - panic!("Unexpected success: {response:?}"); - } - Err(status) => { - assert_eq!(status.code(), tonic::Code::Cancelled); - assert_contains!( - status.message(), - "http2 error: stream error received: stream no longer needed" - ); - } - }; - - // Ensure that the logs captured the panic - let captured_logs = tracing_capture.to_string(); - // Note we don't include the actual line / column in the - // expected panic message to avoid needing to update the test - // whenever the source code file changed. - let expected_error = "'This is a test panic', service_grpc_testing/src/lib.rs:"; - assert_contains!(captured_logs, expected_error); - - // Ensure that panics don't exhaust the tokio executor by - // running 100 times (success is if we can make a successful - // call after this) - for _ in 0usize..100 { - let request = TestErrorRequest {}; - - // Test response from storage server - let response = fixture.iox_client.test_error(request).await; - assert!(response.is_err(), "Got an error response: {response:?}"); - } - - // Ensure there are still threads to answer actual client queries - let caps = fixture.storage_client.capabilities().await.unwrap(); - assert!(!caps.is_empty(), "Caps: {caps:?}"); - } - #[tokio::test] async fn test_read_filter() { test_helpers::maybe_start_logging(); @@ -3736,97 +3646,6 @@ mod tests { v.iter().map(|s| s.to_string()).collect() } - #[derive(Debug, Snafu)] - pub enum FixtureError { - #[snafu(display("Error binding fixture server: {}", source))] - Bind { source: std::io::Error }, - - #[snafu(display("Error creating fixture: {}", source))] - Tonic { source: tonic::transport::Error }, - } - - // Wrapper around raw clients and test database - struct Fixture { - client_connection: Connection, - iox_client: IOxTestingClient, - storage_client: StorageClient, - test_storage: Arc, - join_handle: JoinHandle<()>, - } - - impl Fixture { - /// Start up a test storage server listening on `port`, returning - /// a fixture with the test server and clients - async fn new() -> Result { - Self::new_with_semaphore_size(u16::MAX as usize).await - } - - async fn new_with_semaphore_size(semaphore_size: usize) -> Result { - let test_storage = Arc::new(TestDatabaseStore::new_with_semaphore_size(semaphore_size)); - - // Get a random port from the kernel by asking for port 0. - let bind_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 0); - let socket = tokio::net::TcpListener::bind(bind_addr) - .await - .context(BindSnafu)?; - - // Pull the assigned port out of the socket - let bind_addr = socket.local_addr().unwrap(); - - println!("Starting InfluxDB IOx storage test server on {bind_addr:?}"); - - let trace_header_parser = trace_http::ctx::TraceHeaderParser::new(); - - let router = tonic::transport::Server::builder() - .layer(trace_http::tower::TraceLayer::new( - trace_header_parser, - Arc::clone(&test_storage.metric_registry), - None, - true, - "test server", - )) - .add_service(service_grpc_testing::make_server()) - .add_service(crate::make_server(Arc::clone(&test_storage))); - - let server = async move { - let stream = TcpListenerStream::new(socket); - - router - .serve_with_incoming(stream) - .await - .log_if_error("Running Tonic Server") - .ok(); - }; - - let join_handle = tokio::task::spawn(server); - - let client_connection = ConnectionBuilder::default() - .connect_timeout(std::time::Duration::from_secs(30)) - .build(format!("http://{bind_addr}")) - .await - .unwrap(); - - let iox_client = - IOxTestingClient::new(client_connection.clone().into_grpc_connection()); - - let storage_client = StorageClient::new(client_connection.clone()); - - Ok(Self { - client_connection, - iox_client, - storage_client, - test_storage, - join_handle, - }) - } - } - - impl Drop for Fixture { - fn drop(&mut self) { - self.join_handle.abort(); - } - } - /// Assert that given future is pending. /// /// This will try to poll the future a bit to ensure that it is not stuck in tokios task preemption. diff --git a/service_grpc_influxrpc/src/test_util.rs b/service_grpc_influxrpc/src/test_util.rs new file mode 100644 index 0000000000..5843e5abad --- /dev/null +++ b/service_grpc_influxrpc/src/test_util.rs @@ -0,0 +1,107 @@ +use std::{ + net::{IpAddr, Ipv4Addr, SocketAddr}, + sync::Arc, +}; + +use generated_types::i_ox_testing_client::IOxTestingClient; +use influxdb_storage_client::{ + connection::{Builder as ConnectionBuilder, Connection, GrpcConnection}, + Client as StorageClient, +}; +use service_common::test_util::TestDatabaseStore; +use snafu::{ResultExt, Snafu}; +use tokio::task::JoinHandle; +use tokio_stream::wrappers::TcpListenerStream; + +use crate::service::ErrorLogger; + +#[derive(Debug, Snafu)] +pub enum FixtureError { + #[snafu(display("Error binding fixture server: {}", source))] + Bind { source: std::io::Error }, + + #[snafu(display("Error creating fixture: {}", source))] + Tonic { source: tonic::transport::Error }, +} + +/// Wrapper around raw clients and test database +#[derive(Debug)] +pub struct Fixture { + pub client_connection: Connection, + pub iox_client: IOxTestingClient, + pub storage_client: StorageClient, + pub test_storage: Arc, + pub join_handle: JoinHandle<()>, +} + +impl Fixture { + /// Start up a test storage server listening on `port`, returning + /// a fixture with the test server and clients + pub async fn new() -> Result { + Self::new_with_semaphore_size(u16::MAX as usize).await + } + + pub async fn new_with_semaphore_size(semaphore_size: usize) -> Result { + let test_storage = Arc::new(TestDatabaseStore::new_with_semaphore_size(semaphore_size)); + + // Get a random port from the kernel by asking for port 0. + let bind_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 0); + let socket = tokio::net::TcpListener::bind(bind_addr) + .await + .context(BindSnafu)?; + + // Pull the assigned port out of the socket + let bind_addr = socket.local_addr().unwrap(); + + println!("Starting InfluxDB IOx storage test server on {bind_addr:?}"); + + let trace_header_parser = trace_http::ctx::TraceHeaderParser::new(); + + let router = tonic::transport::Server::builder() + .layer(trace_http::tower::TraceLayer::new( + trace_header_parser, + Arc::clone(&test_storage.metric_registry), + None, + true, + "test server", + )) + .add_service(service_grpc_testing::make_server()) + .add_service(crate::make_server(Arc::clone(&test_storage))); + + let server = async move { + let stream = TcpListenerStream::new(socket); + + router + .serve_with_incoming(stream) + .await + .log_if_error("Running Tonic Server") + .ok(); + }; + + let join_handle = tokio::task::spawn(server); + + let client_connection = ConnectionBuilder::default() + .connect_timeout(std::time::Duration::from_secs(30)) + .build(format!("http://{bind_addr}")) + .await + .unwrap(); + + let iox_client = IOxTestingClient::new(client_connection.clone().into_grpc_connection()); + + let storage_client = StorageClient::new(client_connection.clone()); + + Ok(Self { + client_connection, + iox_client, + storage_client, + test_storage, + join_handle, + }) + } +} + +impl Drop for Fixture { + fn drop(&mut self) { + self.join_handle.abort(); + } +} diff --git a/service_grpc_influxrpc/tests/log_on_panic.rs b/service_grpc_influxrpc/tests/log_on_panic.rs new file mode 100644 index 0000000000..b4c7692a38 --- /dev/null +++ b/service_grpc_influxrpc/tests/log_on_panic.rs @@ -0,0 +1,71 @@ +use generated_types::TestErrorRequest; +use panic_logging::SendPanicsToTracing; +use service_grpc_influxrpc::test_util::Fixture; +use test_helpers::{assert_contains, tracing::TracingCapture}; + +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!! +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// +// This file MUST only contain a single test, otherwise +// libtest's panic hooks will interfer with our custom +// panic hook. +// +// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +#[tokio::test] +async fn test() { + // Send a message to a route that causes a panic and ensure: + // 1. We don't use up all executors 2. The panic message + // message ends up in the log system + + // Normally, the global panic logger is set at program start + let _f = SendPanicsToTracing::new(); + + // capture all tracing messages + let tracing_capture = TracingCapture::new(); + + // Start a test gRPC server on a randomally allocated port + let mut fixture = Fixture::new().await.expect("Connecting to test server"); + + let request = TestErrorRequest {}; + + // Test response from storage server + let response = fixture.iox_client.test_error(request).await; + + match &response { + Ok(_) => { + panic!("Unexpected success: {response:?}"); + } + Err(status) => { + assert_eq!(status.code(), tonic::Code::Cancelled); + assert_contains!( + status.message(), + "http2 error: stream error received: stream no longer needed" + ); + } + }; + + // Ensure that the logs captured the panic + let captured_logs = tracing_capture.to_string(); + // Note we don't include the actual line / column in the + // expected panic message to avoid needing to update the test + // whenever the source code file changed. + let expected_error = "'This is a test panic', service_grpc_testing/src/lib.rs:"; + assert_contains!(captured_logs, expected_error); + + // Ensure that panics don't exhaust the tokio executor by + // running 100 times (success is if we can make a successful + // call after this) + for _ in 0usize..100 { + let request = TestErrorRequest {}; + + // Test response from storage server + let response = fixture.iox_client.test_error(request).await; + assert!(response.is_err(), "Got an error response: {response:?}"); + } + + // Ensure there are still threads to answer actual client queries + let caps = fixture.storage_client.capabilities().await.unwrap(); + assert!(!caps.is_empty(), "Caps: {caps:?}"); +} diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 2b4f2823d4..a5fa99f915 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -204,7 +204,7 @@ once_cell = { version = "1", default-features = false, features = ["unstable"] } rustls = { version = "0.21", features = ["dangerous_configuration"] } scopeguard = { version = "1" } webpki = { version = "0.22", default-features = false, features = ["std"] } -winapi = { version = "0.3", default-features = false, features = ["basetsd", "consoleapi", "errhandlingapi", "fileapi", "handleapi", "impl-debug", "impl-default", "ioapiset", "knownfolders", "libloaderapi", "memoryapi", "minwinbase", "minwindef", "namedpipeapi", "ntsecapi", "ntstatus", "objbase", "processenv", "processthreadsapi", "psapi", "shellapi", "shlobj", "std", "stringapiset", "synchapi", "sysinfoapi", "timezoneapi", "winbase", "wincon", "winerror", "winnt", "winreg", "winuser", "ws2ipdef", "ws2tcpip", "wtypesbase"] } +winapi = { version = "0.3", default-features = false, features = ["basetsd", "consoleapi", "errhandlingapi", "fileapi", "handleapi", "impl-debug", "impl-default", "knownfolders", "minwinbase", "minwindef", "ntsecapi", "ntstatus", "objbase", "processenv", "shellapi", "shlobj", "std", "stringapiset", "synchapi", "sysinfoapi", "timezoneapi", "winbase", "wincon", "winerror", "winnt", "winreg", "winuser", "ws2ipdef", "ws2tcpip", "wtypesbase"] } windows-sys-53888c27b7ba5cf4 = { package = "windows-sys", version = "0.45", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_LibraryLoader", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_WindowsProgramming", "Win32_UI_Input_KeyboardAndMouse"] } windows-sys-c8eced492e86ede7 = { package = "windows-sys", version = "0.48", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_WindowsProgramming", "Win32_UI_Shell"] } @@ -212,7 +212,7 @@ windows-sys-c8eced492e86ede7 = { package = "windows-sys", version = "0.48", feat once_cell = { version = "1", default-features = false, features = ["unstable"] } scopeguard = { version = "1" } webpki = { version = "0.22", default-features = false, features = ["std"] } -winapi = { version = "0.3", default-features = false, features = ["basetsd", "consoleapi", "errhandlingapi", "fileapi", "handleapi", "impl-debug", "impl-default", "ioapiset", "knownfolders", "libloaderapi", "memoryapi", "minwinbase", "minwindef", "namedpipeapi", "ntsecapi", "ntstatus", "objbase", "processenv", "processthreadsapi", "psapi", "shellapi", "shlobj", "std", "stringapiset", "synchapi", "sysinfoapi", "timezoneapi", "winbase", "wincon", "winerror", "winnt", "winreg", "winuser", "ws2ipdef", "ws2tcpip", "wtypesbase"] } +winapi = { version = "0.3", default-features = false, features = ["basetsd", "consoleapi", "errhandlingapi", "fileapi", "handleapi", "impl-debug", "impl-default", "knownfolders", "minwinbase", "minwindef", "ntsecapi", "ntstatus", "objbase", "processenv", "shellapi", "shlobj", "std", "stringapiset", "synchapi", "sysinfoapi", "timezoneapi", "winbase", "wincon", "winerror", "winnt", "winreg", "winuser", "ws2ipdef", "ws2tcpip", "wtypesbase"] } windows-sys-53888c27b7ba5cf4 = { package = "windows-sys", version = "0.45", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_LibraryLoader", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_WindowsProgramming", "Win32_UI_Input_KeyboardAndMouse"] } windows-sys-c8eced492e86ede7 = { package = "windows-sys", version = "0.48", features = ["Win32_Foundation", "Win32_Networking_WinSock", "Win32_Security", "Win32_Storage_FileSystem", "Win32_System_Console", "Win32_System_IO", "Win32_System_Pipes", "Win32_System_SystemServices", "Win32_System_Threading", "Win32_System_WindowsProgramming", "Win32_UI_Shell"] }