diff --git a/.dockerignore b/.dockerignore index c5f51dc81c789..984013bc97e2a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ # macOS -.DS_Store +**/*.DS_Store # Visual Studio Code .vscode/ diff --git a/.gitattributes b/.gitattributes index 6c73bee6f834e..becfd0ec71edf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,7 +2,5 @@ src/tests/regress/data/** linguist-vendored # source test data scripts/source/test_data/** linguist-vendored -# generated proto for dashboard -dashboard/proto/gen/** linguist-generated # generated grafana dashboard grafana/risingwave-dashboard.json linguist-generated diff --git a/.github/workflows/connector-node-integration.yml b/.github/workflows/connector-node-integration.yml index 1b0a429006e22..dce7651cadbbf 100644 --- a/.github/workflows/connector-node-integration.yml +++ b/.github/workflows/connector-node-integration.yml @@ -3,7 +3,7 @@ name: Connector Node Integration tests on: push: branches: [main] - path: [java/**, proto/**] + paths: [java/**, proto/**] pull_request: branches: [main] paths: [java/**, proto/**] diff --git a/.github/workflows/dashboard_main.yml b/.github/workflows/dashboard_main.yml index b20fb0956d4a8..ee7e670bf4ec8 100644 --- a/.github/workflows/dashboard_main.yml +++ b/.github/workflows/dashboard_main.yml @@ -1,8 +1,8 @@ name: Dashboard (main) on: push: - branches: [main] - paths: [dashboard/**] + branches: [ main ] + paths: [ dashboard/** ] jobs: dashboard-ui-deploy: runs-on: ubuntu-latest @@ -11,6 +11,10 @@ jobs: - uses: actions/setup-node@v2 with: node-version: '18' + - uses: arduino/setup-protoc@v1 + with: + version: "3.x" + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: build working-directory: ./dashboard run: | diff --git a/.github/workflows/intergration_tests.yml b/.github/workflows/intergration_tests.yml index 106783e792d39..033425bbb9d57 100644 --- a/.github/workflows/intergration_tests.yml +++ b/.github/workflows/intergration_tests.yml @@ -4,6 +4,12 @@ on: schedule: # Currently we build docker images at 12:00 (UTC), so run this at 13:00 - cron: '0 13 * * *' + push: + branches: [main] + paths: [integration_tests/**] + pull_request: + branches: [main] + paths: [integration_tests/**] jobs: golangci: diff --git a/.gitignore b/.gitignore index 43da088879425..7766e090fb83c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # macOS -.DS_Store +**/*.DS_Store # Visual Studio Code .vscode/* diff --git a/Cargo.lock b/Cargo.lock index d1d774ee6437c..e1295d4674f56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,9 +85,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" dependencies = [ "backtrace", ] @@ -333,12 +333,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" dependencies = [ "event-listener", - "futures-lite", ] [[package]] @@ -408,9 +407,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.64" +version = "0.1.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" +checksum = "b84f9ebcc6c1f5b8cb160f6990096a5c127f423fcb6e1ccc46c370cbdfb75dfc" dependencies = [ "proc-macro2", "quote", @@ -445,32 +444,10 @@ dependencies = [ [[package]] name = "auto_enums" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0dfe45d75158751e195799f47ea02e81f570aa24bc5ef999cdd9e888c4b5c3" -dependencies = [ - "auto_enums_core", - "auto_enums_derive", -] - -[[package]] -name = "auto_enums_core" -version = "0.7.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da47c46001293a2c4b744d731958be22cff408a2ab76e2279328f9713b1267b4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "auto_enums_derive" -version = "0.7.12" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41aed1da83ecdc799503b7cb94da1b45a34d72b49caf40a61d9cf5b88ec07cfd" +checksum = "10143e1d6fc660ac7bfc268c6ec2f9699129a3cfbb241eed50393d1562e0a4ce" dependencies = [ - "autocfg", "derive_utils", "proc-macro2", "quote", @@ -885,13 +862,13 @@ dependencies = [ [[package]] name = "axum" -version = "0.6.8" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd379e511536bad07447f899300aa526e9bae8e6f66dc5e5ca45d7587b7c1ec" +checksum = "13d8068b6ccb8b34db9de397c7043f91db8b4c66414952c6db944f238c4d3db3" dependencies = [ "async-trait", "axum-core", - "bitflags", + "bitflags 1.3.2", "bytes", "futures-util", "http", @@ -911,16 +888,15 @@ dependencies = [ "sync_wrapper", "tokio", "tower", - "tower-http", "tower-layer", "tower-service", ] [[package]] name = "axum-core" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cae3e661676ffbacb30f1a824089a8c9150e71017f7e1e38f2aa32009188d34" +checksum = "b2f958c80c248b34b9a877a643811be8dbca03ca5ba827f2b63baf3a81e5fc4e" dependencies = [ "async-trait", "bytes", @@ -998,7 +974,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce860f38082f1544a557dfa447838143e1b0bfa061c0369e407ebadf640001d1" dependencies = [ "bcc-sys", - "bitflags", + "bitflags 1.3.2", "byteorder", "libc", "socket2", @@ -1032,6 +1008,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487f1e0fcbe47deb8b0574e646def1c903389d95241dd1bbcc6ce4a715dfc0c1" + [[package]] name = "bk-tree" version = "0.4.0" @@ -1044,9 +1026,9 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -1112,9 +1094,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" +checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", "serde", @@ -1128,19 +1110,20 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytecheck" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d11cac2c12b5adc6570dad2ee1b87eff4955dac476fe12d81e5fdd352e52406f" +checksum = "13fe11640a23eb24562225322cd3e452b93a3d4091d62fab69c70542fcd17d1f" dependencies = [ "bytecheck_derive", "ptr_meta", + "simdutf8", ] [[package]] name = "bytecheck_derive" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e576ebe98e605500b3c8041bb888e966653577172df6dd97398714eb30b9bf" +checksum = "e31225543cb46f81a7e224762764f4a6a0f097b1db0b175f69e8065efaa42de5" dependencies = [ "proc-macro2", "quote", @@ -1155,9 +1138,9 @@ checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" [[package]] name = "bytemuck" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" +checksum = "17febce684fd15d89027105661fec94afb475cb995fbc59d2865198446ba2eea" [[package]] name = "byteorder" @@ -1216,9 +1199,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6031a462f977dd38968b6f23378356512feeace69cef817e1a4475108093cec3" +checksum = "c530edf18f37068ac2d977409ed5cd50d53d73bc653c7647b48eb78976ac9ae2" dependencies = [ "serde", ] @@ -1280,9 +1263,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" dependencies = [ "iana-time-zone", "js-sys", @@ -1351,7 +1334,7 @@ version = "3.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" dependencies = [ - "bitflags", + "bitflags 1.3.2", "clap_lex 0.2.4", "indexmap", "textwrap", @@ -1359,13 +1342,13 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.8" +version = "4.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5" +checksum = "42dfd32784433290c51d92c438bb72ea5063797fc3cc9a21a8c4346bebbb2098" dependencies = [ - "bitflags", + "bitflags 2.0.2", "clap_derive", - "clap_lex 0.3.2", + "clap_lex 0.3.3", "is-terminal", "once_cell", "strsim", @@ -1374,9 +1357,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.1.8" +version = "4.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bec8e5c9d09e439c4335b1af0abaab56dcf3b94999a936e1bb47b9134288f0" +checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644" dependencies = [ "heck 0.4.1", "proc-macro-error", @@ -1396,9 +1379,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09" +checksum = "033f6b7a4acb1f358c742aaca805c939ee73b4c6209ae4318ec7aca81c42e646" dependencies = [ "os_str_bytes", ] @@ -1691,9 +1674,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" dependencies = [ "cfg-if", "crossbeam-utils", @@ -1701,9 +1684,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -1712,14 +1695,14 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.7.1", + "memoffset 0.8.0", "scopeguard", ] @@ -1735,9 +1718,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", ] @@ -1748,7 +1731,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossterm_winapi", "libc", "mio", @@ -1831,9 +1814,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.60+curl-7.88.1" +version = "0.4.61+curl-8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f" +checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" dependencies = [ "cc", "libc", @@ -1846,9 +1829,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" +checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" dependencies = [ "cc", "cxxbridge-flags", @@ -1858,9 +1841,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" +checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" dependencies = [ "cc", "codespan-reporting", @@ -1873,15 +1856,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" +checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" [[package]] name = "cxxbridge-macro" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" dependencies = [ "proc-macro2", "quote", @@ -1900,12 +1883,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" dependencies = [ - "darling_core 0.14.3", - "darling_macro 0.14.3", + "darling_core 0.14.4", + "darling_macro 0.14.4", ] [[package]] @@ -1924,9 +1907,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" dependencies = [ "fnv", "ident_case", @@ -1949,11 +1932,11 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ - "darling_core 0.14.3", + "darling_core 0.14.4", "quote", "syn", ] @@ -2057,7 +2040,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" dependencies = [ - "darling 0.14.3", + "darling 0.14.4", "proc-macro2", "quote", "syn", @@ -2075,9 +2058,9 @@ dependencies = [ [[package]] name = "derive_utils" -version = "0.11.2" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532b4c15dccee12c7044f1fcad956e98410860b22231e44a3b827464797ca7bf" +checksum = "7590f99468735a318c254ca9158d0c065aa9b5312896b5a043b5e39bc96f5fa2" dependencies = [ "proc-macro2", "quote", @@ -2174,9 +2157,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" +checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" [[package]] name = "easy-ext" @@ -2231,18 +2214,18 @@ dependencies = [ [[package]] name = "enum-iterator" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea166b3f7dc1032f7866d13f8d8e02c8d87507b61750176b86554964dc6a7bf" +checksum = "706d9e7cf1c7664859d79cd524e4e53ea2b67ea03c98cc2870c5e539695d597e" dependencies = [ "enum-iterator-derive", ] [[package]] name = "enum-iterator-derive" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "828de45d0ca18782232dfb8f3ea9cc428e8ced380eb26a520baaacfc70de39ce" +checksum = "355f93763ef7b0ae1c43c4d8eccc9d5848d84ad1a1d8ce61c421d1ac85a19d05" dependencies = [ "proc-macro2", "quote", @@ -2347,7 +2330,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "084632422a59165633e28f8436545a6694b3d659405ceb3be0a441d4bfbf25d1" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -2380,7 +2363,7 @@ version = "23.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77f5399c2c9c50ae9418e522842ad362f61ee48b346ac106807bd355a8a7c619" dependencies = [ - "bitflags", + "bitflags 1.3.2", "rustc_version", ] @@ -2475,9 +2458,9 @@ checksum = "673464e1e314dd67a0fd9544abc99e8eb28d0c7e3b69b033bcff9b2d00b87333" [[package]] name = "futures" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" +checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" dependencies = [ "futures-channel", "futures-core", @@ -2512,9 +2495,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" dependencies = [ "futures-core", "futures-sink", @@ -2522,15 +2505,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" [[package]] name = "futures-executor" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" +checksum = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83" dependencies = [ "futures-core", "futures-task", @@ -2539,9 +2522,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" +checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" [[package]] name = "futures-lite" @@ -2560,9 +2543,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ "proc-macro2", "quote", @@ -2571,15 +2554,15 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" [[package]] name = "futures-timer" @@ -2589,9 +2572,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" dependencies = [ "futures-channel", "futures-core", @@ -2787,9 +2770,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" dependencies = [ "bytes", "fnv", @@ -3004,9 +2987,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.24" +version = "0.14.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" dependencies = [ "bytes", "futures-channel", @@ -3132,9 +3115,9 @@ dependencies = [ [[package]] name = "indextree" -version = "4.5.0" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497f036ac2fae75c34224648a77802e5dd4e9cfb56f4713ab6b12b7160a0523b" +checksum = "c40411d0e5c63ef1323c3d09ce5ec6d84d71531e18daed0743fccea279d7deb6" [[package]] name = "indicatif" @@ -3189,10 +3172,11 @@ checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" [[package]] name = "io-lifetimes" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" dependencies = [ + "hermit-abi 0.3.1", "libc", "windows-sys 0.45.0", ] @@ -3205,9 +3189,9 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "8687c819457e979cc940d09cb16e42a1bf70aa6b60a549de6d3a62a0ee90c69e" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", @@ -3259,9 +3243,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jni" @@ -3285,9 +3269,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] @@ -3303,11 +3287,11 @@ dependencies = [ [[package]] name = "jsonwebtoken" -version = "8.2.0" +version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09f4f04699947111ec1733e71778d763555737579e44b85844cae8e1940a1828" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "pem", "ring", "serde", @@ -3423,9 +3407,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.139" +version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "libflate" @@ -3459,7 +3443,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7b603516767d1ab23d0de09d023e62966c3322f7148297c35cf3d97aa8b37fa" dependencies = [ - "clap 4.1.8", + "clap 4.1.11", "termcolor", "threadpool", ] @@ -3590,9 +3574,9 @@ dependencies = [ [[package]] name = "madsim" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3c98b41d46214f4ae435a95e246710ad7fb1100754f809dd7c18606a7607c4" +checksum = "c846a15d407458f1ac5da7da965810277229be9c96ed8082a3eaf2787ef81c23" dependencies = [ "ahash 0.7.6", "async-channel", @@ -3606,12 +3590,13 @@ dependencies = [ "madsim-macros", "naive-timer", "rand 0.8.5", + "rand_xoshiro", "rustversion", "serde", - "spin 0.9.5", + "spin 0.9.6", "tokio", "tokio-util", - "toml 0.7.2", + "toml 0.7.3", "tracing", "tracing-subscriber", ] @@ -3629,15 +3614,15 @@ dependencies = [ "bytes", "http", "madsim", - "spin 0.9.5", + "spin 0.9.6", "tracing", ] [[package]] name = "madsim-etcd-client" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb918383c4f5966f29760ec48820e1c2846739e4ae411c2a8aaa4466ce1421b7" +checksum = "72b3894525ac4b7d5732b2123f9d29d018005c96a218e5a7c38d1f42601b927d" dependencies = [ "etcd-client", "futures-util", @@ -3645,10 +3630,10 @@ dependencies = [ "madsim", "serde", "serde_with 2.3.1", - "spin 0.9.5", + "spin 0.9.6", "thiserror", "tokio", - "toml 0.7.2", + "toml 0.7.3", "tonic", "tracing", ] @@ -3659,7 +3644,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d248e97b1a48826a12c3828d921e8548e714394bf17274dd0a93910dc946e1" dependencies = [ - "darling 0.14.3", + "darling 0.14.4", "proc-macro2", "quote", "syn", @@ -3682,7 +3667,7 @@ dependencies = [ "serde_derive", "serde_json", "slab", - "spin 0.9.5", + "spin 0.9.6", "thiserror", "tokio", "tracing", @@ -3700,9 +3685,9 @@ dependencies = [ [[package]] name = "madsim-tonic" -version = "0.2.14" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420ca55ac297f5a3555cb03fdb085e7e91b1287dd872751a6b30dd3c3573277c" +checksum = "0a0d4e7468777e5885b6c3b88a97e3dd81547e0f3304324126c1a07ae89be470" dependencies = [ "async-stream", "chrono", @@ -3806,18 +3791,18 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" @@ -3837,25 +3822,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "minitrace" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a07fdf302cc0591c97eb45939550ddaddd9962e400c20b319aa16c244cb1f16" +checksum = "317e28b8c337ada2fd437611c241ce053d5b7f5480b79e945597996b87b1de96" dependencies = [ - "crossbeam", "futures", "minitrace-macro", "minstant", "once_cell", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "pin-project", - "retain_mut", ] [[package]] name = "minitrace-jaeger" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e130c7db911742ff545bb42d4d32c360cb272204ce021c50fd1c9f89fa65cf5b" +checksum = "7a5abe3273cd524b57b11925721595df5f8e957344c70e285a3a31c7e21523ac" dependencies = [ "async-std", "minitrace", @@ -3864,9 +3847,9 @@ dependencies = [ [[package]] name = "minitrace-macro" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4132dfe6097f4a90c0bbb34be0687c38d14303dd2e74f8442ae80e9bc5a34c47" +checksum = "77814d165883613a1846517efdc50b88fabd9c210b7ff4d3745b38b99d539652" dependencies = [ "proc-macro-error", "proc-macro2", @@ -3989,7 +3972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -4002,7 +3985,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "static_assertions", @@ -4018,15 +4001,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom8" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" -dependencies = [ - "memchr", -] - [[package]] name = "ntapi" version = "0.4.0" @@ -4186,7 +4160,7 @@ version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ - "proc-macro-crate 1.3.0", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn", @@ -4250,9 +4224,9 @@ checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] name = "opendal" -version = "0.30.1" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b63493afc5a8fb8cafbfa87118ffd0aea076935a7ae2375da9e03c1f49aaf3" +checksum = "ecd1bedb1311f05ef3a0cf6dbeb58ee0e01e75735d74003343c802d623b4c6d2" dependencies = [ "anyhow", "async-compat", @@ -4283,9 +4257,9 @@ dependencies = [ [[package]] name = "openidconnect" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a0f47b0f1499d08c4a8480c963d49c5ec77f4249c2b6869780979415f45809" +checksum = "98dd5b7049bac4fdd2233b8c9767d42c05da8006fdb79cc903258556d2b18009" dependencies = [ "base64 0.13.1", "chrono", @@ -4310,11 +4284,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.45" +version = "0.10.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", @@ -4342,18 +4316,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.25.0+1.1.1t" +version = "111.25.2+1.1.1t" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3173cd3626c43e3854b1b727422a276e568d9ec5fe8cec197822cf52cfb743d6" +checksum = "320708a054ad9b3bf314688b5db87cf4d6683d64cfc835e2337924ae62bf4431" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.80" +version = "0.9.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" dependencies = [ "autocfg", "cc", @@ -4464,9 +4438,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.1" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" [[package]] name = "ouroboros" @@ -4606,9 +4580,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "path-absolutize" @@ -4850,16 +4824,18 @@ dependencies = [ [[package]] name = "polling" -version = "2.5.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22122d5ec4f9fe1b3916419b76be1e80bcb93f618d071d2edf841b137b2a2bd6" +checksum = "7e1f879b2998099c2d69ab9605d145d5b661195627eccc680002c4918a7fb6fa" dependencies = [ "autocfg", + "bitflags 1.3.2", "cfg-if", + "concurrent-queue", "libc", "log", - "wepoll-ffi", - "windows-sys 0.42.0", + "pin-project-lite", + "windows-sys 0.45.0", ] [[package]] @@ -4970,6 +4946,12 @@ dependencies = [ "getopts", ] +[[package]] +name = "pretty-xmlish" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a14b10003fc996819269d0f74cc1c241707eec6d53f2bba6980758977ce386" + [[package]] name = "pretty_assertions" version = "1.3.0" @@ -4984,9 +4966,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.23" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" dependencies = [ "proc-macro2", "syn", @@ -5003,12 +4985,12 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit 0.18.1", + "toml_edit", ] [[package]] @@ -5056,7 +5038,7 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0941606b9934e2d98a3677759a971756eb821f75764d0e0d26946d08e74d9104" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "hex", "lazy_static", @@ -5069,7 +5051,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de8dacb0873f77e6aefc6d71e044761fcc68060290f5b1089fcdf84626bb69" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "hex", "lazy_static", @@ -5259,7 +5241,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" dependencies = [ - "bitflags", + "bitflags 1.3.2", "getopts", "memchr", "unicase", @@ -5335,6 +5317,16 @@ dependencies = [ "serde", ] +[[package]] +name = "quick-xml" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c1a97b1bc42b1d550bfb48d4262153fe400a12bab1511821736f7eac76d7e2" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quote" version = "1.0.23" @@ -5415,6 +5407,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "random-string" version = "1.0.0" @@ -5426,18 +5427,18 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "10.6.1" +version = "10.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c307f7aacdbab3f0adee67d52739a1d71112cc068d6fab169ddeb18e48877fad" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "rayon" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", @@ -5445,9 +5446,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -5489,7 +5490,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -5546,9 +5547,9 @@ dependencies = [ [[package]] name = "reqsign" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4d5fefeaaa1e64f4aabb79da4ea68bf6d0e7935ad927728280d2a8e95735fc" +checksum = "a7db6d8d2cd7fa61403d14de670f98d7cedac38143681c124943d7bb69258b3a" dependencies = [ "anyhow", "backon", @@ -5563,7 +5564,7 @@ dependencies = [ "log", "once_cell", "percent-encoding", - "quick-xml 0.27.1", + "quick-xml 0.28.1", "rand 0.8.5", "rsa", "rust-ini", @@ -5577,9 +5578,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "0ba30cc2c0cd02af1222ed216ba659cdb2f879dfe3181852fe7c50b1d0005949" dependencies = [ "base64 0.21.0", "bytes", @@ -5657,7 +5658,7 @@ version = "0.2.0-alpha" dependencies = [ "anyhow", "chrono", - "clap 4.1.8", + "clap 4.1.11", "console", "dialoguer", "enum-iterator", @@ -5703,7 +5704,7 @@ dependencies = [ name = "risingwave_backup_cmd" version = "0.2.0-alpha" dependencies = [ - "clap 4.1.8", + "clap 4.1.11", "madsim-tokio", "risingwave_backup", "risingwave_meta", @@ -5763,7 +5764,7 @@ dependencies = [ "bcc", "bytes", "bytesize", - "clap 4.1.8", + "clap 4.1.11", "futures", "hdrhistogram", "isahc", @@ -5780,7 +5781,7 @@ dependencies = [ "risingwave_storage", "serde", "tokio-stream", - "toml 0.5.11", + "toml 0.7.3", "tracing", "tracing-opentelemetry", "tracing-subscriber", @@ -5792,7 +5793,7 @@ name = "risingwave_cmd" version = "0.2.0-alpha" dependencies = [ "anyhow", - "clap 4.1.8", + "clap 4.1.11", "madsim-tokio", "risingwave_common", "risingwave_compactor", @@ -5812,7 +5813,7 @@ name = "risingwave_cmd_all" version = "0.2.0-alpha" dependencies = [ "anyhow", - "clap 4.1.8", + "clap 4.1.11", "console", "madsim-tokio", "risingwave_common", @@ -5840,12 +5841,12 @@ dependencies = [ "arrow-schema", "async-trait", "auto_enums", - "bitflags", + "bitflags 2.0.2", "byteorder", "bytes", "chrono", "chrono-tz", - "clap 4.1.8", + "clap 4.1.11", "comfy-table", "crc32fast", "criterion", @@ -5877,6 +5878,7 @@ dependencies = [ "prost 0.11.8", "rand 0.8.5", "regex", + "reqwest", "risingwave_pb", "rust_decimal", "ryu", @@ -5888,10 +5890,11 @@ dependencies = [ "sysinfo", "tempfile", "thiserror", - "toml 0.5.11", + "toml 0.7.3", "tracing", "twox-hash", "url", + "uuid", "workspace-hack", ] @@ -5932,7 +5935,7 @@ dependencies = [ "anyhow", "async-trait", "bytes", - "clap 4.1.8", + "clap 4.1.11", "futures", "itertools", "madsim-tokio", @@ -5956,8 +5959,9 @@ dependencies = [ name = "risingwave_compactor" version = "0.2.0-alpha" dependencies = [ + "anyhow", "async-trait", - "clap 4.1.8", + "clap 4.1.11", "madsim-tokio", "madsim-tonic", "prometheus", @@ -5969,6 +5973,8 @@ dependencies = [ "risingwave_pb", "risingwave_rpc_client", "risingwave_storage", + "serde", + "serde_json", "tracing", "workspace-hack", ] @@ -5980,7 +5986,7 @@ dependencies = [ "anyhow", "async-trait", "await-tree", - "clap 4.1.8", + "clap 4.1.11", "either", "futures", "futures-async-stream", @@ -6005,12 +6011,14 @@ dependencies = [ "risingwave_storage", "risingwave_stream", "risingwave_tracing", + "serde", "serde_json", "tempfile", "tikv-jemalloc-ctl", "tokio-stream", "tower", "tracing", + "uuid", "workspace-hack", ] @@ -6087,13 +6095,14 @@ dependencies = [ "anyhow", "bytes", "chrono", - "clap 4.1.8", + "clap 4.1.11", "comfy-table", "futures", "itertools", "madsim-tokio", "regex", "risingwave_common", + "risingwave_connector", "risingwave_frontend", "risingwave_hummock_sdk", "risingwave_object_store", @@ -6109,6 +6118,21 @@ dependencies = [ "workspace-hack", ] +[[package]] +name = "risingwave_e2e_extended_mode_test" +version = "0.2.0-alpha" +dependencies = [ + "anyhow", + "chrono", + "clap 4.1.11", + "pg_interval", + "rust_decimal", + "tokio", + "tokio-postgres", + "tracing", + "tracing-subscriber", +] + [[package]] name = "risingwave_expr" version = "0.2.0-alpha" @@ -6121,6 +6145,7 @@ dependencies = [ "chrono", "chrono-tz", "criterion", + "ctor", "dyn-clone", "either", "futures-util", @@ -6133,14 +6158,28 @@ dependencies = [ "paste", "regex", "risingwave_common", + "risingwave_expr_macro", "risingwave_pb", "risingwave_udf", + "serde_json", "speedate", "static_assertions", "thiserror", + "tracing", "workspace-hack", ] +[[package]] +name = "risingwave_expr_macro" +version = "0.1.0" +dependencies = [ + "itertools", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "risingwave_frontend" version = "0.2.0-alpha" @@ -6153,7 +6192,7 @@ dependencies = [ "async-trait", "bk-tree", "bytes", - "clap 4.1.8", + "clap 4.1.11", "derivative", "downcast-rs", "dyn-clone", @@ -6177,6 +6216,7 @@ dependencies = [ "pgwire", "pin-project-lite", "postgres-types", + "pretty-xmlish", "prometheus", "rand 0.8.5", "risingwave_batch", @@ -6281,7 +6321,7 @@ dependencies = [ "aws-sdk-ec2", "axum", "bytes", - "clap 4.1.8", + "clap 4.1.11", "crepe", "easy-ext", "either", @@ -6315,6 +6355,7 @@ dependencies = [ "risingwave_object_store", "risingwave_pb", "risingwave_rpc_client", + "risingwave_sqlparser", "risingwave_test_runner", "scopeguard", "serde", @@ -6354,7 +6395,7 @@ dependencies = [ "prometheus", "random-string", "risingwave_common", - "spin 0.9.5", + "spin 0.9.6", "tempfile", "thiserror", "tracing", @@ -6401,7 +6442,7 @@ name = "risingwave_regress_test" version = "0.2.0-alpha" dependencies = [ "anyhow", - "clap 4.1.8", + "clap 4.1.11", "madsim-tokio", "path-absolutize", "similar", @@ -6457,7 +6498,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "clap 4.1.8", + "clap 4.1.11", "console", "futures", "glob", @@ -6469,6 +6510,7 @@ dependencies = [ "madsim-rdkafka", "madsim-tokio", "paste", + "pin-project", "pretty_assertions", "rand 0.8.5", "risingwave_common", @@ -6545,7 +6587,7 @@ version = "0.2.0-alpha" dependencies = [ "anyhow", "chrono", - "clap 4.1.8", + "clap 4.1.11", "itertools", "libtest-mimic", "madsim-tokio", @@ -6568,7 +6610,7 @@ version = "0.2.0-alpha" dependencies = [ "anyhow", "chrono", - "clap 4.1.8", + "clap 4.1.11", "futures", "itertools", "madsim-tokio", @@ -6578,7 +6620,7 @@ dependencies = [ "serde_with 2.3.1", "tokio-postgres", "tokio-stream", - "toml 0.4.10", + "toml 0.7.3", "tracing", "workspace-hack", ] @@ -6594,6 +6636,7 @@ dependencies = [ "bytes", "criterion", "crossbeam", + "darwin-libproc", "dashmap", "dyn-clone", "enum-as-inner", @@ -6601,9 +6644,11 @@ dependencies = [ "fiemap", "futures", "futures-async-stream", + "hex", "itertools", "libc", "lz4", + "mach", "madsim-tokio", "memcomparable", "minitrace", @@ -6611,6 +6656,7 @@ dependencies = [ "moka", "nix 0.25.1", "parking_lot 0.12.1", + "procfs 0.12.0", "prometheus", "prost 0.11.8", "rand 0.8.5", @@ -6625,8 +6671,9 @@ dependencies = [ "risingwave_tracing", "scopeguard", "sled", - "spin 0.9.5", + "spin 0.9.6", "sync-point", + "sysinfo", "tempfile", "thiserror", "tokio-retry", @@ -6691,6 +6738,7 @@ dependencies = [ "tokio-metrics", "tokio-stream", "tracing", + "tracing-test", "workspace-hack", ] @@ -6763,9 +6811,9 @@ checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" [[package]] name = "rsa" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b3896c9b7790b70a9aa314a30e4ae114200992a19c96cbe0ca6070edd32ab8" +checksum = "55a77d189da1fee555ad95b7e50e7457d91c0e089ec68ca69ad2989413bbdab4" dependencies = [ "byteorder", "digest", @@ -6829,11 +6877,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.36.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -6876,15 +6924,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "same-file" @@ -6919,9 +6967,9 @@ dependencies = [ [[package]] name = "scheduled-thread-pool" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "977a7519bff143a44f842fd07e80ad1329295bd71686457f18e496736f4bf9bf" +checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" dependencies = [ "parking_lot 0.12.1", ] @@ -6940,9 +6988,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "sct" @@ -6966,7 +7014,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -6985,18 +7033,18 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.152" +version = "1.0.156" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4" dependencies = [ "serde_derive", ] @@ -7013,9 +7061,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.156" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d" dependencies = [ "proc-macro2", "quote", @@ -7024,9 +7072,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" dependencies = [ "itoa", "ryu", @@ -7035,9 +7083,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b04f22b563c91331a10074bda3dd5492e3cc39d56bd557e91c0af42b6c7341" +checksum = "db0969fff533976baadd92e08b1d102c5a3d8a8049eadfd69d4d1e3c5b2ed189" dependencies = [ "serde", ] @@ -7127,7 +7175,7 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7cbcd6104f8a4ab6af7f6be2a0da6be86b9de3c401f6e86bb856ab2af739232f" dependencies = [ - "darling 0.14.3", + "darling 0.14.4", "proc-macro2", "quote", "syn", @@ -7135,9 +7183,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.17" +version = "0.9.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb06d4b6cdaef0e0c51fa881acb721bed3c924cfaa71d9c94a3b771dfdf6567" +checksum = "f82e6c8c047aa50a7328632d067bcae6ef38772a79e28daf32f735e0e4f3dd10" dependencies = [ "indexmap", "itoa", @@ -7382,9 +7430,9 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -7408,9 +7456,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dccf47db1b41fa1573ed27ccf5e08e3ca771cb994f776668c5ebda893b248fc" +checksum = "b5d6e0250b93c8427a177b849d144a96d5acc57006149479403d7861ab721e34" dependencies = [ "lock_api", ] @@ -7573,7 +7621,7 @@ version = "0.1.0" dependencies = [ "futures-util", "madsim-tokio", - "spin 0.9.5", + "spin 0.9.6", "thiserror", ] @@ -7594,7 +7642,6 @@ dependencies = [ "libc", "ntapi", "once_cell", - "rayon", "winapi", ] @@ -7642,18 +7689,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", @@ -7705,12 +7752,12 @@ dependencies = [ [[package]] name = "thrift_codec" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb61fb3d0a0af14949f3a6949b2639112e13226647112824f4d081533f9b1a8" +checksum = "fce3200b189fd4733eb2bb22235755c8aa0361ba1c66b67db54893144d147279" dependencies = [ "byteorder", - "trackable 0.2.24", + "trackable", ] [[package]] @@ -7820,9 +7867,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.25.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" dependencies = [ "autocfg", "bytes", @@ -7836,7 +7883,7 @@ dependencies = [ "socket2", "tokio-macros", "tracing", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -7961,15 +8008,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.5.11" @@ -7981,22 +8019,16 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" dependencies = [ "serde", "serde_spanned", - "toml_datetime 0.6.1", - "toml_edit 0.19.4", + "toml_datetime", + "toml_edit", ] -[[package]] -name = "toml_datetime" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" - [[package]] name = "toml_datetime" version = "0.6.1" @@ -8008,25 +8040,14 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.18.1" +version = "0.19.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" -dependencies = [ - "indexmap", - "nom8", - "toml_datetime 0.5.1", -] - -[[package]] -name = "toml_edit" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" +checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" dependencies = [ "indexmap", "serde", "serde_spanned", - "toml_datetime 0.6.1", + "toml_datetime", "winnow", ] @@ -8105,7 +8126,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" dependencies = [ - "bitflags", + "bitflags 1.3.2", "bytes", "futures-core", "futures-util", @@ -8119,7 +8140,6 @@ dependencies = [ "pin-project-lite", "tokio", "tokio-util", - "tower", "tower-layer", "tower-service", ] @@ -8226,13 +8246,26 @@ dependencies = [ ] [[package]] -name = "trackable" -version = "0.2.24" +name = "tracing-test" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98abb9e7300b9ac902cc04920945a874c1973e08c310627cc4458c04b70dd32" +checksum = "3a2c0ff408fe918a94c428a3f2ad04e4afd5c95bbc08fcf868eff750c15728a4" dependencies = [ - "trackable 1.2.0", - "trackable_derive", + "lazy_static", + "tracing-core", + "tracing-subscriber", + "tracing-test-macro", +] + +[[package]] +name = "tracing-test-macro" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "258bc1c4f8e2e73a977812ab339d503e6feeb92700f6d07a6de4d321522d5c08" +dependencies = [ + "lazy_static", + "quote", + "syn", ] [[package]] @@ -8279,7 +8312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "rand 0.7.3", + "rand 0.8.5", "static_assertions", ] @@ -8320,15 +8353,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-normalization" @@ -8353,9 +8386,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unsafe-libyaml" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" +checksum = "ad2024452afd3874bf539695e04af6732ba06517424dbf958fdb16a01f3bef6c" [[package]] name = "untrusted" @@ -8456,12 +8489,11 @@ checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ "same-file", - "winapi", "winapi-util", ] @@ -8607,15 +8639,6 @@ dependencies = [ "webpki", ] -[[package]] -name = "wepoll-ffi" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" -dependencies = [ - "cc", -] - [[package]] name = "which" version = "4.4.0" @@ -8693,9 +8716,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -8708,51 +8731,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "winnow" -version = "0.3.3" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" +checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" dependencies = [ "memchr", ] @@ -8807,7 +8830,6 @@ dependencies = [ "anyhow", "arrayvec", "auto_enums", - "auto_enums_derive", "aws-sdk-s3", "aws-smithy-client", "aws-types", @@ -8815,7 +8837,7 @@ dependencies = [ "bytes", "cc", "chrono", - "clap 4.1.8", + "clap 4.1.11", "combine", "criterion", "crossbeam-channel", @@ -8872,6 +8894,7 @@ dependencies = [ "regex-syntax", "reqwest", "ring", + "rust_decimal", "scopeguard", "serde", "serde_json", @@ -8883,12 +8906,12 @@ dependencies = [ "syn", "time 0.3.17", "tokio", + "tokio-postgres", "tokio-stream", "tokio-util", "tonic", "tonic-build", "tower", - "tower-http", "tracing", "tracing-core", "tracing-futures", diff --git a/Cargo.toml b/Cargo.toml index 1be6dbbbc2884..640214a213d91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "src/connector", "src/ctl", "src/expr", + "src/expr/macro", "src/frontend", "src/frontend/planner_test", "src/java_binding", @@ -32,6 +33,7 @@ members = [ "src/stream", "src/test_runner", "src/tests/compaction_test", + "src/tests/e2e_extended_mode", "src/tests/regress", "src/tests/simulation", "src/tests/sqlsmith", diff --git a/Makefile.toml b/Makefile.toml index 3fd35d45138f5..027b1062afa88 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -22,6 +22,8 @@ env_scripts = [ ''' #!@duckscript +set_env ENABLE_TELEMETRY "false" + is_sanitizer_enabled = get_env ENABLE_SANITIZER is_all_in_one_enabled = get_env ENABLE_ALL_IN_ONE is_hdfs_backend = get_env ENABLE_HDFS @@ -164,7 +166,7 @@ script = ''' #!/usr/bin/env bash set -e -if [[ -z "$1" ]]; then +if [[ -z "$1" ]]; then echo "Please pass a parameter to this script, defining which logs you want to follow" echo "Available logs are..." ls ${PREFIX_LOG} @@ -176,7 +178,7 @@ if [[ ! -f ${PREFIX_LOG}/$1 ]]; then echo "Available logs are..." ls ${PREFIX_LOG} exit 1 -fi +fi tail -f -n 5 ${PREFIX_LOG}/$1 ''' @@ -369,7 +371,6 @@ cp "src/risedevtool/welcome.sh" "${PREFIX_BIN}/welcome.sh" category = "RiseDev - Components" description = "Download all available components at once" dependencies = [ - "download-connector", "download-maven", "download-etcd", "download-grafana", @@ -441,7 +442,7 @@ alias = "playground" [tasks.playground] category = "RiseDev - Start" description = "Start a lite RisingWave playground using risingwave all-in-one binary" -dependencies = ["download-connector"] +dependencies = ["build-connector-node"] script = ''' #!/usr/bin/env bash @@ -588,7 +589,7 @@ description = "Run unit tests" [tasks.build-connector-node] category = "RiseDev - Components" dependencies = ["prepare"] -condition = { env_set = [ "ENABLE_RW_CONNECTOR", "ENABLE_BUILD_RW_CONNECTOR"] } +condition = { env_set = ["ENABLE_BUILD_RW_CONNECTOR"] } description = "Build RisingWave Connector from source" script = ''' #!/usr/bin/env bash @@ -608,24 +609,24 @@ if [[ ! -f ${TARGET_PATH} ]] || [[ ! -z ${REBUILD_CONNECTOR_NODE} ]]; then cd "${JAVA_DIR}" "${MAVEN_PATH}" --batch-mode --update-snapshots clean package -Dmaven.test.skip else - echo "Connector node was built already. Skipped. Set REBUILD_CONNECTOR_NODE=1 to enable rebuild" + echo "$(tput setaf 4)$(tput bold)[Reminder]$(tput sgr0) Connector node was built already, skipped build. Set $(tput setaf 4)REBUILD_CONNECTOR_NODE=1$(tput sgr0) to enable rebuild" fi rm -rf ${PREFIX_BIN}/connector-node mkdir -p "${PREFIX_BIN}/connector-node" tar xf ${TARGET_PATH} -C "${PREFIX_BIN}/connector-node" ''' - [tasks.sbuild] category = "RiseDev - Build in simulation mode" description = "Build in simulation mode" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e cargo build \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ -p risingwave_batch \ -p risingwave_common \ -p risingwave_compute \ @@ -644,12 +645,13 @@ cargo build \ category = "RiseDev - Deterministic Simulation Test" description = "Run unit tests in deterministic simulation mode" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e cargo nextest run \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ -p risingwave_batch \ -p risingwave_common \ -p risingwave_compute \ @@ -668,12 +670,13 @@ cargo nextest run \ category = "RiseDev - Simulation scaling tests" description = "Run integration scaling tests in deterministic simulation mode" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e cargo nextest run \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ -p risingwave_simulation \ "$@" """ @@ -682,12 +685,13 @@ cargo nextest run \ category = "RiseDev - Simulation scaling tests" description = "Archive integration scaling tests in deterministic simulation mode" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e cargo nextest archive \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ -p risingwave_simulation \ --archive-file scale-test.tar.zst \ "$@" @@ -697,48 +701,58 @@ cargo nextest archive \ category = "RiseDev - Deterministic Simulation End-to-end Test" description = "Run cargo check in deterministic simulation mode" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e -cargo check -p risingwave_simulation --all-targets "$@" +cargo check \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ + -p risingwave_simulation --all-targets "$@" """ [tasks.sslt] category = "RiseDev - Deterministic Simulation End-to-end Test" description = "Run e2e tests in deterministic simulation mode" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e -cargo run -p risingwave_simulation "$@" +cargo run \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ + -p risingwave_simulation "$@" """ [tasks.sslt-build-all] category = "RiseDev - Deterministic Simulation End-to-end Test" description = "Build deterministic simulation runner and tests" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } +env = { CARGO_TARGET_DIR = "target/sim" } script = """ #!/usr/bin/env bash set -e -cargo build -p risingwave_simulation --tests "$@" +cargo build \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ + -p risingwave_simulation \ + --tests "$@" """ [tasks.sslt-cov] category = "RiseDev - Deterministic Simulation End-to-end Test" description = "Run e2e tests in deterministic simulation mode and report code coverage" dependencies = ["warn-on-missing-tools"] -env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim-cov" } +env = { CARGO_TARGET_DIR = "target/sim-cov" } script = """ #!/usr/bin/env bash set -e -cargo llvm-cov run -p risingwave_simulation --html "$@" +cargo llvm-cov run \ + --config "target.'cfg(all())'.rustflags = ['--cfg=madsim']" \ + -p risingwave_simulation \ + --html "$@" """ [tasks.check-java] @@ -757,7 +771,7 @@ else fi cd "${JAVA_DIR}" -"${MAVEN_PATH}" spotless:check +"${MAVEN_PATH}" spotless:check -q """ [tasks.check-java-fix] @@ -1054,3 +1068,14 @@ set -e cp -a .risingwave/rw-docker/* docker ''' + +[tasks.generate-example-config] +category = "misc" +description = "Generate default config and write to src/config/example.toml" +script = ''' +cat << EOF > src/config/example.toml +# This file is generated by ./risedev generate-example-config +# Check detailed comments in src/common/src/config.rs +EOF +cargo run --bin example-config >> src/config/example.toml +''' diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index d9c8a9fee0b9d..ca8e826cbf62b 100755 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -43,10 +43,11 @@ cargo build \ -p risingwave_compaction_test \ -p risingwave_backup_cmd \ -p risingwave_java_binding \ + -p risingwave_e2e_extended_mode_test \ --features "static-link static-log-level" --profile "$profile" # the file name suffix of artifact for risingwave_java_binding is so only for linux. It is dylib for MacOS -artifacts=(risingwave sqlsmith compaction-test backup-restore risingwave_regress_test risedev-dev delete-range-test librisingwave_java_binding.so) +artifacts=(risingwave sqlsmith compaction-test backup-restore risingwave_regress_test risingwave_e2e_extended_mode_test risedev-dev delete-range-test librisingwave_java_binding.so) echo "--- Show link info" ldd target/"$target"/risingwave diff --git a/ci/scripts/common.env.sh b/ci/scripts/common.env.sh index 31e95d47737c9..dbaded683b351 100644 --- a/ci/scripts/common.env.sh +++ b/ci/scripts/common.env.sh @@ -3,6 +3,8 @@ export PROTOC_NO_VENDOR=true export CARGO_HOME=/risingwave/.cargo export RISINGWAVE_CI=true export RUST_BACKTRACE=1 +export ENABLE_TELEMETRY=false + if [ -n "${BUILDKITE_COMMIT:-}" ]; then export GIT_SHA=$BUILDKITE_COMMIT fi diff --git a/ci/scripts/e2e-iceberg-sink-test.sh b/ci/scripts/e2e-iceberg-sink-test.sh index abdbd877574cb..99b417c0c4f85 100755 --- a/ci/scripts/e2e-iceberg-sink-test.sh +++ b/ci/scripts/e2e-iceberg-sink-test.sh @@ -25,8 +25,13 @@ echo "--- Download artifacts" mkdir -p target/debug buildkite-agent artifact download risingwave-"$profile" target/debug/ buildkite-agent artifact download risedev-dev-"$profile" target/debug/ +buildkite-agent artifact download librisingwave_java_binding.so-"$profile" target/debug mv target/debug/risingwave-"$profile" target/debug/risingwave mv target/debug/risedev-dev-"$profile" target/debug/risedev-dev +mv target/debug/librisingwave_java_binding.so-"$profile" target/debug/librisingwave_java_binding.so + +export RW_JAVA_BINDING_LIB_PATH=${PWD}/target/debug +export RW_CONNECTOR_RPC_SINK_PAYLOAD_FORMAT=stream_chunk echo "--- Download connector node package" buildkite-agent artifact download risingwave-connector.tar.gz ./ @@ -45,6 +50,7 @@ cargo make pre-start-dev cargo make link-all-in-one-binaries echo "--- starting risingwave cluster with connector node" +mkdir -p .risingwave/log ./connector-node/start-service.sh -p 50051 > .risingwave/log/connector-sink.log 2>&1 & cargo make ci-start ci-iceberg-test sleep 1 @@ -80,7 +86,7 @@ spark-3.3.1-bin-hadoop3/bin/spark-sql --packages $DEPENDENCIES \ # check sink destination using shell if cat ./spark-output/*.csv | sort | awk -F "," '{ -if ($1 == 1 && $2 == 2 && $3 == "1-2") c1++; +if ($1 == 1 && $2 == 50 && $3 == "1-50") c1++; if ($1 == 13 && $2 == 2 && $3 == "13-2") c2++; if ($1 == 21 && $2 == 2 && $3 == "21-2") c3++; if ($1 == 2 && $2 == 2 && $3 == "2-2") c4++; diff --git a/ci/scripts/e2e-sink-test.sh b/ci/scripts/e2e-sink-test.sh index 3e5328aa49ff3..2b481feb38de0 100755 --- a/ci/scripts/e2e-sink-test.sh +++ b/ci/scripts/e2e-sink-test.sh @@ -25,8 +25,14 @@ echo "--- Download artifacts" mkdir -p target/debug buildkite-agent artifact download risingwave-"$profile" target/debug/ buildkite-agent artifact download risedev-dev-"$profile" target/debug/ +buildkite-agent artifact download librisingwave_java_binding.so-"$profile" target/debug mv target/debug/risingwave-"$profile" target/debug/risingwave mv target/debug/risedev-dev-"$profile" target/debug/risedev-dev +mv target/debug/librisingwave_java_binding.so-"$profile" target/debug/librisingwave_java_binding.so + +export RW_JAVA_BINDING_LIB_PATH=${PWD}/target/debug +# TODO: Switch to stream_chunk encoding once it's completed, and then remove json encoding as well as this env var. +export RW_CONNECTOR_RPC_SINK_PAYLOAD_FORMAT=json echo "--- Download connector node package" buildkite-agent artifact download risingwave-connector.tar.gz ./ @@ -50,7 +56,7 @@ mysql --host=mysql --port=3306 -u root -p123456 -e "CREATE DATABASE IF NOT EXIST # grant access to `test` for ci test user mysql --host=mysql --port=3306 -u root -p123456 -e "GRANT ALL PRIVILEGES ON test.* TO 'mysqluser'@'%';" # create a table named t_remote -mysql --host=mysql --port=3306 -u root -p123456 -e "CREATE TABLE IF NOT EXISTS test.t_remote (id INT, name VARCHAR(255), PRIMARY KEY (id));" +mysql --host=mysql --port=3306 -u root -p123456 test < ./e2e_test/sink/remote/mysql_create_table.sql echo "--- preparing postgresql" @@ -60,11 +66,15 @@ export PGPASSWORD=postgres psql -h db -U postgres -c "CREATE ROLE test LOGIN SUPERUSER PASSWORD 'connector';" createdb -h db -U postgres test psql -h db -U postgres -d test -c "CREATE TABLE t4 (v1 int PRIMARY KEY, v2 int);" -psql -h db -U postgres -d test -c "CREATE TABLE t_remote (id serial PRIMARY KEY, name VARCHAR (50) NOT NULL);" +psql -h db -U postgres -d test < ./e2e_test/sink/remote/pg_create_table.sql node_port=50051 node_timeout=10 -./connector-node/start-service.sh -p $node_port > .risingwave/log/connector-source.log 2>&1 & + +echo "--- starting risingwave cluster with connector node" +cargo make ci-start ci-1cn-1fe +./connector-node/start-service.sh -p $node_port > .risingwave/log/connector-node.log 2>&1 & + echo "waiting for connector node to start" start_time=$(date +%s) while : @@ -83,34 +93,28 @@ do sleep 0.1 done -echo "--- starting risingwave cluster with connector node" -cargo make ci-start ci-1cn-1fe echo "--- testing sinks" sqllogictest -p 4566 -d dev './e2e_test/sink/append_only_sink.slt' -# sqllogictest -p 4566 -d dev './e2e_test/sink/create_sink_as.slt' +sqllogictest -p 4566 -d dev './e2e_test/sink/create_sink_as.slt' sqllogictest -p 4566 -d dev './e2e_test/sink/blackhole_sink.slt' sleep 1 # check sink destination postgres -# sqllogictest -p 4566 -d dev './e2e_test/sink/remote/jdbc.load.slt' -# sleep 1 -# sqllogictest -h db -p 5432 -d test './e2e_test/sink/remote/jdbc.check.pg.slt' -# sleep 1 +sqllogictest -p 4566 -d dev './e2e_test/sink/remote/jdbc.load.slt' +sleep 1 +sqllogictest -h db -p 5432 -d test './e2e_test/sink/remote/jdbc.check.pg.slt' +sleep 1 # check sink destination mysql using shell -# if mysql --host=mysql --port=3306 -u root -p123456 -sN -e "SELECT * FROM test.t_remote ORDER BY id;" | awk '{ -# if ($1 == 1 && $2 == "Alex") c1++; -# if ($1 == 3 && $2 == "Carl") c2++; -# if ($1 == 4 && $2 == "Doris") c3++; -# if ($1 == 5 && $2 == "Eve") c4++; -# if ($1 == 6 && $2 == "Frank") c5++; } -# END { exit !(c1 == 1 && c2 == 1 && c3 == 1 && c4 == 1 && c5 == 1); }'; then -# echo "mysql sink check passed" -# else -# echo "The output is not as expected." -# exit 1 -# fi +diff -u ./e2e_test/sink/remote/mysql_expected_result.tsv \ +<(mysql --host=mysql --port=3306 -u root -p123456 -s -N -r test -e "SELECT * FROM test.t_remote ORDER BY id") +if [ $? -eq 0 ]; then + echo "mysql sink check passed" +else + echo "The output is not as expected." + exit 1 +fi echo "--- Kill cluster" pkill -f connector-node diff --git a/ci/scripts/e2e-source-test.sh b/ci/scripts/e2e-source-test.sh index 010ee0f4ce94a..f3040da60968a 100755 --- a/ci/scripts/e2e-source-test.sh +++ b/ci/scripts/e2e-source-test.sh @@ -6,7 +6,7 @@ set -euo pipefail source ci/scripts/common.env.sh # prepare environment -export CONNECTOR_RPC_ENDPOINT="localhost:60061" +export CONNECTOR_RPC_ENDPOINT="localhost:50051" while getopts 'p:' opt; do case ${opt} in @@ -28,8 +28,12 @@ echo "--- Download artifacts" mkdir -p target/debug buildkite-agent artifact download risingwave-"$profile" target/debug/ buildkite-agent artifact download risedev-dev-"$profile" target/debug/ +buildkite-agent artifact download librisingwave_java_binding.so-"$profile" target/debug mv target/debug/risingwave-"$profile" target/debug/risingwave mv target/debug/risedev-dev-"$profile" target/debug/risedev-dev +mv target/debug/librisingwave_java_binding.so-"$profile" target/debug/librisingwave_java_binding.so + +export RW_JAVA_BINDING_LIB_PATH=${PWD}/target/debug echo "--- Download connector node package" @@ -65,7 +69,10 @@ psql -h db -U postgres -d cdc_test < ./e2e_test/source/cdc/postgres_cdc.sql node_port=50051 node_timeout=10 -./connector-node/start-service.sh -p $node_port > .risingwave/log/connector-source.log 2>&1 & + +echo "--- starting risingwave cluster with connector node" +cargo make ci-start ci-1cn-1fe-with-recovery +./connector-node/start-service.sh -p $node_port > .risingwave/log/connector-node.log 2>&1 & echo "waiting for connector node to start" start_time=$(date +%s) @@ -84,9 +91,6 @@ do fi sleep 0.1 done - -# start risingwave cluster -cargo make ci-start ci-1cn-1fe-with-recovery sleep 2 echo "---- mysql & postgres cdc validate test" diff --git a/ci/scripts/run-e2e-test.sh b/ci/scripts/run-e2e-test.sh index cc29af13c2fdf..2140503ba1915 100755 --- a/ci/scripts/run-e2e-test.sh +++ b/ci/scripts/run-e2e-test.sh @@ -24,12 +24,15 @@ mkdir -p target/debug buildkite-agent artifact download risingwave-"$profile" target/debug/ buildkite-agent artifact download risedev-dev-"$profile" target/debug/ buildkite-agent artifact download "e2e_test/generated/*" ./ +buildkite-agent artifact download risingwave_e2e_extended_mode_test-"$profile" target/debug/ mv target/debug/risingwave-"$profile" target/debug/risingwave mv target/debug/risedev-dev-"$profile" target/debug/risedev-dev +mv target/debug/risingwave_e2e_extended_mode_test-"$profile" target/debug/risingwave_e2e_extended_mode_test echo "--- Adjust permission" chmod +x ./target/debug/risingwave chmod +x ./target/debug/risedev-dev +chmod +x ./target/debug/risingwave_e2e_extended_mode_test echo "--- Generate RiseDev CI config" cp ci/risedev-components.ci.env risedev-components.user.env @@ -75,7 +78,10 @@ cargo make ci-kill echo "--- e2e, ci-3cn-1fe, extended query" RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \ cargo make ci-start ci-3cn-1fe -sqllogictest -p 4566 -d dev -e postgres-extended './e2e_test/extended_query/**/*.slt' +sqllogictest -p 4566 -d dev -e postgres-extended './e2e_test/extended_mode/**/*.slt' +RUST_BACKTRACE=1 target/debug/risingwave_e2e_extended_mode_test --host 127.0.0.1 \ + -p 4566 \ + -u root echo "--- Kill cluster" cargo make ci-kill diff --git a/ci/scripts/s3-source-test-for-opendal-fs-engine.sh b/ci/scripts/s3-source-test-for-opendal-fs-engine.sh new file mode 100755 index 0000000000000..20fd77483a7a9 --- /dev/null +++ b/ci/scripts/s3-source-test-for-opendal-fs-engine.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source ci/scripts/common.env.sh + +while getopts 'p:s:' opt; do + case ${opt} in + p ) + profile=$OPTARG + ;; + s ) + script=$OPTARG + ;; + \? ) + echo "Invalid Option: -$OPTARG" 1>&2 + exit 1 + ;; + : ) + echo "Invalid option: $OPTARG requires an argument" 1>&2 + ;; + esac +done +shift $((OPTIND -1)) + + + +echo "--- Download artifacts" +mkdir -p target/debug +buildkite-agent artifact download risingwave-"$profile" target/debug/ +buildkite-agent artifact download risedev-dev-"$profile" target/debug/ + +mv target/debug/risingwave-"$profile" target/debug/risingwave +mv target/debug/risedev-dev-"$profile" target/debug/risedev-dev + +echo "--- Adjust permission" +chmod +x ./target/debug/risingwave +chmod +x ./target/debug/risedev-dev + +echo "--- Generate RiseDev CI config" +cp ci/risedev-components.ci.env risedev-components.user.env + +echo "--- Prepare RiseDev dev cluster" +cargo make pre-start-dev +cargo make link-all-in-one-binaries + +echo "--- starting risingwave cluster with connector node" +cargo make ci-start ci-3cn-3fe-opendal-fs-backend + +echo "--- Run test" +python3 -m pip install minio psycopg2-binary +python3 e2e_test/s3/$script.py + +echo "--- Kill cluster" +rm -rf /tmp/rw_ci +cargo make ci-kill diff --git a/ci/workflows/main-cron.yml b/ci/workflows/main-cron.yml index 5a139ee74d819..88854253efeda 100644 --- a/ci/workflows/main-cron.yml +++ b/ci/workflows/main-cron.yml @@ -215,6 +215,7 @@ steps: - S3_SOURCE_TEST_CONF timeout_in_minutes: 20 retry: *auto-retry + - label: "S3 source check on AWS (csv parser)" command: "ci/scripts/s3-source-test.sh -p ci-release -s run_csv" depends_on: build @@ -229,4 +230,20 @@ steps: environment: - S3_SOURCE_TEST_CONF timeout_in_minutes: 20 + retry: *auto-retry + + - label: "S3 source on OpenDAL fs engine" + command: "ci/scripts/s3-source-test-for-opendal-fs-engine.sh -p ci-release -s run" + depends_on: build + plugins: + - seek-oss/aws-sm#v2.3.1: + env: + S3_SOURCE_TEST_CONF: ci_s3_source_test_aws + - docker-compose#v4.9.0: + run: rw-build-env + config: ci/docker-compose.yml + mount-buildkite-agent: true + environment: + - S3_SOURCE_TEST_CONF + timeout_in_minutes: 20 retry: *auto-retry \ No newline at end of file diff --git a/ci/workflows/pull-request.yml b/ci/workflows/pull-request.yml index 71cf0190dc021..3a3d147aa78d8 100644 --- a/ci/workflows/pull-request.yml +++ b/ci/workflows/pull-request.yml @@ -297,7 +297,7 @@ steps: retry: *auto-retry - label: "recovery test (deterministic simulation)" - command: "TEST_NUM=8 KILL_RATE=0.5 timeout 14m ci/scripts/deterministic-recovery-test.sh" + command: "TEST_NUM=8 KILL_RATE=0.5 timeout 20m ci/scripts/deterministic-recovery-test.sh" depends_on: "build-simulation" plugins: - gencer/cache#v2.4.10: *cargo-cache @@ -312,7 +312,7 @@ steps: # files: "*-junit.xml" # format: "junit" - ./ci/plugins/upload-failure-logs - timeout_in_minutes: 15 + timeout_in_minutes: 18 retry: *auto-retry - label: "misc check" diff --git a/dashboard/.gitignore b/dashboard/.gitignore index 922d92a5745e8..7d340654380ed 100644 --- a/dashboard/.gitignore +++ b/dashboard/.gitignore @@ -16,10 +16,13 @@ /build # misc -.DS_Store +**/*.DS_Store .env* # debug npm-debug.log* yarn-debug.log* yarn-error.log* + +# generated proto +proto/gen diff --git a/dashboard/README.md b/dashboard/README.md index 5a0b9facf75a7..28a9c29f4c6e8 100644 --- a/dashboard/README.md +++ b/dashboard/README.md @@ -1,11 +1,15 @@ +# Dashboard + The framework: [Next.js](https://nextjs.org). Next.js supports SPA, SSG and SSR. With this feature, the dashboard ui can be deployed in + 1. Standalone machine serving only dashboard UI with a backend. (e.g. Dashboard for cloud product) 2. Meta service node. (e.g. Static HTML files integrated in meta service without any other dependencies like node.js) ## Files -``` + +```plain dashboard/ --.next/ (generated by nextjs) --node_modules/ (development dependencies) @@ -19,47 +23,67 @@ dashboard/ ``` ## Testing + TODO: Find a suitable testing framework ## Development + Start the RisingWave database, remove drop tables from `tpch_snapshot.slt` + ```bash ./risedev d sqllogictest -p 4566 -d dev './e2e_test/streaming/tpch_snapshot.slt' ``` + Install Dependencies. + ```bash npm i ``` + The website will be served at port 3000. + ```bash npm run dev ``` + You should also run: -``` + +```bash node mock-server.js ``` + To start a mock API server when developing. You can use `fetch.sh` to update the mock APIs. ## Test with RisingWave meta node -To replace the built static files in RisingWave with your newest code, + +To replace the built static files in RisingWave with your newest code, run the following scripts in the root directory. -``` + +```bash ./risedev export-dashboard-v2 ``` - ## Deployment -#### Static HTML files + +### Generate the protos + +Running `npm i` will generate the proto files under `proto/gen` automatically. In case there are modifications to the protos, you can regenerate them using the command npm run gen-proto. + +### Static HTML files + Build static files for standalone deployment without node.js. The built files are generated at `./out`. Check more details at [Static HTML Export](https://nextjs.org/docs/advanced-features/static-html-export). + ```bash npm run build-static ``` #### Next.js app + The built files are generated at `./.next`. + ```bash npm run build npm run start -``` \ No newline at end of file +``` diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json index 2d741cd099d19..5c5842cdca159 100644 --- a/dashboard/package-lock.json +++ b/dashboard/package-lock.json @@ -4,6 +4,7 @@ "requires": true, "packages": { "": { + "hasInstallScript": true, "dependencies": { "@chakra-ui/react": "^2.3.1", "@emotion/react": "^11.10.4", diff --git a/dashboard/package.json b/dashboard/package.json index dd50d36471ce6..f809ce3117097 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -8,7 +8,8 @@ "gen-proto": "./scripts/generate_proto.sh", "lint": "prettier --check . && next lint", "format": "prettier --write . && next lint --fix", - "mock-server": "node ./mock-server.js" + "mock-server": "node ./mock-server.js", + "postinstall": "npm run gen-proto" }, "dependencies": { "@chakra-ui/react": "^2.3.1", diff --git a/dashboard/proto/gen/backup_service.ts b/dashboard/proto/gen/backup_service.ts deleted file mode 100644 index a30c09c2ae231..0000000000000 --- a/dashboard/proto/gen/backup_service.ts +++ /dev/null @@ -1,390 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "backup_service"; - -export const BackupJobStatus = { - UNSPECIFIED: "UNSPECIFIED", - RUNNING: "RUNNING", - SUCCEEDED: "SUCCEEDED", - /** - * NOT_FOUND - NOT_FOUND indicates one of these cases: - * - Invalid job id. - * - Job has failed. - * - Job has succeeded, but its resulted backup has been deleted later. - */ - NOT_FOUND: "NOT_FOUND", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type BackupJobStatus = typeof BackupJobStatus[keyof typeof BackupJobStatus]; - -export function backupJobStatusFromJSON(object: any): BackupJobStatus { - switch (object) { - case 0: - case "UNSPECIFIED": - return BackupJobStatus.UNSPECIFIED; - case 1: - case "RUNNING": - return BackupJobStatus.RUNNING; - case 2: - case "SUCCEEDED": - return BackupJobStatus.SUCCEEDED; - case 3: - case "NOT_FOUND": - return BackupJobStatus.NOT_FOUND; - case -1: - case "UNRECOGNIZED": - default: - return BackupJobStatus.UNRECOGNIZED; - } -} - -export function backupJobStatusToJSON(object: BackupJobStatus): string { - switch (object) { - case BackupJobStatus.UNSPECIFIED: - return "UNSPECIFIED"; - case BackupJobStatus.RUNNING: - return "RUNNING"; - case BackupJobStatus.SUCCEEDED: - return "SUCCEEDED"; - case BackupJobStatus.NOT_FOUND: - return "NOT_FOUND"; - case BackupJobStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface MetaBackupManifestId { - id: number; -} - -export interface BackupMetaRequest { -} - -export interface BackupMetaResponse { - jobId: number; -} - -export interface GetBackupJobStatusRequest { - jobId: number; -} - -export interface GetBackupJobStatusResponse { - jobId: number; - jobStatus: BackupJobStatus; -} - -export interface DeleteMetaSnapshotRequest { - snapshotIds: number[]; -} - -export interface DeleteMetaSnapshotResponse { -} - -export interface GetMetaSnapshotManifestRequest { -} - -export interface GetMetaSnapshotManifestResponse { - manifest: MetaSnapshotManifest | undefined; -} - -export interface MetaSnapshotManifest { - manifestId: number; - snapshotMetadata: MetaSnapshotMetadata[]; -} - -export interface MetaSnapshotMetadata { - id: number; - hummockVersionId: number; - maxCommittedEpoch: number; - safeEpoch: number; -} - -function createBaseMetaBackupManifestId(): MetaBackupManifestId { - return { id: 0 }; -} - -export const MetaBackupManifestId = { - fromJSON(object: any): MetaBackupManifestId { - return { id: isSet(object.id) ? Number(object.id) : 0 }; - }, - - toJSON(message: MetaBackupManifestId): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - return obj; - }, - - fromPartial, I>>(object: I): MetaBackupManifestId { - const message = createBaseMetaBackupManifestId(); - message.id = object.id ?? 0; - return message; - }, -}; - -function createBaseBackupMetaRequest(): BackupMetaRequest { - return {}; -} - -export const BackupMetaRequest = { - fromJSON(_: any): BackupMetaRequest { - return {}; - }, - - toJSON(_: BackupMetaRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): BackupMetaRequest { - const message = createBaseBackupMetaRequest(); - return message; - }, -}; - -function createBaseBackupMetaResponse(): BackupMetaResponse { - return { jobId: 0 }; -} - -export const BackupMetaResponse = { - fromJSON(object: any): BackupMetaResponse { - return { jobId: isSet(object.jobId) ? Number(object.jobId) : 0 }; - }, - - toJSON(message: BackupMetaResponse): unknown { - const obj: any = {}; - message.jobId !== undefined && (obj.jobId = Math.round(message.jobId)); - return obj; - }, - - fromPartial, I>>(object: I): BackupMetaResponse { - const message = createBaseBackupMetaResponse(); - message.jobId = object.jobId ?? 0; - return message; - }, -}; - -function createBaseGetBackupJobStatusRequest(): GetBackupJobStatusRequest { - return { jobId: 0 }; -} - -export const GetBackupJobStatusRequest = { - fromJSON(object: any): GetBackupJobStatusRequest { - return { jobId: isSet(object.jobId) ? Number(object.jobId) : 0 }; - }, - - toJSON(message: GetBackupJobStatusRequest): unknown { - const obj: any = {}; - message.jobId !== undefined && (obj.jobId = Math.round(message.jobId)); - return obj; - }, - - fromPartial, I>>(object: I): GetBackupJobStatusRequest { - const message = createBaseGetBackupJobStatusRequest(); - message.jobId = object.jobId ?? 0; - return message; - }, -}; - -function createBaseGetBackupJobStatusResponse(): GetBackupJobStatusResponse { - return { jobId: 0, jobStatus: BackupJobStatus.UNSPECIFIED }; -} - -export const GetBackupJobStatusResponse = { - fromJSON(object: any): GetBackupJobStatusResponse { - return { - jobId: isSet(object.jobId) ? Number(object.jobId) : 0, - jobStatus: isSet(object.jobStatus) ? backupJobStatusFromJSON(object.jobStatus) : BackupJobStatus.UNSPECIFIED, - }; - }, - - toJSON(message: GetBackupJobStatusResponse): unknown { - const obj: any = {}; - message.jobId !== undefined && (obj.jobId = Math.round(message.jobId)); - message.jobStatus !== undefined && (obj.jobStatus = backupJobStatusToJSON(message.jobStatus)); - return obj; - }, - - fromPartial, I>>(object: I): GetBackupJobStatusResponse { - const message = createBaseGetBackupJobStatusResponse(); - message.jobId = object.jobId ?? 0; - message.jobStatus = object.jobStatus ?? BackupJobStatus.UNSPECIFIED; - return message; - }, -}; - -function createBaseDeleteMetaSnapshotRequest(): DeleteMetaSnapshotRequest { - return { snapshotIds: [] }; -} - -export const DeleteMetaSnapshotRequest = { - fromJSON(object: any): DeleteMetaSnapshotRequest { - return { snapshotIds: Array.isArray(object?.snapshotIds) ? object.snapshotIds.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: DeleteMetaSnapshotRequest): unknown { - const obj: any = {}; - if (message.snapshotIds) { - obj.snapshotIds = message.snapshotIds.map((e) => Math.round(e)); - } else { - obj.snapshotIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DeleteMetaSnapshotRequest { - const message = createBaseDeleteMetaSnapshotRequest(); - message.snapshotIds = object.snapshotIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDeleteMetaSnapshotResponse(): DeleteMetaSnapshotResponse { - return {}; -} - -export const DeleteMetaSnapshotResponse = { - fromJSON(_: any): DeleteMetaSnapshotResponse { - return {}; - }, - - toJSON(_: DeleteMetaSnapshotResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): DeleteMetaSnapshotResponse { - const message = createBaseDeleteMetaSnapshotResponse(); - return message; - }, -}; - -function createBaseGetMetaSnapshotManifestRequest(): GetMetaSnapshotManifestRequest { - return {}; -} - -export const GetMetaSnapshotManifestRequest = { - fromJSON(_: any): GetMetaSnapshotManifestRequest { - return {}; - }, - - toJSON(_: GetMetaSnapshotManifestRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetMetaSnapshotManifestRequest { - const message = createBaseGetMetaSnapshotManifestRequest(); - return message; - }, -}; - -function createBaseGetMetaSnapshotManifestResponse(): GetMetaSnapshotManifestResponse { - return { manifest: undefined }; -} - -export const GetMetaSnapshotManifestResponse = { - fromJSON(object: any): GetMetaSnapshotManifestResponse { - return { manifest: isSet(object.manifest) ? MetaSnapshotManifest.fromJSON(object.manifest) : undefined }; - }, - - toJSON(message: GetMetaSnapshotManifestResponse): unknown { - const obj: any = {}; - message.manifest !== undefined && - (obj.manifest = message.manifest ? MetaSnapshotManifest.toJSON(message.manifest) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetMetaSnapshotManifestResponse { - const message = createBaseGetMetaSnapshotManifestResponse(); - message.manifest = (object.manifest !== undefined && object.manifest !== null) - ? MetaSnapshotManifest.fromPartial(object.manifest) - : undefined; - return message; - }, -}; - -function createBaseMetaSnapshotManifest(): MetaSnapshotManifest { - return { manifestId: 0, snapshotMetadata: [] }; -} - -export const MetaSnapshotManifest = { - fromJSON(object: any): MetaSnapshotManifest { - return { - manifestId: isSet(object.manifestId) ? Number(object.manifestId) : 0, - snapshotMetadata: Array.isArray(object?.snapshotMetadata) - ? object.snapshotMetadata.map((e: any) => MetaSnapshotMetadata.fromJSON(e)) - : [], - }; - }, - - toJSON(message: MetaSnapshotManifest): unknown { - const obj: any = {}; - message.manifestId !== undefined && (obj.manifestId = Math.round(message.manifestId)); - if (message.snapshotMetadata) { - obj.snapshotMetadata = message.snapshotMetadata.map((e) => e ? MetaSnapshotMetadata.toJSON(e) : undefined); - } else { - obj.snapshotMetadata = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshotManifest { - const message = createBaseMetaSnapshotManifest(); - message.manifestId = object.manifestId ?? 0; - message.snapshotMetadata = object.snapshotMetadata?.map((e) => MetaSnapshotMetadata.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMetaSnapshotMetadata(): MetaSnapshotMetadata { - return { id: 0, hummockVersionId: 0, maxCommittedEpoch: 0, safeEpoch: 0 }; -} - -export const MetaSnapshotMetadata = { - fromJSON(object: any): MetaSnapshotMetadata { - return { - id: isSet(object.id) ? Number(object.id) : 0, - hummockVersionId: isSet(object.hummockVersionId) ? Number(object.hummockVersionId) : 0, - maxCommittedEpoch: isSet(object.maxCommittedEpoch) ? Number(object.maxCommittedEpoch) : 0, - safeEpoch: isSet(object.safeEpoch) ? Number(object.safeEpoch) : 0, - }; - }, - - toJSON(message: MetaSnapshotMetadata): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.hummockVersionId !== undefined && (obj.hummockVersionId = Math.round(message.hummockVersionId)); - message.maxCommittedEpoch !== undefined && (obj.maxCommittedEpoch = Math.round(message.maxCommittedEpoch)); - message.safeEpoch !== undefined && (obj.safeEpoch = Math.round(message.safeEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshotMetadata { - const message = createBaseMetaSnapshotMetadata(); - message.id = object.id ?? 0; - message.hummockVersionId = object.hummockVersionId ?? 0; - message.maxCommittedEpoch = object.maxCommittedEpoch ?? 0; - message.safeEpoch = object.safeEpoch ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/batch_plan.ts b/dashboard/proto/gen/batch_plan.ts deleted file mode 100644 index 73420d1086fd6..0000000000000 --- a/dashboard/proto/gen/batch_plan.ts +++ /dev/null @@ -1,2472 +0,0 @@ -/* eslint-disable */ -import { StreamSourceInfo } from "./catalog"; -import { - BatchQueryEpoch, - Buffer, - ColumnOrder, - Direction, - directionFromJSON, - directionToJSON, - HostAddress, - WorkerNode, -} from "./common"; -import { IntervalUnit } from "./data"; -import { AggCall, ExprNode, ProjectSetSelectItem, TableFunction } from "./expr"; -import { - ColumnCatalog, - ColumnDesc, - Field, - JoinType, - joinTypeFromJSON, - joinTypeToJSON, - StorageTableDesc, -} from "./plan_common"; - -export const protobufPackage = "batch_plan"; - -export interface RowSeqScanNode { - tableDesc: StorageTableDesc | undefined; - columnIds: number[]; - /** - * All the ranges need to be read. i.e., they are OR'ed. - * - * Empty `scan_ranges` means full table scan. - */ - scanRanges: ScanRange[]; - /** - * The partition to read for scan tasks. - * - * Will be filled by the scheduler. - */ - vnodeBitmap: - | Buffer - | undefined; - /** Whether the order on output columns should be preserved. */ - ordered: boolean; - /** If along with `batch_limit`, `chunk_size` will be set. */ - chunkSize: RowSeqScanNode_ChunkSize | undefined; -} - -export interface RowSeqScanNode_ChunkSize { - chunkSize: number; -} - -export interface SysRowSeqScanNode { - tableId: number; - columnDescs: ColumnDesc[]; -} - -/** - * The range to scan, which specifies a consecutive range of the PK - * and can represent: (Suppose there are N columns in the PK) - * - full table scan: Should not occur. Use an empty `Vec` instead. - * - index range scan: `eq_conds` includes i (between 0 and N-1, inclusive) values, - * and `lower_bound` & `upper_bound` is the range for the (i+1)th column - * - index point get: `eq_conds` includes N values, and `lower_bound` & `upper_bound` are `None` - */ -export interface ScanRange { - /** The i-th element represents the value of the i-th PK column. */ - eqConds: Uint8Array[]; - /** The lower bound of the next PK column subsequent to those in `eq_conds`. */ - lowerBound: - | ScanRange_Bound - | undefined; - /** The upper bound of the next PK column subsequent to those in `eq_conds`. */ - upperBound: ScanRange_Bound | undefined; -} - -/** `None` represent unbounded. */ -export interface ScanRange_Bound { - value: Uint8Array; - inclusive: boolean; -} - -export interface SourceNode { - sourceId: number; - columns: ColumnCatalog[]; - properties: { [key: string]: string }; - split: Uint8Array; - info: StreamSourceInfo | undefined; -} - -export interface SourceNode_PropertiesEntry { - key: string; - value: string; -} - -export interface ProjectNode { - selectList: ExprNode[]; -} - -export interface FilterNode { - searchCondition: ExprNode | undefined; -} - -export interface InsertNode { - /** Id of the table to perform inserting. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - columnIndices: number[]; - /** - * An optional field and will be `None` for tables without user-defined pk. - * The `BatchInsertExecutor` should add a column with NULL value which will - * be filled in streaming. - */ - rowIdIndex?: number | undefined; - returning: boolean; -} - -export interface DeleteNode { - /** Id of the table to perform deleting. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - returning: boolean; -} - -export interface UpdateNode { - /** Id of the table to perform updating. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - exprs: ExprNode[]; - returning: boolean; -} - -export interface ValuesNode { - tuples: ValuesNode_ExprTuple[]; - fields: Field[]; -} - -export interface ValuesNode_ExprTuple { - cells: ExprNode[]; -} - -export interface SortNode { - columnOrders: ColumnOrder[]; -} - -export interface TopNNode { - columnOrders: ColumnOrder[]; - limit: number; - offset: number; - withTies: boolean; -} - -export interface GroupTopNNode { - columnOrders: ColumnOrder[]; - limit: number; - offset: number; - groupKey: number[]; - withTies: boolean; -} - -export interface LimitNode { - limit: number; - offset: number; -} - -export interface NestedLoopJoinNode { - joinType: JoinType; - joinCond: ExprNode | undefined; - outputIndices: number[]; -} - -export interface HashAggNode { - groupKey: number[]; - aggCalls: AggCall[]; -} - -export interface ExpandNode { - columnSubsets: ExpandNode_Subset[]; -} - -export interface ExpandNode_Subset { - columnIndices: number[]; -} - -export interface ProjectSetNode { - selectList: ProjectSetSelectItem[]; -} - -export interface SortAggNode { - groupKey: ExprNode[]; - aggCalls: AggCall[]; -} - -export interface HashJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - condition: ExprNode | undefined; - outputIndices: number[]; - /** - * Null safe means it treats `null = null` as true. - * Each key pair can be null safe independently. (left_key, right_key, null_safe) - */ - nullSafe: boolean[]; -} - -export interface SortMergeJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - direction: Direction; - outputIndices: number[]; -} - -export interface HopWindowNode { - timeCol: number; - windowSlide: IntervalUnit | undefined; - windowSize: IntervalUnit | undefined; - outputIndices: number[]; - windowStartExprs: ExprNode[]; - windowEndExprs: ExprNode[]; -} - -export interface TableFunctionNode { - tableFunction: TableFunction | undefined; -} - -/** Task is a running instance of Stage. */ -export interface TaskId { - queryId: string; - stageId: number; - taskId: number; -} - -/** - * Every task will create N buffers (channels) for parent operators to fetch results from, - * where N is the parallelism of parent stage. - */ -export interface TaskOutputId { - taskId: - | TaskId - | undefined; - /** The id of output channel to fetch from */ - outputId: number; -} - -export interface LocalExecutePlan { - plan: PlanFragment | undefined; - epoch: BatchQueryEpoch | undefined; -} - -/** ExchangeSource describes where to read results from children operators */ -export interface ExchangeSource { - taskOutputId: TaskOutputId | undefined; - host: HostAddress | undefined; - localExecutePlan?: { $case: "plan"; plan: LocalExecutePlan }; -} - -export interface ExchangeNode { - sources: ExchangeSource[]; - inputSchema: Field[]; -} - -export interface MergeSortExchangeNode { - exchange: ExchangeNode | undefined; - columnOrders: ColumnOrder[]; -} - -export interface LocalLookupJoinNode { - joinType: JoinType; - condition: ExprNode | undefined; - outerSideKey: number[]; - innerSideKey: number[]; - lookupPrefixLen: number; - innerSideTableDesc: StorageTableDesc | undefined; - innerSideVnodeMapping: number[]; - innerSideColumnIds: number[]; - outputIndices: number[]; - workerNodes: WorkerNode[]; - /** - * Null safe means it treats `null = null` as true. - * Each key pair can be null safe independently. (left_key, right_key, null_safe) - */ - nullSafe: boolean[]; -} - -/** - * RFC: A new schedule way for distributed lookup join - * https://github.com/risingwavelabs/rfcs/pull/6 - */ -export interface DistributedLookupJoinNode { - joinType: JoinType; - condition: ExprNode | undefined; - outerSideKey: number[]; - innerSideKey: number[]; - lookupPrefixLen: number; - innerSideTableDesc: StorageTableDesc | undefined; - innerSideColumnIds: number[]; - outputIndices: number[]; - /** - * Null safe means it treats `null = null` as true. - * Each key pair can be null safe independently. (left_key, right_key, null_safe) - */ - nullSafe: boolean[]; -} - -export interface UnionNode { -} - -export interface PlanNode { - children: PlanNode[]; - nodeBody?: - | { $case: "insert"; insert: InsertNode } - | { $case: "delete"; delete: DeleteNode } - | { $case: "update"; update: UpdateNode } - | { $case: "project"; project: ProjectNode } - | { $case: "hashAgg"; hashAgg: HashAggNode } - | { $case: "filter"; filter: FilterNode } - | { $case: "exchange"; exchange: ExchangeNode } - | { $case: "sort"; sort: SortNode } - | { $case: "nestedLoopJoin"; nestedLoopJoin: NestedLoopJoinNode } - | { $case: "topN"; topN: TopNNode } - | { $case: "sortAgg"; sortAgg: SortAggNode } - | { $case: "rowSeqScan"; rowSeqScan: RowSeqScanNode } - | { $case: "limit"; limit: LimitNode } - | { $case: "values"; values: ValuesNode } - | { $case: "hashJoin"; hashJoin: HashJoinNode } - | { $case: "mergeSortExchange"; mergeSortExchange: MergeSortExchangeNode } - | { $case: "hopWindow"; hopWindow: HopWindowNode } - | { $case: "tableFunction"; tableFunction: TableFunctionNode } - | { $case: "sysRowSeqScan"; sysRowSeqScan: SysRowSeqScanNode } - | { $case: "expand"; expand: ExpandNode } - | { $case: "localLookupJoin"; localLookupJoin: LocalLookupJoinNode } - | { $case: "projectSet"; projectSet: ProjectSetNode } - | { $case: "union"; union: UnionNode } - | { $case: "groupTopN"; groupTopN: GroupTopNNode } - | { $case: "distributedLookupJoin"; distributedLookupJoin: DistributedLookupJoinNode } - | { $case: "source"; source: SourceNode }; - identity: string; -} - -/** - * ExchangeInfo determines how to distribute results to tasks of next stage. - * - * Note that the fragment itself does not know the where are the receivers. Instead, it prepares results in - * N buffers and wait for parent operators (`Exchange` nodes) to pull data from a specified buffer - */ -export interface ExchangeInfo { - mode: ExchangeInfo_DistributionMode; - distribution?: { $case: "broadcastInfo"; broadcastInfo: ExchangeInfo_BroadcastInfo } | { - $case: "hashInfo"; - hashInfo: ExchangeInfo_HashInfo; - } | { $case: "consistentHashInfo"; consistentHashInfo: ExchangeInfo_ConsistentHashInfo }; -} - -export const ExchangeInfo_DistributionMode = { - /** UNSPECIFIED - No partitioning at all, used for root segment which aggregates query results */ - UNSPECIFIED: "UNSPECIFIED", - SINGLE: "SINGLE", - BROADCAST: "BROADCAST", - HASH: "HASH", - CONSISTENT_HASH: "CONSISTENT_HASH", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type ExchangeInfo_DistributionMode = - typeof ExchangeInfo_DistributionMode[keyof typeof ExchangeInfo_DistributionMode]; - -export function exchangeInfo_DistributionModeFromJSON(object: any): ExchangeInfo_DistributionMode { - switch (object) { - case 0: - case "UNSPECIFIED": - return ExchangeInfo_DistributionMode.UNSPECIFIED; - case 1: - case "SINGLE": - return ExchangeInfo_DistributionMode.SINGLE; - case 2: - case "BROADCAST": - return ExchangeInfo_DistributionMode.BROADCAST; - case 3: - case "HASH": - return ExchangeInfo_DistributionMode.HASH; - case 4: - case "CONSISTENT_HASH": - return ExchangeInfo_DistributionMode.CONSISTENT_HASH; - case -1: - case "UNRECOGNIZED": - default: - return ExchangeInfo_DistributionMode.UNRECOGNIZED; - } -} - -export function exchangeInfo_DistributionModeToJSON(object: ExchangeInfo_DistributionMode): string { - switch (object) { - case ExchangeInfo_DistributionMode.UNSPECIFIED: - return "UNSPECIFIED"; - case ExchangeInfo_DistributionMode.SINGLE: - return "SINGLE"; - case ExchangeInfo_DistributionMode.BROADCAST: - return "BROADCAST"; - case ExchangeInfo_DistributionMode.HASH: - return "HASH"; - case ExchangeInfo_DistributionMode.CONSISTENT_HASH: - return "CONSISTENT_HASH"; - case ExchangeInfo_DistributionMode.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface ExchangeInfo_BroadcastInfo { - count: number; -} - -export interface ExchangeInfo_HashInfo { - outputCount: number; - key: number[]; -} - -export interface ExchangeInfo_ConsistentHashInfo { - /** `vmap` maps virtual node to down stream task id */ - vmap: number[]; - key: number[]; -} - -export interface PlanFragment { - root: PlanNode | undefined; - exchangeInfo: ExchangeInfo | undefined; -} - -function createBaseRowSeqScanNode(): RowSeqScanNode { - return { - tableDesc: undefined, - columnIds: [], - scanRanges: [], - vnodeBitmap: undefined, - ordered: false, - chunkSize: undefined, - }; -} - -export const RowSeqScanNode = { - fromJSON(object: any): RowSeqScanNode { - return { - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - columnIds: Array.isArray(object?.columnIds) ? object.columnIds.map((e: any) => Number(e)) : [], - scanRanges: Array.isArray(object?.scanRanges) ? object.scanRanges.map((e: any) => ScanRange.fromJSON(e)) : [], - vnodeBitmap: isSet(object.vnodeBitmap) ? Buffer.fromJSON(object.vnodeBitmap) : undefined, - ordered: isSet(object.ordered) ? Boolean(object.ordered) : false, - chunkSize: isSet(object.chunkSize) ? RowSeqScanNode_ChunkSize.fromJSON(object.chunkSize) : undefined, - }; - }, - - toJSON(message: RowSeqScanNode): unknown { - const obj: any = {}; - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - if (message.columnIds) { - obj.columnIds = message.columnIds.map((e) => Math.round(e)); - } else { - obj.columnIds = []; - } - if (message.scanRanges) { - obj.scanRanges = message.scanRanges.map((e) => e ? ScanRange.toJSON(e) : undefined); - } else { - obj.scanRanges = []; - } - message.vnodeBitmap !== undefined && - (obj.vnodeBitmap = message.vnodeBitmap ? Buffer.toJSON(message.vnodeBitmap) : undefined); - message.ordered !== undefined && (obj.ordered = message.ordered); - message.chunkSize !== undefined && - (obj.chunkSize = message.chunkSize ? RowSeqScanNode_ChunkSize.toJSON(message.chunkSize) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): RowSeqScanNode { - const message = createBaseRowSeqScanNode(); - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - message.columnIds = object.columnIds?.map((e) => e) || []; - message.scanRanges = object.scanRanges?.map((e) => ScanRange.fromPartial(e)) || []; - message.vnodeBitmap = (object.vnodeBitmap !== undefined && object.vnodeBitmap !== null) - ? Buffer.fromPartial(object.vnodeBitmap) - : undefined; - message.ordered = object.ordered ?? false; - message.chunkSize = (object.chunkSize !== undefined && object.chunkSize !== null) - ? RowSeqScanNode_ChunkSize.fromPartial(object.chunkSize) - : undefined; - return message; - }, -}; - -function createBaseRowSeqScanNode_ChunkSize(): RowSeqScanNode_ChunkSize { - return { chunkSize: 0 }; -} - -export const RowSeqScanNode_ChunkSize = { - fromJSON(object: any): RowSeqScanNode_ChunkSize { - return { chunkSize: isSet(object.chunkSize) ? Number(object.chunkSize) : 0 }; - }, - - toJSON(message: RowSeqScanNode_ChunkSize): unknown { - const obj: any = {}; - message.chunkSize !== undefined && (obj.chunkSize = Math.round(message.chunkSize)); - return obj; - }, - - fromPartial, I>>(object: I): RowSeqScanNode_ChunkSize { - const message = createBaseRowSeqScanNode_ChunkSize(); - message.chunkSize = object.chunkSize ?? 0; - return message; - }, -}; - -function createBaseSysRowSeqScanNode(): SysRowSeqScanNode { - return { tableId: 0, columnDescs: [] }; -} - -export const SysRowSeqScanNode = { - fromJSON(object: any): SysRowSeqScanNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - columnDescs: Array.isArray(object?.columnDescs) ? object.columnDescs.map((e: any) => ColumnDesc.fromJSON(e)) : [], - }; - }, - - toJSON(message: SysRowSeqScanNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.columnDescs) { - obj.columnDescs = message.columnDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columnDescs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SysRowSeqScanNode { - const message = createBaseSysRowSeqScanNode(); - message.tableId = object.tableId ?? 0; - message.columnDescs = object.columnDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseScanRange(): ScanRange { - return { eqConds: [], lowerBound: undefined, upperBound: undefined }; -} - -export const ScanRange = { - fromJSON(object: any): ScanRange { - return { - eqConds: Array.isArray(object?.eqConds) ? object.eqConds.map((e: any) => bytesFromBase64(e)) : [], - lowerBound: isSet(object.lowerBound) ? ScanRange_Bound.fromJSON(object.lowerBound) : undefined, - upperBound: isSet(object.upperBound) ? ScanRange_Bound.fromJSON(object.upperBound) : undefined, - }; - }, - - toJSON(message: ScanRange): unknown { - const obj: any = {}; - if (message.eqConds) { - obj.eqConds = message.eqConds.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.eqConds = []; - } - message.lowerBound !== undefined && - (obj.lowerBound = message.lowerBound ? ScanRange_Bound.toJSON(message.lowerBound) : undefined); - message.upperBound !== undefined && - (obj.upperBound = message.upperBound ? ScanRange_Bound.toJSON(message.upperBound) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ScanRange { - const message = createBaseScanRange(); - message.eqConds = object.eqConds?.map((e) => e) || []; - message.lowerBound = (object.lowerBound !== undefined && object.lowerBound !== null) - ? ScanRange_Bound.fromPartial(object.lowerBound) - : undefined; - message.upperBound = (object.upperBound !== undefined && object.upperBound !== null) - ? ScanRange_Bound.fromPartial(object.upperBound) - : undefined; - return message; - }, -}; - -function createBaseScanRange_Bound(): ScanRange_Bound { - return { value: new Uint8Array(), inclusive: false }; -} - -export const ScanRange_Bound = { - fromJSON(object: any): ScanRange_Bound { - return { - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(), - inclusive: isSet(object.inclusive) ? Boolean(object.inclusive) : false, - }; - }, - - toJSON(message: ScanRange_Bound): unknown { - const obj: any = {}; - message.value !== undefined && - (obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array())); - message.inclusive !== undefined && (obj.inclusive = message.inclusive); - return obj; - }, - - fromPartial, I>>(object: I): ScanRange_Bound { - const message = createBaseScanRange_Bound(); - message.value = object.value ?? new Uint8Array(); - message.inclusive = object.inclusive ?? false; - return message; - }, -}; - -function createBaseSourceNode(): SourceNode { - return { sourceId: 0, columns: [], properties: {}, split: new Uint8Array(), info: undefined }; -} - -export const SourceNode = { - fromJSON(object: any): SourceNode { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - split: isSet(object.split) ? bytesFromBase64(object.split) : new Uint8Array(), - info: isSet(object.info) ? StreamSourceInfo.fromJSON(object.info) : undefined, - }; - }, - - toJSON(message: SourceNode): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.split !== undefined && - (obj.split = base64FromBytes(message.split !== undefined ? message.split : new Uint8Array())); - message.info !== undefined && (obj.info = message.info ? StreamSourceInfo.toJSON(message.info) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SourceNode { - const message = createBaseSourceNode(); - message.sourceId = object.sourceId ?? 0; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.split = object.split ?? new Uint8Array(); - message.info = (object.info !== undefined && object.info !== null) - ? StreamSourceInfo.fromPartial(object.info) - : undefined; - return message; - }, -}; - -function createBaseSourceNode_PropertiesEntry(): SourceNode_PropertiesEntry { - return { key: "", value: "" }; -} - -export const SourceNode_PropertiesEntry = { - fromJSON(object: any): SourceNode_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: SourceNode_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SourceNode_PropertiesEntry { - const message = createBaseSourceNode_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseProjectNode(): ProjectNode { - return { selectList: [] }; -} - -export const ProjectNode = { - fromJSON(object: any): ProjectNode { - return { - selectList: Array.isArray(object?.selectList) ? object.selectList.map((e: any) => ExprNode.fromJSON(e)) : [], - }; - }, - - toJSON(message: ProjectNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectNode { - const message = createBaseProjectNode(); - message.selectList = object.selectList?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFilterNode(): FilterNode { - return { searchCondition: undefined }; -} - -export const FilterNode = { - fromJSON(object: any): FilterNode { - return { searchCondition: isSet(object.searchCondition) ? ExprNode.fromJSON(object.searchCondition) : undefined }; - }, - - toJSON(message: FilterNode): unknown { - const obj: any = {}; - message.searchCondition !== undefined && - (obj.searchCondition = message.searchCondition ? ExprNode.toJSON(message.searchCondition) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FilterNode { - const message = createBaseFilterNode(); - message.searchCondition = (object.searchCondition !== undefined && object.searchCondition !== null) - ? ExprNode.fromPartial(object.searchCondition) - : undefined; - return message; - }, -}; - -function createBaseInsertNode(): InsertNode { - return { tableId: 0, tableVersionId: 0, columnIndices: [], rowIdIndex: undefined, returning: false }; -} - -export const InsertNode = { - fromJSON(object: any): InsertNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - columnIndices: Array.isArray(object?.columnIndices) ? object.columnIndices.map((e: any) => Number(e)) : [], - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - returning: isSet(object.returning) ? Boolean(object.returning) : false, - }; - }, - - toJSON(message: InsertNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - if (message.columnIndices) { - obj.columnIndices = message.columnIndices.map((e) => Math.round(e)); - } else { - obj.columnIndices = []; - } - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - message.returning !== undefined && (obj.returning = message.returning); - return obj; - }, - - fromPartial, I>>(object: I): InsertNode { - const message = createBaseInsertNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.columnIndices = object.columnIndices?.map((e) => e) || []; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.returning = object.returning ?? false; - return message; - }, -}; - -function createBaseDeleteNode(): DeleteNode { - return { tableId: 0, tableVersionId: 0, returning: false }; -} - -export const DeleteNode = { - fromJSON(object: any): DeleteNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - returning: isSet(object.returning) ? Boolean(object.returning) : false, - }; - }, - - toJSON(message: DeleteNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - message.returning !== undefined && (obj.returning = message.returning); - return obj; - }, - - fromPartial, I>>(object: I): DeleteNode { - const message = createBaseDeleteNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.returning = object.returning ?? false; - return message; - }, -}; - -function createBaseUpdateNode(): UpdateNode { - return { tableId: 0, tableVersionId: 0, exprs: [], returning: false }; -} - -export const UpdateNode = { - fromJSON(object: any): UpdateNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => ExprNode.fromJSON(e)) : [], - returning: isSet(object.returning) ? Boolean(object.returning) : false, - }; - }, - - toJSON(message: UpdateNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - if (message.exprs) { - obj.exprs = message.exprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.exprs = []; - } - message.returning !== undefined && (obj.returning = message.returning); - return obj; - }, - - fromPartial, I>>(object: I): UpdateNode { - const message = createBaseUpdateNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.exprs = object.exprs?.map((e) => ExprNode.fromPartial(e)) || []; - message.returning = object.returning ?? false; - return message; - }, -}; - -function createBaseValuesNode(): ValuesNode { - return { tuples: [], fields: [] }; -} - -export const ValuesNode = { - fromJSON(object: any): ValuesNode { - return { - tuples: Array.isArray(object?.tuples) ? object.tuples.map((e: any) => ValuesNode_ExprTuple.fromJSON(e)) : [], - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: ValuesNode): unknown { - const obj: any = {}; - if (message.tuples) { - obj.tuples = message.tuples.map((e) => e ? ValuesNode_ExprTuple.toJSON(e) : undefined); - } else { - obj.tuples = []; - } - if (message.fields) { - obj.fields = message.fields.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.fields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ValuesNode { - const message = createBaseValuesNode(); - message.tuples = object.tuples?.map((e) => ValuesNode_ExprTuple.fromPartial(e)) || []; - message.fields = object.fields?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseValuesNode_ExprTuple(): ValuesNode_ExprTuple { - return { cells: [] }; -} - -export const ValuesNode_ExprTuple = { - fromJSON(object: any): ValuesNode_ExprTuple { - return { cells: Array.isArray(object?.cells) ? object.cells.map((e: any) => ExprNode.fromJSON(e)) : [] }; - }, - - toJSON(message: ValuesNode_ExprTuple): unknown { - const obj: any = {}; - if (message.cells) { - obj.cells = message.cells.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.cells = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ValuesNode_ExprTuple { - const message = createBaseValuesNode_ExprTuple(); - message.cells = object.cells?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSortNode(): SortNode { - return { columnOrders: [] }; -} - -export const SortNode = { - fromJSON(object: any): SortNode { - return { - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - }; - }, - - toJSON(message: SortNode): unknown { - const obj: any = {}; - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SortNode { - const message = createBaseSortNode(); - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseTopNNode(): TopNNode { - return { columnOrders: [], limit: 0, offset: 0, withTies: false }; -} - -export const TopNNode = { - fromJSON(object: any): TopNNode { - return { - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: TopNNode): unknown { - const obj: any = {}; - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): TopNNode { - const message = createBaseTopNNode(); - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseGroupTopNNode(): GroupTopNNode { - return { columnOrders: [], limit: 0, offset: 0, groupKey: [], withTies: false }; -} - -export const GroupTopNNode = { - fromJSON(object: any): GroupTopNNode { - return { - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - groupKey: Array.isArray(object?.groupKey) - ? object.groupKey.map((e: any) => Number(e)) - : [], - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: GroupTopNNode): unknown { - const obj: any = {}; - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): GroupTopNNode { - const message = createBaseGroupTopNNode(); - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.groupKey = object.groupKey?.map((e) => e) || []; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseLimitNode(): LimitNode { - return { limit: 0, offset: 0 }; -} - -export const LimitNode = { - fromJSON(object: any): LimitNode { - return { - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - }; - }, - - toJSON(message: LimitNode): unknown { - const obj: any = {}; - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - return obj; - }, - - fromPartial, I>>(object: I): LimitNode { - const message = createBaseLimitNode(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - return message; - }, -}; - -function createBaseNestedLoopJoinNode(): NestedLoopJoinNode { - return { joinType: JoinType.UNSPECIFIED, joinCond: undefined, outputIndices: [] }; -} - -export const NestedLoopJoinNode = { - fromJSON(object: any): NestedLoopJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - joinCond: isSet(object.joinCond) ? ExprNode.fromJSON(object.joinCond) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: NestedLoopJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - message.joinCond !== undefined && (obj.joinCond = message.joinCond ? ExprNode.toJSON(message.joinCond) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): NestedLoopJoinNode { - const message = createBaseNestedLoopJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.joinCond = (object.joinCond !== undefined && object.joinCond !== null) - ? ExprNode.fromPartial(object.joinCond) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHashAggNode(): HashAggNode { - return { groupKey: [], aggCalls: [] }; -} - -export const HashAggNode = { - fromJSON(object: any): HashAggNode { - return { - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => Number(e)) : [], - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - }; - }, - - toJSON(message: HashAggNode): unknown { - const obj: any = {}; - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HashAggNode { - const message = createBaseHashAggNode(); - message.groupKey = object.groupKey?.map((e) => e) || []; - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExpandNode(): ExpandNode { - return { columnSubsets: [] }; -} - -export const ExpandNode = { - fromJSON(object: any): ExpandNode { - return { - columnSubsets: Array.isArray(object?.columnSubsets) - ? object.columnSubsets.map((e: any) => ExpandNode_Subset.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ExpandNode): unknown { - const obj: any = {}; - if (message.columnSubsets) { - obj.columnSubsets = message.columnSubsets.map((e) => e ? ExpandNode_Subset.toJSON(e) : undefined); - } else { - obj.columnSubsets = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode { - const message = createBaseExpandNode(); - message.columnSubsets = object.columnSubsets?.map((e) => ExpandNode_Subset.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExpandNode_Subset(): ExpandNode_Subset { - return { columnIndices: [] }; -} - -export const ExpandNode_Subset = { - fromJSON(object: any): ExpandNode_Subset { - return { - columnIndices: Array.isArray(object?.columnIndices) ? object.columnIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExpandNode_Subset): unknown { - const obj: any = {}; - if (message.columnIndices) { - obj.columnIndices = message.columnIndices.map((e) => Math.round(e)); - } else { - obj.columnIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode_Subset { - const message = createBaseExpandNode_Subset(); - message.columnIndices = object.columnIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseProjectSetNode(): ProjectSetNode { - return { selectList: [] }; -} - -export const ProjectSetNode = { - fromJSON(object: any): ProjectSetNode { - return { - selectList: Array.isArray(object?.selectList) - ? object.selectList.map((e: any) => ProjectSetSelectItem.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ProjectSetNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ProjectSetSelectItem.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectSetNode { - const message = createBaseProjectSetNode(); - message.selectList = object.selectList?.map((e) => ProjectSetSelectItem.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSortAggNode(): SortAggNode { - return { groupKey: [], aggCalls: [] }; -} - -export const SortAggNode = { - fromJSON(object: any): SortAggNode { - return { - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => ExprNode.fromJSON(e)) : [], - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - }; - }, - - toJSON(message: SortAggNode): unknown { - const obj: any = {}; - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.groupKey = []; - } - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SortAggNode { - const message = createBaseSortAggNode(); - message.groupKey = object.groupKey?.map((e) => ExprNode.fromPartial(e)) || []; - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHashJoinNode(): HashJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - condition: undefined, - outputIndices: [], - nullSafe: [], - }; -} - -export const HashJoinNode = { - fromJSON(object: any): HashJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - }; - }, - - toJSON(message: HashJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HashJoinNode { - const message = createBaseHashJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - return message; - }, -}; - -function createBaseSortMergeJoinNode(): SortMergeJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - direction: Direction.DIRECTION_UNSPECIFIED, - outputIndices: [], - }; -} - -export const SortMergeJoinNode = { - fromJSON(object: any): SortMergeJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - direction: isSet(object.direction) ? directionFromJSON(object.direction) : Direction.DIRECTION_UNSPECIFIED, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: SortMergeJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.direction !== undefined && (obj.direction = directionToJSON(message.direction)); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SortMergeJoinNode { - const message = createBaseSortMergeJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.direction = object.direction ?? Direction.DIRECTION_UNSPECIFIED; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHopWindowNode(): HopWindowNode { - return { - timeCol: 0, - windowSlide: undefined, - windowSize: undefined, - outputIndices: [], - windowStartExprs: [], - windowEndExprs: [], - }; -} - -export const HopWindowNode = { - fromJSON(object: any): HopWindowNode { - return { - timeCol: isSet(object.timeCol) ? Number(object.timeCol) : 0, - windowSlide: isSet(object.windowSlide) ? IntervalUnit.fromJSON(object.windowSlide) : undefined, - windowSize: isSet(object.windowSize) ? IntervalUnit.fromJSON(object.windowSize) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - windowStartExprs: Array.isArray(object?.windowStartExprs) - ? object.windowStartExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - windowEndExprs: Array.isArray(object?.windowEndExprs) - ? object.windowEndExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - }; - }, - - toJSON(message: HopWindowNode): unknown { - const obj: any = {}; - message.timeCol !== undefined && (obj.timeCol = Math.round(message.timeCol)); - message.windowSlide !== undefined && - (obj.windowSlide = message.windowSlide ? IntervalUnit.toJSON(message.windowSlide) : undefined); - message.windowSize !== undefined && - (obj.windowSize = message.windowSize ? IntervalUnit.toJSON(message.windowSize) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.windowStartExprs) { - obj.windowStartExprs = message.windowStartExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowStartExprs = []; - } - if (message.windowEndExprs) { - obj.windowEndExprs = message.windowEndExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowEndExprs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HopWindowNode { - const message = createBaseHopWindowNode(); - message.timeCol = object.timeCol ?? 0; - message.windowSlide = (object.windowSlide !== undefined && object.windowSlide !== null) - ? IntervalUnit.fromPartial(object.windowSlide) - : undefined; - message.windowSize = (object.windowSize !== undefined && object.windowSize !== null) - ? IntervalUnit.fromPartial(object.windowSize) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.windowStartExprs = object.windowStartExprs?.map((e) => ExprNode.fromPartial(e)) || []; - message.windowEndExprs = object.windowEndExprs?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseTableFunctionNode(): TableFunctionNode { - return { tableFunction: undefined }; -} - -export const TableFunctionNode = { - fromJSON(object: any): TableFunctionNode { - return { tableFunction: isSet(object.tableFunction) ? TableFunction.fromJSON(object.tableFunction) : undefined }; - }, - - toJSON(message: TableFunctionNode): unknown { - const obj: any = {}; - message.tableFunction !== undefined && - (obj.tableFunction = message.tableFunction ? TableFunction.toJSON(message.tableFunction) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TableFunctionNode { - const message = createBaseTableFunctionNode(); - message.tableFunction = (object.tableFunction !== undefined && object.tableFunction !== null) - ? TableFunction.fromPartial(object.tableFunction) - : undefined; - return message; - }, -}; - -function createBaseTaskId(): TaskId { - return { queryId: "", stageId: 0, taskId: 0 }; -} - -export const TaskId = { - fromJSON(object: any): TaskId { - return { - queryId: isSet(object.queryId) ? String(object.queryId) : "", - stageId: isSet(object.stageId) ? Number(object.stageId) : 0, - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - }; - }, - - toJSON(message: TaskId): unknown { - const obj: any = {}; - message.queryId !== undefined && (obj.queryId = message.queryId); - message.stageId !== undefined && (obj.stageId = Math.round(message.stageId)); - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - return obj; - }, - - fromPartial, I>>(object: I): TaskId { - const message = createBaseTaskId(); - message.queryId = object.queryId ?? ""; - message.stageId = object.stageId ?? 0; - message.taskId = object.taskId ?? 0; - return message; - }, -}; - -function createBaseTaskOutputId(): TaskOutputId { - return { taskId: undefined, outputId: 0 }; -} - -export const TaskOutputId = { - fromJSON(object: any): TaskOutputId { - return { - taskId: isSet(object.taskId) ? TaskId.fromJSON(object.taskId) : undefined, - outputId: isSet(object.outputId) ? Number(object.outputId) : 0, - }; - }, - - toJSON(message: TaskOutputId): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId.toJSON(message.taskId) : undefined); - message.outputId !== undefined && (obj.outputId = Math.round(message.outputId)); - return obj; - }, - - fromPartial, I>>(object: I): TaskOutputId { - const message = createBaseTaskOutputId(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId.fromPartial(object.taskId) - : undefined; - message.outputId = object.outputId ?? 0; - return message; - }, -}; - -function createBaseLocalExecutePlan(): LocalExecutePlan { - return { plan: undefined, epoch: undefined }; -} - -export const LocalExecutePlan = { - fromJSON(object: any): LocalExecutePlan { - return { - plan: isSet(object.plan) ? PlanFragment.fromJSON(object.plan) : undefined, - epoch: isSet(object.epoch) ? BatchQueryEpoch.fromJSON(object.epoch) : undefined, - }; - }, - - toJSON(message: LocalExecutePlan): unknown { - const obj: any = {}; - message.plan !== undefined && (obj.plan = message.plan ? PlanFragment.toJSON(message.plan) : undefined); - message.epoch !== undefined && (obj.epoch = message.epoch ? BatchQueryEpoch.toJSON(message.epoch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): LocalExecutePlan { - const message = createBaseLocalExecutePlan(); - message.plan = (object.plan !== undefined && object.plan !== null) - ? PlanFragment.fromPartial(object.plan) - : undefined; - message.epoch = (object.epoch !== undefined && object.epoch !== null) - ? BatchQueryEpoch.fromPartial(object.epoch) - : undefined; - return message; - }, -}; - -function createBaseExchangeSource(): ExchangeSource { - return { taskOutputId: undefined, host: undefined, localExecutePlan: undefined }; -} - -export const ExchangeSource = { - fromJSON(object: any): ExchangeSource { - return { - taskOutputId: isSet(object.taskOutputId) ? TaskOutputId.fromJSON(object.taskOutputId) : undefined, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - localExecutePlan: isSet(object.plan) - ? { $case: "plan", plan: LocalExecutePlan.fromJSON(object.plan) } - : undefined, - }; - }, - - toJSON(message: ExchangeSource): unknown { - const obj: any = {}; - message.taskOutputId !== undefined && - (obj.taskOutputId = message.taskOutputId ? TaskOutputId.toJSON(message.taskOutputId) : undefined); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.localExecutePlan?.$case === "plan" && - (obj.plan = message.localExecutePlan?.plan ? LocalExecutePlan.toJSON(message.localExecutePlan?.plan) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeSource { - const message = createBaseExchangeSource(); - message.taskOutputId = (object.taskOutputId !== undefined && object.taskOutputId !== null) - ? TaskOutputId.fromPartial(object.taskOutputId) - : undefined; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - if ( - object.localExecutePlan?.$case === "plan" && - object.localExecutePlan?.plan !== undefined && - object.localExecutePlan?.plan !== null - ) { - message.localExecutePlan = { $case: "plan", plan: LocalExecutePlan.fromPartial(object.localExecutePlan.plan) }; - } - return message; - }, -}; - -function createBaseExchangeNode(): ExchangeNode { - return { sources: [], inputSchema: [] }; -} - -export const ExchangeNode = { - fromJSON(object: any): ExchangeNode { - return { - sources: Array.isArray(object?.sources) ? object.sources.map((e: any) => ExchangeSource.fromJSON(e)) : [], - inputSchema: Array.isArray(object?.inputSchema) ? object.inputSchema.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: ExchangeNode): unknown { - const obj: any = {}; - if (message.sources) { - obj.sources = message.sources.map((e) => e ? ExchangeSource.toJSON(e) : undefined); - } else { - obj.sources = []; - } - if (message.inputSchema) { - obj.inputSchema = message.inputSchema.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.inputSchema = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExchangeNode { - const message = createBaseExchangeNode(); - message.sources = object.sources?.map((e) => ExchangeSource.fromPartial(e)) || []; - message.inputSchema = object.inputSchema?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMergeSortExchangeNode(): MergeSortExchangeNode { - return { exchange: undefined, columnOrders: [] }; -} - -export const MergeSortExchangeNode = { - fromJSON(object: any): MergeSortExchangeNode { - return { - exchange: isSet(object.exchange) ? ExchangeNode.fromJSON(object.exchange) : undefined, - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - }; - }, - - toJSON(message: MergeSortExchangeNode): unknown { - const obj: any = {}; - message.exchange !== undefined && - (obj.exchange = message.exchange ? ExchangeNode.toJSON(message.exchange) : undefined); - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MergeSortExchangeNode { - const message = createBaseMergeSortExchangeNode(); - message.exchange = (object.exchange !== undefined && object.exchange !== null) - ? ExchangeNode.fromPartial(object.exchange) - : undefined; - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseLocalLookupJoinNode(): LocalLookupJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - condition: undefined, - outerSideKey: [], - innerSideKey: [], - lookupPrefixLen: 0, - innerSideTableDesc: undefined, - innerSideVnodeMapping: [], - innerSideColumnIds: [], - outputIndices: [], - workerNodes: [], - nullSafe: [], - }; -} - -export const LocalLookupJoinNode = { - fromJSON(object: any): LocalLookupJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outerSideKey: Array.isArray(object?.outerSideKey) ? object.outerSideKey.map((e: any) => Number(e)) : [], - innerSideKey: Array.isArray(object?.innerSideKey) ? object.innerSideKey.map((e: any) => Number(e)) : [], - lookupPrefixLen: isSet(object.lookupPrefixLen) ? Number(object.lookupPrefixLen) : 0, - innerSideTableDesc: isSet(object.innerSideTableDesc) - ? StorageTableDesc.fromJSON(object.innerSideTableDesc) - : undefined, - innerSideVnodeMapping: Array.isArray(object?.innerSideVnodeMapping) - ? object.innerSideVnodeMapping.map((e: any) => Number(e)) - : [], - innerSideColumnIds: Array.isArray(object?.innerSideColumnIds) - ? object.innerSideColumnIds.map((e: any) => Number(e)) - : [], - outputIndices: Array.isArray(object?.outputIndices) - ? object.outputIndices.map((e: any) => Number(e)) - : [], - workerNodes: Array.isArray(object?.workerNodes) ? object.workerNodes.map((e: any) => WorkerNode.fromJSON(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - }; - }, - - toJSON(message: LocalLookupJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outerSideKey) { - obj.outerSideKey = message.outerSideKey.map((e) => Math.round(e)); - } else { - obj.outerSideKey = []; - } - if (message.innerSideKey) { - obj.innerSideKey = message.innerSideKey.map((e) => Math.round(e)); - } else { - obj.innerSideKey = []; - } - message.lookupPrefixLen !== undefined && (obj.lookupPrefixLen = Math.round(message.lookupPrefixLen)); - message.innerSideTableDesc !== undefined && (obj.innerSideTableDesc = message.innerSideTableDesc - ? StorageTableDesc.toJSON(message.innerSideTableDesc) - : undefined); - if (message.innerSideVnodeMapping) { - obj.innerSideVnodeMapping = message.innerSideVnodeMapping.map((e) => Math.round(e)); - } else { - obj.innerSideVnodeMapping = []; - } - if (message.innerSideColumnIds) { - obj.innerSideColumnIds = message.innerSideColumnIds.map((e) => Math.round(e)); - } else { - obj.innerSideColumnIds = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.workerNodes) { - obj.workerNodes = message.workerNodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.workerNodes = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - return obj; - }, - - fromPartial, I>>(object: I): LocalLookupJoinNode { - const message = createBaseLocalLookupJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outerSideKey = object.outerSideKey?.map((e) => e) || []; - message.innerSideKey = object.innerSideKey?.map((e) => e) || []; - message.lookupPrefixLen = object.lookupPrefixLen ?? 0; - message.innerSideTableDesc = (object.innerSideTableDesc !== undefined && object.innerSideTableDesc !== null) - ? StorageTableDesc.fromPartial(object.innerSideTableDesc) - : undefined; - message.innerSideVnodeMapping = object.innerSideVnodeMapping?.map((e) => e) || []; - message.innerSideColumnIds = object.innerSideColumnIds?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.workerNodes = object.workerNodes?.map((e) => WorkerNode.fromPartial(e)) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDistributedLookupJoinNode(): DistributedLookupJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - condition: undefined, - outerSideKey: [], - innerSideKey: [], - lookupPrefixLen: 0, - innerSideTableDesc: undefined, - innerSideColumnIds: [], - outputIndices: [], - nullSafe: [], - }; -} - -export const DistributedLookupJoinNode = { - fromJSON(object: any): DistributedLookupJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outerSideKey: Array.isArray(object?.outerSideKey) ? object.outerSideKey.map((e: any) => Number(e)) : [], - innerSideKey: Array.isArray(object?.innerSideKey) ? object.innerSideKey.map((e: any) => Number(e)) : [], - lookupPrefixLen: isSet(object.lookupPrefixLen) ? Number(object.lookupPrefixLen) : 0, - innerSideTableDesc: isSet(object.innerSideTableDesc) - ? StorageTableDesc.fromJSON(object.innerSideTableDesc) - : undefined, - innerSideColumnIds: Array.isArray(object?.innerSideColumnIds) - ? object.innerSideColumnIds.map((e: any) => Number(e)) - : [], - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - }; - }, - - toJSON(message: DistributedLookupJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outerSideKey) { - obj.outerSideKey = message.outerSideKey.map((e) => Math.round(e)); - } else { - obj.outerSideKey = []; - } - if (message.innerSideKey) { - obj.innerSideKey = message.innerSideKey.map((e) => Math.round(e)); - } else { - obj.innerSideKey = []; - } - message.lookupPrefixLen !== undefined && (obj.lookupPrefixLen = Math.round(message.lookupPrefixLen)); - message.innerSideTableDesc !== undefined && (obj.innerSideTableDesc = message.innerSideTableDesc - ? StorageTableDesc.toJSON(message.innerSideTableDesc) - : undefined); - if (message.innerSideColumnIds) { - obj.innerSideColumnIds = message.innerSideColumnIds.map((e) => Math.round(e)); - } else { - obj.innerSideColumnIds = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DistributedLookupJoinNode { - const message = createBaseDistributedLookupJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outerSideKey = object.outerSideKey?.map((e) => e) || []; - message.innerSideKey = object.innerSideKey?.map((e) => e) || []; - message.lookupPrefixLen = object.lookupPrefixLen ?? 0; - message.innerSideTableDesc = (object.innerSideTableDesc !== undefined && object.innerSideTableDesc !== null) - ? StorageTableDesc.fromPartial(object.innerSideTableDesc) - : undefined; - message.innerSideColumnIds = object.innerSideColumnIds?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUnionNode(): UnionNode { - return {}; -} - -export const UnionNode = { - fromJSON(_: any): UnionNode { - return {}; - }, - - toJSON(_: UnionNode): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): UnionNode { - const message = createBaseUnionNode(); - return message; - }, -}; - -function createBasePlanNode(): PlanNode { - return { children: [], nodeBody: undefined, identity: "" }; -} - -export const PlanNode = { - fromJSON(object: any): PlanNode { - return { - children: Array.isArray(object?.children) ? object.children.map((e: any) => PlanNode.fromJSON(e)) : [], - nodeBody: isSet(object.insert) - ? { $case: "insert", insert: InsertNode.fromJSON(object.insert) } - : isSet(object.delete) - ? { $case: "delete", delete: DeleteNode.fromJSON(object.delete) } - : isSet(object.update) - ? { $case: "update", update: UpdateNode.fromJSON(object.update) } - : isSet(object.project) - ? { $case: "project", project: ProjectNode.fromJSON(object.project) } - : isSet(object.hashAgg) - ? { $case: "hashAgg", hashAgg: HashAggNode.fromJSON(object.hashAgg) } - : isSet(object.filter) - ? { $case: "filter", filter: FilterNode.fromJSON(object.filter) } - : isSet(object.exchange) - ? { $case: "exchange", exchange: ExchangeNode.fromJSON(object.exchange) } - : isSet(object.sort) - ? { $case: "sort", sort: SortNode.fromJSON(object.sort) } - : isSet(object.nestedLoopJoin) - ? { $case: "nestedLoopJoin", nestedLoopJoin: NestedLoopJoinNode.fromJSON(object.nestedLoopJoin) } - : isSet(object.topN) - ? { $case: "topN", topN: TopNNode.fromJSON(object.topN) } - : isSet(object.sortAgg) - ? { $case: "sortAgg", sortAgg: SortAggNode.fromJSON(object.sortAgg) } - : isSet(object.rowSeqScan) - ? { $case: "rowSeqScan", rowSeqScan: RowSeqScanNode.fromJSON(object.rowSeqScan) } - : isSet(object.limit) - ? { $case: "limit", limit: LimitNode.fromJSON(object.limit) } - : isSet(object.values) - ? { $case: "values", values: ValuesNode.fromJSON(object.values) } - : isSet(object.hashJoin) - ? { $case: "hashJoin", hashJoin: HashJoinNode.fromJSON(object.hashJoin) } - : isSet(object.mergeSortExchange) - ? { $case: "mergeSortExchange", mergeSortExchange: MergeSortExchangeNode.fromJSON(object.mergeSortExchange) } - : isSet(object.hopWindow) - ? { $case: "hopWindow", hopWindow: HopWindowNode.fromJSON(object.hopWindow) } - : isSet(object.tableFunction) - ? { $case: "tableFunction", tableFunction: TableFunctionNode.fromJSON(object.tableFunction) } - : isSet(object.sysRowSeqScan) - ? { $case: "sysRowSeqScan", sysRowSeqScan: SysRowSeqScanNode.fromJSON(object.sysRowSeqScan) } - : isSet(object.expand) - ? { $case: "expand", expand: ExpandNode.fromJSON(object.expand) } - : isSet(object.localLookupJoin) - ? { $case: "localLookupJoin", localLookupJoin: LocalLookupJoinNode.fromJSON(object.localLookupJoin) } - : isSet(object.projectSet) - ? { $case: "projectSet", projectSet: ProjectSetNode.fromJSON(object.projectSet) } - : isSet(object.union) - ? { $case: "union", union: UnionNode.fromJSON(object.union) } - : isSet(object.groupTopN) - ? { $case: "groupTopN", groupTopN: GroupTopNNode.fromJSON(object.groupTopN) } - : isSet(object.distributedLookupJoin) - ? { - $case: "distributedLookupJoin", - distributedLookupJoin: DistributedLookupJoinNode.fromJSON(object.distributedLookupJoin), - } - : isSet(object.source) - ? { $case: "source", source: SourceNode.fromJSON(object.source) } - : undefined, - identity: isSet(object.identity) ? String(object.identity) : "", - }; - }, - - toJSON(message: PlanNode): unknown { - const obj: any = {}; - if (message.children) { - obj.children = message.children.map((e) => e ? PlanNode.toJSON(e) : undefined); - } else { - obj.children = []; - } - message.nodeBody?.$case === "insert" && - (obj.insert = message.nodeBody?.insert ? InsertNode.toJSON(message.nodeBody?.insert) : undefined); - message.nodeBody?.$case === "delete" && - (obj.delete = message.nodeBody?.delete ? DeleteNode.toJSON(message.nodeBody?.delete) : undefined); - message.nodeBody?.$case === "update" && - (obj.update = message.nodeBody?.update ? UpdateNode.toJSON(message.nodeBody?.update) : undefined); - message.nodeBody?.$case === "project" && - (obj.project = message.nodeBody?.project ? ProjectNode.toJSON(message.nodeBody?.project) : undefined); - message.nodeBody?.$case === "hashAgg" && - (obj.hashAgg = message.nodeBody?.hashAgg ? HashAggNode.toJSON(message.nodeBody?.hashAgg) : undefined); - message.nodeBody?.$case === "filter" && - (obj.filter = message.nodeBody?.filter ? FilterNode.toJSON(message.nodeBody?.filter) : undefined); - message.nodeBody?.$case === "exchange" && - (obj.exchange = message.nodeBody?.exchange ? ExchangeNode.toJSON(message.nodeBody?.exchange) : undefined); - message.nodeBody?.$case === "sort" && - (obj.sort = message.nodeBody?.sort ? SortNode.toJSON(message.nodeBody?.sort) : undefined); - message.nodeBody?.$case === "nestedLoopJoin" && (obj.nestedLoopJoin = message.nodeBody?.nestedLoopJoin - ? NestedLoopJoinNode.toJSON(message.nodeBody?.nestedLoopJoin) - : undefined); - message.nodeBody?.$case === "topN" && - (obj.topN = message.nodeBody?.topN ? TopNNode.toJSON(message.nodeBody?.topN) : undefined); - message.nodeBody?.$case === "sortAgg" && - (obj.sortAgg = message.nodeBody?.sortAgg ? SortAggNode.toJSON(message.nodeBody?.sortAgg) : undefined); - message.nodeBody?.$case === "rowSeqScan" && - (obj.rowSeqScan = message.nodeBody?.rowSeqScan ? RowSeqScanNode.toJSON(message.nodeBody?.rowSeqScan) : undefined); - message.nodeBody?.$case === "limit" && - (obj.limit = message.nodeBody?.limit ? LimitNode.toJSON(message.nodeBody?.limit) : undefined); - message.nodeBody?.$case === "values" && - (obj.values = message.nodeBody?.values ? ValuesNode.toJSON(message.nodeBody?.values) : undefined); - message.nodeBody?.$case === "hashJoin" && - (obj.hashJoin = message.nodeBody?.hashJoin ? HashJoinNode.toJSON(message.nodeBody?.hashJoin) : undefined); - message.nodeBody?.$case === "mergeSortExchange" && (obj.mergeSortExchange = message.nodeBody?.mergeSortExchange - ? MergeSortExchangeNode.toJSON(message.nodeBody?.mergeSortExchange) - : undefined); - message.nodeBody?.$case === "hopWindow" && - (obj.hopWindow = message.nodeBody?.hopWindow ? HopWindowNode.toJSON(message.nodeBody?.hopWindow) : undefined); - message.nodeBody?.$case === "tableFunction" && (obj.tableFunction = message.nodeBody?.tableFunction - ? TableFunctionNode.toJSON(message.nodeBody?.tableFunction) - : undefined); - message.nodeBody?.$case === "sysRowSeqScan" && (obj.sysRowSeqScan = message.nodeBody?.sysRowSeqScan - ? SysRowSeqScanNode.toJSON(message.nodeBody?.sysRowSeqScan) - : undefined); - message.nodeBody?.$case === "expand" && - (obj.expand = message.nodeBody?.expand ? ExpandNode.toJSON(message.nodeBody?.expand) : undefined); - message.nodeBody?.$case === "localLookupJoin" && (obj.localLookupJoin = message.nodeBody?.localLookupJoin - ? LocalLookupJoinNode.toJSON(message.nodeBody?.localLookupJoin) - : undefined); - message.nodeBody?.$case === "projectSet" && - (obj.projectSet = message.nodeBody?.projectSet ? ProjectSetNode.toJSON(message.nodeBody?.projectSet) : undefined); - message.nodeBody?.$case === "union" && - (obj.union = message.nodeBody?.union ? UnionNode.toJSON(message.nodeBody?.union) : undefined); - message.nodeBody?.$case === "groupTopN" && - (obj.groupTopN = message.nodeBody?.groupTopN ? GroupTopNNode.toJSON(message.nodeBody?.groupTopN) : undefined); - message.nodeBody?.$case === "distributedLookupJoin" && - (obj.distributedLookupJoin = message.nodeBody?.distributedLookupJoin - ? DistributedLookupJoinNode.toJSON(message.nodeBody?.distributedLookupJoin) - : undefined); - message.nodeBody?.$case === "source" && - (obj.source = message.nodeBody?.source ? SourceNode.toJSON(message.nodeBody?.source) : undefined); - message.identity !== undefined && (obj.identity = message.identity); - return obj; - }, - - fromPartial, I>>(object: I): PlanNode { - const message = createBasePlanNode(); - message.children = object.children?.map((e) => PlanNode.fromPartial(e)) || []; - if ( - object.nodeBody?.$case === "insert" && object.nodeBody?.insert !== undefined && object.nodeBody?.insert !== null - ) { - message.nodeBody = { $case: "insert", insert: InsertNode.fromPartial(object.nodeBody.insert) }; - } - if ( - object.nodeBody?.$case === "delete" && object.nodeBody?.delete !== undefined && object.nodeBody?.delete !== null - ) { - message.nodeBody = { $case: "delete", delete: DeleteNode.fromPartial(object.nodeBody.delete) }; - } - if ( - object.nodeBody?.$case === "update" && object.nodeBody?.update !== undefined && object.nodeBody?.update !== null - ) { - message.nodeBody = { $case: "update", update: UpdateNode.fromPartial(object.nodeBody.update) }; - } - if ( - object.nodeBody?.$case === "project" && - object.nodeBody?.project !== undefined && - object.nodeBody?.project !== null - ) { - message.nodeBody = { $case: "project", project: ProjectNode.fromPartial(object.nodeBody.project) }; - } - if ( - object.nodeBody?.$case === "hashAgg" && - object.nodeBody?.hashAgg !== undefined && - object.nodeBody?.hashAgg !== null - ) { - message.nodeBody = { $case: "hashAgg", hashAgg: HashAggNode.fromPartial(object.nodeBody.hashAgg) }; - } - if ( - object.nodeBody?.$case === "filter" && object.nodeBody?.filter !== undefined && object.nodeBody?.filter !== null - ) { - message.nodeBody = { $case: "filter", filter: FilterNode.fromPartial(object.nodeBody.filter) }; - } - if ( - object.nodeBody?.$case === "exchange" && - object.nodeBody?.exchange !== undefined && - object.nodeBody?.exchange !== null - ) { - message.nodeBody = { $case: "exchange", exchange: ExchangeNode.fromPartial(object.nodeBody.exchange) }; - } - if (object.nodeBody?.$case === "sort" && object.nodeBody?.sort !== undefined && object.nodeBody?.sort !== null) { - message.nodeBody = { $case: "sort", sort: SortNode.fromPartial(object.nodeBody.sort) }; - } - if ( - object.nodeBody?.$case === "nestedLoopJoin" && - object.nodeBody?.nestedLoopJoin !== undefined && - object.nodeBody?.nestedLoopJoin !== null - ) { - message.nodeBody = { - $case: "nestedLoopJoin", - nestedLoopJoin: NestedLoopJoinNode.fromPartial(object.nodeBody.nestedLoopJoin), - }; - } - if (object.nodeBody?.$case === "topN" && object.nodeBody?.topN !== undefined && object.nodeBody?.topN !== null) { - message.nodeBody = { $case: "topN", topN: TopNNode.fromPartial(object.nodeBody.topN) }; - } - if ( - object.nodeBody?.$case === "sortAgg" && - object.nodeBody?.sortAgg !== undefined && - object.nodeBody?.sortAgg !== null - ) { - message.nodeBody = { $case: "sortAgg", sortAgg: SortAggNode.fromPartial(object.nodeBody.sortAgg) }; - } - if ( - object.nodeBody?.$case === "rowSeqScan" && - object.nodeBody?.rowSeqScan !== undefined && - object.nodeBody?.rowSeqScan !== null - ) { - message.nodeBody = { $case: "rowSeqScan", rowSeqScan: RowSeqScanNode.fromPartial(object.nodeBody.rowSeqScan) }; - } - if (object.nodeBody?.$case === "limit" && object.nodeBody?.limit !== undefined && object.nodeBody?.limit !== null) { - message.nodeBody = { $case: "limit", limit: LimitNode.fromPartial(object.nodeBody.limit) }; - } - if ( - object.nodeBody?.$case === "values" && object.nodeBody?.values !== undefined && object.nodeBody?.values !== null - ) { - message.nodeBody = { $case: "values", values: ValuesNode.fromPartial(object.nodeBody.values) }; - } - if ( - object.nodeBody?.$case === "hashJoin" && - object.nodeBody?.hashJoin !== undefined && - object.nodeBody?.hashJoin !== null - ) { - message.nodeBody = { $case: "hashJoin", hashJoin: HashJoinNode.fromPartial(object.nodeBody.hashJoin) }; - } - if ( - object.nodeBody?.$case === "mergeSortExchange" && - object.nodeBody?.mergeSortExchange !== undefined && - object.nodeBody?.mergeSortExchange !== null - ) { - message.nodeBody = { - $case: "mergeSortExchange", - mergeSortExchange: MergeSortExchangeNode.fromPartial(object.nodeBody.mergeSortExchange), - }; - } - if ( - object.nodeBody?.$case === "hopWindow" && - object.nodeBody?.hopWindow !== undefined && - object.nodeBody?.hopWindow !== null - ) { - message.nodeBody = { $case: "hopWindow", hopWindow: HopWindowNode.fromPartial(object.nodeBody.hopWindow) }; - } - if ( - object.nodeBody?.$case === "tableFunction" && - object.nodeBody?.tableFunction !== undefined && - object.nodeBody?.tableFunction !== null - ) { - message.nodeBody = { - $case: "tableFunction", - tableFunction: TableFunctionNode.fromPartial(object.nodeBody.tableFunction), - }; - } - if ( - object.nodeBody?.$case === "sysRowSeqScan" && - object.nodeBody?.sysRowSeqScan !== undefined && - object.nodeBody?.sysRowSeqScan !== null - ) { - message.nodeBody = { - $case: "sysRowSeqScan", - sysRowSeqScan: SysRowSeqScanNode.fromPartial(object.nodeBody.sysRowSeqScan), - }; - } - if ( - object.nodeBody?.$case === "expand" && object.nodeBody?.expand !== undefined && object.nodeBody?.expand !== null - ) { - message.nodeBody = { $case: "expand", expand: ExpandNode.fromPartial(object.nodeBody.expand) }; - } - if ( - object.nodeBody?.$case === "localLookupJoin" && - object.nodeBody?.localLookupJoin !== undefined && - object.nodeBody?.localLookupJoin !== null - ) { - message.nodeBody = { - $case: "localLookupJoin", - localLookupJoin: LocalLookupJoinNode.fromPartial(object.nodeBody.localLookupJoin), - }; - } - if ( - object.nodeBody?.$case === "projectSet" && - object.nodeBody?.projectSet !== undefined && - object.nodeBody?.projectSet !== null - ) { - message.nodeBody = { $case: "projectSet", projectSet: ProjectSetNode.fromPartial(object.nodeBody.projectSet) }; - } - if (object.nodeBody?.$case === "union" && object.nodeBody?.union !== undefined && object.nodeBody?.union !== null) { - message.nodeBody = { $case: "union", union: UnionNode.fromPartial(object.nodeBody.union) }; - } - if ( - object.nodeBody?.$case === "groupTopN" && - object.nodeBody?.groupTopN !== undefined && - object.nodeBody?.groupTopN !== null - ) { - message.nodeBody = { $case: "groupTopN", groupTopN: GroupTopNNode.fromPartial(object.nodeBody.groupTopN) }; - } - if ( - object.nodeBody?.$case === "distributedLookupJoin" && - object.nodeBody?.distributedLookupJoin !== undefined && - object.nodeBody?.distributedLookupJoin !== null - ) { - message.nodeBody = { - $case: "distributedLookupJoin", - distributedLookupJoin: DistributedLookupJoinNode.fromPartial(object.nodeBody.distributedLookupJoin), - }; - } - if ( - object.nodeBody?.$case === "source" && object.nodeBody?.source !== undefined && object.nodeBody?.source !== null - ) { - message.nodeBody = { $case: "source", source: SourceNode.fromPartial(object.nodeBody.source) }; - } - message.identity = object.identity ?? ""; - return message; - }, -}; - -function createBaseExchangeInfo(): ExchangeInfo { - return { mode: ExchangeInfo_DistributionMode.UNSPECIFIED, distribution: undefined }; -} - -export const ExchangeInfo = { - fromJSON(object: any): ExchangeInfo { - return { - mode: isSet(object.mode) - ? exchangeInfo_DistributionModeFromJSON(object.mode) - : ExchangeInfo_DistributionMode.UNSPECIFIED, - distribution: isSet(object.broadcastInfo) - ? { $case: "broadcastInfo", broadcastInfo: ExchangeInfo_BroadcastInfo.fromJSON(object.broadcastInfo) } - : isSet(object.hashInfo) - ? { $case: "hashInfo", hashInfo: ExchangeInfo_HashInfo.fromJSON(object.hashInfo) } - : isSet(object.consistentHashInfo) - ? { - $case: "consistentHashInfo", - consistentHashInfo: ExchangeInfo_ConsistentHashInfo.fromJSON(object.consistentHashInfo), - } - : undefined, - }; - }, - - toJSON(message: ExchangeInfo): unknown { - const obj: any = {}; - message.mode !== undefined && (obj.mode = exchangeInfo_DistributionModeToJSON(message.mode)); - message.distribution?.$case === "broadcastInfo" && (obj.broadcastInfo = message.distribution?.broadcastInfo - ? ExchangeInfo_BroadcastInfo.toJSON(message.distribution?.broadcastInfo) - : undefined); - message.distribution?.$case === "hashInfo" && (obj.hashInfo = message.distribution?.hashInfo - ? ExchangeInfo_HashInfo.toJSON(message.distribution?.hashInfo) - : undefined); - message.distribution?.$case === "consistentHashInfo" && - (obj.consistentHashInfo = message.distribution?.consistentHashInfo - ? ExchangeInfo_ConsistentHashInfo.toJSON(message.distribution?.consistentHashInfo) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeInfo { - const message = createBaseExchangeInfo(); - message.mode = object.mode ?? ExchangeInfo_DistributionMode.UNSPECIFIED; - if ( - object.distribution?.$case === "broadcastInfo" && - object.distribution?.broadcastInfo !== undefined && - object.distribution?.broadcastInfo !== null - ) { - message.distribution = { - $case: "broadcastInfo", - broadcastInfo: ExchangeInfo_BroadcastInfo.fromPartial(object.distribution.broadcastInfo), - }; - } - if ( - object.distribution?.$case === "hashInfo" && - object.distribution?.hashInfo !== undefined && - object.distribution?.hashInfo !== null - ) { - message.distribution = { - $case: "hashInfo", - hashInfo: ExchangeInfo_HashInfo.fromPartial(object.distribution.hashInfo), - }; - } - if ( - object.distribution?.$case === "consistentHashInfo" && - object.distribution?.consistentHashInfo !== undefined && - object.distribution?.consistentHashInfo !== null - ) { - message.distribution = { - $case: "consistentHashInfo", - consistentHashInfo: ExchangeInfo_ConsistentHashInfo.fromPartial(object.distribution.consistentHashInfo), - }; - } - return message; - }, -}; - -function createBaseExchangeInfo_BroadcastInfo(): ExchangeInfo_BroadcastInfo { - return { count: 0 }; -} - -export const ExchangeInfo_BroadcastInfo = { - fromJSON(object: any): ExchangeInfo_BroadcastInfo { - return { count: isSet(object.count) ? Number(object.count) : 0 }; - }, - - toJSON(message: ExchangeInfo_BroadcastInfo): unknown { - const obj: any = {}; - message.count !== undefined && (obj.count = Math.round(message.count)); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeInfo_BroadcastInfo { - const message = createBaseExchangeInfo_BroadcastInfo(); - message.count = object.count ?? 0; - return message; - }, -}; - -function createBaseExchangeInfo_HashInfo(): ExchangeInfo_HashInfo { - return { outputCount: 0, key: [] }; -} - -export const ExchangeInfo_HashInfo = { - fromJSON(object: any): ExchangeInfo_HashInfo { - return { - outputCount: isSet(object.outputCount) ? Number(object.outputCount) : 0, - key: Array.isArray(object?.key) ? object.key.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExchangeInfo_HashInfo): unknown { - const obj: any = {}; - message.outputCount !== undefined && (obj.outputCount = Math.round(message.outputCount)); - if (message.key) { - obj.key = message.key.map((e) => Math.round(e)); - } else { - obj.key = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExchangeInfo_HashInfo { - const message = createBaseExchangeInfo_HashInfo(); - message.outputCount = object.outputCount ?? 0; - message.key = object.key?.map((e) => e) || []; - return message; - }, -}; - -function createBaseExchangeInfo_ConsistentHashInfo(): ExchangeInfo_ConsistentHashInfo { - return { vmap: [], key: [] }; -} - -export const ExchangeInfo_ConsistentHashInfo = { - fromJSON(object: any): ExchangeInfo_ConsistentHashInfo { - return { - vmap: Array.isArray(object?.vmap) ? object.vmap.map((e: any) => Number(e)) : [], - key: Array.isArray(object?.key) ? object.key.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExchangeInfo_ConsistentHashInfo): unknown { - const obj: any = {}; - if (message.vmap) { - obj.vmap = message.vmap.map((e) => Math.round(e)); - } else { - obj.vmap = []; - } - if (message.key) { - obj.key = message.key.map((e) => Math.round(e)); - } else { - obj.key = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ExchangeInfo_ConsistentHashInfo { - const message = createBaseExchangeInfo_ConsistentHashInfo(); - message.vmap = object.vmap?.map((e) => e) || []; - message.key = object.key?.map((e) => e) || []; - return message; - }, -}; - -function createBasePlanFragment(): PlanFragment { - return { root: undefined, exchangeInfo: undefined }; -} - -export const PlanFragment = { - fromJSON(object: any): PlanFragment { - return { - root: isSet(object.root) ? PlanNode.fromJSON(object.root) : undefined, - exchangeInfo: isSet(object.exchangeInfo) ? ExchangeInfo.fromJSON(object.exchangeInfo) : undefined, - }; - }, - - toJSON(message: PlanFragment): unknown { - const obj: any = {}; - message.root !== undefined && (obj.root = message.root ? PlanNode.toJSON(message.root) : undefined); - message.exchangeInfo !== undefined && - (obj.exchangeInfo = message.exchangeInfo ? ExchangeInfo.toJSON(message.exchangeInfo) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PlanFragment { - const message = createBasePlanFragment(); - message.root = (object.root !== undefined && object.root !== null) ? PlanNode.fromPartial(object.root) : undefined; - message.exchangeInfo = (object.exchangeInfo !== undefined && object.exchangeInfo !== null) - ? ExchangeInfo.fromPartial(object.exchangeInfo) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/catalog.ts b/dashboard/proto/gen/catalog.ts deleted file mode 100644 index 7ac3e72f20818..0000000000000 --- a/dashboard/proto/gen/catalog.ts +++ /dev/null @@ -1,1555 +0,0 @@ -/* eslint-disable */ -import { ColumnOrder } from "./common"; -import { DataType } from "./data"; -import { ExprNode } from "./expr"; -import { ColumnCatalog, Field, RowFormatType, rowFormatTypeFromJSON, rowFormatTypeToJSON } from "./plan_common"; - -export const protobufPackage = "catalog"; - -export const SinkType = { - UNSPECIFIED: "UNSPECIFIED", - APPEND_ONLY: "APPEND_ONLY", - FORCE_APPEND_ONLY: "FORCE_APPEND_ONLY", - UPSERT: "UPSERT", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SinkType = typeof SinkType[keyof typeof SinkType]; - -export function sinkTypeFromJSON(object: any): SinkType { - switch (object) { - case 0: - case "UNSPECIFIED": - return SinkType.UNSPECIFIED; - case 1: - case "APPEND_ONLY": - return SinkType.APPEND_ONLY; - case 2: - case "FORCE_APPEND_ONLY": - return SinkType.FORCE_APPEND_ONLY; - case 3: - case "UPSERT": - return SinkType.UPSERT; - case -1: - case "UNRECOGNIZED": - default: - return SinkType.UNRECOGNIZED; - } -} - -export function sinkTypeToJSON(object: SinkType): string { - switch (object) { - case SinkType.UNSPECIFIED: - return "UNSPECIFIED"; - case SinkType.APPEND_ONLY: - return "APPEND_ONLY"; - case SinkType.FORCE_APPEND_ONLY: - return "FORCE_APPEND_ONLY"; - case SinkType.UPSERT: - return "UPSERT"; - case SinkType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const HandleConflictBehavior = { - NO_CHECK_UNSPECIFIED: "NO_CHECK_UNSPECIFIED", - OVERWRITE: "OVERWRITE", - IGNORE: "IGNORE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type HandleConflictBehavior = typeof HandleConflictBehavior[keyof typeof HandleConflictBehavior]; - -export function handleConflictBehaviorFromJSON(object: any): HandleConflictBehavior { - switch (object) { - case 0: - case "NO_CHECK_UNSPECIFIED": - return HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - case 1: - case "OVERWRITE": - return HandleConflictBehavior.OVERWRITE; - case 2: - case "IGNORE": - return HandleConflictBehavior.IGNORE; - case -1: - case "UNRECOGNIZED": - default: - return HandleConflictBehavior.UNRECOGNIZED; - } -} - -export function handleConflictBehaviorToJSON(object: HandleConflictBehavior): string { - switch (object) { - case HandleConflictBehavior.NO_CHECK_UNSPECIFIED: - return "NO_CHECK_UNSPECIFIED"; - case HandleConflictBehavior.OVERWRITE: - return "OVERWRITE"; - case HandleConflictBehavior.IGNORE: - return "IGNORE"; - case HandleConflictBehavior.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** A mapping of column indices. */ -export interface ColIndexMapping { - /** The size of the target space. */ - targetSize: number; - /** - * Each subscript is mapped to the corresponding element. - * For those not mapped, the value will be negative. - */ - map: number[]; -} - -export interface WatermarkDesc { - /** The column idx the watermark is on */ - watermarkIdx: number; - /** The expression to calculate the watermark value. */ - expr: ExprNode | undefined; -} - -export interface StreamSourceInfo { - rowFormat: RowFormatType; - rowSchemaLocation: string; - useSchemaRegistry: boolean; - protoMessageName: string; - csvDelimiter: number; - csvHasHeader: boolean; - upsertAvroPrimaryKey: string; -} - -export interface Source { - id: number; - schemaId: number; - databaseId: number; - name: string; - /** - * The column index of row ID. If the primary key is specified by the user, - * this will be `None`. - */ - rowIdIndex?: - | number - | undefined; - /** Columns of the source. */ - columns: ColumnCatalog[]; - /** - * Column id of the primary key specified by the user. If the user does not - * specify a primary key, the vector will be empty. - */ - pkColumnIds: number[]; - /** Properties specified by the user in WITH clause. */ - properties: { [key: string]: string }; - owner: number; - info: - | StreamSourceInfo - | undefined; - /** - * Define watermarks on the source. The `repeated` is just for forward - * compatibility, currently, only one watermark on the source - */ - watermarkDescs: WatermarkDesc[]; -} - -export interface Source_PropertiesEntry { - key: string; - value: string; -} - -export interface Sink { - id: number; - schemaId: number; - databaseId: number; - name: string; - columns: ColumnCatalog[]; - pk: ColumnOrder[]; - dependentRelations: number[]; - distributionKey: number[]; - /** pk_indices of the corresponding materialize operator's output. */ - streamKey: number[]; - sinkType: SinkType; - owner: number; - properties: { [key: string]: string }; - definition: string; -} - -export interface Sink_PropertiesEntry { - key: string; - value: string; -} - -export interface Connection { - id: number; - name: string; - info?: { $case: "privateLinkService"; privateLinkService: Connection_PrivateLinkService }; -} - -export interface Connection_PrivateLinkService { - provider: string; - endpointId: string; - dnsEntries: { [key: string]: string }; -} - -export interface Connection_PrivateLinkService_DnsEntriesEntry { - key: string; - value: string; -} - -export interface Index { - id: number; - schemaId: number; - databaseId: number; - name: string; - owner: number; - indexTableId: number; - primaryTableId: number; - /** - * Only `InputRef` type index is supported Now. - * The index of `InputRef` is the column index of the primary table. - */ - indexItem: ExprNode[]; - originalColumns: number[]; -} - -export interface Function { - id: number; - schemaId: number; - databaseId: number; - name: string; - owner: number; - argTypes: DataType[]; - returnType: DataType | undefined; - language: string; - link: string; - identifier: string; - kind?: { $case: "scalar"; scalar: Function_ScalarFunction } | { $case: "table"; table: Function_TableFunction } | { - $case: "aggregate"; - aggregate: Function_AggregateFunction; - }; -} - -export interface Function_ScalarFunction { -} - -export interface Function_TableFunction { -} - -export interface Function_AggregateFunction { -} - -/** See `TableCatalog` struct in frontend crate for more information. */ -export interface Table { - id: number; - schemaId: number; - databaseId: number; - name: string; - columns: ColumnCatalog[]; - pk: ColumnOrder[]; - dependentRelations: number[]; - optionalAssociatedSourceId?: { $case: "associatedSourceId"; associatedSourceId: number }; - tableType: Table_TableType; - distributionKey: number[]; - /** pk_indices of the corresponding materialize operator's output. */ - streamKey: number[]; - appendOnly: boolean; - owner: number; - properties: { [key: string]: string }; - fragmentId: number; - /** - * an optional column index which is the vnode of each row computed by the - * table's consistent hash distribution - */ - vnodeColIndex?: - | number - | undefined; - /** - * An optional column index of row id. If the primary key is specified by users, - * this will be `None`. - */ - rowIdIndex?: - | number - | undefined; - /** - * The column indices which are stored in the state store's value with - * row-encoding. Currently is not supported yet and expected to be - * `[0..columns.len()]`. - */ - valueIndices: number[]; - definition: string; - handlePkConflictBehavior: HandleConflictBehavior; - /** - * Anticipated read prefix pattern (number of fields) for the table, which can be utilized - * for implementing the table's bloom filter or other storage optimization techniques. - */ - readPrefixLenHint: number; - watermarkIndices: number[]; - distKeyInPk: number[]; - /** - * Per-table catalog version, used by schema change. `None` for internal tables and tests. - * Not to be confused with the global catalog version for notification service. - */ - version: Table_TableVersion | undefined; -} - -export const Table_TableType = { - UNSPECIFIED: "UNSPECIFIED", - TABLE: "TABLE", - MATERIALIZED_VIEW: "MATERIALIZED_VIEW", - INDEX: "INDEX", - INTERNAL: "INTERNAL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Table_TableType = typeof Table_TableType[keyof typeof Table_TableType]; - -export function table_TableTypeFromJSON(object: any): Table_TableType { - switch (object) { - case 0: - case "UNSPECIFIED": - return Table_TableType.UNSPECIFIED; - case 1: - case "TABLE": - return Table_TableType.TABLE; - case 2: - case "MATERIALIZED_VIEW": - return Table_TableType.MATERIALIZED_VIEW; - case 3: - case "INDEX": - return Table_TableType.INDEX; - case 4: - case "INTERNAL": - return Table_TableType.INTERNAL; - case -1: - case "UNRECOGNIZED": - default: - return Table_TableType.UNRECOGNIZED; - } -} - -export function table_TableTypeToJSON(object: Table_TableType): string { - switch (object) { - case Table_TableType.UNSPECIFIED: - return "UNSPECIFIED"; - case Table_TableType.TABLE: - return "TABLE"; - case Table_TableType.MATERIALIZED_VIEW: - return "MATERIALIZED_VIEW"; - case Table_TableType.INDEX: - return "INDEX"; - case Table_TableType.INTERNAL: - return "INTERNAL"; - case Table_TableType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface Table_TableVersion { - /** - * The version number, which will be 0 by default and be increased by 1 for - * each schema change in the frontend. - */ - version: number; - /** - * The ID of the next column to be added, which is used to make all columns - * in the table have unique IDs, even if some columns have been dropped. - */ - nextColumnId: number; -} - -export interface Table_PropertiesEntry { - key: string; - value: string; -} - -export interface View { - id: number; - schemaId: number; - databaseId: number; - name: string; - owner: number; - properties: { [key: string]: string }; - sql: string; - dependentRelations: number[]; - /** User-specified column names. */ - columns: Field[]; -} - -export interface View_PropertiesEntry { - key: string; - value: string; -} - -export interface Schema { - id: number; - databaseId: number; - name: string; - owner: number; -} - -export interface Database { - id: number; - name: string; - owner: number; -} - -function createBaseColIndexMapping(): ColIndexMapping { - return { targetSize: 0, map: [] }; -} - -export const ColIndexMapping = { - fromJSON(object: any): ColIndexMapping { - return { - targetSize: isSet(object.targetSize) ? Number(object.targetSize) : 0, - map: Array.isArray(object?.map) ? object.map.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ColIndexMapping): unknown { - const obj: any = {}; - message.targetSize !== undefined && (obj.targetSize = Math.round(message.targetSize)); - if (message.map) { - obj.map = message.map.map((e) => Math.round(e)); - } else { - obj.map = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ColIndexMapping { - const message = createBaseColIndexMapping(); - message.targetSize = object.targetSize ?? 0; - message.map = object.map?.map((e) => e) || []; - return message; - }, -}; - -function createBaseWatermarkDesc(): WatermarkDesc { - return { watermarkIdx: 0, expr: undefined }; -} - -export const WatermarkDesc = { - fromJSON(object: any): WatermarkDesc { - return { - watermarkIdx: isSet(object.watermarkIdx) ? Number(object.watermarkIdx) : 0, - expr: isSet(object.expr) ? ExprNode.fromJSON(object.expr) : undefined, - }; - }, - - toJSON(message: WatermarkDesc): unknown { - const obj: any = {}; - message.watermarkIdx !== undefined && (obj.watermarkIdx = Math.round(message.watermarkIdx)); - message.expr !== undefined && (obj.expr = message.expr ? ExprNode.toJSON(message.expr) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): WatermarkDesc { - const message = createBaseWatermarkDesc(); - message.watermarkIdx = object.watermarkIdx ?? 0; - message.expr = (object.expr !== undefined && object.expr !== null) ? ExprNode.fromPartial(object.expr) : undefined; - return message; - }, -}; - -function createBaseStreamSourceInfo(): StreamSourceInfo { - return { - rowFormat: RowFormatType.ROW_UNSPECIFIED, - rowSchemaLocation: "", - useSchemaRegistry: false, - protoMessageName: "", - csvDelimiter: 0, - csvHasHeader: false, - upsertAvroPrimaryKey: "", - }; -} - -export const StreamSourceInfo = { - fromJSON(object: any): StreamSourceInfo { - return { - rowFormat: isSet(object.rowFormat) ? rowFormatTypeFromJSON(object.rowFormat) : RowFormatType.ROW_UNSPECIFIED, - rowSchemaLocation: isSet(object.rowSchemaLocation) ? String(object.rowSchemaLocation) : "", - useSchemaRegistry: isSet(object.useSchemaRegistry) ? Boolean(object.useSchemaRegistry) : false, - protoMessageName: isSet(object.protoMessageName) ? String(object.protoMessageName) : "", - csvDelimiter: isSet(object.csvDelimiter) ? Number(object.csvDelimiter) : 0, - csvHasHeader: isSet(object.csvHasHeader) ? Boolean(object.csvHasHeader) : false, - upsertAvroPrimaryKey: isSet(object.upsertAvroPrimaryKey) ? String(object.upsertAvroPrimaryKey) : "", - }; - }, - - toJSON(message: StreamSourceInfo): unknown { - const obj: any = {}; - message.rowFormat !== undefined && (obj.rowFormat = rowFormatTypeToJSON(message.rowFormat)); - message.rowSchemaLocation !== undefined && (obj.rowSchemaLocation = message.rowSchemaLocation); - message.useSchemaRegistry !== undefined && (obj.useSchemaRegistry = message.useSchemaRegistry); - message.protoMessageName !== undefined && (obj.protoMessageName = message.protoMessageName); - message.csvDelimiter !== undefined && (obj.csvDelimiter = Math.round(message.csvDelimiter)); - message.csvHasHeader !== undefined && (obj.csvHasHeader = message.csvHasHeader); - message.upsertAvroPrimaryKey !== undefined && (obj.upsertAvroPrimaryKey = message.upsertAvroPrimaryKey); - return obj; - }, - - fromPartial, I>>(object: I): StreamSourceInfo { - const message = createBaseStreamSourceInfo(); - message.rowFormat = object.rowFormat ?? RowFormatType.ROW_UNSPECIFIED; - message.rowSchemaLocation = object.rowSchemaLocation ?? ""; - message.useSchemaRegistry = object.useSchemaRegistry ?? false; - message.protoMessageName = object.protoMessageName ?? ""; - message.csvDelimiter = object.csvDelimiter ?? 0; - message.csvHasHeader = object.csvHasHeader ?? false; - message.upsertAvroPrimaryKey = object.upsertAvroPrimaryKey ?? ""; - return message; - }, -}; - -function createBaseSource(): Source { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - rowIdIndex: undefined, - columns: [], - pkColumnIds: [], - properties: {}, - owner: 0, - info: undefined, - watermarkDescs: [], - }; -} - -export const Source = { - fromJSON(object: any): Source { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pkColumnIds: Array.isArray(object?.pkColumnIds) ? object.pkColumnIds.map((e: any) => Number(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - owner: isSet(object.owner) ? Number(object.owner) : 0, - info: isSet(object.info) ? StreamSourceInfo.fromJSON(object.info) : undefined, - watermarkDescs: Array.isArray(object?.watermarkDescs) - ? object.watermarkDescs.map((e: any) => WatermarkDesc.fromJSON(e)) - : [], - }; - }, - - toJSON(message: Source): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pkColumnIds) { - obj.pkColumnIds = message.pkColumnIds.map((e) => Math.round(e)); - } else { - obj.pkColumnIds = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - message.info !== undefined && (obj.info = message.info ? StreamSourceInfo.toJSON(message.info) : undefined); - if (message.watermarkDescs) { - obj.watermarkDescs = message.watermarkDescs.map((e) => e ? WatermarkDesc.toJSON(e) : undefined); - } else { - obj.watermarkDescs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Source { - const message = createBaseSource(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pkColumnIds = object.pkColumnIds?.map((e) => e) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.owner = object.owner ?? 0; - message.info = (object.info !== undefined && object.info !== null) - ? StreamSourceInfo.fromPartial(object.info) - : undefined; - message.watermarkDescs = object.watermarkDescs?.map((e) => WatermarkDesc.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSource_PropertiesEntry(): Source_PropertiesEntry { - return { key: "", value: "" }; -} - -export const Source_PropertiesEntry = { - fromJSON(object: any): Source_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Source_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): Source_PropertiesEntry { - const message = createBaseSource_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSink(): Sink { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - columns: [], - pk: [], - dependentRelations: [], - distributionKey: [], - streamKey: [], - sinkType: SinkType.UNSPECIFIED, - owner: 0, - properties: {}, - definition: "", - }; -} - -export const Sink = { - fromJSON(object: any): Sink { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pk: Array.isArray(object?.pk) ? object.pk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - dependentRelations: Array.isArray(object?.dependentRelations) - ? object.dependentRelations.map((e: any) => Number(e)) - : [], - distributionKey: Array.isArray(object?.distributionKey) - ? object.distributionKey.map((e: any) => Number(e)) - : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - sinkType: isSet(object.sinkType) ? sinkTypeFromJSON(object.sinkType) : SinkType.UNSPECIFIED, - owner: isSet(object.owner) ? Number(object.owner) : 0, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - definition: isSet(object.definition) ? String(object.definition) : "", - }; - }, - - toJSON(message: Sink): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pk) { - obj.pk = message.pk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.pk = []; - } - if (message.dependentRelations) { - obj.dependentRelations = message.dependentRelations.map((e) => Math.round(e)); - } else { - obj.dependentRelations = []; - } - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => Math.round(e)); - } else { - obj.streamKey = []; - } - message.sinkType !== undefined && (obj.sinkType = sinkTypeToJSON(message.sinkType)); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.definition !== undefined && (obj.definition = message.definition); - return obj; - }, - - fromPartial, I>>(object: I): Sink { - const message = createBaseSink(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pk = object.pk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.dependentRelations = object.dependentRelations?.map((e) => e) || []; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.sinkType = object.sinkType ?? SinkType.UNSPECIFIED; - message.owner = object.owner ?? 0; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.definition = object.definition ?? ""; - return message; - }, -}; - -function createBaseSink_PropertiesEntry(): Sink_PropertiesEntry { - return { key: "", value: "" }; -} - -export const Sink_PropertiesEntry = { - fromJSON(object: any): Sink_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Sink_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): Sink_PropertiesEntry { - const message = createBaseSink_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseConnection(): Connection { - return { id: 0, name: "", info: undefined }; -} - -export const Connection = { - fromJSON(object: any): Connection { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - info: isSet(object.privateLinkService) - ? { - $case: "privateLinkService", - privateLinkService: Connection_PrivateLinkService.fromJSON(object.privateLinkService), - } - : undefined, - }; - }, - - toJSON(message: Connection): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.info?.$case === "privateLinkService" && (obj.privateLinkService = message.info?.privateLinkService - ? Connection_PrivateLinkService.toJSON(message.info?.privateLinkService) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Connection { - const message = createBaseConnection(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - if ( - object.info?.$case === "privateLinkService" && - object.info?.privateLinkService !== undefined && - object.info?.privateLinkService !== null - ) { - message.info = { - $case: "privateLinkService", - privateLinkService: Connection_PrivateLinkService.fromPartial(object.info.privateLinkService), - }; - } - return message; - }, -}; - -function createBaseConnection_PrivateLinkService(): Connection_PrivateLinkService { - return { provider: "", endpointId: "", dnsEntries: {} }; -} - -export const Connection_PrivateLinkService = { - fromJSON(object: any): Connection_PrivateLinkService { - return { - provider: isSet(object.provider) ? String(object.provider) : "", - endpointId: isSet(object.endpointId) ? String(object.endpointId) : "", - dnsEntries: isObject(object.dnsEntries) - ? Object.entries(object.dnsEntries).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: Connection_PrivateLinkService): unknown { - const obj: any = {}; - message.provider !== undefined && (obj.provider = message.provider); - message.endpointId !== undefined && (obj.endpointId = message.endpointId); - obj.dnsEntries = {}; - if (message.dnsEntries) { - Object.entries(message.dnsEntries).forEach(([k, v]) => { - obj.dnsEntries[k] = v; - }); - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): Connection_PrivateLinkService { - const message = createBaseConnection_PrivateLinkService(); - message.provider = object.provider ?? ""; - message.endpointId = object.endpointId ?? ""; - message.dnsEntries = Object.entries(object.dnsEntries ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseConnection_PrivateLinkService_DnsEntriesEntry(): Connection_PrivateLinkService_DnsEntriesEntry { - return { key: "", value: "" }; -} - -export const Connection_PrivateLinkService_DnsEntriesEntry = { - fromJSON(object: any): Connection_PrivateLinkService_DnsEntriesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Connection_PrivateLinkService_DnsEntriesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): Connection_PrivateLinkService_DnsEntriesEntry { - const message = createBaseConnection_PrivateLinkService_DnsEntriesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseIndex(): Index { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - owner: 0, - indexTableId: 0, - primaryTableId: 0, - indexItem: [], - originalColumns: [], - }; -} - -export const Index = { - fromJSON(object: any): Index { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - indexTableId: isSet(object.indexTableId) ? Number(object.indexTableId) : 0, - primaryTableId: isSet(object.primaryTableId) ? Number(object.primaryTableId) : 0, - indexItem: Array.isArray(object?.indexItem) - ? object.indexItem.map((e: any) => ExprNode.fromJSON(e)) - : [], - originalColumns: Array.isArray(object?.originalColumns) ? object.originalColumns.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: Index): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - message.indexTableId !== undefined && (obj.indexTableId = Math.round(message.indexTableId)); - message.primaryTableId !== undefined && (obj.primaryTableId = Math.round(message.primaryTableId)); - if (message.indexItem) { - obj.indexItem = message.indexItem.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.indexItem = []; - } - if (message.originalColumns) { - obj.originalColumns = message.originalColumns.map((e) => Math.round(e)); - } else { - obj.originalColumns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Index { - const message = createBaseIndex(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - message.indexTableId = object.indexTableId ?? 0; - message.primaryTableId = object.primaryTableId ?? 0; - message.indexItem = object.indexItem?.map((e) => ExprNode.fromPartial(e)) || []; - message.originalColumns = object.originalColumns?.map((e) => e) || []; - return message; - }, -}; - -function createBaseFunction(): Function { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - owner: 0, - argTypes: [], - returnType: undefined, - language: "", - link: "", - identifier: "", - kind: undefined, - }; -} - -export const Function = { - fromJSON(object: any): Function { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - argTypes: Array.isArray(object?.argTypes) - ? object.argTypes.map((e: any) => DataType.fromJSON(e)) - : [], - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - language: isSet(object.language) ? String(object.language) : "", - link: isSet(object.link) ? String(object.link) : "", - identifier: isSet(object.identifier) ? String(object.identifier) : "", - kind: isSet(object.scalar) - ? { $case: "scalar", scalar: Function_ScalarFunction.fromJSON(object.scalar) } - : isSet(object.table) - ? { $case: "table", table: Function_TableFunction.fromJSON(object.table) } - : isSet(object.aggregate) - ? { $case: "aggregate", aggregate: Function_AggregateFunction.fromJSON(object.aggregate) } - : undefined, - }; - }, - - toJSON(message: Function): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - if (message.argTypes) { - obj.argTypes = message.argTypes.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.argTypes = []; - } - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.language !== undefined && (obj.language = message.language); - message.link !== undefined && (obj.link = message.link); - message.identifier !== undefined && (obj.identifier = message.identifier); - message.kind?.$case === "scalar" && - (obj.scalar = message.kind?.scalar ? Function_ScalarFunction.toJSON(message.kind?.scalar) : undefined); - message.kind?.$case === "table" && - (obj.table = message.kind?.table ? Function_TableFunction.toJSON(message.kind?.table) : undefined); - message.kind?.$case === "aggregate" && - (obj.aggregate = message.kind?.aggregate - ? Function_AggregateFunction.toJSON(message.kind?.aggregate) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Function { - const message = createBaseFunction(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - message.argTypes = object.argTypes?.map((e) => DataType.fromPartial(e)) || []; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - message.language = object.language ?? ""; - message.link = object.link ?? ""; - message.identifier = object.identifier ?? ""; - if (object.kind?.$case === "scalar" && object.kind?.scalar !== undefined && object.kind?.scalar !== null) { - message.kind = { $case: "scalar", scalar: Function_ScalarFunction.fromPartial(object.kind.scalar) }; - } - if (object.kind?.$case === "table" && object.kind?.table !== undefined && object.kind?.table !== null) { - message.kind = { $case: "table", table: Function_TableFunction.fromPartial(object.kind.table) }; - } - if (object.kind?.$case === "aggregate" && object.kind?.aggregate !== undefined && object.kind?.aggregate !== null) { - message.kind = { $case: "aggregate", aggregate: Function_AggregateFunction.fromPartial(object.kind.aggregate) }; - } - return message; - }, -}; - -function createBaseFunction_ScalarFunction(): Function_ScalarFunction { - return {}; -} - -export const Function_ScalarFunction = { - fromJSON(_: any): Function_ScalarFunction { - return {}; - }, - - toJSON(_: Function_ScalarFunction): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Function_ScalarFunction { - const message = createBaseFunction_ScalarFunction(); - return message; - }, -}; - -function createBaseFunction_TableFunction(): Function_TableFunction { - return {}; -} - -export const Function_TableFunction = { - fromJSON(_: any): Function_TableFunction { - return {}; - }, - - toJSON(_: Function_TableFunction): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Function_TableFunction { - const message = createBaseFunction_TableFunction(); - return message; - }, -}; - -function createBaseFunction_AggregateFunction(): Function_AggregateFunction { - return {}; -} - -export const Function_AggregateFunction = { - fromJSON(_: any): Function_AggregateFunction { - return {}; - }, - - toJSON(_: Function_AggregateFunction): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Function_AggregateFunction { - const message = createBaseFunction_AggregateFunction(); - return message; - }, -}; - -function createBaseTable(): Table { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - columns: [], - pk: [], - dependentRelations: [], - optionalAssociatedSourceId: undefined, - tableType: Table_TableType.UNSPECIFIED, - distributionKey: [], - streamKey: [], - appendOnly: false, - owner: 0, - properties: {}, - fragmentId: 0, - vnodeColIndex: undefined, - rowIdIndex: undefined, - valueIndices: [], - definition: "", - handlePkConflictBehavior: HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - readPrefixLenHint: 0, - watermarkIndices: [], - distKeyInPk: [], - version: undefined, - }; -} - -export const Table = { - fromJSON(object: any): Table { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pk: Array.isArray(object?.pk) ? object.pk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - dependentRelations: Array.isArray(object?.dependentRelations) - ? object.dependentRelations.map((e: any) => Number(e)) - : [], - optionalAssociatedSourceId: isSet(object.associatedSourceId) - ? { $case: "associatedSourceId", associatedSourceId: Number(object.associatedSourceId) } - : undefined, - tableType: isSet(object.tableType) ? table_TableTypeFromJSON(object.tableType) : Table_TableType.UNSPECIFIED, - distributionKey: Array.isArray(object?.distributionKey) - ? object.distributionKey.map((e: any) => Number(e)) - : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - appendOnly: isSet(object.appendOnly) ? Boolean(object.appendOnly) : false, - owner: isSet(object.owner) ? Number(object.owner) : 0, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - vnodeColIndex: isSet(object.vnodeColIndex) ? Number(object.vnodeColIndex) : undefined, - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - valueIndices: Array.isArray(object?.valueIndices) - ? object.valueIndices.map((e: any) => Number(e)) - : [], - definition: isSet(object.definition) ? String(object.definition) : "", - handlePkConflictBehavior: isSet(object.handlePkConflictBehavior) - ? handleConflictBehaviorFromJSON(object.handlePkConflictBehavior) - : HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - readPrefixLenHint: isSet(object.readPrefixLenHint) ? Number(object.readPrefixLenHint) : 0, - watermarkIndices: Array.isArray(object?.watermarkIndices) - ? object.watermarkIndices.map((e: any) => Number(e)) - : [], - distKeyInPk: Array.isArray(object?.distKeyInPk) ? object.distKeyInPk.map((e: any) => Number(e)) : [], - version: isSet(object.version) ? Table_TableVersion.fromJSON(object.version) : undefined, - }; - }, - - toJSON(message: Table): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pk) { - obj.pk = message.pk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.pk = []; - } - if (message.dependentRelations) { - obj.dependentRelations = message.dependentRelations.map((e) => Math.round(e)); - } else { - obj.dependentRelations = []; - } - message.optionalAssociatedSourceId?.$case === "associatedSourceId" && - (obj.associatedSourceId = Math.round(message.optionalAssociatedSourceId?.associatedSourceId)); - message.tableType !== undefined && (obj.tableType = table_TableTypeToJSON(message.tableType)); - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => Math.round(e)); - } else { - obj.streamKey = []; - } - message.appendOnly !== undefined && (obj.appendOnly = message.appendOnly); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.vnodeColIndex !== undefined && (obj.vnodeColIndex = Math.round(message.vnodeColIndex)); - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - if (message.valueIndices) { - obj.valueIndices = message.valueIndices.map((e) => Math.round(e)); - } else { - obj.valueIndices = []; - } - message.definition !== undefined && (obj.definition = message.definition); - message.handlePkConflictBehavior !== undefined && - (obj.handlePkConflictBehavior = handleConflictBehaviorToJSON(message.handlePkConflictBehavior)); - message.readPrefixLenHint !== undefined && (obj.readPrefixLenHint = Math.round(message.readPrefixLenHint)); - if (message.watermarkIndices) { - obj.watermarkIndices = message.watermarkIndices.map((e) => Math.round(e)); - } else { - obj.watermarkIndices = []; - } - if (message.distKeyInPk) { - obj.distKeyInPk = message.distKeyInPk.map((e) => Math.round(e)); - } else { - obj.distKeyInPk = []; - } - message.version !== undefined && - (obj.version = message.version ? Table_TableVersion.toJSON(message.version) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Table { - const message = createBaseTable(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pk = object.pk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.dependentRelations = object.dependentRelations?.map((e) => e) || []; - if ( - object.optionalAssociatedSourceId?.$case === "associatedSourceId" && - object.optionalAssociatedSourceId?.associatedSourceId !== undefined && - object.optionalAssociatedSourceId?.associatedSourceId !== null - ) { - message.optionalAssociatedSourceId = { - $case: "associatedSourceId", - associatedSourceId: object.optionalAssociatedSourceId.associatedSourceId, - }; - } - message.tableType = object.tableType ?? Table_TableType.UNSPECIFIED; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.appendOnly = object.appendOnly ?? false; - message.owner = object.owner ?? 0; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.fragmentId = object.fragmentId ?? 0; - message.vnodeColIndex = object.vnodeColIndex ?? undefined; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.valueIndices = object.valueIndices?.map((e) => e) || []; - message.definition = object.definition ?? ""; - message.handlePkConflictBehavior = object.handlePkConflictBehavior ?? HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - message.readPrefixLenHint = object.readPrefixLenHint ?? 0; - message.watermarkIndices = object.watermarkIndices?.map((e) => e) || []; - message.distKeyInPk = object.distKeyInPk?.map((e) => e) || []; - message.version = (object.version !== undefined && object.version !== null) - ? Table_TableVersion.fromPartial(object.version) - : undefined; - return message; - }, -}; - -function createBaseTable_TableVersion(): Table_TableVersion { - return { version: 0, nextColumnId: 0 }; -} - -export const Table_TableVersion = { - fromJSON(object: any): Table_TableVersion { - return { - version: isSet(object.version) ? Number(object.version) : 0, - nextColumnId: isSet(object.nextColumnId) ? Number(object.nextColumnId) : 0, - }; - }, - - toJSON(message: Table_TableVersion): unknown { - const obj: any = {}; - message.version !== undefined && (obj.version = Math.round(message.version)); - message.nextColumnId !== undefined && (obj.nextColumnId = Math.round(message.nextColumnId)); - return obj; - }, - - fromPartial, I>>(object: I): Table_TableVersion { - const message = createBaseTable_TableVersion(); - message.version = object.version ?? 0; - message.nextColumnId = object.nextColumnId ?? 0; - return message; - }, -}; - -function createBaseTable_PropertiesEntry(): Table_PropertiesEntry { - return { key: "", value: "" }; -} - -export const Table_PropertiesEntry = { - fromJSON(object: any): Table_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: Table_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): Table_PropertiesEntry { - const message = createBaseTable_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseView(): View { - return { - id: 0, - schemaId: 0, - databaseId: 0, - name: "", - owner: 0, - properties: {}, - sql: "", - dependentRelations: [], - columns: [], - }; -} - -export const View = { - fromJSON(object: any): View { - return { - id: isSet(object.id) ? Number(object.id) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - sql: isSet(object.sql) ? String(object.sql) : "", - dependentRelations: Array.isArray(object?.dependentRelations) - ? object.dependentRelations.map((e: any) => Number(e)) - : [], - columns: Array.isArray(object?.columns) - ? object.columns.map((e: any) => Field.fromJSON(e)) - : [], - }; - }, - - toJSON(message: View): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.sql !== undefined && (obj.sql = message.sql); - if (message.dependentRelations) { - obj.dependentRelations = message.dependentRelations.map((e) => Math.round(e)); - } else { - obj.dependentRelations = []; - } - if (message.columns) { - obj.columns = message.columns.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.columns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): View { - const message = createBaseView(); - message.id = object.id ?? 0; - message.schemaId = object.schemaId ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.sql = object.sql ?? ""; - message.dependentRelations = object.dependentRelations?.map((e) => e) || []; - message.columns = object.columns?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseView_PropertiesEntry(): View_PropertiesEntry { - return { key: "", value: "" }; -} - -export const View_PropertiesEntry = { - fromJSON(object: any): View_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: View_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): View_PropertiesEntry { - const message = createBaseView_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSchema(): Schema { - return { id: 0, databaseId: 0, name: "", owner: 0 }; -} - -export const Schema = { - fromJSON(object: any): Schema { - return { - id: isSet(object.id) ? Number(object.id) : 0, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - }; - }, - - toJSON(message: Schema): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - return obj; - }, - - fromPartial, I>>(object: I): Schema { - const message = createBaseSchema(); - message.id = object.id ?? 0; - message.databaseId = object.databaseId ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - return message; - }, -}; - -function createBaseDatabase(): Database { - return { id: 0, name: "", owner: 0 }; -} - -export const Database = { - fromJSON(object: any): Database { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - owner: isSet(object.owner) ? Number(object.owner) : 0, - }; - }, - - toJSON(message: Database): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.owner !== undefined && (obj.owner = Math.round(message.owner)); - return obj; - }, - - fromPartial, I>>(object: I): Database { - const message = createBaseDatabase(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - message.owner = object.owner ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/common.ts b/dashboard/proto/gen/common.ts deleted file mode 100644 index f3cefe80d6710..0000000000000 --- a/dashboard/proto/gen/common.ts +++ /dev/null @@ -1,659 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "common"; - -export const WorkerType = { - UNSPECIFIED: "UNSPECIFIED", - FRONTEND: "FRONTEND", - COMPUTE_NODE: "COMPUTE_NODE", - RISE_CTL: "RISE_CTL", - COMPACTOR: "COMPACTOR", - META: "META", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type WorkerType = typeof WorkerType[keyof typeof WorkerType]; - -export function workerTypeFromJSON(object: any): WorkerType { - switch (object) { - case 0: - case "UNSPECIFIED": - return WorkerType.UNSPECIFIED; - case 1: - case "FRONTEND": - return WorkerType.FRONTEND; - case 2: - case "COMPUTE_NODE": - return WorkerType.COMPUTE_NODE; - case 3: - case "RISE_CTL": - return WorkerType.RISE_CTL; - case 4: - case "COMPACTOR": - return WorkerType.COMPACTOR; - case 5: - case "META": - return WorkerType.META; - case -1: - case "UNRECOGNIZED": - default: - return WorkerType.UNRECOGNIZED; - } -} - -export function workerTypeToJSON(object: WorkerType): string { - switch (object) { - case WorkerType.UNSPECIFIED: - return "UNSPECIFIED"; - case WorkerType.FRONTEND: - return "FRONTEND"; - case WorkerType.COMPUTE_NODE: - return "COMPUTE_NODE"; - case WorkerType.RISE_CTL: - return "RISE_CTL"; - case WorkerType.COMPACTOR: - return "COMPACTOR"; - case WorkerType.META: - return "META"; - case WorkerType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const Direction = { - DIRECTION_UNSPECIFIED: "DIRECTION_UNSPECIFIED", - DIRECTION_ASCENDING: "DIRECTION_ASCENDING", - DIRECTION_DESCENDING: "DIRECTION_DESCENDING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Direction = typeof Direction[keyof typeof Direction]; - -export function directionFromJSON(object: any): Direction { - switch (object) { - case 0: - case "DIRECTION_UNSPECIFIED": - return Direction.DIRECTION_UNSPECIFIED; - case 1: - case "DIRECTION_ASCENDING": - return Direction.DIRECTION_ASCENDING; - case 2: - case "DIRECTION_DESCENDING": - return Direction.DIRECTION_DESCENDING; - case -1: - case "UNRECOGNIZED": - default: - return Direction.UNRECOGNIZED; - } -} - -export function directionToJSON(object: Direction): string { - switch (object) { - case Direction.DIRECTION_UNSPECIFIED: - return "DIRECTION_UNSPECIFIED"; - case Direction.DIRECTION_ASCENDING: - return "DIRECTION_ASCENDING"; - case Direction.DIRECTION_DESCENDING: - return "DIRECTION_DESCENDING"; - case Direction.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface Status { - code: Status_Code; - message: string; -} - -export const Status_Code = { - UNSPECIFIED: "UNSPECIFIED", - OK: "OK", - UNKNOWN_WORKER: "UNKNOWN_WORKER", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Status_Code = typeof Status_Code[keyof typeof Status_Code]; - -export function status_CodeFromJSON(object: any): Status_Code { - switch (object) { - case 0: - case "UNSPECIFIED": - return Status_Code.UNSPECIFIED; - case 1: - case "OK": - return Status_Code.OK; - case 2: - case "UNKNOWN_WORKER": - return Status_Code.UNKNOWN_WORKER; - case -1: - case "UNRECOGNIZED": - default: - return Status_Code.UNRECOGNIZED; - } -} - -export function status_CodeToJSON(object: Status_Code): string { - switch (object) { - case Status_Code.UNSPECIFIED: - return "UNSPECIFIED"; - case Status_Code.OK: - return "OK"; - case Status_Code.UNKNOWN_WORKER: - return "UNKNOWN_WORKER"; - case Status_Code.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface HostAddress { - host: string; - port: number; -} - -/** Encode which host machine an actor resides. */ -export interface ActorInfo { - actorId: number; - host: HostAddress | undefined; -} - -export interface ParallelUnit { - id: number; - workerNodeId: number; -} - -export interface WorkerNode { - id: number; - type: WorkerType; - host: HostAddress | undefined; - state: WorkerNode_State; - parallelUnits: ParallelUnit[]; -} - -export const WorkerNode_State = { - UNSPECIFIED: "UNSPECIFIED", - STARTING: "STARTING", - RUNNING: "RUNNING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type WorkerNode_State = typeof WorkerNode_State[keyof typeof WorkerNode_State]; - -export function workerNode_StateFromJSON(object: any): WorkerNode_State { - switch (object) { - case 0: - case "UNSPECIFIED": - return WorkerNode_State.UNSPECIFIED; - case 1: - case "STARTING": - return WorkerNode_State.STARTING; - case 2: - case "RUNNING": - return WorkerNode_State.RUNNING; - case -1: - case "UNRECOGNIZED": - default: - return WorkerNode_State.UNRECOGNIZED; - } -} - -export function workerNode_StateToJSON(object: WorkerNode_State): string { - switch (object) { - case WorkerNode_State.UNSPECIFIED: - return "UNSPECIFIED"; - case WorkerNode_State.STARTING: - return "STARTING"; - case WorkerNode_State.RUNNING: - return "RUNNING"; - case WorkerNode_State.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface Buffer { - compression: Buffer_CompressionType; - body: Uint8Array; -} - -export const Buffer_CompressionType = { - UNSPECIFIED: "UNSPECIFIED", - NONE: "NONE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Buffer_CompressionType = typeof Buffer_CompressionType[keyof typeof Buffer_CompressionType]; - -export function buffer_CompressionTypeFromJSON(object: any): Buffer_CompressionType { - switch (object) { - case 0: - case "UNSPECIFIED": - return Buffer_CompressionType.UNSPECIFIED; - case 1: - case "NONE": - return Buffer_CompressionType.NONE; - case -1: - case "UNRECOGNIZED": - default: - return Buffer_CompressionType.UNRECOGNIZED; - } -} - -export function buffer_CompressionTypeToJSON(object: Buffer_CompressionType): string { - switch (object) { - case Buffer_CompressionType.UNSPECIFIED: - return "UNSPECIFIED"; - case Buffer_CompressionType.NONE: - return "NONE"; - case Buffer_CompressionType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Vnode mapping for stream fragments. Stores mapping from virtual node to parallel unit id. */ -export interface ParallelUnitMapping { - originalIndices: number[]; - data: number[]; -} - -export interface BatchQueryEpoch { - epoch?: { $case: "committed"; committed: number } | { $case: "current"; current: number } | { - $case: "backup"; - backup: number; - }; -} - -export interface OrderType { - /** - * TODO(rc): enable `NULLS FIRST | LAST` - * NullsAre nulls_are = 2; - */ - direction: Direction; -} - -/** Column index with an order type (ASC or DESC). Used to represent a sort key (`repeated ColumnOrder`). */ -export interface ColumnOrder { - columnIndex: number; - orderType: OrderType | undefined; -} - -function createBaseStatus(): Status { - return { code: Status_Code.UNSPECIFIED, message: "" }; -} - -export const Status = { - fromJSON(object: any): Status { - return { - code: isSet(object.code) ? status_CodeFromJSON(object.code) : Status_Code.UNSPECIFIED, - message: isSet(object.message) ? String(object.message) : "", - }; - }, - - toJSON(message: Status): unknown { - const obj: any = {}; - message.code !== undefined && (obj.code = status_CodeToJSON(message.code)); - message.message !== undefined && (obj.message = message.message); - return obj; - }, - - fromPartial, I>>(object: I): Status { - const message = createBaseStatus(); - message.code = object.code ?? Status_Code.UNSPECIFIED; - message.message = object.message ?? ""; - return message; - }, -}; - -function createBaseHostAddress(): HostAddress { - return { host: "", port: 0 }; -} - -export const HostAddress = { - fromJSON(object: any): HostAddress { - return { host: isSet(object.host) ? String(object.host) : "", port: isSet(object.port) ? Number(object.port) : 0 }; - }, - - toJSON(message: HostAddress): unknown { - const obj: any = {}; - message.host !== undefined && (obj.host = message.host); - message.port !== undefined && (obj.port = Math.round(message.port)); - return obj; - }, - - fromPartial, I>>(object: I): HostAddress { - const message = createBaseHostAddress(); - message.host = object.host ?? ""; - message.port = object.port ?? 0; - return message; - }, -}; - -function createBaseActorInfo(): ActorInfo { - return { actorId: 0, host: undefined }; -} - -export const ActorInfo = { - fromJSON(object: any): ActorInfo { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - }; - }, - - toJSON(message: ActorInfo): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ActorInfo { - const message = createBaseActorInfo(); - message.actorId = object.actorId ?? 0; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - return message; - }, -}; - -function createBaseParallelUnit(): ParallelUnit { - return { id: 0, workerNodeId: 0 }; -} - -export const ParallelUnit = { - fromJSON(object: any): ParallelUnit { - return { - id: isSet(object.id) ? Number(object.id) : 0, - workerNodeId: isSet(object.workerNodeId) ? Number(object.workerNodeId) : 0, - }; - }, - - toJSON(message: ParallelUnit): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.workerNodeId !== undefined && (obj.workerNodeId = Math.round(message.workerNodeId)); - return obj; - }, - - fromPartial, I>>(object: I): ParallelUnit { - const message = createBaseParallelUnit(); - message.id = object.id ?? 0; - message.workerNodeId = object.workerNodeId ?? 0; - return message; - }, -}; - -function createBaseWorkerNode(): WorkerNode { - return { - id: 0, - type: WorkerType.UNSPECIFIED, - host: undefined, - state: WorkerNode_State.UNSPECIFIED, - parallelUnits: [], - }; -} - -export const WorkerNode = { - fromJSON(object: any): WorkerNode { - return { - id: isSet(object.id) ? Number(object.id) : 0, - type: isSet(object.type) ? workerTypeFromJSON(object.type) : WorkerType.UNSPECIFIED, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - state: isSet(object.state) ? workerNode_StateFromJSON(object.state) : WorkerNode_State.UNSPECIFIED, - parallelUnits: Array.isArray(object?.parallelUnits) - ? object.parallelUnits.map((e: any) => ParallelUnit.fromJSON(e)) - : [], - }; - }, - - toJSON(message: WorkerNode): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.type !== undefined && (obj.type = workerTypeToJSON(message.type)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.state !== undefined && (obj.state = workerNode_StateToJSON(message.state)); - if (message.parallelUnits) { - obj.parallelUnits = message.parallelUnits.map((e) => e ? ParallelUnit.toJSON(e) : undefined); - } else { - obj.parallelUnits = []; - } - return obj; - }, - - fromPartial, I>>(object: I): WorkerNode { - const message = createBaseWorkerNode(); - message.id = object.id ?? 0; - message.type = object.type ?? WorkerType.UNSPECIFIED; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - message.state = object.state ?? WorkerNode_State.UNSPECIFIED; - message.parallelUnits = object.parallelUnits?.map((e) => ParallelUnit.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseBuffer(): Buffer { - return { compression: Buffer_CompressionType.UNSPECIFIED, body: new Uint8Array() }; -} - -export const Buffer = { - fromJSON(object: any): Buffer { - return { - compression: isSet(object.compression) - ? buffer_CompressionTypeFromJSON(object.compression) - : Buffer_CompressionType.UNSPECIFIED, - body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(), - }; - }, - - toJSON(message: Buffer): unknown { - const obj: any = {}; - message.compression !== undefined && (obj.compression = buffer_CompressionTypeToJSON(message.compression)); - message.body !== undefined && - (obj.body = base64FromBytes(message.body !== undefined ? message.body : new Uint8Array())); - return obj; - }, - - fromPartial, I>>(object: I): Buffer { - const message = createBaseBuffer(); - message.compression = object.compression ?? Buffer_CompressionType.UNSPECIFIED; - message.body = object.body ?? new Uint8Array(); - return message; - }, -}; - -function createBaseParallelUnitMapping(): ParallelUnitMapping { - return { originalIndices: [], data: [] }; -} - -export const ParallelUnitMapping = { - fromJSON(object: any): ParallelUnitMapping { - return { - originalIndices: Array.isArray(object?.originalIndices) ? object.originalIndices.map((e: any) => Number(e)) : [], - data: Array.isArray(object?.data) ? object.data.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ParallelUnitMapping): unknown { - const obj: any = {}; - if (message.originalIndices) { - obj.originalIndices = message.originalIndices.map((e) => Math.round(e)); - } else { - obj.originalIndices = []; - } - if (message.data) { - obj.data = message.data.map((e) => Math.round(e)); - } else { - obj.data = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ParallelUnitMapping { - const message = createBaseParallelUnitMapping(); - message.originalIndices = object.originalIndices?.map((e) => e) || []; - message.data = object.data?.map((e) => e) || []; - return message; - }, -}; - -function createBaseBatchQueryEpoch(): BatchQueryEpoch { - return { epoch: undefined }; -} - -export const BatchQueryEpoch = { - fromJSON(object: any): BatchQueryEpoch { - return { - epoch: isSet(object.committed) - ? { $case: "committed", committed: Number(object.committed) } - : isSet(object.current) - ? { $case: "current", current: Number(object.current) } - : isSet(object.backup) - ? { $case: "backup", backup: Number(object.backup) } - : undefined, - }; - }, - - toJSON(message: BatchQueryEpoch): unknown { - const obj: any = {}; - message.epoch?.$case === "committed" && (obj.committed = Math.round(message.epoch?.committed)); - message.epoch?.$case === "current" && (obj.current = Math.round(message.epoch?.current)); - message.epoch?.$case === "backup" && (obj.backup = Math.round(message.epoch?.backup)); - return obj; - }, - - fromPartial, I>>(object: I): BatchQueryEpoch { - const message = createBaseBatchQueryEpoch(); - if ( - object.epoch?.$case === "committed" && object.epoch?.committed !== undefined && object.epoch?.committed !== null - ) { - message.epoch = { $case: "committed", committed: object.epoch.committed }; - } - if (object.epoch?.$case === "current" && object.epoch?.current !== undefined && object.epoch?.current !== null) { - message.epoch = { $case: "current", current: object.epoch.current }; - } - if (object.epoch?.$case === "backup" && object.epoch?.backup !== undefined && object.epoch?.backup !== null) { - message.epoch = { $case: "backup", backup: object.epoch.backup }; - } - return message; - }, -}; - -function createBaseOrderType(): OrderType { - return { direction: Direction.DIRECTION_UNSPECIFIED }; -} - -export const OrderType = { - fromJSON(object: any): OrderType { - return { - direction: isSet(object.direction) ? directionFromJSON(object.direction) : Direction.DIRECTION_UNSPECIFIED, - }; - }, - - toJSON(message: OrderType): unknown { - const obj: any = {}; - message.direction !== undefined && (obj.direction = directionToJSON(message.direction)); - return obj; - }, - - fromPartial, I>>(object: I): OrderType { - const message = createBaseOrderType(); - message.direction = object.direction ?? Direction.DIRECTION_UNSPECIFIED; - return message; - }, -}; - -function createBaseColumnOrder(): ColumnOrder { - return { columnIndex: 0, orderType: undefined }; -} - -export const ColumnOrder = { - fromJSON(object: any): ColumnOrder { - return { - columnIndex: isSet(object.columnIndex) ? Number(object.columnIndex) : 0, - orderType: isSet(object.orderType) ? OrderType.fromJSON(object.orderType) : undefined, - }; - }, - - toJSON(message: ColumnOrder): unknown { - const obj: any = {}; - message.columnIndex !== undefined && (obj.columnIndex = Math.round(message.columnIndex)); - message.orderType !== undefined && - (obj.orderType = message.orderType ? OrderType.toJSON(message.orderType) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ColumnOrder { - const message = createBaseColumnOrder(); - message.columnIndex = object.columnIndex ?? 0; - message.orderType = (object.orderType !== undefined && object.orderType !== null) - ? OrderType.fromPartial(object.orderType) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/compactor.ts b/dashboard/proto/gen/compactor.ts deleted file mode 100644 index 3fee992c1f710..0000000000000 --- a/dashboard/proto/gen/compactor.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "compactor"; - -export interface CompactorRuntimeConfig { - maxConcurrentTaskNumber: number; -} - -export interface SetRuntimeConfigRequest { - config: CompactorRuntimeConfig | undefined; -} - -export interface SetRuntimeConfigResponse { -} - -function createBaseCompactorRuntimeConfig(): CompactorRuntimeConfig { - return { maxConcurrentTaskNumber: 0 }; -} - -export const CompactorRuntimeConfig = { - fromJSON(object: any): CompactorRuntimeConfig { - return { - maxConcurrentTaskNumber: isSet(object.maxConcurrentTaskNumber) ? Number(object.maxConcurrentTaskNumber) : 0, - }; - }, - - toJSON(message: CompactorRuntimeConfig): unknown { - const obj: any = {}; - message.maxConcurrentTaskNumber !== undefined && - (obj.maxConcurrentTaskNumber = Math.round(message.maxConcurrentTaskNumber)); - return obj; - }, - - fromPartial, I>>(object: I): CompactorRuntimeConfig { - const message = createBaseCompactorRuntimeConfig(); - message.maxConcurrentTaskNumber = object.maxConcurrentTaskNumber ?? 0; - return message; - }, -}; - -function createBaseSetRuntimeConfigRequest(): SetRuntimeConfigRequest { - return { config: undefined }; -} - -export const SetRuntimeConfigRequest = { - fromJSON(object: any): SetRuntimeConfigRequest { - return { config: isSet(object.config) ? CompactorRuntimeConfig.fromJSON(object.config) : undefined }; - }, - - toJSON(message: SetRuntimeConfigRequest): unknown { - const obj: any = {}; - message.config !== undefined && - (obj.config = message.config ? CompactorRuntimeConfig.toJSON(message.config) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SetRuntimeConfigRequest { - const message = createBaseSetRuntimeConfigRequest(); - message.config = (object.config !== undefined && object.config !== null) - ? CompactorRuntimeConfig.fromPartial(object.config) - : undefined; - return message; - }, -}; - -function createBaseSetRuntimeConfigResponse(): SetRuntimeConfigResponse { - return {}; -} - -export const SetRuntimeConfigResponse = { - fromJSON(_: any): SetRuntimeConfigResponse { - return {}; - }, - - toJSON(_: SetRuntimeConfigResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): SetRuntimeConfigResponse { - const message = createBaseSetRuntimeConfigResponse(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/compute.ts b/dashboard/proto/gen/compute.ts deleted file mode 100644 index 95d6595232634..0000000000000 --- a/dashboard/proto/gen/compute.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "compute"; - -export interface ShowConfigRequest { -} - -export interface ShowConfigResponse { - batchConfig: string; - streamConfig: string; -} - -function createBaseShowConfigRequest(): ShowConfigRequest { - return {}; -} - -export const ShowConfigRequest = { - fromJSON(_: any): ShowConfigRequest { - return {}; - }, - - toJSON(_: ShowConfigRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ShowConfigRequest { - const message = createBaseShowConfigRequest(); - return message; - }, -}; - -function createBaseShowConfigResponse(): ShowConfigResponse { - return { batchConfig: "", streamConfig: "" }; -} - -export const ShowConfigResponse = { - fromJSON(object: any): ShowConfigResponse { - return { - batchConfig: isSet(object.batchConfig) ? String(object.batchConfig) : "", - streamConfig: isSet(object.streamConfig) ? String(object.streamConfig) : "", - }; - }, - - toJSON(message: ShowConfigResponse): unknown { - const obj: any = {}; - message.batchConfig !== undefined && (obj.batchConfig = message.batchConfig); - message.streamConfig !== undefined && (obj.streamConfig = message.streamConfig); - return obj; - }, - - fromPartial, I>>(object: I): ShowConfigResponse { - const message = createBaseShowConfigResponse(); - message.batchConfig = object.batchConfig ?? ""; - message.streamConfig = object.streamConfig ?? ""; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/connector_service.ts b/dashboard/proto/gen/connector_service.ts deleted file mode 100644 index 8e8a96c48bd0d..0000000000000 --- a/dashboard/proto/gen/connector_service.ts +++ /dev/null @@ -1,1115 +0,0 @@ -/* eslint-disable */ -import { SinkType, sinkTypeFromJSON, sinkTypeToJSON } from "./catalog"; -import { - DataType_TypeName, - dataType_TypeNameFromJSON, - dataType_TypeNameToJSON, - Op, - opFromJSON, - opToJSON, -} from "./data"; - -export const protobufPackage = "connector_service"; - -export const SinkPayloadFormat = { - FORMAT_UNSPECIFIED: "FORMAT_UNSPECIFIED", - JSON: "JSON", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SinkPayloadFormat = typeof SinkPayloadFormat[keyof typeof SinkPayloadFormat]; - -export function sinkPayloadFormatFromJSON(object: any): SinkPayloadFormat { - switch (object) { - case 0: - case "FORMAT_UNSPECIFIED": - return SinkPayloadFormat.FORMAT_UNSPECIFIED; - case 1: - case "JSON": - return SinkPayloadFormat.JSON; - case -1: - case "UNRECOGNIZED": - default: - return SinkPayloadFormat.UNRECOGNIZED; - } -} - -export function sinkPayloadFormatToJSON(object: SinkPayloadFormat): string { - switch (object) { - case SinkPayloadFormat.FORMAT_UNSPECIFIED: - return "FORMAT_UNSPECIFIED"; - case SinkPayloadFormat.JSON: - return "JSON"; - case SinkPayloadFormat.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const SourceType = { - UNSPECIFIED: "UNSPECIFIED", - MYSQL: "MYSQL", - POSTGRES: "POSTGRES", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SourceType = typeof SourceType[keyof typeof SourceType]; - -export function sourceTypeFromJSON(object: any): SourceType { - switch (object) { - case 0: - case "UNSPECIFIED": - return SourceType.UNSPECIFIED; - case 1: - case "MYSQL": - return SourceType.MYSQL; - case 2: - case "POSTGRES": - return SourceType.POSTGRES; - case -1: - case "UNRECOGNIZED": - default: - return SourceType.UNRECOGNIZED; - } -} - -export function sourceTypeToJSON(object: SourceType): string { - switch (object) { - case SourceType.UNSPECIFIED: - return "UNSPECIFIED"; - case SourceType.MYSQL: - return "MYSQL"; - case SourceType.POSTGRES: - return "POSTGRES"; - case SourceType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableSchema { - columns: TableSchema_Column[]; - pkIndices: number[]; -} - -export interface TableSchema_Column { - name: string; - dataType: DataType_TypeName; -} - -export interface ValidationError { - errorMessage: string; -} - -export interface SinkConfig { - connectorType: string; - properties: { [key: string]: string }; - tableSchema: TableSchema | undefined; -} - -export interface SinkConfig_PropertiesEntry { - key: string; - value: string; -} - -export interface SinkStreamRequest { - request?: - | { $case: "start"; start: SinkStreamRequest_StartSink } - | { $case: "startEpoch"; startEpoch: SinkStreamRequest_StartEpoch } - | { $case: "write"; write: SinkStreamRequest_WriteBatch } - | { $case: "sync"; sync: SinkStreamRequest_SyncBatch }; -} - -export interface SinkStreamRequest_StartSink { - sinkConfig: SinkConfig | undefined; - format: SinkPayloadFormat; -} - -export interface SinkStreamRequest_WriteBatch { - payload?: { $case: "jsonPayload"; jsonPayload: SinkStreamRequest_WriteBatch_JsonPayload }; - batchId: number; - epoch: number; -} - -export interface SinkStreamRequest_WriteBatch_JsonPayload { - rowOps: SinkStreamRequest_WriteBatch_JsonPayload_RowOp[]; -} - -export interface SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - opType: Op; - line: string; -} - -export interface SinkStreamRequest_StartEpoch { - epoch: number; -} - -export interface SinkStreamRequest_SyncBatch { - epoch: number; -} - -export interface SinkResponse { - response?: - | { $case: "sync"; sync: SinkResponse_SyncResponse } - | { $case: "startEpoch"; startEpoch: SinkResponse_StartEpochResponse } - | { $case: "write"; write: SinkResponse_WriteResponse } - | { $case: "start"; start: SinkResponse_StartResponse }; -} - -export interface SinkResponse_SyncResponse { - epoch: number; -} - -export interface SinkResponse_StartEpochResponse { - epoch: number; -} - -export interface SinkResponse_WriteResponse { - epoch: number; - batchId: number; -} - -export interface SinkResponse_StartResponse { -} - -export interface ValidateSinkRequest { - sinkConfig: SinkConfig | undefined; - sinkType: SinkType; -} - -export interface ValidateSinkResponse { - /** On validation failure, we return the error. */ - error: ValidationError | undefined; -} - -export interface CdcMessage { - payload: string; - partition: string; - offset: string; -} - -export interface GetEventStreamRequest { - request?: { $case: "validate"; validate: GetEventStreamRequest_ValidateProperties } | { - $case: "start"; - start: GetEventStreamRequest_StartSource; - }; -} - -export interface GetEventStreamRequest_ValidateProperties { - sourceId: number; - sourceType: SourceType; - properties: { [key: string]: string }; - tableSchema: TableSchema | undefined; -} - -export interface GetEventStreamRequest_ValidateProperties_PropertiesEntry { - key: string; - value: string; -} - -export interface GetEventStreamRequest_StartSource { - sourceId: number; - sourceType: SourceType; - startOffset: string; - properties: { [key: string]: string }; -} - -export interface GetEventStreamRequest_StartSource_PropertiesEntry { - key: string; - value: string; -} - -export interface GetEventStreamResponse { - sourceId: number; - events: CdcMessage[]; -} - -function createBaseTableSchema(): TableSchema { - return { columns: [], pkIndices: [] }; -} - -export const TableSchema = { - fromJSON(object: any): TableSchema { - return { - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => TableSchema_Column.fromJSON(e)) : [], - pkIndices: Array.isArray(object?.pkIndices) ? object.pkIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: TableSchema): unknown { - const obj: any = {}; - if (message.columns) { - obj.columns = message.columns.map((e) => e ? TableSchema_Column.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pkIndices) { - obj.pkIndices = message.pkIndices.map((e) => Math.round(e)); - } else { - obj.pkIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): TableSchema { - const message = createBaseTableSchema(); - message.columns = object.columns?.map((e) => TableSchema_Column.fromPartial(e)) || []; - message.pkIndices = object.pkIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTableSchema_Column(): TableSchema_Column { - return { name: "", dataType: DataType_TypeName.TYPE_UNSPECIFIED }; -} - -export const TableSchema_Column = { - fromJSON(object: any): TableSchema_Column { - return { - name: isSet(object.name) ? String(object.name) : "", - dataType: isSet(object.dataType) - ? dataType_TypeNameFromJSON(object.dataType) - : DataType_TypeName.TYPE_UNSPECIFIED, - }; - }, - - toJSON(message: TableSchema_Column): unknown { - const obj: any = {}; - message.name !== undefined && (obj.name = message.name); - message.dataType !== undefined && (obj.dataType = dataType_TypeNameToJSON(message.dataType)); - return obj; - }, - - fromPartial, I>>(object: I): TableSchema_Column { - const message = createBaseTableSchema_Column(); - message.name = object.name ?? ""; - message.dataType = object.dataType ?? DataType_TypeName.TYPE_UNSPECIFIED; - return message; - }, -}; - -function createBaseValidationError(): ValidationError { - return { errorMessage: "" }; -} - -export const ValidationError = { - fromJSON(object: any): ValidationError { - return { errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "" }; - }, - - toJSON(message: ValidationError): unknown { - const obj: any = {}; - message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage); - return obj; - }, - - fromPartial, I>>(object: I): ValidationError { - const message = createBaseValidationError(); - message.errorMessage = object.errorMessage ?? ""; - return message; - }, -}; - -function createBaseSinkConfig(): SinkConfig { - return { connectorType: "", properties: {}, tableSchema: undefined }; -} - -export const SinkConfig = { - fromJSON(object: any): SinkConfig { - return { - connectorType: isSet(object.connectorType) ? String(object.connectorType) : "", - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - tableSchema: isSet(object.tableSchema) ? TableSchema.fromJSON(object.tableSchema) : undefined, - }; - }, - - toJSON(message: SinkConfig): unknown { - const obj: any = {}; - message.connectorType !== undefined && (obj.connectorType = message.connectorType); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.tableSchema !== undefined && - (obj.tableSchema = message.tableSchema ? TableSchema.toJSON(message.tableSchema) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkConfig { - const message = createBaseSinkConfig(); - message.connectorType = object.connectorType ?? ""; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.tableSchema = (object.tableSchema !== undefined && object.tableSchema !== null) - ? TableSchema.fromPartial(object.tableSchema) - : undefined; - return message; - }, -}; - -function createBaseSinkConfig_PropertiesEntry(): SinkConfig_PropertiesEntry { - return { key: "", value: "" }; -} - -export const SinkConfig_PropertiesEntry = { - fromJSON(object: any): SinkConfig_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: SinkConfig_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SinkConfig_PropertiesEntry { - const message = createBaseSinkConfig_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSinkStreamRequest(): SinkStreamRequest { - return { request: undefined }; -} - -export const SinkStreamRequest = { - fromJSON(object: any): SinkStreamRequest { - return { - request: isSet(object.start) - ? { $case: "start", start: SinkStreamRequest_StartSink.fromJSON(object.start) } - : isSet(object.startEpoch) - ? { $case: "startEpoch", startEpoch: SinkStreamRequest_StartEpoch.fromJSON(object.startEpoch) } - : isSet(object.write) - ? { $case: "write", write: SinkStreamRequest_WriteBatch.fromJSON(object.write) } - : isSet(object.sync) - ? { $case: "sync", sync: SinkStreamRequest_SyncBatch.fromJSON(object.sync) } - : undefined, - }; - }, - - toJSON(message: SinkStreamRequest): unknown { - const obj: any = {}; - message.request?.$case === "start" && - (obj.start = message.request?.start ? SinkStreamRequest_StartSink.toJSON(message.request?.start) : undefined); - message.request?.$case === "startEpoch" && (obj.startEpoch = message.request?.startEpoch - ? SinkStreamRequest_StartEpoch.toJSON(message.request?.startEpoch) - : undefined); - message.request?.$case === "write" && - (obj.write = message.request?.write ? SinkStreamRequest_WriteBatch.toJSON(message.request?.write) : undefined); - message.request?.$case === "sync" && - (obj.sync = message.request?.sync ? SinkStreamRequest_SyncBatch.toJSON(message.request?.sync) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest { - const message = createBaseSinkStreamRequest(); - if (object.request?.$case === "start" && object.request?.start !== undefined && object.request?.start !== null) { - message.request = { $case: "start", start: SinkStreamRequest_StartSink.fromPartial(object.request.start) }; - } - if ( - object.request?.$case === "startEpoch" && - object.request?.startEpoch !== undefined && - object.request?.startEpoch !== null - ) { - message.request = { - $case: "startEpoch", - startEpoch: SinkStreamRequest_StartEpoch.fromPartial(object.request.startEpoch), - }; - } - if (object.request?.$case === "write" && object.request?.write !== undefined && object.request?.write !== null) { - message.request = { $case: "write", write: SinkStreamRequest_WriteBatch.fromPartial(object.request.write) }; - } - if (object.request?.$case === "sync" && object.request?.sync !== undefined && object.request?.sync !== null) { - message.request = { $case: "sync", sync: SinkStreamRequest_SyncBatch.fromPartial(object.request.sync) }; - } - return message; - }, -}; - -function createBaseSinkStreamRequest_StartSink(): SinkStreamRequest_StartSink { - return { sinkConfig: undefined, format: SinkPayloadFormat.FORMAT_UNSPECIFIED }; -} - -export const SinkStreamRequest_StartSink = { - fromJSON(object: any): SinkStreamRequest_StartSink { - return { - sinkConfig: isSet(object.sinkConfig) ? SinkConfig.fromJSON(object.sinkConfig) : undefined, - format: isSet(object.format) ? sinkPayloadFormatFromJSON(object.format) : SinkPayloadFormat.FORMAT_UNSPECIFIED, - }; - }, - - toJSON(message: SinkStreamRequest_StartSink): unknown { - const obj: any = {}; - message.sinkConfig !== undefined && - (obj.sinkConfig = message.sinkConfig ? SinkConfig.toJSON(message.sinkConfig) : undefined); - message.format !== undefined && (obj.format = sinkPayloadFormatToJSON(message.format)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_StartSink { - const message = createBaseSinkStreamRequest_StartSink(); - message.sinkConfig = (object.sinkConfig !== undefined && object.sinkConfig !== null) - ? SinkConfig.fromPartial(object.sinkConfig) - : undefined; - message.format = object.format ?? SinkPayloadFormat.FORMAT_UNSPECIFIED; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch(): SinkStreamRequest_WriteBatch { - return { payload: undefined, batchId: 0, epoch: 0 }; -} - -export const SinkStreamRequest_WriteBatch = { - fromJSON(object: any): SinkStreamRequest_WriteBatch { - return { - payload: isSet(object.jsonPayload) - ? { $case: "jsonPayload", jsonPayload: SinkStreamRequest_WriteBatch_JsonPayload.fromJSON(object.jsonPayload) } - : undefined, - batchId: isSet(object.batchId) ? Number(object.batchId) : 0, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch): unknown { - const obj: any = {}; - message.payload?.$case === "jsonPayload" && (obj.jsonPayload = message.payload?.jsonPayload - ? SinkStreamRequest_WriteBatch_JsonPayload.toJSON(message.payload?.jsonPayload) - : undefined); - message.batchId !== undefined && (obj.batchId = Math.round(message.batchId)); - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_WriteBatch { - const message = createBaseSinkStreamRequest_WriteBatch(); - if ( - object.payload?.$case === "jsonPayload" && - object.payload?.jsonPayload !== undefined && - object.payload?.jsonPayload !== null - ) { - message.payload = { - $case: "jsonPayload", - jsonPayload: SinkStreamRequest_WriteBatch_JsonPayload.fromPartial(object.payload.jsonPayload), - }; - } - message.batchId = object.batchId ?? 0; - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch_JsonPayload(): SinkStreamRequest_WriteBatch_JsonPayload { - return { rowOps: [] }; -} - -export const SinkStreamRequest_WriteBatch_JsonPayload = { - fromJSON(object: any): SinkStreamRequest_WriteBatch_JsonPayload { - return { - rowOps: Array.isArray(object?.rowOps) - ? object.rowOps.map((e: any) => SinkStreamRequest_WriteBatch_JsonPayload_RowOp.fromJSON(e)) - : [], - }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch_JsonPayload): unknown { - const obj: any = {}; - if (message.rowOps) { - obj.rowOps = message.rowOps.map((e) => e ? SinkStreamRequest_WriteBatch_JsonPayload_RowOp.toJSON(e) : undefined); - } else { - obj.rowOps = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkStreamRequest_WriteBatch_JsonPayload { - const message = createBaseSinkStreamRequest_WriteBatch_JsonPayload(); - message.rowOps = object.rowOps?.map((e) => SinkStreamRequest_WriteBatch_JsonPayload_RowOp.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSinkStreamRequest_WriteBatch_JsonPayload_RowOp(): SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - return { opType: Op.OP_UNSPECIFIED, line: "" }; -} - -export const SinkStreamRequest_WriteBatch_JsonPayload_RowOp = { - fromJSON(object: any): SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - return { - opType: isSet(object.opType) ? opFromJSON(object.opType) : Op.OP_UNSPECIFIED, - line: isSet(object.line) ? String(object.line) : "", - }; - }, - - toJSON(message: SinkStreamRequest_WriteBatch_JsonPayload_RowOp): unknown { - const obj: any = {}; - message.opType !== undefined && (obj.opType = opToJSON(message.opType)); - message.line !== undefined && (obj.line = message.line); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkStreamRequest_WriteBatch_JsonPayload_RowOp { - const message = createBaseSinkStreamRequest_WriteBatch_JsonPayload_RowOp(); - message.opType = object.opType ?? Op.OP_UNSPECIFIED; - message.line = object.line ?? ""; - return message; - }, -}; - -function createBaseSinkStreamRequest_StartEpoch(): SinkStreamRequest_StartEpoch { - return { epoch: 0 }; -} - -export const SinkStreamRequest_StartEpoch = { - fromJSON(object: any): SinkStreamRequest_StartEpoch { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkStreamRequest_StartEpoch): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_StartEpoch { - const message = createBaseSinkStreamRequest_StartEpoch(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkStreamRequest_SyncBatch(): SinkStreamRequest_SyncBatch { - return { epoch: 0 }; -} - -export const SinkStreamRequest_SyncBatch = { - fromJSON(object: any): SinkStreamRequest_SyncBatch { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkStreamRequest_SyncBatch): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkStreamRequest_SyncBatch { - const message = createBaseSinkStreamRequest_SyncBatch(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkResponse(): SinkResponse { - return { response: undefined }; -} - -export const SinkResponse = { - fromJSON(object: any): SinkResponse { - return { - response: isSet(object.sync) - ? { $case: "sync", sync: SinkResponse_SyncResponse.fromJSON(object.sync) } - : isSet(object.startEpoch) - ? { $case: "startEpoch", startEpoch: SinkResponse_StartEpochResponse.fromJSON(object.startEpoch) } - : isSet(object.write) - ? { $case: "write", write: SinkResponse_WriteResponse.fromJSON(object.write) } - : isSet(object.start) - ? { $case: "start", start: SinkResponse_StartResponse.fromJSON(object.start) } - : undefined, - }; - }, - - toJSON(message: SinkResponse): unknown { - const obj: any = {}; - message.response?.$case === "sync" && - (obj.sync = message.response?.sync ? SinkResponse_SyncResponse.toJSON(message.response?.sync) : undefined); - message.response?.$case === "startEpoch" && (obj.startEpoch = message.response?.startEpoch - ? SinkResponse_StartEpochResponse.toJSON(message.response?.startEpoch) - : undefined); - message.response?.$case === "write" && - (obj.write = message.response?.write ? SinkResponse_WriteResponse.toJSON(message.response?.write) : undefined); - message.response?.$case === "start" && - (obj.start = message.response?.start ? SinkResponse_StartResponse.toJSON(message.response?.start) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkResponse { - const message = createBaseSinkResponse(); - if (object.response?.$case === "sync" && object.response?.sync !== undefined && object.response?.sync !== null) { - message.response = { $case: "sync", sync: SinkResponse_SyncResponse.fromPartial(object.response.sync) }; - } - if ( - object.response?.$case === "startEpoch" && - object.response?.startEpoch !== undefined && - object.response?.startEpoch !== null - ) { - message.response = { - $case: "startEpoch", - startEpoch: SinkResponse_StartEpochResponse.fromPartial(object.response.startEpoch), - }; - } - if (object.response?.$case === "write" && object.response?.write !== undefined && object.response?.write !== null) { - message.response = { $case: "write", write: SinkResponse_WriteResponse.fromPartial(object.response.write) }; - } - if (object.response?.$case === "start" && object.response?.start !== undefined && object.response?.start !== null) { - message.response = { $case: "start", start: SinkResponse_StartResponse.fromPartial(object.response.start) }; - } - return message; - }, -}; - -function createBaseSinkResponse_SyncResponse(): SinkResponse_SyncResponse { - return { epoch: 0 }; -} - -export const SinkResponse_SyncResponse = { - fromJSON(object: any): SinkResponse_SyncResponse { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkResponse_SyncResponse): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): SinkResponse_SyncResponse { - const message = createBaseSinkResponse_SyncResponse(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkResponse_StartEpochResponse(): SinkResponse_StartEpochResponse { - return { epoch: 0 }; -} - -export const SinkResponse_StartEpochResponse = { - fromJSON(object: any): SinkResponse_StartEpochResponse { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: SinkResponse_StartEpochResponse): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SinkResponse_StartEpochResponse { - const message = createBaseSinkResponse_StartEpochResponse(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseSinkResponse_WriteResponse(): SinkResponse_WriteResponse { - return { epoch: 0, batchId: 0 }; -} - -export const SinkResponse_WriteResponse = { - fromJSON(object: any): SinkResponse_WriteResponse { - return { - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - batchId: isSet(object.batchId) ? Number(object.batchId) : 0, - }; - }, - - toJSON(message: SinkResponse_WriteResponse): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - message.batchId !== undefined && (obj.batchId = Math.round(message.batchId)); - return obj; - }, - - fromPartial, I>>(object: I): SinkResponse_WriteResponse { - const message = createBaseSinkResponse_WriteResponse(); - message.epoch = object.epoch ?? 0; - message.batchId = object.batchId ?? 0; - return message; - }, -}; - -function createBaseSinkResponse_StartResponse(): SinkResponse_StartResponse { - return {}; -} - -export const SinkResponse_StartResponse = { - fromJSON(_: any): SinkResponse_StartResponse { - return {}; - }, - - toJSON(_: SinkResponse_StartResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): SinkResponse_StartResponse { - const message = createBaseSinkResponse_StartResponse(); - return message; - }, -}; - -function createBaseValidateSinkRequest(): ValidateSinkRequest { - return { sinkConfig: undefined, sinkType: SinkType.UNSPECIFIED }; -} - -export const ValidateSinkRequest = { - fromJSON(object: any): ValidateSinkRequest { - return { - sinkConfig: isSet(object.sinkConfig) ? SinkConfig.fromJSON(object.sinkConfig) : undefined, - sinkType: isSet(object.sinkType) ? sinkTypeFromJSON(object.sinkType) : SinkType.UNSPECIFIED, - }; - }, - - toJSON(message: ValidateSinkRequest): unknown { - const obj: any = {}; - message.sinkConfig !== undefined && - (obj.sinkConfig = message.sinkConfig ? SinkConfig.toJSON(message.sinkConfig) : undefined); - message.sinkType !== undefined && (obj.sinkType = sinkTypeToJSON(message.sinkType)); - return obj; - }, - - fromPartial, I>>(object: I): ValidateSinkRequest { - const message = createBaseValidateSinkRequest(); - message.sinkConfig = (object.sinkConfig !== undefined && object.sinkConfig !== null) - ? SinkConfig.fromPartial(object.sinkConfig) - : undefined; - message.sinkType = object.sinkType ?? SinkType.UNSPECIFIED; - return message; - }, -}; - -function createBaseValidateSinkResponse(): ValidateSinkResponse { - return { error: undefined }; -} - -export const ValidateSinkResponse = { - fromJSON(object: any): ValidateSinkResponse { - return { error: isSet(object.error) ? ValidationError.fromJSON(object.error) : undefined }; - }, - - toJSON(message: ValidateSinkResponse): unknown { - const obj: any = {}; - message.error !== undefined && (obj.error = message.error ? ValidationError.toJSON(message.error) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ValidateSinkResponse { - const message = createBaseValidateSinkResponse(); - message.error = (object.error !== undefined && object.error !== null) - ? ValidationError.fromPartial(object.error) - : undefined; - return message; - }, -}; - -function createBaseCdcMessage(): CdcMessage { - return { payload: "", partition: "", offset: "" }; -} - -export const CdcMessage = { - fromJSON(object: any): CdcMessage { - return { - payload: isSet(object.payload) ? String(object.payload) : "", - partition: isSet(object.partition) ? String(object.partition) : "", - offset: isSet(object.offset) ? String(object.offset) : "", - }; - }, - - toJSON(message: CdcMessage): unknown { - const obj: any = {}; - message.payload !== undefined && (obj.payload = message.payload); - message.partition !== undefined && (obj.partition = message.partition); - message.offset !== undefined && (obj.offset = message.offset); - return obj; - }, - - fromPartial, I>>(object: I): CdcMessage { - const message = createBaseCdcMessage(); - message.payload = object.payload ?? ""; - message.partition = object.partition ?? ""; - message.offset = object.offset ?? ""; - return message; - }, -}; - -function createBaseGetEventStreamRequest(): GetEventStreamRequest { - return { request: undefined }; -} - -export const GetEventStreamRequest = { - fromJSON(object: any): GetEventStreamRequest { - return { - request: isSet(object.validate) - ? { $case: "validate", validate: GetEventStreamRequest_ValidateProperties.fromJSON(object.validate) } - : isSet(object.start) - ? { $case: "start", start: GetEventStreamRequest_StartSource.fromJSON(object.start) } - : undefined, - }; - }, - - toJSON(message: GetEventStreamRequest): unknown { - const obj: any = {}; - message.request?.$case === "validate" && (obj.validate = message.request?.validate - ? GetEventStreamRequest_ValidateProperties.toJSON(message.request?.validate) - : undefined); - message.request?.$case === "start" && - (obj.start = message.request?.start - ? GetEventStreamRequest_StartSource.toJSON(message.request?.start) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetEventStreamRequest { - const message = createBaseGetEventStreamRequest(); - if ( - object.request?.$case === "validate" && - object.request?.validate !== undefined && - object.request?.validate !== null - ) { - message.request = { - $case: "validate", - validate: GetEventStreamRequest_ValidateProperties.fromPartial(object.request.validate), - }; - } - if (object.request?.$case === "start" && object.request?.start !== undefined && object.request?.start !== null) { - message.request = { $case: "start", start: GetEventStreamRequest_StartSource.fromPartial(object.request.start) }; - } - return message; - }, -}; - -function createBaseGetEventStreamRequest_ValidateProperties(): GetEventStreamRequest_ValidateProperties { - return { sourceId: 0, sourceType: SourceType.UNSPECIFIED, properties: {}, tableSchema: undefined }; -} - -export const GetEventStreamRequest_ValidateProperties = { - fromJSON(object: any): GetEventStreamRequest_ValidateProperties { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - sourceType: isSet(object.sourceType) ? sourceTypeFromJSON(object.sourceType) : SourceType.UNSPECIFIED, - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - tableSchema: isSet(object.tableSchema) ? TableSchema.fromJSON(object.tableSchema) : undefined, - }; - }, - - toJSON(message: GetEventStreamRequest_ValidateProperties): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.sourceType !== undefined && (obj.sourceType = sourceTypeToJSON(message.sourceType)); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.tableSchema !== undefined && - (obj.tableSchema = message.tableSchema ? TableSchema.toJSON(message.tableSchema) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_ValidateProperties { - const message = createBaseGetEventStreamRequest_ValidateProperties(); - message.sourceId = object.sourceId ?? 0; - message.sourceType = object.sourceType ?? SourceType.UNSPECIFIED; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.tableSchema = (object.tableSchema !== undefined && object.tableSchema !== null) - ? TableSchema.fromPartial(object.tableSchema) - : undefined; - return message; - }, -}; - -function createBaseGetEventStreamRequest_ValidateProperties_PropertiesEntry(): GetEventStreamRequest_ValidateProperties_PropertiesEntry { - return { key: "", value: "" }; -} - -export const GetEventStreamRequest_ValidateProperties_PropertiesEntry = { - fromJSON(object: any): GetEventStreamRequest_ValidateProperties_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: GetEventStreamRequest_ValidateProperties_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_ValidateProperties_PropertiesEntry { - const message = createBaseGetEventStreamRequest_ValidateProperties_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseGetEventStreamRequest_StartSource(): GetEventStreamRequest_StartSource { - return { sourceId: 0, sourceType: SourceType.UNSPECIFIED, startOffset: "", properties: {} }; -} - -export const GetEventStreamRequest_StartSource = { - fromJSON(object: any): GetEventStreamRequest_StartSource { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - sourceType: isSet(object.sourceType) ? sourceTypeFromJSON(object.sourceType) : SourceType.UNSPECIFIED, - startOffset: isSet(object.startOffset) ? String(object.startOffset) : "", - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: GetEventStreamRequest_StartSource): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.sourceType !== undefined && (obj.sourceType = sourceTypeToJSON(message.sourceType)); - message.startOffset !== undefined && (obj.startOffset = message.startOffset); - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_StartSource { - const message = createBaseGetEventStreamRequest_StartSource(); - message.sourceId = object.sourceId ?? 0; - message.sourceType = object.sourceType ?? SourceType.UNSPECIFIED; - message.startOffset = object.startOffset ?? ""; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseGetEventStreamRequest_StartSource_PropertiesEntry(): GetEventStreamRequest_StartSource_PropertiesEntry { - return { key: "", value: "" }; -} - -export const GetEventStreamRequest_StartSource_PropertiesEntry = { - fromJSON(object: any): GetEventStreamRequest_StartSource_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: GetEventStreamRequest_StartSource_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetEventStreamRequest_StartSource_PropertiesEntry { - const message = createBaseGetEventStreamRequest_StartSource_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseGetEventStreamResponse(): GetEventStreamResponse { - return { sourceId: 0, events: [] }; -} - -export const GetEventStreamResponse = { - fromJSON(object: any): GetEventStreamResponse { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - events: Array.isArray(object?.events) ? object.events.map((e: any) => CdcMessage.fromJSON(e)) : [], - }; - }, - - toJSON(message: GetEventStreamResponse): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - if (message.events) { - obj.events = message.events.map((e) => e ? CdcMessage.toJSON(e) : undefined); - } else { - obj.events = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GetEventStreamResponse { - const message = createBaseGetEventStreamResponse(); - message.sourceId = object.sourceId ?? 0; - message.events = object.events?.map((e) => CdcMessage.fromPartial(e)) || []; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/data.ts b/dashboard/proto/gen/data.ts deleted file mode 100644 index d24bf8a9de15a..0000000000000 --- a/dashboard/proto/gen/data.ts +++ /dev/null @@ -1,964 +0,0 @@ -/* eslint-disable */ -import { Buffer } from "./common"; - -export const protobufPackage = "data"; - -export const RwArrayType = { - UNSPECIFIED: "UNSPECIFIED", - INT16: "INT16", - INT32: "INT32", - INT64: "INT64", - FLOAT32: "FLOAT32", - FLOAT64: "FLOAT64", - UTF8: "UTF8", - BOOL: "BOOL", - DECIMAL: "DECIMAL", - DATE: "DATE", - TIME: "TIME", - TIMESTAMP: "TIMESTAMP", - INTERVAL: "INTERVAL", - STRUCT: "STRUCT", - LIST: "LIST", - BYTEA: "BYTEA", - JSONB: "JSONB", - SERIAL: "SERIAL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type RwArrayType = typeof RwArrayType[keyof typeof RwArrayType]; - -export function rwArrayTypeFromJSON(object: any): RwArrayType { - switch (object) { - case 0: - case "UNSPECIFIED": - return RwArrayType.UNSPECIFIED; - case 1: - case "INT16": - return RwArrayType.INT16; - case 2: - case "INT32": - return RwArrayType.INT32; - case 3: - case "INT64": - return RwArrayType.INT64; - case 4: - case "FLOAT32": - return RwArrayType.FLOAT32; - case 5: - case "FLOAT64": - return RwArrayType.FLOAT64; - case 6: - case "UTF8": - return RwArrayType.UTF8; - case 7: - case "BOOL": - return RwArrayType.BOOL; - case 8: - case "DECIMAL": - return RwArrayType.DECIMAL; - case 9: - case "DATE": - return RwArrayType.DATE; - case 10: - case "TIME": - return RwArrayType.TIME; - case 11: - case "TIMESTAMP": - return RwArrayType.TIMESTAMP; - case 12: - case "INTERVAL": - return RwArrayType.INTERVAL; - case 13: - case "STRUCT": - return RwArrayType.STRUCT; - case 14: - case "LIST": - return RwArrayType.LIST; - case 15: - case "BYTEA": - return RwArrayType.BYTEA; - case 16: - case "JSONB": - return RwArrayType.JSONB; - case 17: - case "SERIAL": - return RwArrayType.SERIAL; - case -1: - case "UNRECOGNIZED": - default: - return RwArrayType.UNRECOGNIZED; - } -} - -export function rwArrayTypeToJSON(object: RwArrayType): string { - switch (object) { - case RwArrayType.UNSPECIFIED: - return "UNSPECIFIED"; - case RwArrayType.INT16: - return "INT16"; - case RwArrayType.INT32: - return "INT32"; - case RwArrayType.INT64: - return "INT64"; - case RwArrayType.FLOAT32: - return "FLOAT32"; - case RwArrayType.FLOAT64: - return "FLOAT64"; - case RwArrayType.UTF8: - return "UTF8"; - case RwArrayType.BOOL: - return "BOOL"; - case RwArrayType.DECIMAL: - return "DECIMAL"; - case RwArrayType.DATE: - return "DATE"; - case RwArrayType.TIME: - return "TIME"; - case RwArrayType.TIMESTAMP: - return "TIMESTAMP"; - case RwArrayType.INTERVAL: - return "INTERVAL"; - case RwArrayType.STRUCT: - return "STRUCT"; - case RwArrayType.LIST: - return "LIST"; - case RwArrayType.BYTEA: - return "BYTEA"; - case RwArrayType.JSONB: - return "JSONB"; - case RwArrayType.SERIAL: - return "SERIAL"; - case RwArrayType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const Op = { - OP_UNSPECIFIED: "OP_UNSPECIFIED", - INSERT: "INSERT", - DELETE: "DELETE", - UPDATE_INSERT: "UPDATE_INSERT", - UPDATE_DELETE: "UPDATE_DELETE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type Op = typeof Op[keyof typeof Op]; - -export function opFromJSON(object: any): Op { - switch (object) { - case 0: - case "OP_UNSPECIFIED": - return Op.OP_UNSPECIFIED; - case 1: - case "INSERT": - return Op.INSERT; - case 2: - case "DELETE": - return Op.DELETE; - case 3: - case "UPDATE_INSERT": - return Op.UPDATE_INSERT; - case 4: - case "UPDATE_DELETE": - return Op.UPDATE_DELETE; - case -1: - case "UNRECOGNIZED": - default: - return Op.UNRECOGNIZED; - } -} - -export function opToJSON(object: Op): string { - switch (object) { - case Op.OP_UNSPECIFIED: - return "OP_UNSPECIFIED"; - case Op.INSERT: - return "INSERT"; - case Op.DELETE: - return "DELETE"; - case Op.UPDATE_INSERT: - return "UPDATE_INSERT"; - case Op.UPDATE_DELETE: - return "UPDATE_DELETE"; - case Op.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface IntervalUnit { - months: number; - days: number; - usecs: number; -} - -export interface DataType { - typeName: DataType_TypeName; - /** - * Data length for char. - * Max data length for varchar. - * Precision for time, decimal. - */ - precision: number; - /** Scale for decimal. */ - scale: number; - isNullable: boolean; - intervalType: DataType_IntervalType; - /** - * For struct type, it represents all the fields in the struct. - * For list type it only contains 1 element which is the inner item type of the List. - * For example, `ARRAY` will be represented as `vec![DataType::Int32]`. - */ - fieldType: DataType[]; - /** Name of the fields if it is a struct type. For other types it will be empty. */ - fieldNames: string[]; -} - -export const DataType_IntervalType = { - UNSPECIFIED: "UNSPECIFIED", - YEAR: "YEAR", - MONTH: "MONTH", - DAY: "DAY", - HOUR: "HOUR", - MINUTE: "MINUTE", - SECOND: "SECOND", - YEAR_TO_MONTH: "YEAR_TO_MONTH", - DAY_TO_HOUR: "DAY_TO_HOUR", - DAY_TO_MINUTE: "DAY_TO_MINUTE", - DAY_TO_SECOND: "DAY_TO_SECOND", - HOUR_TO_MINUTE: "HOUR_TO_MINUTE", - HOUR_TO_SECOND: "HOUR_TO_SECOND", - MINUTE_TO_SECOND: "MINUTE_TO_SECOND", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type DataType_IntervalType = typeof DataType_IntervalType[keyof typeof DataType_IntervalType]; - -export function dataType_IntervalTypeFromJSON(object: any): DataType_IntervalType { - switch (object) { - case 0: - case "UNSPECIFIED": - return DataType_IntervalType.UNSPECIFIED; - case 1: - case "YEAR": - return DataType_IntervalType.YEAR; - case 2: - case "MONTH": - return DataType_IntervalType.MONTH; - case 3: - case "DAY": - return DataType_IntervalType.DAY; - case 4: - case "HOUR": - return DataType_IntervalType.HOUR; - case 5: - case "MINUTE": - return DataType_IntervalType.MINUTE; - case 6: - case "SECOND": - return DataType_IntervalType.SECOND; - case 7: - case "YEAR_TO_MONTH": - return DataType_IntervalType.YEAR_TO_MONTH; - case 8: - case "DAY_TO_HOUR": - return DataType_IntervalType.DAY_TO_HOUR; - case 9: - case "DAY_TO_MINUTE": - return DataType_IntervalType.DAY_TO_MINUTE; - case 10: - case "DAY_TO_SECOND": - return DataType_IntervalType.DAY_TO_SECOND; - case 11: - case "HOUR_TO_MINUTE": - return DataType_IntervalType.HOUR_TO_MINUTE; - case 12: - case "HOUR_TO_SECOND": - return DataType_IntervalType.HOUR_TO_SECOND; - case 13: - case "MINUTE_TO_SECOND": - return DataType_IntervalType.MINUTE_TO_SECOND; - case -1: - case "UNRECOGNIZED": - default: - return DataType_IntervalType.UNRECOGNIZED; - } -} - -export function dataType_IntervalTypeToJSON(object: DataType_IntervalType): string { - switch (object) { - case DataType_IntervalType.UNSPECIFIED: - return "UNSPECIFIED"; - case DataType_IntervalType.YEAR: - return "YEAR"; - case DataType_IntervalType.MONTH: - return "MONTH"; - case DataType_IntervalType.DAY: - return "DAY"; - case DataType_IntervalType.HOUR: - return "HOUR"; - case DataType_IntervalType.MINUTE: - return "MINUTE"; - case DataType_IntervalType.SECOND: - return "SECOND"; - case DataType_IntervalType.YEAR_TO_MONTH: - return "YEAR_TO_MONTH"; - case DataType_IntervalType.DAY_TO_HOUR: - return "DAY_TO_HOUR"; - case DataType_IntervalType.DAY_TO_MINUTE: - return "DAY_TO_MINUTE"; - case DataType_IntervalType.DAY_TO_SECOND: - return "DAY_TO_SECOND"; - case DataType_IntervalType.HOUR_TO_MINUTE: - return "HOUR_TO_MINUTE"; - case DataType_IntervalType.HOUR_TO_SECOND: - return "HOUR_TO_SECOND"; - case DataType_IntervalType.MINUTE_TO_SECOND: - return "MINUTE_TO_SECOND"; - case DataType_IntervalType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const DataType_TypeName = { - TYPE_UNSPECIFIED: "TYPE_UNSPECIFIED", - INT16: "INT16", - INT32: "INT32", - INT64: "INT64", - FLOAT: "FLOAT", - DOUBLE: "DOUBLE", - BOOLEAN: "BOOLEAN", - VARCHAR: "VARCHAR", - DECIMAL: "DECIMAL", - TIME: "TIME", - TIMESTAMP: "TIMESTAMP", - INTERVAL: "INTERVAL", - DATE: "DATE", - /** TIMESTAMPTZ - Timestamp type with timezone */ - TIMESTAMPTZ: "TIMESTAMPTZ", - STRUCT: "STRUCT", - LIST: "LIST", - BYTEA: "BYTEA", - JSONB: "JSONB", - SERIAL: "SERIAL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type DataType_TypeName = typeof DataType_TypeName[keyof typeof DataType_TypeName]; - -export function dataType_TypeNameFromJSON(object: any): DataType_TypeName { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return DataType_TypeName.TYPE_UNSPECIFIED; - case 1: - case "INT16": - return DataType_TypeName.INT16; - case 2: - case "INT32": - return DataType_TypeName.INT32; - case 3: - case "INT64": - return DataType_TypeName.INT64; - case 4: - case "FLOAT": - return DataType_TypeName.FLOAT; - case 5: - case "DOUBLE": - return DataType_TypeName.DOUBLE; - case 6: - case "BOOLEAN": - return DataType_TypeName.BOOLEAN; - case 7: - case "VARCHAR": - return DataType_TypeName.VARCHAR; - case 8: - case "DECIMAL": - return DataType_TypeName.DECIMAL; - case 9: - case "TIME": - return DataType_TypeName.TIME; - case 10: - case "TIMESTAMP": - return DataType_TypeName.TIMESTAMP; - case 11: - case "INTERVAL": - return DataType_TypeName.INTERVAL; - case 12: - case "DATE": - return DataType_TypeName.DATE; - case 13: - case "TIMESTAMPTZ": - return DataType_TypeName.TIMESTAMPTZ; - case 15: - case "STRUCT": - return DataType_TypeName.STRUCT; - case 16: - case "LIST": - return DataType_TypeName.LIST; - case 17: - case "BYTEA": - return DataType_TypeName.BYTEA; - case 18: - case "JSONB": - return DataType_TypeName.JSONB; - case 19: - case "SERIAL": - return DataType_TypeName.SERIAL; - case -1: - case "UNRECOGNIZED": - default: - return DataType_TypeName.UNRECOGNIZED; - } -} - -export function dataType_TypeNameToJSON(object: DataType_TypeName): string { - switch (object) { - case DataType_TypeName.TYPE_UNSPECIFIED: - return "TYPE_UNSPECIFIED"; - case DataType_TypeName.INT16: - return "INT16"; - case DataType_TypeName.INT32: - return "INT32"; - case DataType_TypeName.INT64: - return "INT64"; - case DataType_TypeName.FLOAT: - return "FLOAT"; - case DataType_TypeName.DOUBLE: - return "DOUBLE"; - case DataType_TypeName.BOOLEAN: - return "BOOLEAN"; - case DataType_TypeName.VARCHAR: - return "VARCHAR"; - case DataType_TypeName.DECIMAL: - return "DECIMAL"; - case DataType_TypeName.TIME: - return "TIME"; - case DataType_TypeName.TIMESTAMP: - return "TIMESTAMP"; - case DataType_TypeName.INTERVAL: - return "INTERVAL"; - case DataType_TypeName.DATE: - return "DATE"; - case DataType_TypeName.TIMESTAMPTZ: - return "TIMESTAMPTZ"; - case DataType_TypeName.STRUCT: - return "STRUCT"; - case DataType_TypeName.LIST: - return "LIST"; - case DataType_TypeName.BYTEA: - return "BYTEA"; - case DataType_TypeName.JSONB: - return "JSONB"; - case DataType_TypeName.SERIAL: - return "SERIAL"; - case DataType_TypeName.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface StructRwArrayData { - childrenArray: RwArray[]; - childrenType: DataType[]; -} - -export interface ListRwArrayData { - offsets: number[]; - value: RwArray | undefined; - valueType: DataType | undefined; -} - -export interface RwArray { - arrayType: RwArrayType; - nullBitmap: Buffer | undefined; - values: Buffer[]; - structArrayData: StructRwArrayData | undefined; - listArrayData: ListRwArrayData | undefined; -} - -export interface Datum { - /** - * bool array/bitmap: one byte, 0 for false (null), non-zero for true (non-null) - * integer, float, double: big-endianness - * interval: encoded to (months, days, milliseconds), big-endianness - * varchar: encoded accorded to encoding, currently only utf8 is supported. - */ - body: Uint8Array; -} - -/** - * New column proto def to replace fixed width column. This def - * aims to include all column type. Currently it do not support struct/array - * but capable of extending in future by add other fields. - */ -export interface Column { - array: RwArray | undefined; -} - -export interface DataChunk { - cardinality: number; - columns: Column[]; -} - -export interface StreamChunk { - /** for Column::from_protobuf(), may not need later */ - cardinality: number; - ops: Op[]; - columns: Column[]; -} - -export interface Epoch { - curr: number; - prev: number; -} - -export interface Terminate { -} - -function createBaseIntervalUnit(): IntervalUnit { - return { months: 0, days: 0, usecs: 0 }; -} - -export const IntervalUnit = { - fromJSON(object: any): IntervalUnit { - return { - months: isSet(object.months) ? Number(object.months) : 0, - days: isSet(object.days) ? Number(object.days) : 0, - usecs: isSet(object.usecs) ? Number(object.usecs) : 0, - }; - }, - - toJSON(message: IntervalUnit): unknown { - const obj: any = {}; - message.months !== undefined && (obj.months = Math.round(message.months)); - message.days !== undefined && (obj.days = Math.round(message.days)); - message.usecs !== undefined && (obj.usecs = Math.round(message.usecs)); - return obj; - }, - - fromPartial, I>>(object: I): IntervalUnit { - const message = createBaseIntervalUnit(); - message.months = object.months ?? 0; - message.days = object.days ?? 0; - message.usecs = object.usecs ?? 0; - return message; - }, -}; - -function createBaseDataType(): DataType { - return { - typeName: DataType_TypeName.TYPE_UNSPECIFIED, - precision: 0, - scale: 0, - isNullable: false, - intervalType: DataType_IntervalType.UNSPECIFIED, - fieldType: [], - fieldNames: [], - }; -} - -export const DataType = { - fromJSON(object: any): DataType { - return { - typeName: isSet(object.typeName) - ? dataType_TypeNameFromJSON(object.typeName) - : DataType_TypeName.TYPE_UNSPECIFIED, - precision: isSet(object.precision) ? Number(object.precision) : 0, - scale: isSet(object.scale) ? Number(object.scale) : 0, - isNullable: isSet(object.isNullable) ? Boolean(object.isNullable) : false, - intervalType: isSet(object.intervalType) - ? dataType_IntervalTypeFromJSON(object.intervalType) - : DataType_IntervalType.UNSPECIFIED, - fieldType: Array.isArray(object?.fieldType) ? object.fieldType.map((e: any) => DataType.fromJSON(e)) : [], - fieldNames: Array.isArray(object?.fieldNames) ? object.fieldNames.map((e: any) => String(e)) : [], - }; - }, - - toJSON(message: DataType): unknown { - const obj: any = {}; - message.typeName !== undefined && (obj.typeName = dataType_TypeNameToJSON(message.typeName)); - message.precision !== undefined && (obj.precision = Math.round(message.precision)); - message.scale !== undefined && (obj.scale = Math.round(message.scale)); - message.isNullable !== undefined && (obj.isNullable = message.isNullable); - message.intervalType !== undefined && (obj.intervalType = dataType_IntervalTypeToJSON(message.intervalType)); - if (message.fieldType) { - obj.fieldType = message.fieldType.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.fieldType = []; - } - if (message.fieldNames) { - obj.fieldNames = message.fieldNames.map((e) => e); - } else { - obj.fieldNames = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DataType { - const message = createBaseDataType(); - message.typeName = object.typeName ?? DataType_TypeName.TYPE_UNSPECIFIED; - message.precision = object.precision ?? 0; - message.scale = object.scale ?? 0; - message.isNullable = object.isNullable ?? false; - message.intervalType = object.intervalType ?? DataType_IntervalType.UNSPECIFIED; - message.fieldType = object.fieldType?.map((e) => DataType.fromPartial(e)) || []; - message.fieldNames = object.fieldNames?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStructRwArrayData(): StructRwArrayData { - return { childrenArray: [], childrenType: [] }; -} - -export const StructRwArrayData = { - fromJSON(object: any): StructRwArrayData { - return { - childrenArray: Array.isArray(object?.childrenArray) - ? object.childrenArray.map((e: any) => RwArray.fromJSON(e)) - : [], - childrenType: Array.isArray(object?.childrenType) - ? object.childrenType.map((e: any) => DataType.fromJSON(e)) - : [], - }; - }, - - toJSON(message: StructRwArrayData): unknown { - const obj: any = {}; - if (message.childrenArray) { - obj.childrenArray = message.childrenArray.map((e) => e ? RwArray.toJSON(e) : undefined); - } else { - obj.childrenArray = []; - } - if (message.childrenType) { - obj.childrenType = message.childrenType.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.childrenType = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StructRwArrayData { - const message = createBaseStructRwArrayData(); - message.childrenArray = object.childrenArray?.map((e) => RwArray.fromPartial(e)) || []; - message.childrenType = object.childrenType?.map((e) => DataType.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListRwArrayData(): ListRwArrayData { - return { offsets: [], value: undefined, valueType: undefined }; -} - -export const ListRwArrayData = { - fromJSON(object: any): ListRwArrayData { - return { - offsets: Array.isArray(object?.offsets) ? object.offsets.map((e: any) => Number(e)) : [], - value: isSet(object.value) ? RwArray.fromJSON(object.value) : undefined, - valueType: isSet(object.valueType) ? DataType.fromJSON(object.valueType) : undefined, - }; - }, - - toJSON(message: ListRwArrayData): unknown { - const obj: any = {}; - if (message.offsets) { - obj.offsets = message.offsets.map((e) => Math.round(e)); - } else { - obj.offsets = []; - } - message.value !== undefined && (obj.value = message.value ? RwArray.toJSON(message.value) : undefined); - message.valueType !== undefined && - (obj.valueType = message.valueType ? DataType.toJSON(message.valueType) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ListRwArrayData { - const message = createBaseListRwArrayData(); - message.offsets = object.offsets?.map((e) => e) || []; - message.value = (object.value !== undefined && object.value !== null) - ? RwArray.fromPartial(object.value) - : undefined; - message.valueType = (object.valueType !== undefined && object.valueType !== null) - ? DataType.fromPartial(object.valueType) - : undefined; - return message; - }, -}; - -function createBaseRwArray(): RwArray { - return { - arrayType: RwArrayType.UNSPECIFIED, - nullBitmap: undefined, - values: [], - structArrayData: undefined, - listArrayData: undefined, - }; -} - -export const RwArray = { - fromJSON(object: any): RwArray { - return { - arrayType: isSet(object.arrayType) ? rwArrayTypeFromJSON(object.arrayType) : RwArrayType.UNSPECIFIED, - nullBitmap: isSet(object.nullBitmap) ? Buffer.fromJSON(object.nullBitmap) : undefined, - values: Array.isArray(object?.values) ? object.values.map((e: any) => Buffer.fromJSON(e)) : [], - structArrayData: isSet(object.structArrayData) ? StructRwArrayData.fromJSON(object.structArrayData) : undefined, - listArrayData: isSet(object.listArrayData) ? ListRwArrayData.fromJSON(object.listArrayData) : undefined, - }; - }, - - toJSON(message: RwArray): unknown { - const obj: any = {}; - message.arrayType !== undefined && (obj.arrayType = rwArrayTypeToJSON(message.arrayType)); - message.nullBitmap !== undefined && - (obj.nullBitmap = message.nullBitmap ? Buffer.toJSON(message.nullBitmap) : undefined); - if (message.values) { - obj.values = message.values.map((e) => e ? Buffer.toJSON(e) : undefined); - } else { - obj.values = []; - } - message.structArrayData !== undefined && - (obj.structArrayData = message.structArrayData ? StructRwArrayData.toJSON(message.structArrayData) : undefined); - message.listArrayData !== undefined && - (obj.listArrayData = message.listArrayData ? ListRwArrayData.toJSON(message.listArrayData) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): RwArray { - const message = createBaseRwArray(); - message.arrayType = object.arrayType ?? RwArrayType.UNSPECIFIED; - message.nullBitmap = (object.nullBitmap !== undefined && object.nullBitmap !== null) - ? Buffer.fromPartial(object.nullBitmap) - : undefined; - message.values = object.values?.map((e) => Buffer.fromPartial(e)) || []; - message.structArrayData = (object.structArrayData !== undefined && object.structArrayData !== null) - ? StructRwArrayData.fromPartial(object.structArrayData) - : undefined; - message.listArrayData = (object.listArrayData !== undefined && object.listArrayData !== null) - ? ListRwArrayData.fromPartial(object.listArrayData) - : undefined; - return message; - }, -}; - -function createBaseDatum(): Datum { - return { body: new Uint8Array() }; -} - -export const Datum = { - fromJSON(object: any): Datum { - return { body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array() }; - }, - - toJSON(message: Datum): unknown { - const obj: any = {}; - message.body !== undefined && - (obj.body = base64FromBytes(message.body !== undefined ? message.body : new Uint8Array())); - return obj; - }, - - fromPartial, I>>(object: I): Datum { - const message = createBaseDatum(); - message.body = object.body ?? new Uint8Array(); - return message; - }, -}; - -function createBaseColumn(): Column { - return { array: undefined }; -} - -export const Column = { - fromJSON(object: any): Column { - return { array: isSet(object.array) ? RwArray.fromJSON(object.array) : undefined }; - }, - - toJSON(message: Column): unknown { - const obj: any = {}; - message.array !== undefined && (obj.array = message.array ? RwArray.toJSON(message.array) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Column { - const message = createBaseColumn(); - message.array = (object.array !== undefined && object.array !== null) - ? RwArray.fromPartial(object.array) - : undefined; - return message; - }, -}; - -function createBaseDataChunk(): DataChunk { - return { cardinality: 0, columns: [] }; -} - -export const DataChunk = { - fromJSON(object: any): DataChunk { - return { - cardinality: isSet(object.cardinality) ? Number(object.cardinality) : 0, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => Column.fromJSON(e)) : [], - }; - }, - - toJSON(message: DataChunk): unknown { - const obj: any = {}; - message.cardinality !== undefined && (obj.cardinality = Math.round(message.cardinality)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? Column.toJSON(e) : undefined); - } else { - obj.columns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DataChunk { - const message = createBaseDataChunk(); - message.cardinality = object.cardinality ?? 0; - message.columns = object.columns?.map((e) => Column.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseStreamChunk(): StreamChunk { - return { cardinality: 0, ops: [], columns: [] }; -} - -export const StreamChunk = { - fromJSON(object: any): StreamChunk { - return { - cardinality: isSet(object.cardinality) ? Number(object.cardinality) : 0, - ops: Array.isArray(object?.ops) ? object.ops.map((e: any) => opFromJSON(e)) : [], - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => Column.fromJSON(e)) : [], - }; - }, - - toJSON(message: StreamChunk): unknown { - const obj: any = {}; - message.cardinality !== undefined && (obj.cardinality = Math.round(message.cardinality)); - if (message.ops) { - obj.ops = message.ops.map((e) => opToJSON(e)); - } else { - obj.ops = []; - } - if (message.columns) { - obj.columns = message.columns.map((e) => e ? Column.toJSON(e) : undefined); - } else { - obj.columns = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StreamChunk { - const message = createBaseStreamChunk(); - message.cardinality = object.cardinality ?? 0; - message.ops = object.ops?.map((e) => e) || []; - message.columns = object.columns?.map((e) => Column.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseEpoch(): Epoch { - return { curr: 0, prev: 0 }; -} - -export const Epoch = { - fromJSON(object: any): Epoch { - return { curr: isSet(object.curr) ? Number(object.curr) : 0, prev: isSet(object.prev) ? Number(object.prev) : 0 }; - }, - - toJSON(message: Epoch): unknown { - const obj: any = {}; - message.curr !== undefined && (obj.curr = Math.round(message.curr)); - message.prev !== undefined && (obj.prev = Math.round(message.prev)); - return obj; - }, - - fromPartial, I>>(object: I): Epoch { - const message = createBaseEpoch(); - message.curr = object.curr ?? 0; - message.prev = object.prev ?? 0; - return message; - }, -}; - -function createBaseTerminate(): Terminate { - return {}; -} - -export const Terminate = { - fromJSON(_: any): Terminate { - return {}; - }, - - toJSON(_: Terminate): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): Terminate { - const message = createBaseTerminate(); - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/ddl_service.ts b/dashboard/proto/gen/ddl_service.ts deleted file mode 100644 index 56ba0f8aefac3..0000000000000 --- a/dashboard/proto/gen/ddl_service.ts +++ /dev/null @@ -1,1738 +0,0 @@ -/* eslint-disable */ -import { ColIndexMapping, Connection, Database, Function, Index, Schema, Sink, Source, Table, View } from "./catalog"; -import { Status } from "./common"; -import { StreamFragmentGraph } from "./stream_plan"; - -export const protobufPackage = "ddl_service"; - -export interface CreateDatabaseRequest { - db: Database | undefined; -} - -export interface CreateDatabaseResponse { - status: Status | undefined; - databaseId: number; - version: number; -} - -export interface DropDatabaseRequest { - databaseId: number; -} - -export interface DropDatabaseResponse { - status: Status | undefined; - version: number; -} - -export interface CreateSchemaRequest { - schema: Schema | undefined; -} - -export interface CreateSchemaResponse { - status: Status | undefined; - schemaId: number; - version: number; -} - -export interface DropSchemaRequest { - schemaId: number; -} - -export interface DropSchemaResponse { - status: Status | undefined; - version: number; -} - -export interface CreateSourceRequest { - source: Source | undefined; -} - -export interface CreateSourceResponse { - status: Status | undefined; - sourceId: number; - version: number; -} - -export interface DropSourceRequest { - sourceId: number; -} - -export interface DropSourceResponse { - status: Status | undefined; - version: number; -} - -export interface CreateSinkRequest { - sink: Sink | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateSinkResponse { - status: Status | undefined; - sinkId: number; - version: number; -} - -export interface DropSinkRequest { - sinkId: number; -} - -export interface DropSinkResponse { - status: Status | undefined; - version: number; -} - -export interface CreateMaterializedViewRequest { - materializedView: Table | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateMaterializedViewResponse { - status: Status | undefined; - tableId: number; - version: number; -} - -export interface DropMaterializedViewRequest { - tableId: number; -} - -export interface DropMaterializedViewResponse { - status: Status | undefined; - version: number; -} - -export interface CreateViewRequest { - view: View | undefined; -} - -export interface CreateViewResponse { - status: Status | undefined; - viewId: number; - version: number; -} - -export interface DropViewRequest { - viewId: number; -} - -export interface DropViewResponse { - status: Status | undefined; - version: number; -} - -export interface CreateTableRequest { - /** - * An optional field and will be `Some` for tables with an external connector. If so, the table - * will subscribe to the changes of the external connector and materialize the data. - */ - source: Source | undefined; - materializedView: Table | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateTableResponse { - status: Status | undefined; - tableId: number; - version: number; -} - -export interface CreateFunctionRequest { - function: Function | undefined; -} - -export interface CreateFunctionResponse { - status: Status | undefined; - functionId: number; - version: number; -} - -export interface DropFunctionRequest { - functionId: number; -} - -export interface DropFunctionResponse { - status: Status | undefined; - version: number; -} - -export interface DropTableRequest { - sourceId?: { $case: "id"; id: number }; - tableId: number; -} - -export interface DropTableResponse { - status: Status | undefined; - version: number; -} - -/** Used by risectl (and in the future, dashboard) */ -export interface RisectlListStateTablesRequest { -} - -/** Used by risectl (and in the future, dashboard) */ -export interface RisectlListStateTablesResponse { - tables: Table[]; -} - -export interface CreateIndexRequest { - index: Index | undefined; - indexTable: Table | undefined; - fragmentGraph: StreamFragmentGraph | undefined; -} - -export interface CreateIndexResponse { - status: Status | undefined; - indexId: number; - version: number; -} - -export interface DropIndexRequest { - indexId: number; -} - -export interface DropIndexResponse { - status: Status | undefined; - version: number; -} - -export interface ReplaceTablePlanRequest { - /** - * The new table catalog, with the correct table ID and a new version. - * If the new version does not match the subsequent version in the meta service's - * catalog, this request will be rejected. - */ - table: - | Table - | undefined; - /** The new materialization plan, where all schema are updated. */ - fragmentGraph: - | StreamFragmentGraph - | undefined; - /** The mapping from the old columns to the new columns of the table. */ - tableColIndexMapping: ColIndexMapping | undefined; -} - -export interface ReplaceTablePlanResponse { - status: - | Status - | undefined; - /** The new global catalog version. */ - version: number; -} - -export interface GetTableRequest { - databaseName: string; - tableName: string; -} - -export interface GetTableResponse { - table: Table | undefined; -} - -export interface GetDdlProgressRequest { -} - -export interface DdlProgress { - id: number; - statement: string; - progress: string; -} - -export interface GetDdlProgressResponse { - ddlProgress: DdlProgress[]; -} - -export interface CreateConnectionRequest { - payload?: { $case: "privateLink"; privateLink: CreateConnectionRequest_PrivateLink }; -} - -export interface CreateConnectionRequest_PrivateLink { - provider: string; - serviceName: string; - availabilityZones: string[]; -} - -export interface CreateConnectionResponse { - connectionId: number; - /** global catalog version */ - version: number; -} - -export interface ListConnectionsRequest { -} - -export interface ListConnectionsResponse { - connections: Connection[]; -} - -export interface DropConnectionRequest { - connectionName: string; -} - -export interface DropConnectionResponse { -} - -function createBaseCreateDatabaseRequest(): CreateDatabaseRequest { - return { db: undefined }; -} - -export const CreateDatabaseRequest = { - fromJSON(object: any): CreateDatabaseRequest { - return { db: isSet(object.db) ? Database.fromJSON(object.db) : undefined }; - }, - - toJSON(message: CreateDatabaseRequest): unknown { - const obj: any = {}; - message.db !== undefined && (obj.db = message.db ? Database.toJSON(message.db) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateDatabaseRequest { - const message = createBaseCreateDatabaseRequest(); - message.db = (object.db !== undefined && object.db !== null) ? Database.fromPartial(object.db) : undefined; - return message; - }, -}; - -function createBaseCreateDatabaseResponse(): CreateDatabaseResponse { - return { status: undefined, databaseId: 0, version: 0 }; -} - -export const CreateDatabaseResponse = { - fromJSON(object: any): CreateDatabaseResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateDatabaseResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateDatabaseResponse { - const message = createBaseCreateDatabaseResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.databaseId = object.databaseId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropDatabaseRequest(): DropDatabaseRequest { - return { databaseId: 0 }; -} - -export const DropDatabaseRequest = { - fromJSON(object: any): DropDatabaseRequest { - return { databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0 }; - }, - - toJSON(message: DropDatabaseRequest): unknown { - const obj: any = {}; - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - return obj; - }, - - fromPartial, I>>(object: I): DropDatabaseRequest { - const message = createBaseDropDatabaseRequest(); - message.databaseId = object.databaseId ?? 0; - return message; - }, -}; - -function createBaseDropDatabaseResponse(): DropDatabaseResponse { - return { status: undefined, version: 0 }; -} - -export const DropDatabaseResponse = { - fromJSON(object: any): DropDatabaseResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropDatabaseResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropDatabaseResponse { - const message = createBaseDropDatabaseResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateSchemaRequest(): CreateSchemaRequest { - return { schema: undefined }; -} - -export const CreateSchemaRequest = { - fromJSON(object: any): CreateSchemaRequest { - return { schema: isSet(object.schema) ? Schema.fromJSON(object.schema) : undefined }; - }, - - toJSON(message: CreateSchemaRequest): unknown { - const obj: any = {}; - message.schema !== undefined && (obj.schema = message.schema ? Schema.toJSON(message.schema) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateSchemaRequest { - const message = createBaseCreateSchemaRequest(); - message.schema = (object.schema !== undefined && object.schema !== null) - ? Schema.fromPartial(object.schema) - : undefined; - return message; - }, -}; - -function createBaseCreateSchemaResponse(): CreateSchemaResponse { - return { status: undefined, schemaId: 0, version: 0 }; -} - -export const CreateSchemaResponse = { - fromJSON(object: any): CreateSchemaResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateSchemaResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateSchemaResponse { - const message = createBaseCreateSchemaResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.schemaId = object.schemaId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropSchemaRequest(): DropSchemaRequest { - return { schemaId: 0 }; -} - -export const DropSchemaRequest = { - fromJSON(object: any): DropSchemaRequest { - return { schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0 }; - }, - - toJSON(message: DropSchemaRequest): unknown { - const obj: any = {}; - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - return obj; - }, - - fromPartial, I>>(object: I): DropSchemaRequest { - const message = createBaseDropSchemaRequest(); - message.schemaId = object.schemaId ?? 0; - return message; - }, -}; - -function createBaseDropSchemaResponse(): DropSchemaResponse { - return { status: undefined, version: 0 }; -} - -export const DropSchemaResponse = { - fromJSON(object: any): DropSchemaResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropSchemaResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropSchemaResponse { - const message = createBaseDropSchemaResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateSourceRequest(): CreateSourceRequest { - return { source: undefined }; -} - -export const CreateSourceRequest = { - fromJSON(object: any): CreateSourceRequest { - return { source: isSet(object.source) ? Source.fromJSON(object.source) : undefined }; - }, - - toJSON(message: CreateSourceRequest): unknown { - const obj: any = {}; - message.source !== undefined && (obj.source = message.source ? Source.toJSON(message.source) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateSourceRequest { - const message = createBaseCreateSourceRequest(); - message.source = (object.source !== undefined && object.source !== null) - ? Source.fromPartial(object.source) - : undefined; - return message; - }, -}; - -function createBaseCreateSourceResponse(): CreateSourceResponse { - return { status: undefined, sourceId: 0, version: 0 }; -} - -export const CreateSourceResponse = { - fromJSON(object: any): CreateSourceResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateSourceResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateSourceResponse { - const message = createBaseCreateSourceResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.sourceId = object.sourceId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropSourceRequest(): DropSourceRequest { - return { sourceId: 0 }; -} - -export const DropSourceRequest = { - fromJSON(object: any): DropSourceRequest { - return { sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0 }; - }, - - toJSON(message: DropSourceRequest): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - return obj; - }, - - fromPartial, I>>(object: I): DropSourceRequest { - const message = createBaseDropSourceRequest(); - message.sourceId = object.sourceId ?? 0; - return message; - }, -}; - -function createBaseDropSourceResponse(): DropSourceResponse { - return { status: undefined, version: 0 }; -} - -export const DropSourceResponse = { - fromJSON(object: any): DropSourceResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropSourceResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropSourceResponse { - const message = createBaseDropSourceResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateSinkRequest(): CreateSinkRequest { - return { sink: undefined, fragmentGraph: undefined }; -} - -export const CreateSinkRequest = { - fromJSON(object: any): CreateSinkRequest { - return { - sink: isSet(object.sink) ? Sink.fromJSON(object.sink) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateSinkRequest): unknown { - const obj: any = {}; - message.sink !== undefined && (obj.sink = message.sink ? Sink.toJSON(message.sink) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateSinkRequest { - const message = createBaseCreateSinkRequest(); - message.sink = (object.sink !== undefined && object.sink !== null) ? Sink.fromPartial(object.sink) : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateSinkResponse(): CreateSinkResponse { - return { status: undefined, sinkId: 0, version: 0 }; -} - -export const CreateSinkResponse = { - fromJSON(object: any): CreateSinkResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - sinkId: isSet(object.sinkId) ? Number(object.sinkId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateSinkResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.sinkId !== undefined && (obj.sinkId = Math.round(message.sinkId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateSinkResponse { - const message = createBaseCreateSinkResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.sinkId = object.sinkId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropSinkRequest(): DropSinkRequest { - return { sinkId: 0 }; -} - -export const DropSinkRequest = { - fromJSON(object: any): DropSinkRequest { - return { sinkId: isSet(object.sinkId) ? Number(object.sinkId) : 0 }; - }, - - toJSON(message: DropSinkRequest): unknown { - const obj: any = {}; - message.sinkId !== undefined && (obj.sinkId = Math.round(message.sinkId)); - return obj; - }, - - fromPartial, I>>(object: I): DropSinkRequest { - const message = createBaseDropSinkRequest(); - message.sinkId = object.sinkId ?? 0; - return message; - }, -}; - -function createBaseDropSinkResponse(): DropSinkResponse { - return { status: undefined, version: 0 }; -} - -export const DropSinkResponse = { - fromJSON(object: any): DropSinkResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropSinkResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropSinkResponse { - const message = createBaseDropSinkResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateMaterializedViewRequest(): CreateMaterializedViewRequest { - return { materializedView: undefined, fragmentGraph: undefined }; -} - -export const CreateMaterializedViewRequest = { - fromJSON(object: any): CreateMaterializedViewRequest { - return { - materializedView: isSet(object.materializedView) ? Table.fromJSON(object.materializedView) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateMaterializedViewRequest): unknown { - const obj: any = {}; - message.materializedView !== undefined && - (obj.materializedView = message.materializedView ? Table.toJSON(message.materializedView) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): CreateMaterializedViewRequest { - const message = createBaseCreateMaterializedViewRequest(); - message.materializedView = (object.materializedView !== undefined && object.materializedView !== null) - ? Table.fromPartial(object.materializedView) - : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateMaterializedViewResponse(): CreateMaterializedViewResponse { - return { status: undefined, tableId: 0, version: 0 }; -} - -export const CreateMaterializedViewResponse = { - fromJSON(object: any): CreateMaterializedViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateMaterializedViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): CreateMaterializedViewResponse { - const message = createBaseCreateMaterializedViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.tableId = object.tableId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropMaterializedViewRequest(): DropMaterializedViewRequest { - return { tableId: 0 }; -} - -export const DropMaterializedViewRequest = { - fromJSON(object: any): DropMaterializedViewRequest { - return { tableId: isSet(object.tableId) ? Number(object.tableId) : 0 }; - }, - - toJSON(message: DropMaterializedViewRequest): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - return obj; - }, - - fromPartial, I>>(object: I): DropMaterializedViewRequest { - const message = createBaseDropMaterializedViewRequest(); - message.tableId = object.tableId ?? 0; - return message; - }, -}; - -function createBaseDropMaterializedViewResponse(): DropMaterializedViewResponse { - return { status: undefined, version: 0 }; -} - -export const DropMaterializedViewResponse = { - fromJSON(object: any): DropMaterializedViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropMaterializedViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropMaterializedViewResponse { - const message = createBaseDropMaterializedViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateViewRequest(): CreateViewRequest { - return { view: undefined }; -} - -export const CreateViewRequest = { - fromJSON(object: any): CreateViewRequest { - return { view: isSet(object.view) ? View.fromJSON(object.view) : undefined }; - }, - - toJSON(message: CreateViewRequest): unknown { - const obj: any = {}; - message.view !== undefined && (obj.view = message.view ? View.toJSON(message.view) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateViewRequest { - const message = createBaseCreateViewRequest(); - message.view = (object.view !== undefined && object.view !== null) ? View.fromPartial(object.view) : undefined; - return message; - }, -}; - -function createBaseCreateViewResponse(): CreateViewResponse { - return { status: undefined, viewId: 0, version: 0 }; -} - -export const CreateViewResponse = { - fromJSON(object: any): CreateViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - viewId: isSet(object.viewId) ? Number(object.viewId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.viewId !== undefined && (obj.viewId = Math.round(message.viewId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateViewResponse { - const message = createBaseCreateViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.viewId = object.viewId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropViewRequest(): DropViewRequest { - return { viewId: 0 }; -} - -export const DropViewRequest = { - fromJSON(object: any): DropViewRequest { - return { viewId: isSet(object.viewId) ? Number(object.viewId) : 0 }; - }, - - toJSON(message: DropViewRequest): unknown { - const obj: any = {}; - message.viewId !== undefined && (obj.viewId = Math.round(message.viewId)); - return obj; - }, - - fromPartial, I>>(object: I): DropViewRequest { - const message = createBaseDropViewRequest(); - message.viewId = object.viewId ?? 0; - return message; - }, -}; - -function createBaseDropViewResponse(): DropViewResponse { - return { status: undefined, version: 0 }; -} - -export const DropViewResponse = { - fromJSON(object: any): DropViewResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropViewResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropViewResponse { - const message = createBaseDropViewResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateTableRequest(): CreateTableRequest { - return { source: undefined, materializedView: undefined, fragmentGraph: undefined }; -} - -export const CreateTableRequest = { - fromJSON(object: any): CreateTableRequest { - return { - source: isSet(object.source) ? Source.fromJSON(object.source) : undefined, - materializedView: isSet(object.materializedView) ? Table.fromJSON(object.materializedView) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateTableRequest): unknown { - const obj: any = {}; - message.source !== undefined && (obj.source = message.source ? Source.toJSON(message.source) : undefined); - message.materializedView !== undefined && - (obj.materializedView = message.materializedView ? Table.toJSON(message.materializedView) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateTableRequest { - const message = createBaseCreateTableRequest(); - message.source = (object.source !== undefined && object.source !== null) - ? Source.fromPartial(object.source) - : undefined; - message.materializedView = (object.materializedView !== undefined && object.materializedView !== null) - ? Table.fromPartial(object.materializedView) - : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateTableResponse(): CreateTableResponse { - return { status: undefined, tableId: 0, version: 0 }; -} - -export const CreateTableResponse = { - fromJSON(object: any): CreateTableResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateTableResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateTableResponse { - const message = createBaseCreateTableResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.tableId = object.tableId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseCreateFunctionRequest(): CreateFunctionRequest { - return { function: undefined }; -} - -export const CreateFunctionRequest = { - fromJSON(object: any): CreateFunctionRequest { - return { function: isSet(object.function) ? Function.fromJSON(object.function) : undefined }; - }, - - toJSON(message: CreateFunctionRequest): unknown { - const obj: any = {}; - message.function !== undefined && (obj.function = message.function ? Function.toJSON(message.function) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateFunctionRequest { - const message = createBaseCreateFunctionRequest(); - message.function = (object.function !== undefined && object.function !== null) - ? Function.fromPartial(object.function) - : undefined; - return message; - }, -}; - -function createBaseCreateFunctionResponse(): CreateFunctionResponse { - return { status: undefined, functionId: 0, version: 0 }; -} - -export const CreateFunctionResponse = { - fromJSON(object: any): CreateFunctionResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - functionId: isSet(object.functionId) ? Number(object.functionId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateFunctionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.functionId !== undefined && (obj.functionId = Math.round(message.functionId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateFunctionResponse { - const message = createBaseCreateFunctionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.functionId = object.functionId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropFunctionRequest(): DropFunctionRequest { - return { functionId: 0 }; -} - -export const DropFunctionRequest = { - fromJSON(object: any): DropFunctionRequest { - return { functionId: isSet(object.functionId) ? Number(object.functionId) : 0 }; - }, - - toJSON(message: DropFunctionRequest): unknown { - const obj: any = {}; - message.functionId !== undefined && (obj.functionId = Math.round(message.functionId)); - return obj; - }, - - fromPartial, I>>(object: I): DropFunctionRequest { - const message = createBaseDropFunctionRequest(); - message.functionId = object.functionId ?? 0; - return message; - }, -}; - -function createBaseDropFunctionResponse(): DropFunctionResponse { - return { status: undefined, version: 0 }; -} - -export const DropFunctionResponse = { - fromJSON(object: any): DropFunctionResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropFunctionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropFunctionResponse { - const message = createBaseDropFunctionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropTableRequest(): DropTableRequest { - return { sourceId: undefined, tableId: 0 }; -} - -export const DropTableRequest = { - fromJSON(object: any): DropTableRequest { - return { - sourceId: isSet(object.id) ? { $case: "id", id: Number(object.id) } : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - }; - }, - - toJSON(message: DropTableRequest): unknown { - const obj: any = {}; - message.sourceId?.$case === "id" && (obj.id = Math.round(message.sourceId?.id)); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - return obj; - }, - - fromPartial, I>>(object: I): DropTableRequest { - const message = createBaseDropTableRequest(); - if (object.sourceId?.$case === "id" && object.sourceId?.id !== undefined && object.sourceId?.id !== null) { - message.sourceId = { $case: "id", id: object.sourceId.id }; - } - message.tableId = object.tableId ?? 0; - return message; - }, -}; - -function createBaseDropTableResponse(): DropTableResponse { - return { status: undefined, version: 0 }; -} - -export const DropTableResponse = { - fromJSON(object: any): DropTableResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropTableResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropTableResponse { - const message = createBaseDropTableResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseRisectlListStateTablesRequest(): RisectlListStateTablesRequest { - return {}; -} - -export const RisectlListStateTablesRequest = { - fromJSON(_: any): RisectlListStateTablesRequest { - return {}; - }, - - toJSON(_: RisectlListStateTablesRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): RisectlListStateTablesRequest { - const message = createBaseRisectlListStateTablesRequest(); - return message; - }, -}; - -function createBaseRisectlListStateTablesResponse(): RisectlListStateTablesResponse { - return { tables: [] }; -} - -export const RisectlListStateTablesResponse = { - fromJSON(object: any): RisectlListStateTablesResponse { - return { tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => Table.fromJSON(e)) : [] }; - }, - - toJSON(message: RisectlListStateTablesResponse): unknown { - const obj: any = {}; - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): RisectlListStateTablesResponse { - const message = createBaseRisectlListStateTablesResponse(); - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCreateIndexRequest(): CreateIndexRequest { - return { index: undefined, indexTable: undefined, fragmentGraph: undefined }; -} - -export const CreateIndexRequest = { - fromJSON(object: any): CreateIndexRequest { - return { - index: isSet(object.index) ? Index.fromJSON(object.index) : undefined, - indexTable: isSet(object.indexTable) ? Table.fromJSON(object.indexTable) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - }; - }, - - toJSON(message: CreateIndexRequest): unknown { - const obj: any = {}; - message.index !== undefined && (obj.index = message.index ? Index.toJSON(message.index) : undefined); - message.indexTable !== undefined && - (obj.indexTable = message.indexTable ? Table.toJSON(message.indexTable) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateIndexRequest { - const message = createBaseCreateIndexRequest(); - message.index = (object.index !== undefined && object.index !== null) ? Index.fromPartial(object.index) : undefined; - message.indexTable = (object.indexTable !== undefined && object.indexTable !== null) - ? Table.fromPartial(object.indexTable) - : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - return message; - }, -}; - -function createBaseCreateIndexResponse(): CreateIndexResponse { - return { status: undefined, indexId: 0, version: 0 }; -} - -export const CreateIndexResponse = { - fromJSON(object: any): CreateIndexResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - indexId: isSet(object.indexId) ? Number(object.indexId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateIndexResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.indexId !== undefined && (obj.indexId = Math.round(message.indexId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateIndexResponse { - const message = createBaseCreateIndexResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.indexId = object.indexId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropIndexRequest(): DropIndexRequest { - return { indexId: 0 }; -} - -export const DropIndexRequest = { - fromJSON(object: any): DropIndexRequest { - return { indexId: isSet(object.indexId) ? Number(object.indexId) : 0 }; - }, - - toJSON(message: DropIndexRequest): unknown { - const obj: any = {}; - message.indexId !== undefined && (obj.indexId = Math.round(message.indexId)); - return obj; - }, - - fromPartial, I>>(object: I): DropIndexRequest { - const message = createBaseDropIndexRequest(); - message.indexId = object.indexId ?? 0; - return message; - }, -}; - -function createBaseDropIndexResponse(): DropIndexResponse { - return { status: undefined, version: 0 }; -} - -export const DropIndexResponse = { - fromJSON(object: any): DropIndexResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropIndexResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropIndexResponse { - const message = createBaseDropIndexResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseReplaceTablePlanRequest(): ReplaceTablePlanRequest { - return { table: undefined, fragmentGraph: undefined, tableColIndexMapping: undefined }; -} - -export const ReplaceTablePlanRequest = { - fromJSON(object: any): ReplaceTablePlanRequest { - return { - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - fragmentGraph: isSet(object.fragmentGraph) ? StreamFragmentGraph.fromJSON(object.fragmentGraph) : undefined, - tableColIndexMapping: isSet(object.tableColIndexMapping) - ? ColIndexMapping.fromJSON(object.tableColIndexMapping) - : undefined, - }; - }, - - toJSON(message: ReplaceTablePlanRequest): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - message.fragmentGraph !== undefined && - (obj.fragmentGraph = message.fragmentGraph ? StreamFragmentGraph.toJSON(message.fragmentGraph) : undefined); - message.tableColIndexMapping !== undefined && (obj.tableColIndexMapping = message.tableColIndexMapping - ? ColIndexMapping.toJSON(message.tableColIndexMapping) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReplaceTablePlanRequest { - const message = createBaseReplaceTablePlanRequest(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.fragmentGraph = (object.fragmentGraph !== undefined && object.fragmentGraph !== null) - ? StreamFragmentGraph.fromPartial(object.fragmentGraph) - : undefined; - message.tableColIndexMapping = (object.tableColIndexMapping !== undefined && object.tableColIndexMapping !== null) - ? ColIndexMapping.fromPartial(object.tableColIndexMapping) - : undefined; - return message; - }, -}; - -function createBaseReplaceTablePlanResponse(): ReplaceTablePlanResponse { - return { status: undefined, version: 0 }; -} - -export const ReplaceTablePlanResponse = { - fromJSON(object: any): ReplaceTablePlanResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: ReplaceTablePlanResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): ReplaceTablePlanResponse { - const message = createBaseReplaceTablePlanResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseGetTableRequest(): GetTableRequest { - return { databaseName: "", tableName: "" }; -} - -export const GetTableRequest = { - fromJSON(object: any): GetTableRequest { - return { - databaseName: isSet(object.databaseName) ? String(object.databaseName) : "", - tableName: isSet(object.tableName) ? String(object.tableName) : "", - }; - }, - - toJSON(message: GetTableRequest): unknown { - const obj: any = {}; - message.databaseName !== undefined && (obj.databaseName = message.databaseName); - message.tableName !== undefined && (obj.tableName = message.tableName); - return obj; - }, - - fromPartial, I>>(object: I): GetTableRequest { - const message = createBaseGetTableRequest(); - message.databaseName = object.databaseName ?? ""; - message.tableName = object.tableName ?? ""; - return message; - }, -}; - -function createBaseGetTableResponse(): GetTableResponse { - return { table: undefined }; -} - -export const GetTableResponse = { - fromJSON(object: any): GetTableResponse { - return { table: isSet(object.table) ? Table.fromJSON(object.table) : undefined }; - }, - - toJSON(message: GetTableResponse): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetTableResponse { - const message = createBaseGetTableResponse(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - return message; - }, -}; - -function createBaseGetDdlProgressRequest(): GetDdlProgressRequest { - return {}; -} - -export const GetDdlProgressRequest = { - fromJSON(_: any): GetDdlProgressRequest { - return {}; - }, - - toJSON(_: GetDdlProgressRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetDdlProgressRequest { - const message = createBaseGetDdlProgressRequest(); - return message; - }, -}; - -function createBaseDdlProgress(): DdlProgress { - return { id: 0, statement: "", progress: "" }; -} - -export const DdlProgress = { - fromJSON(object: any): DdlProgress { - return { - id: isSet(object.id) ? Number(object.id) : 0, - statement: isSet(object.statement) ? String(object.statement) : "", - progress: isSet(object.progress) ? String(object.progress) : "", - }; - }, - - toJSON(message: DdlProgress): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.statement !== undefined && (obj.statement = message.statement); - message.progress !== undefined && (obj.progress = message.progress); - return obj; - }, - - fromPartial, I>>(object: I): DdlProgress { - const message = createBaseDdlProgress(); - message.id = object.id ?? 0; - message.statement = object.statement ?? ""; - message.progress = object.progress ?? ""; - return message; - }, -}; - -function createBaseGetDdlProgressResponse(): GetDdlProgressResponse { - return { ddlProgress: [] }; -} - -export const GetDdlProgressResponse = { - fromJSON(object: any): GetDdlProgressResponse { - return { - ddlProgress: Array.isArray(object?.ddlProgress) - ? object.ddlProgress.map((e: any) => DdlProgress.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GetDdlProgressResponse): unknown { - const obj: any = {}; - if (message.ddlProgress) { - obj.ddlProgress = message.ddlProgress.map((e) => e ? DdlProgress.toJSON(e) : undefined); - } else { - obj.ddlProgress = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GetDdlProgressResponse { - const message = createBaseGetDdlProgressResponse(); - message.ddlProgress = object.ddlProgress?.map((e) => DdlProgress.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCreateConnectionRequest(): CreateConnectionRequest { - return { payload: undefined }; -} - -export const CreateConnectionRequest = { - fromJSON(object: any): CreateConnectionRequest { - return { - payload: isSet(object.privateLink) - ? { $case: "privateLink", privateLink: CreateConnectionRequest_PrivateLink.fromJSON(object.privateLink) } - : undefined, - }; - }, - - toJSON(message: CreateConnectionRequest): unknown { - const obj: any = {}; - message.payload?.$case === "privateLink" && (obj.privateLink = message.payload?.privateLink - ? CreateConnectionRequest_PrivateLink.toJSON(message.payload?.privateLink) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateConnectionRequest { - const message = createBaseCreateConnectionRequest(); - if ( - object.payload?.$case === "privateLink" && - object.payload?.privateLink !== undefined && - object.payload?.privateLink !== null - ) { - message.payload = { - $case: "privateLink", - privateLink: CreateConnectionRequest_PrivateLink.fromPartial(object.payload.privateLink), - }; - } - return message; - }, -}; - -function createBaseCreateConnectionRequest_PrivateLink(): CreateConnectionRequest_PrivateLink { - return { provider: "", serviceName: "", availabilityZones: [] }; -} - -export const CreateConnectionRequest_PrivateLink = { - fromJSON(object: any): CreateConnectionRequest_PrivateLink { - return { - provider: isSet(object.provider) ? String(object.provider) : "", - serviceName: isSet(object.serviceName) ? String(object.serviceName) : "", - availabilityZones: Array.isArray(object?.availabilityZones) - ? object.availabilityZones.map((e: any) => String(e)) - : [], - }; - }, - - toJSON(message: CreateConnectionRequest_PrivateLink): unknown { - const obj: any = {}; - message.provider !== undefined && (obj.provider = message.provider); - message.serviceName !== undefined && (obj.serviceName = message.serviceName); - if (message.availabilityZones) { - obj.availabilityZones = message.availabilityZones.map((e) => e); - } else { - obj.availabilityZones = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): CreateConnectionRequest_PrivateLink { - const message = createBaseCreateConnectionRequest_PrivateLink(); - message.provider = object.provider ?? ""; - message.serviceName = object.serviceName ?? ""; - message.availabilityZones = object.availabilityZones?.map((e) => e) || []; - return message; - }, -}; - -function createBaseCreateConnectionResponse(): CreateConnectionResponse { - return { connectionId: 0, version: 0 }; -} - -export const CreateConnectionResponse = { - fromJSON(object: any): CreateConnectionResponse { - return { - connectionId: isSet(object.connectionId) ? Number(object.connectionId) : 0, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateConnectionResponse): unknown { - const obj: any = {}; - message.connectionId !== undefined && (obj.connectionId = Math.round(message.connectionId)); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateConnectionResponse { - const message = createBaseCreateConnectionResponse(); - message.connectionId = object.connectionId ?? 0; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseListConnectionsRequest(): ListConnectionsRequest { - return {}; -} - -export const ListConnectionsRequest = { - fromJSON(_: any): ListConnectionsRequest { - return {}; - }, - - toJSON(_: ListConnectionsRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ListConnectionsRequest { - const message = createBaseListConnectionsRequest(); - return message; - }, -}; - -function createBaseListConnectionsResponse(): ListConnectionsResponse { - return { connections: [] }; -} - -export const ListConnectionsResponse = { - fromJSON(object: any): ListConnectionsResponse { - return { - connections: Array.isArray(object?.connections) ? object.connections.map((e: any) => Connection.fromJSON(e)) : [], - }; - }, - - toJSON(message: ListConnectionsResponse): unknown { - const obj: any = {}; - if (message.connections) { - obj.connections = message.connections.map((e) => e ? Connection.toJSON(e) : undefined); - } else { - obj.connections = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ListConnectionsResponse { - const message = createBaseListConnectionsResponse(); - message.connections = object.connections?.map((e) => Connection.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseDropConnectionRequest(): DropConnectionRequest { - return { connectionName: "" }; -} - -export const DropConnectionRequest = { - fromJSON(object: any): DropConnectionRequest { - return { connectionName: isSet(object.connectionName) ? String(object.connectionName) : "" }; - }, - - toJSON(message: DropConnectionRequest): unknown { - const obj: any = {}; - message.connectionName !== undefined && (obj.connectionName = message.connectionName); - return obj; - }, - - fromPartial, I>>(object: I): DropConnectionRequest { - const message = createBaseDropConnectionRequest(); - message.connectionName = object.connectionName ?? ""; - return message; - }, -}; - -function createBaseDropConnectionResponse(): DropConnectionResponse { - return {}; -} - -export const DropConnectionResponse = { - fromJSON(_: any): DropConnectionResponse { - return {}; - }, - - toJSON(_: DropConnectionResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): DropConnectionResponse { - const message = createBaseDropConnectionResponse(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/expr.ts b/dashboard/proto/gen/expr.ts deleted file mode 100644 index 4faa1e414aa7a..0000000000000 --- a/dashboard/proto/gen/expr.ts +++ /dev/null @@ -1,1267 +0,0 @@ -/* eslint-disable */ -import { ColumnOrder } from "./common"; -import { DataType, Datum } from "./data"; - -export const protobufPackage = "expr"; - -export interface ExprNode { - exprType: ExprNode_Type; - returnType: DataType | undefined; - rexNode?: { $case: "inputRef"; inputRef: number } | { $case: "constant"; constant: Datum } | { - $case: "funcCall"; - funcCall: FunctionCall; - } | { $case: "udf"; udf: UserDefinedFunction }; -} - -/** - * a "pure function" will be defined as having `1 < expr_node as i32 <= 600`. - * Please modify this definition if adding a pure function that does not belong - * to this range. - */ -export const ExprNode_Type = { - UNSPECIFIED: "UNSPECIFIED", - INPUT_REF: "INPUT_REF", - CONSTANT_VALUE: "CONSTANT_VALUE", - /** ADD - arithmetics operators */ - ADD: "ADD", - SUBTRACT: "SUBTRACT", - MULTIPLY: "MULTIPLY", - DIVIDE: "DIVIDE", - MODULUS: "MODULUS", - /** EQUAL - comparison operators */ - EQUAL: "EQUAL", - NOT_EQUAL: "NOT_EQUAL", - LESS_THAN: "LESS_THAN", - LESS_THAN_OR_EQUAL: "LESS_THAN_OR_EQUAL", - GREATER_THAN: "GREATER_THAN", - GREATER_THAN_OR_EQUAL: "GREATER_THAN_OR_EQUAL", - /** AND - logical operators */ - AND: "AND", - OR: "OR", - NOT: "NOT", - IN: "IN", - SOME: "SOME", - ALL: "ALL", - /** BITWISE_AND - bitwise operators */ - BITWISE_AND: "BITWISE_AND", - BITWISE_OR: "BITWISE_OR", - BITWISE_XOR: "BITWISE_XOR", - BITWISE_NOT: "BITWISE_NOT", - BITWISE_SHIFT_LEFT: "BITWISE_SHIFT_LEFT", - BITWISE_SHIFT_RIGHT: "BITWISE_SHIFT_RIGHT", - /** EXTRACT - date functions */ - EXTRACT: "EXTRACT", - TUMBLE_START: "TUMBLE_START", - /** - * TO_TIMESTAMP - From f64 to timestamp. - * e.g. `select to_timestamp(1672044740.0)` - */ - TO_TIMESTAMP: "TO_TIMESTAMP", - AT_TIME_ZONE: "AT_TIME_ZONE", - DATE_TRUNC: "DATE_TRUNC", - /** - * TO_TIMESTAMP1 - Parse text to timestamp by format string. - * e.g. `select to_timestamp('2022 08 21', 'YYYY MM DD')` - */ - TO_TIMESTAMP1: "TO_TIMESTAMP1", - /** CAST_WITH_TIME_ZONE - Performs a cast with additional timezone information. */ - CAST_WITH_TIME_ZONE: "CAST_WITH_TIME_ZONE", - /** CAST - other functions */ - CAST: "CAST", - SUBSTR: "SUBSTR", - LENGTH: "LENGTH", - LIKE: "LIKE", - UPPER: "UPPER", - LOWER: "LOWER", - TRIM: "TRIM", - REPLACE: "REPLACE", - POSITION: "POSITION", - LTRIM: "LTRIM", - RTRIM: "RTRIM", - CASE: "CASE", - /** ROUND_DIGIT - ROUND(numeric, integer) -> numeric */ - ROUND_DIGIT: "ROUND_DIGIT", - /** - * ROUND - ROUND(numeric) -> numeric - * ROUND(double precision) -> double precision - */ - ROUND: "ROUND", - ASCII: "ASCII", - TRANSLATE: "TRANSLATE", - COALESCE: "COALESCE", - CONCAT_WS: "CONCAT_WS", - ABS: "ABS", - SPLIT_PART: "SPLIT_PART", - CEIL: "CEIL", - FLOOR: "FLOOR", - TO_CHAR: "TO_CHAR", - MD5: "MD5", - CHAR_LENGTH: "CHAR_LENGTH", - REPEAT: "REPEAT", - CONCAT_OP: "CONCAT_OP", - /** BOOL_OUT - BOOL_OUT is different from CAST-bool-to-varchar in PostgreSQL. */ - BOOL_OUT: "BOOL_OUT", - OCTET_LENGTH: "OCTET_LENGTH", - BIT_LENGTH: "BIT_LENGTH", - OVERLAY: "OVERLAY", - REGEXP_MATCH: "REGEXP_MATCH", - POW: "POW", - EXP: "EXP", - /** IS_TRUE - Boolean comparison */ - IS_TRUE: "IS_TRUE", - IS_NOT_TRUE: "IS_NOT_TRUE", - IS_FALSE: "IS_FALSE", - IS_NOT_FALSE: "IS_NOT_FALSE", - IS_NULL: "IS_NULL", - IS_NOT_NULL: "IS_NOT_NULL", - IS_DISTINCT_FROM: "IS_DISTINCT_FROM", - IS_NOT_DISTINCT_FROM: "IS_NOT_DISTINCT_FROM", - /** NEG - Unary operators */ - NEG: "NEG", - /** FIELD - Nested selection operators */ - FIELD: "FIELD", - /** ARRAY - Array expression. */ - ARRAY: "ARRAY", - ARRAY_ACCESS: "ARRAY_ACCESS", - ROW: "ROW", - ARRAY_TO_STRING: "ARRAY_TO_STRING", - /** ARRAY_CAT - Array functions */ - ARRAY_CAT: "ARRAY_CAT", - ARRAY_APPEND: "ARRAY_APPEND", - ARRAY_PREPEND: "ARRAY_PREPEND", - FORMAT_TYPE: "FORMAT_TYPE", - ARRAY_DISTINCT: "ARRAY_DISTINCT", - /** JSONB_ACCESS_INNER - jsonb -> int, jsonb -> text, jsonb #> text[] that returns jsonb */ - JSONB_ACCESS_INNER: "JSONB_ACCESS_INNER", - /** JSONB_ACCESS_STR - jsonb ->> int, jsonb ->> text, jsonb #>> text[] that returns text */ - JSONB_ACCESS_STR: "JSONB_ACCESS_STR", - JSONB_TYPEOF: "JSONB_TYPEOF", - JSONB_ARRAY_LENGTH: "JSONB_ARRAY_LENGTH", - /** PI - Functions that return a constant value */ - PI: "PI", - /** - * VNODE - Non-pure functions below (> 1000) - * ------------------------ - * Internal functions - */ - VNODE: "VNODE", - /** NOW - Non-deterministic functions */ - NOW: "NOW", - /** UDF - User defined functions */ - UDF: "UDF", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type ExprNode_Type = typeof ExprNode_Type[keyof typeof ExprNode_Type]; - -export function exprNode_TypeFromJSON(object: any): ExprNode_Type { - switch (object) { - case 0: - case "UNSPECIFIED": - return ExprNode_Type.UNSPECIFIED; - case 1: - case "INPUT_REF": - return ExprNode_Type.INPUT_REF; - case 2: - case "CONSTANT_VALUE": - return ExprNode_Type.CONSTANT_VALUE; - case 3: - case "ADD": - return ExprNode_Type.ADD; - case 4: - case "SUBTRACT": - return ExprNode_Type.SUBTRACT; - case 5: - case "MULTIPLY": - return ExprNode_Type.MULTIPLY; - case 6: - case "DIVIDE": - return ExprNode_Type.DIVIDE; - case 7: - case "MODULUS": - return ExprNode_Type.MODULUS; - case 8: - case "EQUAL": - return ExprNode_Type.EQUAL; - case 9: - case "NOT_EQUAL": - return ExprNode_Type.NOT_EQUAL; - case 10: - case "LESS_THAN": - return ExprNode_Type.LESS_THAN; - case 11: - case "LESS_THAN_OR_EQUAL": - return ExprNode_Type.LESS_THAN_OR_EQUAL; - case 12: - case "GREATER_THAN": - return ExprNode_Type.GREATER_THAN; - case 13: - case "GREATER_THAN_OR_EQUAL": - return ExprNode_Type.GREATER_THAN_OR_EQUAL; - case 21: - case "AND": - return ExprNode_Type.AND; - case 22: - case "OR": - return ExprNode_Type.OR; - case 23: - case "NOT": - return ExprNode_Type.NOT; - case 24: - case "IN": - return ExprNode_Type.IN; - case 25: - case "SOME": - return ExprNode_Type.SOME; - case 26: - case "ALL": - return ExprNode_Type.ALL; - case 31: - case "BITWISE_AND": - return ExprNode_Type.BITWISE_AND; - case 32: - case "BITWISE_OR": - return ExprNode_Type.BITWISE_OR; - case 33: - case "BITWISE_XOR": - return ExprNode_Type.BITWISE_XOR; - case 34: - case "BITWISE_NOT": - return ExprNode_Type.BITWISE_NOT; - case 35: - case "BITWISE_SHIFT_LEFT": - return ExprNode_Type.BITWISE_SHIFT_LEFT; - case 36: - case "BITWISE_SHIFT_RIGHT": - return ExprNode_Type.BITWISE_SHIFT_RIGHT; - case 101: - case "EXTRACT": - return ExprNode_Type.EXTRACT; - case 103: - case "TUMBLE_START": - return ExprNode_Type.TUMBLE_START; - case 104: - case "TO_TIMESTAMP": - return ExprNode_Type.TO_TIMESTAMP; - case 105: - case "AT_TIME_ZONE": - return ExprNode_Type.AT_TIME_ZONE; - case 106: - case "DATE_TRUNC": - return ExprNode_Type.DATE_TRUNC; - case 107: - case "TO_TIMESTAMP1": - return ExprNode_Type.TO_TIMESTAMP1; - case 108: - case "CAST_WITH_TIME_ZONE": - return ExprNode_Type.CAST_WITH_TIME_ZONE; - case 201: - case "CAST": - return ExprNode_Type.CAST; - case 202: - case "SUBSTR": - return ExprNode_Type.SUBSTR; - case 203: - case "LENGTH": - return ExprNode_Type.LENGTH; - case 204: - case "LIKE": - return ExprNode_Type.LIKE; - case 205: - case "UPPER": - return ExprNode_Type.UPPER; - case 206: - case "LOWER": - return ExprNode_Type.LOWER; - case 207: - case "TRIM": - return ExprNode_Type.TRIM; - case 208: - case "REPLACE": - return ExprNode_Type.REPLACE; - case 209: - case "POSITION": - return ExprNode_Type.POSITION; - case 210: - case "LTRIM": - return ExprNode_Type.LTRIM; - case 211: - case "RTRIM": - return ExprNode_Type.RTRIM; - case 212: - case "CASE": - return ExprNode_Type.CASE; - case 213: - case "ROUND_DIGIT": - return ExprNode_Type.ROUND_DIGIT; - case 214: - case "ROUND": - return ExprNode_Type.ROUND; - case 215: - case "ASCII": - return ExprNode_Type.ASCII; - case 216: - case "TRANSLATE": - return ExprNode_Type.TRANSLATE; - case 217: - case "COALESCE": - return ExprNode_Type.COALESCE; - case 218: - case "CONCAT_WS": - return ExprNode_Type.CONCAT_WS; - case 219: - case "ABS": - return ExprNode_Type.ABS; - case 220: - case "SPLIT_PART": - return ExprNode_Type.SPLIT_PART; - case 221: - case "CEIL": - return ExprNode_Type.CEIL; - case 222: - case "FLOOR": - return ExprNode_Type.FLOOR; - case 223: - case "TO_CHAR": - return ExprNode_Type.TO_CHAR; - case 224: - case "MD5": - return ExprNode_Type.MD5; - case 225: - case "CHAR_LENGTH": - return ExprNode_Type.CHAR_LENGTH; - case 226: - case "REPEAT": - return ExprNode_Type.REPEAT; - case 227: - case "CONCAT_OP": - return ExprNode_Type.CONCAT_OP; - case 228: - case "BOOL_OUT": - return ExprNode_Type.BOOL_OUT; - case 229: - case "OCTET_LENGTH": - return ExprNode_Type.OCTET_LENGTH; - case 230: - case "BIT_LENGTH": - return ExprNode_Type.BIT_LENGTH; - case 231: - case "OVERLAY": - return ExprNode_Type.OVERLAY; - case 232: - case "REGEXP_MATCH": - return ExprNode_Type.REGEXP_MATCH; - case 233: - case "POW": - return ExprNode_Type.POW; - case 234: - case "EXP": - return ExprNode_Type.EXP; - case 301: - case "IS_TRUE": - return ExprNode_Type.IS_TRUE; - case 302: - case "IS_NOT_TRUE": - return ExprNode_Type.IS_NOT_TRUE; - case 303: - case "IS_FALSE": - return ExprNode_Type.IS_FALSE; - case 304: - case "IS_NOT_FALSE": - return ExprNode_Type.IS_NOT_FALSE; - case 305: - case "IS_NULL": - return ExprNode_Type.IS_NULL; - case 306: - case "IS_NOT_NULL": - return ExprNode_Type.IS_NOT_NULL; - case 307: - case "IS_DISTINCT_FROM": - return ExprNode_Type.IS_DISTINCT_FROM; - case 308: - case "IS_NOT_DISTINCT_FROM": - return ExprNode_Type.IS_NOT_DISTINCT_FROM; - case 401: - case "NEG": - return ExprNode_Type.NEG; - case 501: - case "FIELD": - return ExprNode_Type.FIELD; - case 521: - case "ARRAY": - return ExprNode_Type.ARRAY; - case 522: - case "ARRAY_ACCESS": - return ExprNode_Type.ARRAY_ACCESS; - case 523: - case "ROW": - return ExprNode_Type.ROW; - case 524: - case "ARRAY_TO_STRING": - return ExprNode_Type.ARRAY_TO_STRING; - case 531: - case "ARRAY_CAT": - return ExprNode_Type.ARRAY_CAT; - case 532: - case "ARRAY_APPEND": - return ExprNode_Type.ARRAY_APPEND; - case 533: - case "ARRAY_PREPEND": - return ExprNode_Type.ARRAY_PREPEND; - case 534: - case "FORMAT_TYPE": - return ExprNode_Type.FORMAT_TYPE; - case 535: - case "ARRAY_DISTINCT": - return ExprNode_Type.ARRAY_DISTINCT; - case 600: - case "JSONB_ACCESS_INNER": - return ExprNode_Type.JSONB_ACCESS_INNER; - case 601: - case "JSONB_ACCESS_STR": - return ExprNode_Type.JSONB_ACCESS_STR; - case 602: - case "JSONB_TYPEOF": - return ExprNode_Type.JSONB_TYPEOF; - case 603: - case "JSONB_ARRAY_LENGTH": - return ExprNode_Type.JSONB_ARRAY_LENGTH; - case 610: - case "PI": - return ExprNode_Type.PI; - case 1101: - case "VNODE": - return ExprNode_Type.VNODE; - case 2022: - case "NOW": - return ExprNode_Type.NOW; - case 3000: - case "UDF": - return ExprNode_Type.UDF; - case -1: - case "UNRECOGNIZED": - default: - return ExprNode_Type.UNRECOGNIZED; - } -} - -export function exprNode_TypeToJSON(object: ExprNode_Type): string { - switch (object) { - case ExprNode_Type.UNSPECIFIED: - return "UNSPECIFIED"; - case ExprNode_Type.INPUT_REF: - return "INPUT_REF"; - case ExprNode_Type.CONSTANT_VALUE: - return "CONSTANT_VALUE"; - case ExprNode_Type.ADD: - return "ADD"; - case ExprNode_Type.SUBTRACT: - return "SUBTRACT"; - case ExprNode_Type.MULTIPLY: - return "MULTIPLY"; - case ExprNode_Type.DIVIDE: - return "DIVIDE"; - case ExprNode_Type.MODULUS: - return "MODULUS"; - case ExprNode_Type.EQUAL: - return "EQUAL"; - case ExprNode_Type.NOT_EQUAL: - return "NOT_EQUAL"; - case ExprNode_Type.LESS_THAN: - return "LESS_THAN"; - case ExprNode_Type.LESS_THAN_OR_EQUAL: - return "LESS_THAN_OR_EQUAL"; - case ExprNode_Type.GREATER_THAN: - return "GREATER_THAN"; - case ExprNode_Type.GREATER_THAN_OR_EQUAL: - return "GREATER_THAN_OR_EQUAL"; - case ExprNode_Type.AND: - return "AND"; - case ExprNode_Type.OR: - return "OR"; - case ExprNode_Type.NOT: - return "NOT"; - case ExprNode_Type.IN: - return "IN"; - case ExprNode_Type.SOME: - return "SOME"; - case ExprNode_Type.ALL: - return "ALL"; - case ExprNode_Type.BITWISE_AND: - return "BITWISE_AND"; - case ExprNode_Type.BITWISE_OR: - return "BITWISE_OR"; - case ExprNode_Type.BITWISE_XOR: - return "BITWISE_XOR"; - case ExprNode_Type.BITWISE_NOT: - return "BITWISE_NOT"; - case ExprNode_Type.BITWISE_SHIFT_LEFT: - return "BITWISE_SHIFT_LEFT"; - case ExprNode_Type.BITWISE_SHIFT_RIGHT: - return "BITWISE_SHIFT_RIGHT"; - case ExprNode_Type.EXTRACT: - return "EXTRACT"; - case ExprNode_Type.TUMBLE_START: - return "TUMBLE_START"; - case ExprNode_Type.TO_TIMESTAMP: - return "TO_TIMESTAMP"; - case ExprNode_Type.AT_TIME_ZONE: - return "AT_TIME_ZONE"; - case ExprNode_Type.DATE_TRUNC: - return "DATE_TRUNC"; - case ExprNode_Type.TO_TIMESTAMP1: - return "TO_TIMESTAMP1"; - case ExprNode_Type.CAST_WITH_TIME_ZONE: - return "CAST_WITH_TIME_ZONE"; - case ExprNode_Type.CAST: - return "CAST"; - case ExprNode_Type.SUBSTR: - return "SUBSTR"; - case ExprNode_Type.LENGTH: - return "LENGTH"; - case ExprNode_Type.LIKE: - return "LIKE"; - case ExprNode_Type.UPPER: - return "UPPER"; - case ExprNode_Type.LOWER: - return "LOWER"; - case ExprNode_Type.TRIM: - return "TRIM"; - case ExprNode_Type.REPLACE: - return "REPLACE"; - case ExprNode_Type.POSITION: - return "POSITION"; - case ExprNode_Type.LTRIM: - return "LTRIM"; - case ExprNode_Type.RTRIM: - return "RTRIM"; - case ExprNode_Type.CASE: - return "CASE"; - case ExprNode_Type.ROUND_DIGIT: - return "ROUND_DIGIT"; - case ExprNode_Type.ROUND: - return "ROUND"; - case ExprNode_Type.ASCII: - return "ASCII"; - case ExprNode_Type.TRANSLATE: - return "TRANSLATE"; - case ExprNode_Type.COALESCE: - return "COALESCE"; - case ExprNode_Type.CONCAT_WS: - return "CONCAT_WS"; - case ExprNode_Type.ABS: - return "ABS"; - case ExprNode_Type.SPLIT_PART: - return "SPLIT_PART"; - case ExprNode_Type.CEIL: - return "CEIL"; - case ExprNode_Type.FLOOR: - return "FLOOR"; - case ExprNode_Type.TO_CHAR: - return "TO_CHAR"; - case ExprNode_Type.MD5: - return "MD5"; - case ExprNode_Type.CHAR_LENGTH: - return "CHAR_LENGTH"; - case ExprNode_Type.REPEAT: - return "REPEAT"; - case ExprNode_Type.CONCAT_OP: - return "CONCAT_OP"; - case ExprNode_Type.BOOL_OUT: - return "BOOL_OUT"; - case ExprNode_Type.OCTET_LENGTH: - return "OCTET_LENGTH"; - case ExprNode_Type.BIT_LENGTH: - return "BIT_LENGTH"; - case ExprNode_Type.OVERLAY: - return "OVERLAY"; - case ExprNode_Type.REGEXP_MATCH: - return "REGEXP_MATCH"; - case ExprNode_Type.POW: - return "POW"; - case ExprNode_Type.EXP: - return "EXP"; - case ExprNode_Type.IS_TRUE: - return "IS_TRUE"; - case ExprNode_Type.IS_NOT_TRUE: - return "IS_NOT_TRUE"; - case ExprNode_Type.IS_FALSE: - return "IS_FALSE"; - case ExprNode_Type.IS_NOT_FALSE: - return "IS_NOT_FALSE"; - case ExprNode_Type.IS_NULL: - return "IS_NULL"; - case ExprNode_Type.IS_NOT_NULL: - return "IS_NOT_NULL"; - case ExprNode_Type.IS_DISTINCT_FROM: - return "IS_DISTINCT_FROM"; - case ExprNode_Type.IS_NOT_DISTINCT_FROM: - return "IS_NOT_DISTINCT_FROM"; - case ExprNode_Type.NEG: - return "NEG"; - case ExprNode_Type.FIELD: - return "FIELD"; - case ExprNode_Type.ARRAY: - return "ARRAY"; - case ExprNode_Type.ARRAY_ACCESS: - return "ARRAY_ACCESS"; - case ExprNode_Type.ROW: - return "ROW"; - case ExprNode_Type.ARRAY_TO_STRING: - return "ARRAY_TO_STRING"; - case ExprNode_Type.ARRAY_CAT: - return "ARRAY_CAT"; - case ExprNode_Type.ARRAY_APPEND: - return "ARRAY_APPEND"; - case ExprNode_Type.ARRAY_PREPEND: - return "ARRAY_PREPEND"; - case ExprNode_Type.FORMAT_TYPE: - return "FORMAT_TYPE"; - case ExprNode_Type.ARRAY_DISTINCT: - return "ARRAY_DISTINCT"; - case ExprNode_Type.JSONB_ACCESS_INNER: - return "JSONB_ACCESS_INNER"; - case ExprNode_Type.JSONB_ACCESS_STR: - return "JSONB_ACCESS_STR"; - case ExprNode_Type.JSONB_TYPEOF: - return "JSONB_TYPEOF"; - case ExprNode_Type.JSONB_ARRAY_LENGTH: - return "JSONB_ARRAY_LENGTH"; - case ExprNode_Type.PI: - return "PI"; - case ExprNode_Type.VNODE: - return "VNODE"; - case ExprNode_Type.NOW: - return "NOW"; - case ExprNode_Type.UDF: - return "UDF"; - case ExprNode_Type.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableFunction { - functionType: TableFunction_Type; - args: ExprNode[]; - returnType: - | DataType - | undefined; - /** optional. only used when the type is UDTF. */ - udtf: UserDefinedTableFunction | undefined; -} - -export const TableFunction_Type = { - UNSPECIFIED: "UNSPECIFIED", - GENERATE: "GENERATE", - UNNEST: "UNNEST", - REGEXP_MATCHES: "REGEXP_MATCHES", - RANGE: "RANGE", - /** UDTF - User defined table function */ - UDTF: "UDTF", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFunction_Type = typeof TableFunction_Type[keyof typeof TableFunction_Type]; - -export function tableFunction_TypeFromJSON(object: any): TableFunction_Type { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFunction_Type.UNSPECIFIED; - case 1: - case "GENERATE": - return TableFunction_Type.GENERATE; - case 2: - case "UNNEST": - return TableFunction_Type.UNNEST; - case 3: - case "REGEXP_MATCHES": - return TableFunction_Type.REGEXP_MATCHES; - case 4: - case "RANGE": - return TableFunction_Type.RANGE; - case 100: - case "UDTF": - return TableFunction_Type.UDTF; - case -1: - case "UNRECOGNIZED": - default: - return TableFunction_Type.UNRECOGNIZED; - } -} - -export function tableFunction_TypeToJSON(object: TableFunction_Type): string { - switch (object) { - case TableFunction_Type.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFunction_Type.GENERATE: - return "GENERATE"; - case TableFunction_Type.UNNEST: - return "UNNEST"; - case TableFunction_Type.REGEXP_MATCHES: - return "REGEXP_MATCHES"; - case TableFunction_Type.RANGE: - return "RANGE"; - case TableFunction_Type.UDTF: - return "UDTF"; - case TableFunction_Type.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Reference to an upstream column, containing its index and data type. */ -export interface InputRef { - index: number; - type: DataType | undefined; -} - -/** - * The items which can occur in the select list of `ProjectSet` operator. - * - * When there are table functions in the SQL query `SELECT ...`, it will be planned as `ProjectSet`. - * Otherwise it will be planned as `Project`. - * - * # Examples - * - * ```sql - * # Project - * select 1; - * - * # ProjectSet - * select unnest(array[1,2,3]); - * - * # ProjectSet (table function & usual expression) - * select unnest(array[1,2,3]), 1; - * - * # ProjectSet (multiple table functions) - * select unnest(array[1,2,3]), unnest(array[4,5]); - * - * # ProjectSet over ProjectSet (table function as parameters of table function) - * select unnest(regexp_matches(v1, 'a(\d)c(\d)', 'g')) from t; - * - * # Project over ProjectSet (table function as parameters of usual function) - * select unnest(regexp_matches(v1, 'a(\d)c(\d)', 'g')) from t; - * ``` - */ -export interface ProjectSetSelectItem { - selectItem?: { $case: "expr"; expr: ExprNode } | { $case: "tableFunction"; tableFunction: TableFunction }; -} - -export interface FunctionCall { - children: ExprNode[]; -} - -/** Aggregate Function Calls for Aggregation */ -export interface AggCall { - type: AggCall_Type; - args: InputRef[]; - returnType: DataType | undefined; - distinct: boolean; - orderBy: ColumnOrder[]; - filter: ExprNode | undefined; -} - -export const AggCall_Type = { - UNSPECIFIED: "UNSPECIFIED", - SUM: "SUM", - MIN: "MIN", - MAX: "MAX", - COUNT: "COUNT", - AVG: "AVG", - STRING_AGG: "STRING_AGG", - APPROX_COUNT_DISTINCT: "APPROX_COUNT_DISTINCT", - ARRAY_AGG: "ARRAY_AGG", - FIRST_VALUE: "FIRST_VALUE", - SUM0: "SUM0", - VAR_POP: "VAR_POP", - VAR_SAMP: "VAR_SAMP", - STDDEV_POP: "STDDEV_POP", - STDDEV_SAMP: "STDDEV_SAMP", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type AggCall_Type = typeof AggCall_Type[keyof typeof AggCall_Type]; - -export function aggCall_TypeFromJSON(object: any): AggCall_Type { - switch (object) { - case 0: - case "UNSPECIFIED": - return AggCall_Type.UNSPECIFIED; - case 1: - case "SUM": - return AggCall_Type.SUM; - case 2: - case "MIN": - return AggCall_Type.MIN; - case 3: - case "MAX": - return AggCall_Type.MAX; - case 4: - case "COUNT": - return AggCall_Type.COUNT; - case 5: - case "AVG": - return AggCall_Type.AVG; - case 6: - case "STRING_AGG": - return AggCall_Type.STRING_AGG; - case 7: - case "APPROX_COUNT_DISTINCT": - return AggCall_Type.APPROX_COUNT_DISTINCT; - case 8: - case "ARRAY_AGG": - return AggCall_Type.ARRAY_AGG; - case 9: - case "FIRST_VALUE": - return AggCall_Type.FIRST_VALUE; - case 10: - case "SUM0": - return AggCall_Type.SUM0; - case 11: - case "VAR_POP": - return AggCall_Type.VAR_POP; - case 12: - case "VAR_SAMP": - return AggCall_Type.VAR_SAMP; - case 13: - case "STDDEV_POP": - return AggCall_Type.STDDEV_POP; - case 14: - case "STDDEV_SAMP": - return AggCall_Type.STDDEV_SAMP; - case -1: - case "UNRECOGNIZED": - default: - return AggCall_Type.UNRECOGNIZED; - } -} - -export function aggCall_TypeToJSON(object: AggCall_Type): string { - switch (object) { - case AggCall_Type.UNSPECIFIED: - return "UNSPECIFIED"; - case AggCall_Type.SUM: - return "SUM"; - case AggCall_Type.MIN: - return "MIN"; - case AggCall_Type.MAX: - return "MAX"; - case AggCall_Type.COUNT: - return "COUNT"; - case AggCall_Type.AVG: - return "AVG"; - case AggCall_Type.STRING_AGG: - return "STRING_AGG"; - case AggCall_Type.APPROX_COUNT_DISTINCT: - return "APPROX_COUNT_DISTINCT"; - case AggCall_Type.ARRAY_AGG: - return "ARRAY_AGG"; - case AggCall_Type.FIRST_VALUE: - return "FIRST_VALUE"; - case AggCall_Type.SUM0: - return "SUM0"; - case AggCall_Type.VAR_POP: - return "VAR_POP"; - case AggCall_Type.VAR_SAMP: - return "VAR_SAMP"; - case AggCall_Type.STDDEV_POP: - return "STDDEV_POP"; - case AggCall_Type.STDDEV_SAMP: - return "STDDEV_SAMP"; - case AggCall_Type.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface UserDefinedFunction { - children: ExprNode[]; - name: string; - argTypes: DataType[]; - language: string; - link: string; - identifier: string; -} - -export interface UserDefinedTableFunction { - argTypes: DataType[]; - language: string; - link: string; - identifier: string; -} - -function createBaseExprNode(): ExprNode { - return { exprType: ExprNode_Type.UNSPECIFIED, returnType: undefined, rexNode: undefined }; -} - -export const ExprNode = { - fromJSON(object: any): ExprNode { - return { - exprType: isSet(object.exprType) ? exprNode_TypeFromJSON(object.exprType) : ExprNode_Type.UNSPECIFIED, - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - rexNode: isSet(object.inputRef) - ? { $case: "inputRef", inputRef: Number(object.inputRef) } - : isSet(object.constant) - ? { $case: "constant", constant: Datum.fromJSON(object.constant) } - : isSet(object.funcCall) - ? { $case: "funcCall", funcCall: FunctionCall.fromJSON(object.funcCall) } - : isSet(object.udf) - ? { $case: "udf", udf: UserDefinedFunction.fromJSON(object.udf) } - : undefined, - }; - }, - - toJSON(message: ExprNode): unknown { - const obj: any = {}; - message.exprType !== undefined && (obj.exprType = exprNode_TypeToJSON(message.exprType)); - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.rexNode?.$case === "inputRef" && (obj.inputRef = Math.round(message.rexNode?.inputRef)); - message.rexNode?.$case === "constant" && - (obj.constant = message.rexNode?.constant ? Datum.toJSON(message.rexNode?.constant) : undefined); - message.rexNode?.$case === "funcCall" && - (obj.funcCall = message.rexNode?.funcCall ? FunctionCall.toJSON(message.rexNode?.funcCall) : undefined); - message.rexNode?.$case === "udf" && - (obj.udf = message.rexNode?.udf ? UserDefinedFunction.toJSON(message.rexNode?.udf) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExprNode { - const message = createBaseExprNode(); - message.exprType = object.exprType ?? ExprNode_Type.UNSPECIFIED; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - if ( - object.rexNode?.$case === "inputRef" && - object.rexNode?.inputRef !== undefined && - object.rexNode?.inputRef !== null - ) { - message.rexNode = { $case: "inputRef", inputRef: object.rexNode.inputRef }; - } - if ( - object.rexNode?.$case === "constant" && - object.rexNode?.constant !== undefined && - object.rexNode?.constant !== null - ) { - message.rexNode = { $case: "constant", constant: Datum.fromPartial(object.rexNode.constant) }; - } - if ( - object.rexNode?.$case === "funcCall" && - object.rexNode?.funcCall !== undefined && - object.rexNode?.funcCall !== null - ) { - message.rexNode = { $case: "funcCall", funcCall: FunctionCall.fromPartial(object.rexNode.funcCall) }; - } - if (object.rexNode?.$case === "udf" && object.rexNode?.udf !== undefined && object.rexNode?.udf !== null) { - message.rexNode = { $case: "udf", udf: UserDefinedFunction.fromPartial(object.rexNode.udf) }; - } - return message; - }, -}; - -function createBaseTableFunction(): TableFunction { - return { functionType: TableFunction_Type.UNSPECIFIED, args: [], returnType: undefined, udtf: undefined }; -} - -export const TableFunction = { - fromJSON(object: any): TableFunction { - return { - functionType: isSet(object.functionType) - ? tableFunction_TypeFromJSON(object.functionType) - : TableFunction_Type.UNSPECIFIED, - args: Array.isArray(object?.args) - ? object.args.map((e: any) => ExprNode.fromJSON(e)) - : [], - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - udtf: isSet(object.udtf) ? UserDefinedTableFunction.fromJSON(object.udtf) : undefined, - }; - }, - - toJSON(message: TableFunction): unknown { - const obj: any = {}; - message.functionType !== undefined && (obj.functionType = tableFunction_TypeToJSON(message.functionType)); - if (message.args) { - obj.args = message.args.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.args = []; - } - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.udtf !== undefined && (obj.udtf = message.udtf ? UserDefinedTableFunction.toJSON(message.udtf) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TableFunction { - const message = createBaseTableFunction(); - message.functionType = object.functionType ?? TableFunction_Type.UNSPECIFIED; - message.args = object.args?.map((e) => ExprNode.fromPartial(e)) || []; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - message.udtf = (object.udtf !== undefined && object.udtf !== null) - ? UserDefinedTableFunction.fromPartial(object.udtf) - : undefined; - return message; - }, -}; - -function createBaseInputRef(): InputRef { - return { index: 0, type: undefined }; -} - -export const InputRef = { - fromJSON(object: any): InputRef { - return { - index: isSet(object.index) ? Number(object.index) : 0, - type: isSet(object.type) ? DataType.fromJSON(object.type) : undefined, - }; - }, - - toJSON(message: InputRef): unknown { - const obj: any = {}; - message.index !== undefined && (obj.index = Math.round(message.index)); - message.type !== undefined && (obj.type = message.type ? DataType.toJSON(message.type) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): InputRef { - const message = createBaseInputRef(); - message.index = object.index ?? 0; - message.type = (object.type !== undefined && object.type !== null) ? DataType.fromPartial(object.type) : undefined; - return message; - }, -}; - -function createBaseProjectSetSelectItem(): ProjectSetSelectItem { - return { selectItem: undefined }; -} - -export const ProjectSetSelectItem = { - fromJSON(object: any): ProjectSetSelectItem { - return { - selectItem: isSet(object.expr) - ? { $case: "expr", expr: ExprNode.fromJSON(object.expr) } - : isSet(object.tableFunction) - ? { $case: "tableFunction", tableFunction: TableFunction.fromJSON(object.tableFunction) } - : undefined, - }; - }, - - toJSON(message: ProjectSetSelectItem): unknown { - const obj: any = {}; - message.selectItem?.$case === "expr" && - (obj.expr = message.selectItem?.expr ? ExprNode.toJSON(message.selectItem?.expr) : undefined); - message.selectItem?.$case === "tableFunction" && (obj.tableFunction = message.selectItem?.tableFunction - ? TableFunction.toJSON(message.selectItem?.tableFunction) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ProjectSetSelectItem { - const message = createBaseProjectSetSelectItem(); - if ( - object.selectItem?.$case === "expr" && object.selectItem?.expr !== undefined && object.selectItem?.expr !== null - ) { - message.selectItem = { $case: "expr", expr: ExprNode.fromPartial(object.selectItem.expr) }; - } - if ( - object.selectItem?.$case === "tableFunction" && - object.selectItem?.tableFunction !== undefined && - object.selectItem?.tableFunction !== null - ) { - message.selectItem = { - $case: "tableFunction", - tableFunction: TableFunction.fromPartial(object.selectItem.tableFunction), - }; - } - return message; - }, -}; - -function createBaseFunctionCall(): FunctionCall { - return { children: [] }; -} - -export const FunctionCall = { - fromJSON(object: any): FunctionCall { - return { children: Array.isArray(object?.children) ? object.children.map((e: any) => ExprNode.fromJSON(e)) : [] }; - }, - - toJSON(message: FunctionCall): unknown { - const obj: any = {}; - if (message.children) { - obj.children = message.children.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.children = []; - } - return obj; - }, - - fromPartial, I>>(object: I): FunctionCall { - const message = createBaseFunctionCall(); - message.children = object.children?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseAggCall(): AggCall { - return { - type: AggCall_Type.UNSPECIFIED, - args: [], - returnType: undefined, - distinct: false, - orderBy: [], - filter: undefined, - }; -} - -export const AggCall = { - fromJSON(object: any): AggCall { - return { - type: isSet(object.type) ? aggCall_TypeFromJSON(object.type) : AggCall_Type.UNSPECIFIED, - args: Array.isArray(object?.args) ? object.args.map((e: any) => InputRef.fromJSON(e)) : [], - returnType: isSet(object.returnType) ? DataType.fromJSON(object.returnType) : undefined, - distinct: isSet(object.distinct) ? Boolean(object.distinct) : false, - orderBy: Array.isArray(object?.orderBy) ? object.orderBy.map((e: any) => ColumnOrder.fromJSON(e)) : [], - filter: isSet(object.filter) ? ExprNode.fromJSON(object.filter) : undefined, - }; - }, - - toJSON(message: AggCall): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = aggCall_TypeToJSON(message.type)); - if (message.args) { - obj.args = message.args.map((e) => e ? InputRef.toJSON(e) : undefined); - } else { - obj.args = []; - } - message.returnType !== undefined && - (obj.returnType = message.returnType ? DataType.toJSON(message.returnType) : undefined); - message.distinct !== undefined && (obj.distinct = message.distinct); - if (message.orderBy) { - obj.orderBy = message.orderBy.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.orderBy = []; - } - message.filter !== undefined && (obj.filter = message.filter ? ExprNode.toJSON(message.filter) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AggCall { - const message = createBaseAggCall(); - message.type = object.type ?? AggCall_Type.UNSPECIFIED; - message.args = object.args?.map((e) => InputRef.fromPartial(e)) || []; - message.returnType = (object.returnType !== undefined && object.returnType !== null) - ? DataType.fromPartial(object.returnType) - : undefined; - message.distinct = object.distinct ?? false; - message.orderBy = object.orderBy?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.filter = (object.filter !== undefined && object.filter !== null) - ? ExprNode.fromPartial(object.filter) - : undefined; - return message; - }, -}; - -function createBaseUserDefinedFunction(): UserDefinedFunction { - return { children: [], name: "", argTypes: [], language: "", link: "", identifier: "" }; -} - -export const UserDefinedFunction = { - fromJSON(object: any): UserDefinedFunction { - return { - children: Array.isArray(object?.children) ? object.children.map((e: any) => ExprNode.fromJSON(e)) : [], - name: isSet(object.name) ? String(object.name) : "", - argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => DataType.fromJSON(e)) : [], - language: isSet(object.language) ? String(object.language) : "", - link: isSet(object.link) ? String(object.link) : "", - identifier: isSet(object.identifier) ? String(object.identifier) : "", - }; - }, - - toJSON(message: UserDefinedFunction): unknown { - const obj: any = {}; - if (message.children) { - obj.children = message.children.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.children = []; - } - message.name !== undefined && (obj.name = message.name); - if (message.argTypes) { - obj.argTypes = message.argTypes.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.argTypes = []; - } - message.language !== undefined && (obj.language = message.language); - message.link !== undefined && (obj.link = message.link); - message.identifier !== undefined && (obj.identifier = message.identifier); - return obj; - }, - - fromPartial, I>>(object: I): UserDefinedFunction { - const message = createBaseUserDefinedFunction(); - message.children = object.children?.map((e) => ExprNode.fromPartial(e)) || []; - message.name = object.name ?? ""; - message.argTypes = object.argTypes?.map((e) => DataType.fromPartial(e)) || []; - message.language = object.language ?? ""; - message.link = object.link ?? ""; - message.identifier = object.identifier ?? ""; - return message; - }, -}; - -function createBaseUserDefinedTableFunction(): UserDefinedTableFunction { - return { argTypes: [], language: "", link: "", identifier: "" }; -} - -export const UserDefinedTableFunction = { - fromJSON(object: any): UserDefinedTableFunction { - return { - argTypes: Array.isArray(object?.argTypes) ? object.argTypes.map((e: any) => DataType.fromJSON(e)) : [], - language: isSet(object.language) ? String(object.language) : "", - link: isSet(object.link) ? String(object.link) : "", - identifier: isSet(object.identifier) ? String(object.identifier) : "", - }; - }, - - toJSON(message: UserDefinedTableFunction): unknown { - const obj: any = {}; - if (message.argTypes) { - obj.argTypes = message.argTypes.map((e) => e ? DataType.toJSON(e) : undefined); - } else { - obj.argTypes = []; - } - message.language !== undefined && (obj.language = message.language); - message.link !== undefined && (obj.link = message.link); - message.identifier !== undefined && (obj.identifier = message.identifier); - return obj; - }, - - fromPartial, I>>(object: I): UserDefinedTableFunction { - const message = createBaseUserDefinedTableFunction(); - message.argTypes = object.argTypes?.map((e) => DataType.fromPartial(e)) || []; - message.language = object.language ?? ""; - message.link = object.link ?? ""; - message.identifier = object.identifier ?? ""; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/health.ts b/dashboard/proto/gen/health.ts deleted file mode 100644 index c77e2b8bebe9e..0000000000000 --- a/dashboard/proto/gen/health.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "health"; - -export interface HealthCheckRequest { - service: string; -} - -export interface HealthCheckResponse { - status: HealthCheckResponse_ServingStatus; -} - -export const HealthCheckResponse_ServingStatus = { - UNKNOWN: "UNKNOWN", - SERVING: "SERVING", - NOT_SERVING: "NOT_SERVING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type HealthCheckResponse_ServingStatus = - typeof HealthCheckResponse_ServingStatus[keyof typeof HealthCheckResponse_ServingStatus]; - -export function healthCheckResponse_ServingStatusFromJSON(object: any): HealthCheckResponse_ServingStatus { - switch (object) { - case 0: - case "UNKNOWN": - return HealthCheckResponse_ServingStatus.UNKNOWN; - case 1: - case "SERVING": - return HealthCheckResponse_ServingStatus.SERVING; - case 2: - case "NOT_SERVING": - return HealthCheckResponse_ServingStatus.NOT_SERVING; - case -1: - case "UNRECOGNIZED": - default: - return HealthCheckResponse_ServingStatus.UNRECOGNIZED; - } -} - -export function healthCheckResponse_ServingStatusToJSON(object: HealthCheckResponse_ServingStatus): string { - switch (object) { - case HealthCheckResponse_ServingStatus.UNKNOWN: - return "UNKNOWN"; - case HealthCheckResponse_ServingStatus.SERVING: - return "SERVING"; - case HealthCheckResponse_ServingStatus.NOT_SERVING: - return "NOT_SERVING"; - case HealthCheckResponse_ServingStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -function createBaseHealthCheckRequest(): HealthCheckRequest { - return { service: "" }; -} - -export const HealthCheckRequest = { - fromJSON(object: any): HealthCheckRequest { - return { service: isSet(object.service) ? String(object.service) : "" }; - }, - - toJSON(message: HealthCheckRequest): unknown { - const obj: any = {}; - message.service !== undefined && (obj.service = message.service); - return obj; - }, - - fromPartial, I>>(object: I): HealthCheckRequest { - const message = createBaseHealthCheckRequest(); - message.service = object.service ?? ""; - return message; - }, -}; - -function createBaseHealthCheckResponse(): HealthCheckResponse { - return { status: HealthCheckResponse_ServingStatus.UNKNOWN }; -} - -export const HealthCheckResponse = { - fromJSON(object: any): HealthCheckResponse { - return { - status: isSet(object.status) - ? healthCheckResponse_ServingStatusFromJSON(object.status) - : HealthCheckResponse_ServingStatus.UNKNOWN, - }; - }, - - toJSON(message: HealthCheckResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = healthCheckResponse_ServingStatusToJSON(message.status)); - return obj; - }, - - fromPartial, I>>(object: I): HealthCheckResponse { - const message = createBaseHealthCheckResponse(); - message.status = object.status ?? HealthCheckResponse_ServingStatus.UNKNOWN; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/hummock.ts b/dashboard/proto/gen/hummock.ts deleted file mode 100644 index 48e6aee33faae..0000000000000 --- a/dashboard/proto/gen/hummock.ts +++ /dev/null @@ -1,4726 +0,0 @@ -/* eslint-disable */ -import { Table } from "./catalog"; -import { Status, WorkerNode } from "./common"; -import { CompactorRuntimeConfig } from "./compactor"; - -export const protobufPackage = "hummock"; - -export const LevelType = { - UNSPECIFIED: "UNSPECIFIED", - NONOVERLAPPING: "NONOVERLAPPING", - OVERLAPPING: "OVERLAPPING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type LevelType = typeof LevelType[keyof typeof LevelType]; - -export function levelTypeFromJSON(object: any): LevelType { - switch (object) { - case 0: - case "UNSPECIFIED": - return LevelType.UNSPECIFIED; - case 1: - case "NONOVERLAPPING": - return LevelType.NONOVERLAPPING; - case 2: - case "OVERLAPPING": - return LevelType.OVERLAPPING; - case -1: - case "UNRECOGNIZED": - default: - return LevelType.UNRECOGNIZED; - } -} - -export function levelTypeToJSON(object: LevelType): string { - switch (object) { - case LevelType.UNSPECIFIED: - return "UNSPECIFIED"; - case LevelType.NONOVERLAPPING: - return "NONOVERLAPPING"; - case LevelType.OVERLAPPING: - return "OVERLAPPING"; - case LevelType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface SstableInfo { - objectId: number; - sstId: number; - keyRange: KeyRange | undefined; - fileSize: number; - tableIds: number[]; - metaOffset: number; - staleKeyCount: number; - totalKeyCount: number; - minEpoch: number; - maxEpoch: number; - uncompressedFileSize: number; -} - -export interface OverlappingLevel { - subLevels: Level[]; - totalFileSize: number; - uncompressedFileSize: number; -} - -export interface Level { - levelIdx: number; - levelType: LevelType; - tableInfos: SstableInfo[]; - totalFileSize: number; - subLevelId: number; - uncompressedFileSize: number; -} - -export interface InputLevel { - levelIdx: number; - levelType: LevelType; - tableInfos: SstableInfo[]; -} - -export interface IntraLevelDelta { - levelIdx: number; - l0SubLevelId: number; - removedTableIds: number[]; - insertedTableInfos: SstableInfo[]; -} - -export interface GroupConstruct { - groupConfig: - | CompactionConfig - | undefined; - /** If `parent_group_id` is not 0, it means `parent_group_id` splits into `parent_group_id` and this group, so this group is not empty initially. */ - parentGroupId: number; - tableIds: number[]; - groupId: number; - newSstStartId: number; -} - -export interface GroupMetaChange { - tableIdsAdd: number[]; - tableIdsRemove: number[]; -} - -export interface GroupDestroy { -} - -export interface GroupDelta { - deltaType?: - | { $case: "intraLevel"; intraLevel: IntraLevelDelta } - | { $case: "groupConstruct"; groupConstruct: GroupConstruct } - | { $case: "groupDestroy"; groupDestroy: GroupDestroy } - | { $case: "groupMetaChange"; groupMetaChange: GroupMetaChange }; -} - -export interface UncommittedEpoch { - epoch: number; - tables: SstableInfo[]; -} - -export interface HummockVersion { - id: number; - /** Levels of each compaction group */ - levels: { [key: number]: HummockVersion_Levels }; - maxCommittedEpoch: number; - /** - * Snapshots with epoch less than the safe epoch have been GCed. - * Reads against such an epoch will fail. - */ - safeEpoch: number; -} - -export interface HummockVersion_Levels { - levels: Level[]; - l0: OverlappingLevel | undefined; - groupId: number; - parentGroupId: number; - memberTableIds: number[]; -} - -export interface HummockVersion_LevelsEntry { - key: number; - value: HummockVersion_Levels | undefined; -} - -export interface HummockVersionDelta { - id: number; - prevId: number; - /** Levels of each compaction group */ - groupDeltas: { [key: number]: HummockVersionDelta_GroupDeltas }; - maxCommittedEpoch: number; - /** - * Snapshots with epoch less than the safe epoch have been GCed. - * Reads against such an epoch will fail. - */ - safeEpoch: number; - trivialMove: boolean; - gcObjectIds: number[]; -} - -export interface HummockVersionDelta_GroupDeltas { - groupDeltas: GroupDelta[]; -} - -export interface HummockVersionDelta_GroupDeltasEntry { - key: number; - value: HummockVersionDelta_GroupDeltas | undefined; -} - -export interface HummockVersionDeltas { - versionDeltas: HummockVersionDelta[]; -} - -/** We will have two epoch after decouple */ -export interface HummockSnapshot { - /** Epoch with checkpoint, we will read durable data with it. */ - committedEpoch: number; - /** Epoch without checkpoint, we will read real-time data with it. But it may be rolled back. */ - currentEpoch: number; -} - -export interface VersionUpdatePayload { - payload?: { $case: "versionDeltas"; versionDeltas: HummockVersionDeltas } | { - $case: "pinnedVersion"; - pinnedVersion: HummockVersion; - }; -} - -export interface UnpinVersionBeforeRequest { - contextId: number; - unpinVersionBefore: number; -} - -export interface UnpinVersionBeforeResponse { - status: Status | undefined; -} - -export interface GetCurrentVersionRequest { -} - -export interface GetCurrentVersionResponse { - status: Status | undefined; - currentVersion: HummockVersion | undefined; -} - -export interface UnpinVersionRequest { - contextId: number; -} - -export interface UnpinVersionResponse { - status: Status | undefined; -} - -export interface PinSnapshotRequest { - contextId: number; -} - -export interface PinSpecificSnapshotRequest { - contextId: number; - epoch: number; -} - -export interface GetAssignedCompactTaskNumRequest { -} - -export interface GetAssignedCompactTaskNumResponse { - numTasks: number; -} - -export interface PinSnapshotResponse { - status: Status | undefined; - snapshot: HummockSnapshot | undefined; -} - -export interface GetEpochRequest { -} - -export interface GetEpochResponse { - status: Status | undefined; - snapshot: HummockSnapshot | undefined; -} - -export interface UnpinSnapshotRequest { - contextId: number; -} - -export interface UnpinSnapshotResponse { - status: Status | undefined; -} - -export interface UnpinSnapshotBeforeRequest { - contextId: number; - minSnapshot: HummockSnapshot | undefined; -} - -export interface UnpinSnapshotBeforeResponse { - status: Status | undefined; -} - -/** - * When `right_exclusive=false`, it represents [left, right], of which both boundary are open. When `right_exclusive=true`, - * it represents [left, right), of which right is exclusive. - */ -export interface KeyRange { - left: Uint8Array; - right: Uint8Array; - rightExclusive: boolean; -} - -export interface TableOption { - retentionSeconds: number; -} - -export interface CompactTask { - /** SSTs to be compacted, which will be removed from LSM after compaction */ - inputSsts: InputLevel[]; - /** - * In ideal case, the compaction will generate `splits.len()` tables which have key range - * corresponding to that in [`splits`], respectively - */ - splits: KeyRange[]; - /** low watermark in 'ts-aware compaction' */ - watermark: number; - /** compaction output, which will be added to [`target_level`] of LSM after compaction */ - sortedOutputSsts: SstableInfo[]; - /** task id assigned by hummock storage service */ - taskId: number; - /** compaction output will be added to [`target_level`] of LSM after compaction */ - targetLevel: number; - gcDeleteKeys: boolean; - taskStatus: CompactTask_TaskStatus; - /** compaction group the task belongs to */ - compactionGroupId: number; - /** existing_table_ids for compaction drop key */ - existingTableIds: number[]; - compressionAlgorithm: number; - targetFileSize: number; - compactionFilterMask: number; - tableOptions: { [key: number]: TableOption }; - currentEpochTime: number; - targetSubLevelId: number; - /** Identifies whether the task is space_reclaim, if the compact_task_type increases, it will be refactored to enum */ - taskType: CompactTask_TaskType; - splitByStateTable: boolean; -} - -export const CompactTask_TaskStatus = { - UNSPECIFIED: "UNSPECIFIED", - PENDING: "PENDING", - SUCCESS: "SUCCESS", - HEARTBEAT_CANCELED: "HEARTBEAT_CANCELED", - NO_AVAIL_CANCELED: "NO_AVAIL_CANCELED", - ASSIGN_FAIL_CANCELED: "ASSIGN_FAIL_CANCELED", - SEND_FAIL_CANCELED: "SEND_FAIL_CANCELED", - MANUAL_CANCELED: "MANUAL_CANCELED", - INVALID_GROUP_CANCELED: "INVALID_GROUP_CANCELED", - EXECUTE_FAILED: "EXECUTE_FAILED", - JOIN_HANDLE_FAILED: "JOIN_HANDLE_FAILED", - TRACK_SST_OBJECT_ID_FAILED: "TRACK_SST_OBJECT_ID_FAILED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type CompactTask_TaskStatus = typeof CompactTask_TaskStatus[keyof typeof CompactTask_TaskStatus]; - -export function compactTask_TaskStatusFromJSON(object: any): CompactTask_TaskStatus { - switch (object) { - case 0: - case "UNSPECIFIED": - return CompactTask_TaskStatus.UNSPECIFIED; - case 1: - case "PENDING": - return CompactTask_TaskStatus.PENDING; - case 2: - case "SUCCESS": - return CompactTask_TaskStatus.SUCCESS; - case 3: - case "HEARTBEAT_CANCELED": - return CompactTask_TaskStatus.HEARTBEAT_CANCELED; - case 4: - case "NO_AVAIL_CANCELED": - return CompactTask_TaskStatus.NO_AVAIL_CANCELED; - case 5: - case "ASSIGN_FAIL_CANCELED": - return CompactTask_TaskStatus.ASSIGN_FAIL_CANCELED; - case 6: - case "SEND_FAIL_CANCELED": - return CompactTask_TaskStatus.SEND_FAIL_CANCELED; - case 7: - case "MANUAL_CANCELED": - return CompactTask_TaskStatus.MANUAL_CANCELED; - case 8: - case "INVALID_GROUP_CANCELED": - return CompactTask_TaskStatus.INVALID_GROUP_CANCELED; - case 9: - case "EXECUTE_FAILED": - return CompactTask_TaskStatus.EXECUTE_FAILED; - case 10: - case "JOIN_HANDLE_FAILED": - return CompactTask_TaskStatus.JOIN_HANDLE_FAILED; - case 11: - case "TRACK_SST_OBJECT_ID_FAILED": - return CompactTask_TaskStatus.TRACK_SST_OBJECT_ID_FAILED; - case -1: - case "UNRECOGNIZED": - default: - return CompactTask_TaskStatus.UNRECOGNIZED; - } -} - -export function compactTask_TaskStatusToJSON(object: CompactTask_TaskStatus): string { - switch (object) { - case CompactTask_TaskStatus.UNSPECIFIED: - return "UNSPECIFIED"; - case CompactTask_TaskStatus.PENDING: - return "PENDING"; - case CompactTask_TaskStatus.SUCCESS: - return "SUCCESS"; - case CompactTask_TaskStatus.HEARTBEAT_CANCELED: - return "HEARTBEAT_CANCELED"; - case CompactTask_TaskStatus.NO_AVAIL_CANCELED: - return "NO_AVAIL_CANCELED"; - case CompactTask_TaskStatus.ASSIGN_FAIL_CANCELED: - return "ASSIGN_FAIL_CANCELED"; - case CompactTask_TaskStatus.SEND_FAIL_CANCELED: - return "SEND_FAIL_CANCELED"; - case CompactTask_TaskStatus.MANUAL_CANCELED: - return "MANUAL_CANCELED"; - case CompactTask_TaskStatus.INVALID_GROUP_CANCELED: - return "INVALID_GROUP_CANCELED"; - case CompactTask_TaskStatus.EXECUTE_FAILED: - return "EXECUTE_FAILED"; - case CompactTask_TaskStatus.JOIN_HANDLE_FAILED: - return "JOIN_HANDLE_FAILED"; - case CompactTask_TaskStatus.TRACK_SST_OBJECT_ID_FAILED: - return "TRACK_SST_OBJECT_ID_FAILED"; - case CompactTask_TaskStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const CompactTask_TaskType = { - TYPE_UNSPECIFIED: "TYPE_UNSPECIFIED", - DYNAMIC: "DYNAMIC", - SPACE_RECLAIM: "SPACE_RECLAIM", - MANUAL: "MANUAL", - SHARED_BUFFER: "SHARED_BUFFER", - TTL: "TTL", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type CompactTask_TaskType = typeof CompactTask_TaskType[keyof typeof CompactTask_TaskType]; - -export function compactTask_TaskTypeFromJSON(object: any): CompactTask_TaskType { - switch (object) { - case 0: - case "TYPE_UNSPECIFIED": - return CompactTask_TaskType.TYPE_UNSPECIFIED; - case 1: - case "DYNAMIC": - return CompactTask_TaskType.DYNAMIC; - case 2: - case "SPACE_RECLAIM": - return CompactTask_TaskType.SPACE_RECLAIM; - case 3: - case "MANUAL": - return CompactTask_TaskType.MANUAL; - case 4: - case "SHARED_BUFFER": - return CompactTask_TaskType.SHARED_BUFFER; - case 5: - case "TTL": - return CompactTask_TaskType.TTL; - case -1: - case "UNRECOGNIZED": - default: - return CompactTask_TaskType.UNRECOGNIZED; - } -} - -export function compactTask_TaskTypeToJSON(object: CompactTask_TaskType): string { - switch (object) { - case CompactTask_TaskType.TYPE_UNSPECIFIED: - return "TYPE_UNSPECIFIED"; - case CompactTask_TaskType.DYNAMIC: - return "DYNAMIC"; - case CompactTask_TaskType.SPACE_RECLAIM: - return "SPACE_RECLAIM"; - case CompactTask_TaskType.MANUAL: - return "MANUAL"; - case CompactTask_TaskType.SHARED_BUFFER: - return "SHARED_BUFFER"; - case CompactTask_TaskType.TTL: - return "TTL"; - case CompactTask_TaskType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface CompactTask_TableOptionsEntry { - key: number; - value: TableOption | undefined; -} - -export interface LevelHandler { - level: number; - tasks: LevelHandler_RunningCompactTask[]; -} - -export interface LevelHandler_RunningCompactTask { - taskId: number; - ssts: number[]; - totalFileSize: number; - targetLevel: number; -} - -export interface CompactStatus { - compactionGroupId: number; - levelHandlers: LevelHandler[]; -} - -/** Config info of compaction group. */ -export interface CompactionGroup { - id: number; - compactionConfig: CompactionConfig | undefined; -} - -/** - * Complete info of compaction group. - * The info is the aggregate of `HummockVersion` and `CompactionGroupConfig` - */ -export interface CompactionGroupInfo { - id: number; - parentId: number; - memberTableIds: number[]; - compactionConfig: CompactionConfig | undefined; -} - -export interface CompactTaskAssignment { - compactTask: CompactTask | undefined; - contextId: number; -} - -export interface GetCompactionTasksRequest { -} - -export interface GetCompactionTasksResponse { - status: Status | undefined; - compactTask: CompactTask | undefined; -} - -export interface ReportCompactionTasksRequest { - contextId: number; - compactTask: CompactTask | undefined; - tableStatsChange: { [key: number]: TableStats }; -} - -export interface ReportCompactionTasksRequest_TableStatsChangeEntry { - key: number; - value: TableStats | undefined; -} - -export interface ReportCompactionTasksResponse { - status: Status | undefined; -} - -export interface HummockPinnedVersion { - contextId: number; - minPinnedId: number; -} - -export interface HummockPinnedSnapshot { - contextId: number; - minimalPinnedSnapshot: number; -} - -export interface GetNewSstIdsRequest { - number: number; -} - -export interface GetNewSstIdsResponse { - status: - | Status - | undefined; - /** inclusive */ - startId: number; - /** exclusive */ - endId: number; -} - -/** - * This is a heartbeat message. Task will be considered dead if - * `CompactTaskProgress` is not received for a timeout - * or `num_ssts_sealed`/`num_ssts_uploaded` do not increase for a timeout. - */ -export interface CompactTaskProgress { - taskId: number; - numSstsSealed: number; - numSstsUploaded: number; -} - -export interface ReportCompactionTaskProgressRequest { - contextId: number; - progress: CompactTaskProgress[]; -} - -export interface ReportCompactionTaskProgressResponse { - status: Status | undefined; -} - -export interface SubscribeCompactTasksRequest { - contextId: number; - maxConcurrentTaskNumber: number; -} - -export interface ValidationTask { - sstInfos: SstableInfo[]; - sstIdToWorkerId: { [key: number]: number }; - epoch: number; -} - -export interface ValidationTask_SstIdToWorkerIdEntry { - key: number; - value: number; -} - -export interface SubscribeCompactTasksResponse { - task?: - | { $case: "compactTask"; compactTask: CompactTask } - | { $case: "vacuumTask"; vacuumTask: VacuumTask } - | { $case: "fullScanTask"; fullScanTask: FullScanTask } - | { $case: "validationTask"; validationTask: ValidationTask } - | { $case: "cancelCompactTask"; cancelCompactTask: CancelCompactTask }; -} - -/** Delete SSTs in object store */ -export interface VacuumTask { - sstableObjectIds: number[]; -} - -/** Scan object store to get candidate orphan SSTs. */ -export interface FullScanTask { - sstRetentionTimeSec: number; -} - -/** Cancel compact task */ -export interface CancelCompactTask { - contextId: number; - taskId: number; -} - -export interface ReportVacuumTaskRequest { - vacuumTask: VacuumTask | undefined; -} - -export interface ReportVacuumTaskResponse { - status: Status | undefined; -} - -export interface TriggerManualCompactionRequest { - compactionGroupId: number; - keyRange: KeyRange | undefined; - tableId: number; - level: number; - sstIds: number[]; -} - -export interface TriggerManualCompactionResponse { - status: Status | undefined; -} - -export interface ReportFullScanTaskRequest { - objectIds: number[]; -} - -export interface ReportFullScanTaskResponse { - status: Status | undefined; -} - -export interface TriggerFullGCRequest { - sstRetentionTimeSec: number; -} - -export interface TriggerFullGCResponse { - status: Status | undefined; -} - -export interface ListVersionDeltasRequest { - startId: number; - numLimit: number; - committedEpochLimit: number; -} - -export interface ListVersionDeltasResponse { - versionDeltas: HummockVersionDeltas | undefined; -} - -export interface PinnedVersionsSummary { - pinnedVersions: HummockPinnedVersion[]; - workers: { [key: number]: WorkerNode }; -} - -export interface PinnedVersionsSummary_WorkersEntry { - key: number; - value: WorkerNode | undefined; -} - -export interface PinnedSnapshotsSummary { - pinnedSnapshots: HummockPinnedSnapshot[]; - workers: { [key: number]: WorkerNode }; -} - -export interface PinnedSnapshotsSummary_WorkersEntry { - key: number; - value: WorkerNode | undefined; -} - -export interface RiseCtlGetPinnedVersionsSummaryRequest { -} - -export interface RiseCtlGetPinnedVersionsSummaryResponse { - summary: PinnedVersionsSummary | undefined; -} - -export interface RiseCtlGetPinnedSnapshotsSummaryRequest { -} - -export interface RiseCtlGetPinnedSnapshotsSummaryResponse { - summary: PinnedSnapshotsSummary | undefined; -} - -export interface InitMetadataForReplayRequest { - tables: Table[]; - compactionGroups: CompactionGroupInfo[]; -} - -export interface InitMetadataForReplayResponse { -} - -export interface ReplayVersionDeltaRequest { - versionDelta: HummockVersionDelta | undefined; -} - -export interface ReplayVersionDeltaResponse { - version: HummockVersion | undefined; - modifiedCompactionGroups: number[]; -} - -export interface TriggerCompactionDeterministicRequest { - versionId: number; - compactionGroups: number[]; -} - -export interface TriggerCompactionDeterministicResponse { -} - -export interface DisableCommitEpochRequest { -} - -export interface DisableCommitEpochResponse { - currentVersion: HummockVersion | undefined; -} - -export interface RiseCtlListCompactionGroupRequest { -} - -export interface RiseCtlListCompactionGroupResponse { - status: Status | undefined; - compactionGroups: CompactionGroupInfo[]; -} - -export interface RiseCtlUpdateCompactionConfigRequest { - compactionGroupIds: number[]; - configs: RiseCtlUpdateCompactionConfigRequest_MutableConfig[]; -} - -export interface RiseCtlUpdateCompactionConfigRequest_MutableConfig { - mutableConfig?: - | { $case: "maxBytesForLevelBase"; maxBytesForLevelBase: number } - | { $case: "maxBytesForLevelMultiplier"; maxBytesForLevelMultiplier: number } - | { $case: "maxCompactionBytes"; maxCompactionBytes: number } - | { $case: "subLevelMaxCompactionBytes"; subLevelMaxCompactionBytes: number } - | { $case: "level0TierCompactFileNumber"; level0TierCompactFileNumber: number } - | { $case: "targetFileSizeBase"; targetFileSizeBase: number } - | { $case: "compactionFilterMask"; compactionFilterMask: number } - | { $case: "maxSubCompaction"; maxSubCompaction: number } - | { $case: "level0StopWriteThresholdSubLevelNumber"; level0StopWriteThresholdSubLevelNumber: number }; -} - -export interface RiseCtlUpdateCompactionConfigResponse { - status: Status | undefined; -} - -export interface SetCompactorRuntimeConfigRequest { - contextId: number; - config: CompactorRuntimeConfig | undefined; -} - -export interface SetCompactorRuntimeConfigResponse { -} - -export interface PinVersionRequest { - contextId: number; -} - -export interface PinVersionResponse { - pinnedVersion: HummockVersion | undefined; -} - -export interface SplitCompactionGroupRequest { - groupId: number; - tableIds: number[]; -} - -export interface SplitCompactionGroupResponse { - newGroupId: number; -} - -export interface CompactionConfig { - maxBytesForLevelBase: number; - maxLevel: number; - maxBytesForLevelMultiplier: number; - maxCompactionBytes: number; - subLevelMaxCompactionBytes: number; - level0TierCompactFileNumber: number; - compactionMode: CompactionConfig_CompactionMode; - compressionAlgorithm: string[]; - targetFileSizeBase: number; - compactionFilterMask: number; - maxSubCompaction: number; - maxSpaceReclaimBytes: number; - splitByStateTable: boolean; - /** soft limit for max number of sub level number */ - level0StopWriteThresholdSubLevelNumber: number; - level0MaxCompactFileNumber: number; -} - -export const CompactionConfig_CompactionMode = { - UNSPECIFIED: "UNSPECIFIED", - RANGE: "RANGE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type CompactionConfig_CompactionMode = - typeof CompactionConfig_CompactionMode[keyof typeof CompactionConfig_CompactionMode]; - -export function compactionConfig_CompactionModeFromJSON(object: any): CompactionConfig_CompactionMode { - switch (object) { - case 0: - case "UNSPECIFIED": - return CompactionConfig_CompactionMode.UNSPECIFIED; - case 1: - case "RANGE": - return CompactionConfig_CompactionMode.RANGE; - case -1: - case "UNRECOGNIZED": - default: - return CompactionConfig_CompactionMode.UNRECOGNIZED; - } -} - -export function compactionConfig_CompactionModeToJSON(object: CompactionConfig_CompactionMode): string { - switch (object) { - case CompactionConfig_CompactionMode.UNSPECIFIED: - return "UNSPECIFIED"; - case CompactionConfig_CompactionMode.RANGE: - return "RANGE"; - case CompactionConfig_CompactionMode.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableStats { - totalKeySize: number; - totalValueSize: number; - totalKeyCount: number; -} - -export interface HummockVersionStats { - hummockVersionId: number; - tableStats: { [key: number]: TableStats }; -} - -export interface HummockVersionStats_TableStatsEntry { - key: number; - value: TableStats | undefined; -} - -export interface WriteLimits { - /** < compaction group id, write limit info > */ - writeLimits: { [key: number]: WriteLimits_WriteLimit }; -} - -export interface WriteLimits_WriteLimit { - tableIds: number[]; - reason: string; -} - -export interface WriteLimits_WriteLimitsEntry { - key: number; - value: WriteLimits_WriteLimit | undefined; -} - -function createBaseSstableInfo(): SstableInfo { - return { - objectId: 0, - sstId: 0, - keyRange: undefined, - fileSize: 0, - tableIds: [], - metaOffset: 0, - staleKeyCount: 0, - totalKeyCount: 0, - minEpoch: 0, - maxEpoch: 0, - uncompressedFileSize: 0, - }; -} - -export const SstableInfo = { - fromJSON(object: any): SstableInfo { - return { - objectId: isSet(object.objectId) ? Number(object.objectId) : 0, - sstId: isSet(object.sstId) ? Number(object.sstId) : 0, - keyRange: isSet(object.keyRange) ? KeyRange.fromJSON(object.keyRange) : undefined, - fileSize: isSet(object.fileSize) ? Number(object.fileSize) : 0, - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - metaOffset: isSet(object.metaOffset) ? Number(object.metaOffset) : 0, - staleKeyCount: isSet(object.staleKeyCount) ? Number(object.staleKeyCount) : 0, - totalKeyCount: isSet(object.totalKeyCount) ? Number(object.totalKeyCount) : 0, - minEpoch: isSet(object.minEpoch) ? Number(object.minEpoch) : 0, - maxEpoch: isSet(object.maxEpoch) ? Number(object.maxEpoch) : 0, - uncompressedFileSize: isSet(object.uncompressedFileSize) ? Number(object.uncompressedFileSize) : 0, - }; - }, - - toJSON(message: SstableInfo): unknown { - const obj: any = {}; - message.objectId !== undefined && (obj.objectId = Math.round(message.objectId)); - message.sstId !== undefined && (obj.sstId = Math.round(message.sstId)); - message.keyRange !== undefined && (obj.keyRange = message.keyRange ? KeyRange.toJSON(message.keyRange) : undefined); - message.fileSize !== undefined && (obj.fileSize = Math.round(message.fileSize)); - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - message.metaOffset !== undefined && (obj.metaOffset = Math.round(message.metaOffset)); - message.staleKeyCount !== undefined && (obj.staleKeyCount = Math.round(message.staleKeyCount)); - message.totalKeyCount !== undefined && (obj.totalKeyCount = Math.round(message.totalKeyCount)); - message.minEpoch !== undefined && (obj.minEpoch = Math.round(message.minEpoch)); - message.maxEpoch !== undefined && (obj.maxEpoch = Math.round(message.maxEpoch)); - message.uncompressedFileSize !== undefined && (obj.uncompressedFileSize = Math.round(message.uncompressedFileSize)); - return obj; - }, - - fromPartial, I>>(object: I): SstableInfo { - const message = createBaseSstableInfo(); - message.objectId = object.objectId ?? 0; - message.sstId = object.sstId ?? 0; - message.keyRange = (object.keyRange !== undefined && object.keyRange !== null) - ? KeyRange.fromPartial(object.keyRange) - : undefined; - message.fileSize = object.fileSize ?? 0; - message.tableIds = object.tableIds?.map((e) => e) || []; - message.metaOffset = object.metaOffset ?? 0; - message.staleKeyCount = object.staleKeyCount ?? 0; - message.totalKeyCount = object.totalKeyCount ?? 0; - message.minEpoch = object.minEpoch ?? 0; - message.maxEpoch = object.maxEpoch ?? 0; - message.uncompressedFileSize = object.uncompressedFileSize ?? 0; - return message; - }, -}; - -function createBaseOverlappingLevel(): OverlappingLevel { - return { subLevels: [], totalFileSize: 0, uncompressedFileSize: 0 }; -} - -export const OverlappingLevel = { - fromJSON(object: any): OverlappingLevel { - return { - subLevels: Array.isArray(object?.subLevels) ? object.subLevels.map((e: any) => Level.fromJSON(e)) : [], - totalFileSize: isSet(object.totalFileSize) ? Number(object.totalFileSize) : 0, - uncompressedFileSize: isSet(object.uncompressedFileSize) ? Number(object.uncompressedFileSize) : 0, - }; - }, - - toJSON(message: OverlappingLevel): unknown { - const obj: any = {}; - if (message.subLevels) { - obj.subLevels = message.subLevels.map((e) => e ? Level.toJSON(e) : undefined); - } else { - obj.subLevels = []; - } - message.totalFileSize !== undefined && (obj.totalFileSize = Math.round(message.totalFileSize)); - message.uncompressedFileSize !== undefined && (obj.uncompressedFileSize = Math.round(message.uncompressedFileSize)); - return obj; - }, - - fromPartial, I>>(object: I): OverlappingLevel { - const message = createBaseOverlappingLevel(); - message.subLevels = object.subLevels?.map((e) => Level.fromPartial(e)) || []; - message.totalFileSize = object.totalFileSize ?? 0; - message.uncompressedFileSize = object.uncompressedFileSize ?? 0; - return message; - }, -}; - -function createBaseLevel(): Level { - return { - levelIdx: 0, - levelType: LevelType.UNSPECIFIED, - tableInfos: [], - totalFileSize: 0, - subLevelId: 0, - uncompressedFileSize: 0, - }; -} - -export const Level = { - fromJSON(object: any): Level { - return { - levelIdx: isSet(object.levelIdx) ? Number(object.levelIdx) : 0, - levelType: isSet(object.levelType) ? levelTypeFromJSON(object.levelType) : LevelType.UNSPECIFIED, - tableInfos: Array.isArray(object?.tableInfos) ? object.tableInfos.map((e: any) => SstableInfo.fromJSON(e)) : [], - totalFileSize: isSet(object.totalFileSize) ? Number(object.totalFileSize) : 0, - subLevelId: isSet(object.subLevelId) ? Number(object.subLevelId) : 0, - uncompressedFileSize: isSet(object.uncompressedFileSize) ? Number(object.uncompressedFileSize) : 0, - }; - }, - - toJSON(message: Level): unknown { - const obj: any = {}; - message.levelIdx !== undefined && (obj.levelIdx = Math.round(message.levelIdx)); - message.levelType !== undefined && (obj.levelType = levelTypeToJSON(message.levelType)); - if (message.tableInfos) { - obj.tableInfos = message.tableInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.tableInfos = []; - } - message.totalFileSize !== undefined && (obj.totalFileSize = Math.round(message.totalFileSize)); - message.subLevelId !== undefined && (obj.subLevelId = Math.round(message.subLevelId)); - message.uncompressedFileSize !== undefined && (obj.uncompressedFileSize = Math.round(message.uncompressedFileSize)); - return obj; - }, - - fromPartial, I>>(object: I): Level { - const message = createBaseLevel(); - message.levelIdx = object.levelIdx ?? 0; - message.levelType = object.levelType ?? LevelType.UNSPECIFIED; - message.tableInfos = object.tableInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - message.totalFileSize = object.totalFileSize ?? 0; - message.subLevelId = object.subLevelId ?? 0; - message.uncompressedFileSize = object.uncompressedFileSize ?? 0; - return message; - }, -}; - -function createBaseInputLevel(): InputLevel { - return { levelIdx: 0, levelType: LevelType.UNSPECIFIED, tableInfos: [] }; -} - -export const InputLevel = { - fromJSON(object: any): InputLevel { - return { - levelIdx: isSet(object.levelIdx) ? Number(object.levelIdx) : 0, - levelType: isSet(object.levelType) ? levelTypeFromJSON(object.levelType) : LevelType.UNSPECIFIED, - tableInfos: Array.isArray(object?.tableInfos) ? object.tableInfos.map((e: any) => SstableInfo.fromJSON(e)) : [], - }; - }, - - toJSON(message: InputLevel): unknown { - const obj: any = {}; - message.levelIdx !== undefined && (obj.levelIdx = Math.round(message.levelIdx)); - message.levelType !== undefined && (obj.levelType = levelTypeToJSON(message.levelType)); - if (message.tableInfos) { - obj.tableInfos = message.tableInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.tableInfos = []; - } - return obj; - }, - - fromPartial, I>>(object: I): InputLevel { - const message = createBaseInputLevel(); - message.levelIdx = object.levelIdx ?? 0; - message.levelType = object.levelType ?? LevelType.UNSPECIFIED; - message.tableInfos = object.tableInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseIntraLevelDelta(): IntraLevelDelta { - return { levelIdx: 0, l0SubLevelId: 0, removedTableIds: [], insertedTableInfos: [] }; -} - -export const IntraLevelDelta = { - fromJSON(object: any): IntraLevelDelta { - return { - levelIdx: isSet(object.levelIdx) ? Number(object.levelIdx) : 0, - l0SubLevelId: isSet(object.l0SubLevelId) ? Number(object.l0SubLevelId) : 0, - removedTableIds: Array.isArray(object?.removedTableIds) ? object.removedTableIds.map((e: any) => Number(e)) : [], - insertedTableInfos: Array.isArray(object?.insertedTableInfos) - ? object.insertedTableInfos.map((e: any) => SstableInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: IntraLevelDelta): unknown { - const obj: any = {}; - message.levelIdx !== undefined && (obj.levelIdx = Math.round(message.levelIdx)); - message.l0SubLevelId !== undefined && (obj.l0SubLevelId = Math.round(message.l0SubLevelId)); - if (message.removedTableIds) { - obj.removedTableIds = message.removedTableIds.map((e) => Math.round(e)); - } else { - obj.removedTableIds = []; - } - if (message.insertedTableInfos) { - obj.insertedTableInfos = message.insertedTableInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.insertedTableInfos = []; - } - return obj; - }, - - fromPartial, I>>(object: I): IntraLevelDelta { - const message = createBaseIntraLevelDelta(); - message.levelIdx = object.levelIdx ?? 0; - message.l0SubLevelId = object.l0SubLevelId ?? 0; - message.removedTableIds = object.removedTableIds?.map((e) => e) || []; - message.insertedTableInfos = object.insertedTableInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGroupConstruct(): GroupConstruct { - return { groupConfig: undefined, parentGroupId: 0, tableIds: [], groupId: 0, newSstStartId: 0 }; -} - -export const GroupConstruct = { - fromJSON(object: any): GroupConstruct { - return { - groupConfig: isSet(object.groupConfig) ? CompactionConfig.fromJSON(object.groupConfig) : undefined, - parentGroupId: isSet(object.parentGroupId) ? Number(object.parentGroupId) : 0, - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - groupId: isSet(object.groupId) ? Number(object.groupId) : 0, - newSstStartId: isSet(object.newSstStartId) ? Number(object.newSstStartId) : 0, - }; - }, - - toJSON(message: GroupConstruct): unknown { - const obj: any = {}; - message.groupConfig !== undefined && - (obj.groupConfig = message.groupConfig ? CompactionConfig.toJSON(message.groupConfig) : undefined); - message.parentGroupId !== undefined && (obj.parentGroupId = Math.round(message.parentGroupId)); - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - message.groupId !== undefined && (obj.groupId = Math.round(message.groupId)); - message.newSstStartId !== undefined && (obj.newSstStartId = Math.round(message.newSstStartId)); - return obj; - }, - - fromPartial, I>>(object: I): GroupConstruct { - const message = createBaseGroupConstruct(); - message.groupConfig = (object.groupConfig !== undefined && object.groupConfig !== null) - ? CompactionConfig.fromPartial(object.groupConfig) - : undefined; - message.parentGroupId = object.parentGroupId ?? 0; - message.tableIds = object.tableIds?.map((e) => e) || []; - message.groupId = object.groupId ?? 0; - message.newSstStartId = object.newSstStartId ?? 0; - return message; - }, -}; - -function createBaseGroupMetaChange(): GroupMetaChange { - return { tableIdsAdd: [], tableIdsRemove: [] }; -} - -export const GroupMetaChange = { - fromJSON(object: any): GroupMetaChange { - return { - tableIdsAdd: Array.isArray(object?.tableIdsAdd) ? object.tableIdsAdd.map((e: any) => Number(e)) : [], - tableIdsRemove: Array.isArray(object?.tableIdsRemove) ? object.tableIdsRemove.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: GroupMetaChange): unknown { - const obj: any = {}; - if (message.tableIdsAdd) { - obj.tableIdsAdd = message.tableIdsAdd.map((e) => Math.round(e)); - } else { - obj.tableIdsAdd = []; - } - if (message.tableIdsRemove) { - obj.tableIdsRemove = message.tableIdsRemove.map((e) => Math.round(e)); - } else { - obj.tableIdsRemove = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GroupMetaChange { - const message = createBaseGroupMetaChange(); - message.tableIdsAdd = object.tableIdsAdd?.map((e) => e) || []; - message.tableIdsRemove = object.tableIdsRemove?.map((e) => e) || []; - return message; - }, -}; - -function createBaseGroupDestroy(): GroupDestroy { - return {}; -} - -export const GroupDestroy = { - fromJSON(_: any): GroupDestroy { - return {}; - }, - - toJSON(_: GroupDestroy): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GroupDestroy { - const message = createBaseGroupDestroy(); - return message; - }, -}; - -function createBaseGroupDelta(): GroupDelta { - return { deltaType: undefined }; -} - -export const GroupDelta = { - fromJSON(object: any): GroupDelta { - return { - deltaType: isSet(object.intraLevel) - ? { $case: "intraLevel", intraLevel: IntraLevelDelta.fromJSON(object.intraLevel) } - : isSet(object.groupConstruct) - ? { $case: "groupConstruct", groupConstruct: GroupConstruct.fromJSON(object.groupConstruct) } - : isSet(object.groupDestroy) - ? { $case: "groupDestroy", groupDestroy: GroupDestroy.fromJSON(object.groupDestroy) } - : isSet(object.groupMetaChange) - ? { $case: "groupMetaChange", groupMetaChange: GroupMetaChange.fromJSON(object.groupMetaChange) } - : undefined, - }; - }, - - toJSON(message: GroupDelta): unknown { - const obj: any = {}; - message.deltaType?.$case === "intraLevel" && (obj.intraLevel = message.deltaType?.intraLevel - ? IntraLevelDelta.toJSON(message.deltaType?.intraLevel) - : undefined); - message.deltaType?.$case === "groupConstruct" && (obj.groupConstruct = message.deltaType?.groupConstruct - ? GroupConstruct.toJSON(message.deltaType?.groupConstruct) - : undefined); - message.deltaType?.$case === "groupDestroy" && (obj.groupDestroy = message.deltaType?.groupDestroy - ? GroupDestroy.toJSON(message.deltaType?.groupDestroy) - : undefined); - message.deltaType?.$case === "groupMetaChange" && (obj.groupMetaChange = message.deltaType?.groupMetaChange - ? GroupMetaChange.toJSON(message.deltaType?.groupMetaChange) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GroupDelta { - const message = createBaseGroupDelta(); - if ( - object.deltaType?.$case === "intraLevel" && - object.deltaType?.intraLevel !== undefined && - object.deltaType?.intraLevel !== null - ) { - message.deltaType = { $case: "intraLevel", intraLevel: IntraLevelDelta.fromPartial(object.deltaType.intraLevel) }; - } - if ( - object.deltaType?.$case === "groupConstruct" && - object.deltaType?.groupConstruct !== undefined && - object.deltaType?.groupConstruct !== null - ) { - message.deltaType = { - $case: "groupConstruct", - groupConstruct: GroupConstruct.fromPartial(object.deltaType.groupConstruct), - }; - } - if ( - object.deltaType?.$case === "groupDestroy" && - object.deltaType?.groupDestroy !== undefined && - object.deltaType?.groupDestroy !== null - ) { - message.deltaType = { - $case: "groupDestroy", - groupDestroy: GroupDestroy.fromPartial(object.deltaType.groupDestroy), - }; - } - if ( - object.deltaType?.$case === "groupMetaChange" && - object.deltaType?.groupMetaChange !== undefined && - object.deltaType?.groupMetaChange !== null - ) { - message.deltaType = { - $case: "groupMetaChange", - groupMetaChange: GroupMetaChange.fromPartial(object.deltaType.groupMetaChange), - }; - } - return message; - }, -}; - -function createBaseUncommittedEpoch(): UncommittedEpoch { - return { epoch: 0, tables: [] }; -} - -export const UncommittedEpoch = { - fromJSON(object: any): UncommittedEpoch { - return { - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => SstableInfo.fromJSON(e)) : [], - }; - }, - - toJSON(message: UncommittedEpoch): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - if (message.tables) { - obj.tables = message.tables.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.tables = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UncommittedEpoch { - const message = createBaseUncommittedEpoch(); - message.epoch = object.epoch ?? 0; - message.tables = object.tables?.map((e) => SstableInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHummockVersion(): HummockVersion { - return { id: 0, levels: {}, maxCommittedEpoch: 0, safeEpoch: 0 }; -} - -export const HummockVersion = { - fromJSON(object: any): HummockVersion { - return { - id: isSet(object.id) ? Number(object.id) : 0, - levels: isObject(object.levels) - ? Object.entries(object.levels).reduce<{ [key: number]: HummockVersion_Levels }>((acc, [key, value]) => { - acc[Number(key)] = HummockVersion_Levels.fromJSON(value); - return acc; - }, {}) - : {}, - maxCommittedEpoch: isSet(object.maxCommittedEpoch) ? Number(object.maxCommittedEpoch) : 0, - safeEpoch: isSet(object.safeEpoch) ? Number(object.safeEpoch) : 0, - }; - }, - - toJSON(message: HummockVersion): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - obj.levels = {}; - if (message.levels) { - Object.entries(message.levels).forEach(([k, v]) => { - obj.levels[k] = HummockVersion_Levels.toJSON(v); - }); - } - message.maxCommittedEpoch !== undefined && (obj.maxCommittedEpoch = Math.round(message.maxCommittedEpoch)); - message.safeEpoch !== undefined && (obj.safeEpoch = Math.round(message.safeEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): HummockVersion { - const message = createBaseHummockVersion(); - message.id = object.id ?? 0; - message.levels = Object.entries(object.levels ?? {}).reduce<{ [key: number]: HummockVersion_Levels }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = HummockVersion_Levels.fromPartial(value); - } - return acc; - }, - {}, - ); - message.maxCommittedEpoch = object.maxCommittedEpoch ?? 0; - message.safeEpoch = object.safeEpoch ?? 0; - return message; - }, -}; - -function createBaseHummockVersion_Levels(): HummockVersion_Levels { - return { levels: [], l0: undefined, groupId: 0, parentGroupId: 0, memberTableIds: [] }; -} - -export const HummockVersion_Levels = { - fromJSON(object: any): HummockVersion_Levels { - return { - levels: Array.isArray(object?.levels) ? object.levels.map((e: any) => Level.fromJSON(e)) : [], - l0: isSet(object.l0) ? OverlappingLevel.fromJSON(object.l0) : undefined, - groupId: isSet(object.groupId) ? Number(object.groupId) : 0, - parentGroupId: isSet(object.parentGroupId) ? Number(object.parentGroupId) : 0, - memberTableIds: Array.isArray(object?.memberTableIds) ? object.memberTableIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: HummockVersion_Levels): unknown { - const obj: any = {}; - if (message.levels) { - obj.levels = message.levels.map((e) => e ? Level.toJSON(e) : undefined); - } else { - obj.levels = []; - } - message.l0 !== undefined && (obj.l0 = message.l0 ? OverlappingLevel.toJSON(message.l0) : undefined); - message.groupId !== undefined && (obj.groupId = Math.round(message.groupId)); - message.parentGroupId !== undefined && (obj.parentGroupId = Math.round(message.parentGroupId)); - if (message.memberTableIds) { - obj.memberTableIds = message.memberTableIds.map((e) => Math.round(e)); - } else { - obj.memberTableIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersion_Levels { - const message = createBaseHummockVersion_Levels(); - message.levels = object.levels?.map((e) => Level.fromPartial(e)) || []; - message.l0 = (object.l0 !== undefined && object.l0 !== null) ? OverlappingLevel.fromPartial(object.l0) : undefined; - message.groupId = object.groupId ?? 0; - message.parentGroupId = object.parentGroupId ?? 0; - message.memberTableIds = object.memberTableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHummockVersion_LevelsEntry(): HummockVersion_LevelsEntry { - return { key: 0, value: undefined }; -} - -export const HummockVersion_LevelsEntry = { - fromJSON(object: any): HummockVersion_LevelsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? HummockVersion_Levels.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HummockVersion_LevelsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? HummockVersion_Levels.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): HummockVersion_LevelsEntry { - const message = createBaseHummockVersion_LevelsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? HummockVersion_Levels.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseHummockVersionDelta(): HummockVersionDelta { - return { id: 0, prevId: 0, groupDeltas: {}, maxCommittedEpoch: 0, safeEpoch: 0, trivialMove: false, gcObjectIds: [] }; -} - -export const HummockVersionDelta = { - fromJSON(object: any): HummockVersionDelta { - return { - id: isSet(object.id) ? Number(object.id) : 0, - prevId: isSet(object.prevId) ? Number(object.prevId) : 0, - groupDeltas: isObject(object.groupDeltas) - ? Object.entries(object.groupDeltas).reduce<{ [key: number]: HummockVersionDelta_GroupDeltas }>( - (acc, [key, value]) => { - acc[Number(key)] = HummockVersionDelta_GroupDeltas.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - maxCommittedEpoch: isSet(object.maxCommittedEpoch) ? Number(object.maxCommittedEpoch) : 0, - safeEpoch: isSet(object.safeEpoch) ? Number(object.safeEpoch) : 0, - trivialMove: isSet(object.trivialMove) ? Boolean(object.trivialMove) : false, - gcObjectIds: Array.isArray(object?.gcObjectIds) - ? object.gcObjectIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: HummockVersionDelta): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.prevId !== undefined && (obj.prevId = Math.round(message.prevId)); - obj.groupDeltas = {}; - if (message.groupDeltas) { - Object.entries(message.groupDeltas).forEach(([k, v]) => { - obj.groupDeltas[k] = HummockVersionDelta_GroupDeltas.toJSON(v); - }); - } - message.maxCommittedEpoch !== undefined && (obj.maxCommittedEpoch = Math.round(message.maxCommittedEpoch)); - message.safeEpoch !== undefined && (obj.safeEpoch = Math.round(message.safeEpoch)); - message.trivialMove !== undefined && (obj.trivialMove = message.trivialMove); - if (message.gcObjectIds) { - obj.gcObjectIds = message.gcObjectIds.map((e) => Math.round(e)); - } else { - obj.gcObjectIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersionDelta { - const message = createBaseHummockVersionDelta(); - message.id = object.id ?? 0; - message.prevId = object.prevId ?? 0; - message.groupDeltas = Object.entries(object.groupDeltas ?? {}).reduce< - { [key: number]: HummockVersionDelta_GroupDeltas } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = HummockVersionDelta_GroupDeltas.fromPartial(value); - } - return acc; - }, {}); - message.maxCommittedEpoch = object.maxCommittedEpoch ?? 0; - message.safeEpoch = object.safeEpoch ?? 0; - message.trivialMove = object.trivialMove ?? false; - message.gcObjectIds = object.gcObjectIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHummockVersionDelta_GroupDeltas(): HummockVersionDelta_GroupDeltas { - return { groupDeltas: [] }; -} - -export const HummockVersionDelta_GroupDeltas = { - fromJSON(object: any): HummockVersionDelta_GroupDeltas { - return { - groupDeltas: Array.isArray(object?.groupDeltas) ? object.groupDeltas.map((e: any) => GroupDelta.fromJSON(e)) : [], - }; - }, - - toJSON(message: HummockVersionDelta_GroupDeltas): unknown { - const obj: any = {}; - if (message.groupDeltas) { - obj.groupDeltas = message.groupDeltas.map((e) => e ? GroupDelta.toJSON(e) : undefined); - } else { - obj.groupDeltas = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): HummockVersionDelta_GroupDeltas { - const message = createBaseHummockVersionDelta_GroupDeltas(); - message.groupDeltas = object.groupDeltas?.map((e) => GroupDelta.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHummockVersionDelta_GroupDeltasEntry(): HummockVersionDelta_GroupDeltasEntry { - return { key: 0, value: undefined }; -} - -export const HummockVersionDelta_GroupDeltasEntry = { - fromJSON(object: any): HummockVersionDelta_GroupDeltasEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? HummockVersionDelta_GroupDeltas.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HummockVersionDelta_GroupDeltasEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? HummockVersionDelta_GroupDeltas.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): HummockVersionDelta_GroupDeltasEntry { - const message = createBaseHummockVersionDelta_GroupDeltasEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? HummockVersionDelta_GroupDeltas.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseHummockVersionDeltas(): HummockVersionDeltas { - return { versionDeltas: [] }; -} - -export const HummockVersionDeltas = { - fromJSON(object: any): HummockVersionDeltas { - return { - versionDeltas: Array.isArray(object?.versionDeltas) - ? object.versionDeltas.map((e: any) => HummockVersionDelta.fromJSON(e)) - : [], - }; - }, - - toJSON(message: HummockVersionDeltas): unknown { - const obj: any = {}; - if (message.versionDeltas) { - obj.versionDeltas = message.versionDeltas.map((e) => e ? HummockVersionDelta.toJSON(e) : undefined); - } else { - obj.versionDeltas = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersionDeltas { - const message = createBaseHummockVersionDeltas(); - message.versionDeltas = object.versionDeltas?.map((e) => HummockVersionDelta.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHummockSnapshot(): HummockSnapshot { - return { committedEpoch: 0, currentEpoch: 0 }; -} - -export const HummockSnapshot = { - fromJSON(object: any): HummockSnapshot { - return { - committedEpoch: isSet(object.committedEpoch) ? Number(object.committedEpoch) : 0, - currentEpoch: isSet(object.currentEpoch) ? Number(object.currentEpoch) : 0, - }; - }, - - toJSON(message: HummockSnapshot): unknown { - const obj: any = {}; - message.committedEpoch !== undefined && (obj.committedEpoch = Math.round(message.committedEpoch)); - message.currentEpoch !== undefined && (obj.currentEpoch = Math.round(message.currentEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): HummockSnapshot { - const message = createBaseHummockSnapshot(); - message.committedEpoch = object.committedEpoch ?? 0; - message.currentEpoch = object.currentEpoch ?? 0; - return message; - }, -}; - -function createBaseVersionUpdatePayload(): VersionUpdatePayload { - return { payload: undefined }; -} - -export const VersionUpdatePayload = { - fromJSON(object: any): VersionUpdatePayload { - return { - payload: isSet(object.versionDeltas) - ? { $case: "versionDeltas", versionDeltas: HummockVersionDeltas.fromJSON(object.versionDeltas) } - : isSet(object.pinnedVersion) - ? { $case: "pinnedVersion", pinnedVersion: HummockVersion.fromJSON(object.pinnedVersion) } - : undefined, - }; - }, - - toJSON(message: VersionUpdatePayload): unknown { - const obj: any = {}; - message.payload?.$case === "versionDeltas" && (obj.versionDeltas = message.payload?.versionDeltas - ? HummockVersionDeltas.toJSON(message.payload?.versionDeltas) - : undefined); - message.payload?.$case === "pinnedVersion" && (obj.pinnedVersion = message.payload?.pinnedVersion - ? HummockVersion.toJSON(message.payload?.pinnedVersion) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): VersionUpdatePayload { - const message = createBaseVersionUpdatePayload(); - if ( - object.payload?.$case === "versionDeltas" && - object.payload?.versionDeltas !== undefined && - object.payload?.versionDeltas !== null - ) { - message.payload = { - $case: "versionDeltas", - versionDeltas: HummockVersionDeltas.fromPartial(object.payload.versionDeltas), - }; - } - if ( - object.payload?.$case === "pinnedVersion" && - object.payload?.pinnedVersion !== undefined && - object.payload?.pinnedVersion !== null - ) { - message.payload = { - $case: "pinnedVersion", - pinnedVersion: HummockVersion.fromPartial(object.payload.pinnedVersion), - }; - } - return message; - }, -}; - -function createBaseUnpinVersionBeforeRequest(): UnpinVersionBeforeRequest { - return { contextId: 0, unpinVersionBefore: 0 }; -} - -export const UnpinVersionBeforeRequest = { - fromJSON(object: any): UnpinVersionBeforeRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - unpinVersionBefore: isSet(object.unpinVersionBefore) ? Number(object.unpinVersionBefore) : 0, - }; - }, - - toJSON(message: UnpinVersionBeforeRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.unpinVersionBefore !== undefined && (obj.unpinVersionBefore = Math.round(message.unpinVersionBefore)); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionBeforeRequest { - const message = createBaseUnpinVersionBeforeRequest(); - message.contextId = object.contextId ?? 0; - message.unpinVersionBefore = object.unpinVersionBefore ?? 0; - return message; - }, -}; - -function createBaseUnpinVersionBeforeResponse(): UnpinVersionBeforeResponse { - return { status: undefined }; -} - -export const UnpinVersionBeforeResponse = { - fromJSON(object: any): UnpinVersionBeforeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinVersionBeforeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionBeforeResponse { - const message = createBaseUnpinVersionBeforeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseGetCurrentVersionRequest(): GetCurrentVersionRequest { - return {}; -} - -export const GetCurrentVersionRequest = { - fromJSON(_: any): GetCurrentVersionRequest { - return {}; - }, - - toJSON(_: GetCurrentVersionRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetCurrentVersionRequest { - const message = createBaseGetCurrentVersionRequest(); - return message; - }, -}; - -function createBaseGetCurrentVersionResponse(): GetCurrentVersionResponse { - return { status: undefined, currentVersion: undefined }; -} - -export const GetCurrentVersionResponse = { - fromJSON(object: any): GetCurrentVersionResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - currentVersion: isSet(object.currentVersion) ? HummockVersion.fromJSON(object.currentVersion) : undefined, - }; - }, - - toJSON(message: GetCurrentVersionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.currentVersion !== undefined && - (obj.currentVersion = message.currentVersion ? HummockVersion.toJSON(message.currentVersion) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetCurrentVersionResponse { - const message = createBaseGetCurrentVersionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.currentVersion = (object.currentVersion !== undefined && object.currentVersion !== null) - ? HummockVersion.fromPartial(object.currentVersion) - : undefined; - return message; - }, -}; - -function createBaseUnpinVersionRequest(): UnpinVersionRequest { - return { contextId: 0 }; -} - -export const UnpinVersionRequest = { - fromJSON(object: any): UnpinVersionRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: UnpinVersionRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionRequest { - const message = createBaseUnpinVersionRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBaseUnpinVersionResponse(): UnpinVersionResponse { - return { status: undefined }; -} - -export const UnpinVersionResponse = { - fromJSON(object: any): UnpinVersionResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinVersionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinVersionResponse { - const message = createBaseUnpinVersionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBasePinSnapshotRequest(): PinSnapshotRequest { - return { contextId: 0 }; -} - -export const PinSnapshotRequest = { - fromJSON(object: any): PinSnapshotRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: PinSnapshotRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): PinSnapshotRequest { - const message = createBasePinSnapshotRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBasePinSpecificSnapshotRequest(): PinSpecificSnapshotRequest { - return { contextId: 0, epoch: 0 }; -} - -export const PinSpecificSnapshotRequest = { - fromJSON(object: any): PinSpecificSnapshotRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - }; - }, - - toJSON(message: PinSpecificSnapshotRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): PinSpecificSnapshotRequest { - const message = createBasePinSpecificSnapshotRequest(); - message.contextId = object.contextId ?? 0; - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseGetAssignedCompactTaskNumRequest(): GetAssignedCompactTaskNumRequest { - return {}; -} - -export const GetAssignedCompactTaskNumRequest = { - fromJSON(_: any): GetAssignedCompactTaskNumRequest { - return {}; - }, - - toJSON(_: GetAssignedCompactTaskNumRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): GetAssignedCompactTaskNumRequest { - const message = createBaseGetAssignedCompactTaskNumRequest(); - return message; - }, -}; - -function createBaseGetAssignedCompactTaskNumResponse(): GetAssignedCompactTaskNumResponse { - return { numTasks: 0 }; -} - -export const GetAssignedCompactTaskNumResponse = { - fromJSON(object: any): GetAssignedCompactTaskNumResponse { - return { numTasks: isSet(object.numTasks) ? Number(object.numTasks) : 0 }; - }, - - toJSON(message: GetAssignedCompactTaskNumResponse): unknown { - const obj: any = {}; - message.numTasks !== undefined && (obj.numTasks = Math.round(message.numTasks)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetAssignedCompactTaskNumResponse { - const message = createBaseGetAssignedCompactTaskNumResponse(); - message.numTasks = object.numTasks ?? 0; - return message; - }, -}; - -function createBasePinSnapshotResponse(): PinSnapshotResponse { - return { status: undefined, snapshot: undefined }; -} - -export const PinSnapshotResponse = { - fromJSON(object: any): PinSnapshotResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - snapshot: isSet(object.snapshot) ? HummockSnapshot.fromJSON(object.snapshot) : undefined, - }; - }, - - toJSON(message: PinSnapshotResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? HummockSnapshot.toJSON(message.snapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PinSnapshotResponse { - const message = createBasePinSnapshotResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) - ? HummockSnapshot.fromPartial(object.snapshot) - : undefined; - return message; - }, -}; - -function createBaseGetEpochRequest(): GetEpochRequest { - return {}; -} - -export const GetEpochRequest = { - fromJSON(_: any): GetEpochRequest { - return {}; - }, - - toJSON(_: GetEpochRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetEpochRequest { - const message = createBaseGetEpochRequest(); - return message; - }, -}; - -function createBaseGetEpochResponse(): GetEpochResponse { - return { status: undefined, snapshot: undefined }; -} - -export const GetEpochResponse = { - fromJSON(object: any): GetEpochResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - snapshot: isSet(object.snapshot) ? HummockSnapshot.fromJSON(object.snapshot) : undefined, - }; - }, - - toJSON(message: GetEpochResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? HummockSnapshot.toJSON(message.snapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetEpochResponse { - const message = createBaseGetEpochResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) - ? HummockSnapshot.fromPartial(object.snapshot) - : undefined; - return message; - }, -}; - -function createBaseUnpinSnapshotRequest(): UnpinSnapshotRequest { - return { contextId: 0 }; -} - -export const UnpinSnapshotRequest = { - fromJSON(object: any): UnpinSnapshotRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: UnpinSnapshotRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotRequest { - const message = createBaseUnpinSnapshotRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBaseUnpinSnapshotResponse(): UnpinSnapshotResponse { - return { status: undefined }; -} - -export const UnpinSnapshotResponse = { - fromJSON(object: any): UnpinSnapshotResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinSnapshotResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotResponse { - const message = createBaseUnpinSnapshotResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseUnpinSnapshotBeforeRequest(): UnpinSnapshotBeforeRequest { - return { contextId: 0, minSnapshot: undefined }; -} - -export const UnpinSnapshotBeforeRequest = { - fromJSON(object: any): UnpinSnapshotBeforeRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - minSnapshot: isSet(object.minSnapshot) ? HummockSnapshot.fromJSON(object.minSnapshot) : undefined, - }; - }, - - toJSON(message: UnpinSnapshotBeforeRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.minSnapshot !== undefined && - (obj.minSnapshot = message.minSnapshot ? HummockSnapshot.toJSON(message.minSnapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotBeforeRequest { - const message = createBaseUnpinSnapshotBeforeRequest(); - message.contextId = object.contextId ?? 0; - message.minSnapshot = (object.minSnapshot !== undefined && object.minSnapshot !== null) - ? HummockSnapshot.fromPartial(object.minSnapshot) - : undefined; - return message; - }, -}; - -function createBaseUnpinSnapshotBeforeResponse(): UnpinSnapshotBeforeResponse { - return { status: undefined }; -} - -export const UnpinSnapshotBeforeResponse = { - fromJSON(object: any): UnpinSnapshotBeforeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UnpinSnapshotBeforeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UnpinSnapshotBeforeResponse { - const message = createBaseUnpinSnapshotBeforeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseKeyRange(): KeyRange { - return { left: new Uint8Array(), right: new Uint8Array(), rightExclusive: false }; -} - -export const KeyRange = { - fromJSON(object: any): KeyRange { - return { - left: isSet(object.left) ? bytesFromBase64(object.left) : new Uint8Array(), - right: isSet(object.right) ? bytesFromBase64(object.right) : new Uint8Array(), - rightExclusive: isSet(object.rightExclusive) ? Boolean(object.rightExclusive) : false, - }; - }, - - toJSON(message: KeyRange): unknown { - const obj: any = {}; - message.left !== undefined && - (obj.left = base64FromBytes(message.left !== undefined ? message.left : new Uint8Array())); - message.right !== undefined && - (obj.right = base64FromBytes(message.right !== undefined ? message.right : new Uint8Array())); - message.rightExclusive !== undefined && (obj.rightExclusive = message.rightExclusive); - return obj; - }, - - fromPartial, I>>(object: I): KeyRange { - const message = createBaseKeyRange(); - message.left = object.left ?? new Uint8Array(); - message.right = object.right ?? new Uint8Array(); - message.rightExclusive = object.rightExclusive ?? false; - return message; - }, -}; - -function createBaseTableOption(): TableOption { - return { retentionSeconds: 0 }; -} - -export const TableOption = { - fromJSON(object: any): TableOption { - return { retentionSeconds: isSet(object.retentionSeconds) ? Number(object.retentionSeconds) : 0 }; - }, - - toJSON(message: TableOption): unknown { - const obj: any = {}; - message.retentionSeconds !== undefined && (obj.retentionSeconds = Math.round(message.retentionSeconds)); - return obj; - }, - - fromPartial, I>>(object: I): TableOption { - const message = createBaseTableOption(); - message.retentionSeconds = object.retentionSeconds ?? 0; - return message; - }, -}; - -function createBaseCompactTask(): CompactTask { - return { - inputSsts: [], - splits: [], - watermark: 0, - sortedOutputSsts: [], - taskId: 0, - targetLevel: 0, - gcDeleteKeys: false, - taskStatus: CompactTask_TaskStatus.UNSPECIFIED, - compactionGroupId: 0, - existingTableIds: [], - compressionAlgorithm: 0, - targetFileSize: 0, - compactionFilterMask: 0, - tableOptions: {}, - currentEpochTime: 0, - targetSubLevelId: 0, - taskType: CompactTask_TaskType.TYPE_UNSPECIFIED, - splitByStateTable: false, - }; -} - -export const CompactTask = { - fromJSON(object: any): CompactTask { - return { - inputSsts: Array.isArray(object?.inputSsts) ? object.inputSsts.map((e: any) => InputLevel.fromJSON(e)) : [], - splits: Array.isArray(object?.splits) ? object.splits.map((e: any) => KeyRange.fromJSON(e)) : [], - watermark: isSet(object.watermark) ? Number(object.watermark) : 0, - sortedOutputSsts: Array.isArray(object?.sortedOutputSsts) - ? object.sortedOutputSsts.map((e: any) => SstableInfo.fromJSON(e)) - : [], - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - targetLevel: isSet(object.targetLevel) ? Number(object.targetLevel) : 0, - gcDeleteKeys: isSet(object.gcDeleteKeys) ? Boolean(object.gcDeleteKeys) : false, - taskStatus: isSet(object.taskStatus) - ? compactTask_TaskStatusFromJSON(object.taskStatus) - : CompactTask_TaskStatus.UNSPECIFIED, - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - existingTableIds: Array.isArray(object?.existingTableIds) - ? object.existingTableIds.map((e: any) => Number(e)) - : [], - compressionAlgorithm: isSet(object.compressionAlgorithm) ? Number(object.compressionAlgorithm) : 0, - targetFileSize: isSet(object.targetFileSize) ? Number(object.targetFileSize) : 0, - compactionFilterMask: isSet(object.compactionFilterMask) ? Number(object.compactionFilterMask) : 0, - tableOptions: isObject(object.tableOptions) - ? Object.entries(object.tableOptions).reduce<{ [key: number]: TableOption }>((acc, [key, value]) => { - acc[Number(key)] = TableOption.fromJSON(value); - return acc; - }, {}) - : {}, - currentEpochTime: isSet(object.currentEpochTime) ? Number(object.currentEpochTime) : 0, - targetSubLevelId: isSet(object.targetSubLevelId) ? Number(object.targetSubLevelId) : 0, - taskType: isSet(object.taskType) - ? compactTask_TaskTypeFromJSON(object.taskType) - : CompactTask_TaskType.TYPE_UNSPECIFIED, - splitByStateTable: isSet(object.splitByStateTable) ? Boolean(object.splitByStateTable) : false, - }; - }, - - toJSON(message: CompactTask): unknown { - const obj: any = {}; - if (message.inputSsts) { - obj.inputSsts = message.inputSsts.map((e) => e ? InputLevel.toJSON(e) : undefined); - } else { - obj.inputSsts = []; - } - if (message.splits) { - obj.splits = message.splits.map((e) => e ? KeyRange.toJSON(e) : undefined); - } else { - obj.splits = []; - } - message.watermark !== undefined && (obj.watermark = Math.round(message.watermark)); - if (message.sortedOutputSsts) { - obj.sortedOutputSsts = message.sortedOutputSsts.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.sortedOutputSsts = []; - } - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - message.targetLevel !== undefined && (obj.targetLevel = Math.round(message.targetLevel)); - message.gcDeleteKeys !== undefined && (obj.gcDeleteKeys = message.gcDeleteKeys); - message.taskStatus !== undefined && (obj.taskStatus = compactTask_TaskStatusToJSON(message.taskStatus)); - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - if (message.existingTableIds) { - obj.existingTableIds = message.existingTableIds.map((e) => Math.round(e)); - } else { - obj.existingTableIds = []; - } - message.compressionAlgorithm !== undefined && (obj.compressionAlgorithm = Math.round(message.compressionAlgorithm)); - message.targetFileSize !== undefined && (obj.targetFileSize = Math.round(message.targetFileSize)); - message.compactionFilterMask !== undefined && (obj.compactionFilterMask = Math.round(message.compactionFilterMask)); - obj.tableOptions = {}; - if (message.tableOptions) { - Object.entries(message.tableOptions).forEach(([k, v]) => { - obj.tableOptions[k] = TableOption.toJSON(v); - }); - } - message.currentEpochTime !== undefined && (obj.currentEpochTime = Math.round(message.currentEpochTime)); - message.targetSubLevelId !== undefined && (obj.targetSubLevelId = Math.round(message.targetSubLevelId)); - message.taskType !== undefined && (obj.taskType = compactTask_TaskTypeToJSON(message.taskType)); - message.splitByStateTable !== undefined && (obj.splitByStateTable = message.splitByStateTable); - return obj; - }, - - fromPartial, I>>(object: I): CompactTask { - const message = createBaseCompactTask(); - message.inputSsts = object.inputSsts?.map((e) => InputLevel.fromPartial(e)) || []; - message.splits = object.splits?.map((e) => KeyRange.fromPartial(e)) || []; - message.watermark = object.watermark ?? 0; - message.sortedOutputSsts = object.sortedOutputSsts?.map((e) => SstableInfo.fromPartial(e)) || []; - message.taskId = object.taskId ?? 0; - message.targetLevel = object.targetLevel ?? 0; - message.gcDeleteKeys = object.gcDeleteKeys ?? false; - message.taskStatus = object.taskStatus ?? CompactTask_TaskStatus.UNSPECIFIED; - message.compactionGroupId = object.compactionGroupId ?? 0; - message.existingTableIds = object.existingTableIds?.map((e) => e) || []; - message.compressionAlgorithm = object.compressionAlgorithm ?? 0; - message.targetFileSize = object.targetFileSize ?? 0; - message.compactionFilterMask = object.compactionFilterMask ?? 0; - message.tableOptions = Object.entries(object.tableOptions ?? {}).reduce<{ [key: number]: TableOption }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableOption.fromPartial(value); - } - return acc; - }, - {}, - ); - message.currentEpochTime = object.currentEpochTime ?? 0; - message.targetSubLevelId = object.targetSubLevelId ?? 0; - message.taskType = object.taskType ?? CompactTask_TaskType.TYPE_UNSPECIFIED; - message.splitByStateTable = object.splitByStateTable ?? false; - return message; - }, -}; - -function createBaseCompactTask_TableOptionsEntry(): CompactTask_TableOptionsEntry { - return { key: 0, value: undefined }; -} - -export const CompactTask_TableOptionsEntry = { - fromJSON(object: any): CompactTask_TableOptionsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableOption.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: CompactTask_TableOptionsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableOption.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): CompactTask_TableOptionsEntry { - const message = createBaseCompactTask_TableOptionsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableOption.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseLevelHandler(): LevelHandler { - return { level: 0, tasks: [] }; -} - -export const LevelHandler = { - fromJSON(object: any): LevelHandler { - return { - level: isSet(object.level) ? Number(object.level) : 0, - tasks: Array.isArray(object?.tasks) - ? object.tasks.map((e: any) => LevelHandler_RunningCompactTask.fromJSON(e)) - : [], - }; - }, - - toJSON(message: LevelHandler): unknown { - const obj: any = {}; - message.level !== undefined && (obj.level = Math.round(message.level)); - if (message.tasks) { - obj.tasks = message.tasks.map((e) => e ? LevelHandler_RunningCompactTask.toJSON(e) : undefined); - } else { - obj.tasks = []; - } - return obj; - }, - - fromPartial, I>>(object: I): LevelHandler { - const message = createBaseLevelHandler(); - message.level = object.level ?? 0; - message.tasks = object.tasks?.map((e) => LevelHandler_RunningCompactTask.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseLevelHandler_RunningCompactTask(): LevelHandler_RunningCompactTask { - return { taskId: 0, ssts: [], totalFileSize: 0, targetLevel: 0 }; -} - -export const LevelHandler_RunningCompactTask = { - fromJSON(object: any): LevelHandler_RunningCompactTask { - return { - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - ssts: Array.isArray(object?.ssts) ? object.ssts.map((e: any) => Number(e)) : [], - totalFileSize: isSet(object.totalFileSize) ? Number(object.totalFileSize) : 0, - targetLevel: isSet(object.targetLevel) ? Number(object.targetLevel) : 0, - }; - }, - - toJSON(message: LevelHandler_RunningCompactTask): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - if (message.ssts) { - obj.ssts = message.ssts.map((e) => Math.round(e)); - } else { - obj.ssts = []; - } - message.totalFileSize !== undefined && (obj.totalFileSize = Math.round(message.totalFileSize)); - message.targetLevel !== undefined && (obj.targetLevel = Math.round(message.targetLevel)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): LevelHandler_RunningCompactTask { - const message = createBaseLevelHandler_RunningCompactTask(); - message.taskId = object.taskId ?? 0; - message.ssts = object.ssts?.map((e) => e) || []; - message.totalFileSize = object.totalFileSize ?? 0; - message.targetLevel = object.targetLevel ?? 0; - return message; - }, -}; - -function createBaseCompactStatus(): CompactStatus { - return { compactionGroupId: 0, levelHandlers: [] }; -} - -export const CompactStatus = { - fromJSON(object: any): CompactStatus { - return { - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - levelHandlers: Array.isArray(object?.levelHandlers) - ? object.levelHandlers.map((e: any) => LevelHandler.fromJSON(e)) - : [], - }; - }, - - toJSON(message: CompactStatus): unknown { - const obj: any = {}; - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - if (message.levelHandlers) { - obj.levelHandlers = message.levelHandlers.map((e) => e ? LevelHandler.toJSON(e) : undefined); - } else { - obj.levelHandlers = []; - } - return obj; - }, - - fromPartial, I>>(object: I): CompactStatus { - const message = createBaseCompactStatus(); - message.compactionGroupId = object.compactionGroupId ?? 0; - message.levelHandlers = object.levelHandlers?.map((e) => LevelHandler.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCompactionGroup(): CompactionGroup { - return { id: 0, compactionConfig: undefined }; -} - -export const CompactionGroup = { - fromJSON(object: any): CompactionGroup { - return { - id: isSet(object.id) ? Number(object.id) : 0, - compactionConfig: isSet(object.compactionConfig) ? CompactionConfig.fromJSON(object.compactionConfig) : undefined, - }; - }, - - toJSON(message: CompactionGroup): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.compactionConfig !== undefined && - (obj.compactionConfig = message.compactionConfig ? CompactionConfig.toJSON(message.compactionConfig) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CompactionGroup { - const message = createBaseCompactionGroup(); - message.id = object.id ?? 0; - message.compactionConfig = (object.compactionConfig !== undefined && object.compactionConfig !== null) - ? CompactionConfig.fromPartial(object.compactionConfig) - : undefined; - return message; - }, -}; - -function createBaseCompactionGroupInfo(): CompactionGroupInfo { - return { id: 0, parentId: 0, memberTableIds: [], compactionConfig: undefined }; -} - -export const CompactionGroupInfo = { - fromJSON(object: any): CompactionGroupInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - parentId: isSet(object.parentId) ? Number(object.parentId) : 0, - memberTableIds: Array.isArray(object?.memberTableIds) ? object.memberTableIds.map((e: any) => Number(e)) : [], - compactionConfig: isSet(object.compactionConfig) ? CompactionConfig.fromJSON(object.compactionConfig) : undefined, - }; - }, - - toJSON(message: CompactionGroupInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.parentId !== undefined && (obj.parentId = Math.round(message.parentId)); - if (message.memberTableIds) { - obj.memberTableIds = message.memberTableIds.map((e) => Math.round(e)); - } else { - obj.memberTableIds = []; - } - message.compactionConfig !== undefined && - (obj.compactionConfig = message.compactionConfig ? CompactionConfig.toJSON(message.compactionConfig) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CompactionGroupInfo { - const message = createBaseCompactionGroupInfo(); - message.id = object.id ?? 0; - message.parentId = object.parentId ?? 0; - message.memberTableIds = object.memberTableIds?.map((e) => e) || []; - message.compactionConfig = (object.compactionConfig !== undefined && object.compactionConfig !== null) - ? CompactionConfig.fromPartial(object.compactionConfig) - : undefined; - return message; - }, -}; - -function createBaseCompactTaskAssignment(): CompactTaskAssignment { - return { compactTask: undefined, contextId: 0 }; -} - -export const CompactTaskAssignment = { - fromJSON(object: any): CompactTaskAssignment { - return { - compactTask: isSet(object.compactTask) ? CompactTask.fromJSON(object.compactTask) : undefined, - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - }; - }, - - toJSON(message: CompactTaskAssignment): unknown { - const obj: any = {}; - message.compactTask !== undefined && - (obj.compactTask = message.compactTask ? CompactTask.toJSON(message.compactTask) : undefined); - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): CompactTaskAssignment { - const message = createBaseCompactTaskAssignment(); - message.compactTask = (object.compactTask !== undefined && object.compactTask !== null) - ? CompactTask.fromPartial(object.compactTask) - : undefined; - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBaseGetCompactionTasksRequest(): GetCompactionTasksRequest { - return {}; -} - -export const GetCompactionTasksRequest = { - fromJSON(_: any): GetCompactionTasksRequest { - return {}; - }, - - toJSON(_: GetCompactionTasksRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetCompactionTasksRequest { - const message = createBaseGetCompactionTasksRequest(); - return message; - }, -}; - -function createBaseGetCompactionTasksResponse(): GetCompactionTasksResponse { - return { status: undefined, compactTask: undefined }; -} - -export const GetCompactionTasksResponse = { - fromJSON(object: any): GetCompactionTasksResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - compactTask: isSet(object.compactTask) ? CompactTask.fromJSON(object.compactTask) : undefined, - }; - }, - - toJSON(message: GetCompactionTasksResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.compactTask !== undefined && - (obj.compactTask = message.compactTask ? CompactTask.toJSON(message.compactTask) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetCompactionTasksResponse { - const message = createBaseGetCompactionTasksResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.compactTask = (object.compactTask !== undefined && object.compactTask !== null) - ? CompactTask.fromPartial(object.compactTask) - : undefined; - return message; - }, -}; - -function createBaseReportCompactionTasksRequest(): ReportCompactionTasksRequest { - return { contextId: 0, compactTask: undefined, tableStatsChange: {} }; -} - -export const ReportCompactionTasksRequest = { - fromJSON(object: any): ReportCompactionTasksRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - compactTask: isSet(object.compactTask) ? CompactTask.fromJSON(object.compactTask) : undefined, - tableStatsChange: isObject(object.tableStatsChange) - ? Object.entries(object.tableStatsChange).reduce<{ [key: number]: TableStats }>((acc, [key, value]) => { - acc[Number(key)] = TableStats.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: ReportCompactionTasksRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.compactTask !== undefined && - (obj.compactTask = message.compactTask ? CompactTask.toJSON(message.compactTask) : undefined); - obj.tableStatsChange = {}; - if (message.tableStatsChange) { - Object.entries(message.tableStatsChange).forEach(([k, v]) => { - obj.tableStatsChange[k] = TableStats.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): ReportCompactionTasksRequest { - const message = createBaseReportCompactionTasksRequest(); - message.contextId = object.contextId ?? 0; - message.compactTask = (object.compactTask !== undefined && object.compactTask !== null) - ? CompactTask.fromPartial(object.compactTask) - : undefined; - message.tableStatsChange = Object.entries(object.tableStatsChange ?? {}).reduce<{ [key: number]: TableStats }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableStats.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseReportCompactionTasksRequest_TableStatsChangeEntry(): ReportCompactionTasksRequest_TableStatsChangeEntry { - return { key: 0, value: undefined }; -} - -export const ReportCompactionTasksRequest_TableStatsChangeEntry = { - fromJSON(object: any): ReportCompactionTasksRequest_TableStatsChangeEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableStats.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: ReportCompactionTasksRequest_TableStatsChangeEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableStats.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ReportCompactionTasksRequest_TableStatsChangeEntry { - const message = createBaseReportCompactionTasksRequest_TableStatsChangeEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableStats.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseReportCompactionTasksResponse(): ReportCompactionTasksResponse { - return { status: undefined }; -} - -export const ReportCompactionTasksResponse = { - fromJSON(object: any): ReportCompactionTasksResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportCompactionTasksResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ReportCompactionTasksResponse { - const message = createBaseReportCompactionTasksResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseHummockPinnedVersion(): HummockPinnedVersion { - return { contextId: 0, minPinnedId: 0 }; -} - -export const HummockPinnedVersion = { - fromJSON(object: any): HummockPinnedVersion { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - minPinnedId: isSet(object.minPinnedId) ? Number(object.minPinnedId) : 0, - }; - }, - - toJSON(message: HummockPinnedVersion): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.minPinnedId !== undefined && (obj.minPinnedId = Math.round(message.minPinnedId)); - return obj; - }, - - fromPartial, I>>(object: I): HummockPinnedVersion { - const message = createBaseHummockPinnedVersion(); - message.contextId = object.contextId ?? 0; - message.minPinnedId = object.minPinnedId ?? 0; - return message; - }, -}; - -function createBaseHummockPinnedSnapshot(): HummockPinnedSnapshot { - return { contextId: 0, minimalPinnedSnapshot: 0 }; -} - -export const HummockPinnedSnapshot = { - fromJSON(object: any): HummockPinnedSnapshot { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - minimalPinnedSnapshot: isSet(object.minimalPinnedSnapshot) ? Number(object.minimalPinnedSnapshot) : 0, - }; - }, - - toJSON(message: HummockPinnedSnapshot): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.minimalPinnedSnapshot !== undefined && - (obj.minimalPinnedSnapshot = Math.round(message.minimalPinnedSnapshot)); - return obj; - }, - - fromPartial, I>>(object: I): HummockPinnedSnapshot { - const message = createBaseHummockPinnedSnapshot(); - message.contextId = object.contextId ?? 0; - message.minimalPinnedSnapshot = object.minimalPinnedSnapshot ?? 0; - return message; - }, -}; - -function createBaseGetNewSstIdsRequest(): GetNewSstIdsRequest { - return { number: 0 }; -} - -export const GetNewSstIdsRequest = { - fromJSON(object: any): GetNewSstIdsRequest { - return { number: isSet(object.number) ? Number(object.number) : 0 }; - }, - - toJSON(message: GetNewSstIdsRequest): unknown { - const obj: any = {}; - message.number !== undefined && (obj.number = Math.round(message.number)); - return obj; - }, - - fromPartial, I>>(object: I): GetNewSstIdsRequest { - const message = createBaseGetNewSstIdsRequest(); - message.number = object.number ?? 0; - return message; - }, -}; - -function createBaseGetNewSstIdsResponse(): GetNewSstIdsResponse { - return { status: undefined, startId: 0, endId: 0 }; -} - -export const GetNewSstIdsResponse = { - fromJSON(object: any): GetNewSstIdsResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - startId: isSet(object.startId) ? Number(object.startId) : 0, - endId: isSet(object.endId) ? Number(object.endId) : 0, - }; - }, - - toJSON(message: GetNewSstIdsResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.startId !== undefined && (obj.startId = Math.round(message.startId)); - message.endId !== undefined && (obj.endId = Math.round(message.endId)); - return obj; - }, - - fromPartial, I>>(object: I): GetNewSstIdsResponse { - const message = createBaseGetNewSstIdsResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.startId = object.startId ?? 0; - message.endId = object.endId ?? 0; - return message; - }, -}; - -function createBaseCompactTaskProgress(): CompactTaskProgress { - return { taskId: 0, numSstsSealed: 0, numSstsUploaded: 0 }; -} - -export const CompactTaskProgress = { - fromJSON(object: any): CompactTaskProgress { - return { - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - numSstsSealed: isSet(object.numSstsSealed) ? Number(object.numSstsSealed) : 0, - numSstsUploaded: isSet(object.numSstsUploaded) ? Number(object.numSstsUploaded) : 0, - }; - }, - - toJSON(message: CompactTaskProgress): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - message.numSstsSealed !== undefined && (obj.numSstsSealed = Math.round(message.numSstsSealed)); - message.numSstsUploaded !== undefined && (obj.numSstsUploaded = Math.round(message.numSstsUploaded)); - return obj; - }, - - fromPartial, I>>(object: I): CompactTaskProgress { - const message = createBaseCompactTaskProgress(); - message.taskId = object.taskId ?? 0; - message.numSstsSealed = object.numSstsSealed ?? 0; - message.numSstsUploaded = object.numSstsUploaded ?? 0; - return message; - }, -}; - -function createBaseReportCompactionTaskProgressRequest(): ReportCompactionTaskProgressRequest { - return { contextId: 0, progress: [] }; -} - -export const ReportCompactionTaskProgressRequest = { - fromJSON(object: any): ReportCompactionTaskProgressRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - progress: Array.isArray(object?.progress) ? object.progress.map((e: any) => CompactTaskProgress.fromJSON(e)) : [], - }; - }, - - toJSON(message: ReportCompactionTaskProgressRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - if (message.progress) { - obj.progress = message.progress.map((e) => e ? CompactTaskProgress.toJSON(e) : undefined); - } else { - obj.progress = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ReportCompactionTaskProgressRequest { - const message = createBaseReportCompactionTaskProgressRequest(); - message.contextId = object.contextId ?? 0; - message.progress = object.progress?.map((e) => CompactTaskProgress.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseReportCompactionTaskProgressResponse(): ReportCompactionTaskProgressResponse { - return { status: undefined }; -} - -export const ReportCompactionTaskProgressResponse = { - fromJSON(object: any): ReportCompactionTaskProgressResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportCompactionTaskProgressResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ReportCompactionTaskProgressResponse { - const message = createBaseReportCompactionTaskProgressResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseSubscribeCompactTasksRequest(): SubscribeCompactTasksRequest { - return { contextId: 0, maxConcurrentTaskNumber: 0 }; -} - -export const SubscribeCompactTasksRequest = { - fromJSON(object: any): SubscribeCompactTasksRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - maxConcurrentTaskNumber: isSet(object.maxConcurrentTaskNumber) ? Number(object.maxConcurrentTaskNumber) : 0, - }; - }, - - toJSON(message: SubscribeCompactTasksRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.maxConcurrentTaskNumber !== undefined && - (obj.maxConcurrentTaskNumber = Math.round(message.maxConcurrentTaskNumber)); - return obj; - }, - - fromPartial, I>>(object: I): SubscribeCompactTasksRequest { - const message = createBaseSubscribeCompactTasksRequest(); - message.contextId = object.contextId ?? 0; - message.maxConcurrentTaskNumber = object.maxConcurrentTaskNumber ?? 0; - return message; - }, -}; - -function createBaseValidationTask(): ValidationTask { - return { sstInfos: [], sstIdToWorkerId: {}, epoch: 0 }; -} - -export const ValidationTask = { - fromJSON(object: any): ValidationTask { - return { - sstInfos: Array.isArray(object?.sstInfos) ? object.sstInfos.map((e: any) => SstableInfo.fromJSON(e)) : [], - sstIdToWorkerId: isObject(object.sstIdToWorkerId) - ? Object.entries(object.sstIdToWorkerId).reduce<{ [key: number]: number }>((acc, [key, value]) => { - acc[Number(key)] = Number(value); - return acc; - }, {}) - : {}, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - }; - }, - - toJSON(message: ValidationTask): unknown { - const obj: any = {}; - if (message.sstInfos) { - obj.sstInfos = message.sstInfos.map((e) => e ? SstableInfo.toJSON(e) : undefined); - } else { - obj.sstInfos = []; - } - obj.sstIdToWorkerId = {}; - if (message.sstIdToWorkerId) { - Object.entries(message.sstIdToWorkerId).forEach(([k, v]) => { - obj.sstIdToWorkerId[k] = Math.round(v); - }); - } - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): ValidationTask { - const message = createBaseValidationTask(); - message.sstInfos = object.sstInfos?.map((e) => SstableInfo.fromPartial(e)) || []; - message.sstIdToWorkerId = Object.entries(object.sstIdToWorkerId ?? {}).reduce<{ [key: number]: number }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Number(value); - } - return acc; - }, - {}, - ); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseValidationTask_SstIdToWorkerIdEntry(): ValidationTask_SstIdToWorkerIdEntry { - return { key: 0, value: 0 }; -} - -export const ValidationTask_SstIdToWorkerIdEntry = { - fromJSON(object: any): ValidationTask_SstIdToWorkerIdEntry { - return { key: isSet(object.key) ? Number(object.key) : 0, value: isSet(object.value) ? Number(object.value) : 0 }; - }, - - toJSON(message: ValidationTask_SstIdToWorkerIdEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = Math.round(message.value)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ValidationTask_SstIdToWorkerIdEntry { - const message = createBaseValidationTask_SstIdToWorkerIdEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? 0; - return message; - }, -}; - -function createBaseSubscribeCompactTasksResponse(): SubscribeCompactTasksResponse { - return { task: undefined }; -} - -export const SubscribeCompactTasksResponse = { - fromJSON(object: any): SubscribeCompactTasksResponse { - return { - task: isSet(object.compactTask) - ? { $case: "compactTask", compactTask: CompactTask.fromJSON(object.compactTask) } - : isSet(object.vacuumTask) - ? { $case: "vacuumTask", vacuumTask: VacuumTask.fromJSON(object.vacuumTask) } - : isSet(object.fullScanTask) - ? { $case: "fullScanTask", fullScanTask: FullScanTask.fromJSON(object.fullScanTask) } - : isSet(object.validationTask) - ? { $case: "validationTask", validationTask: ValidationTask.fromJSON(object.validationTask) } - : isSet(object.cancelCompactTask) - ? { $case: "cancelCompactTask", cancelCompactTask: CancelCompactTask.fromJSON(object.cancelCompactTask) } - : undefined, - }; - }, - - toJSON(message: SubscribeCompactTasksResponse): unknown { - const obj: any = {}; - message.task?.$case === "compactTask" && - (obj.compactTask = message.task?.compactTask ? CompactTask.toJSON(message.task?.compactTask) : undefined); - message.task?.$case === "vacuumTask" && - (obj.vacuumTask = message.task?.vacuumTask ? VacuumTask.toJSON(message.task?.vacuumTask) : undefined); - message.task?.$case === "fullScanTask" && - (obj.fullScanTask = message.task?.fullScanTask ? FullScanTask.toJSON(message.task?.fullScanTask) : undefined); - message.task?.$case === "validationTask" && (obj.validationTask = message.task?.validationTask - ? ValidationTask.toJSON(message.task?.validationTask) - : undefined); - message.task?.$case === "cancelCompactTask" && (obj.cancelCompactTask = message.task?.cancelCompactTask - ? CancelCompactTask.toJSON(message.task?.cancelCompactTask) - : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SubscribeCompactTasksResponse { - const message = createBaseSubscribeCompactTasksResponse(); - if ( - object.task?.$case === "compactTask" && - object.task?.compactTask !== undefined && - object.task?.compactTask !== null - ) { - message.task = { $case: "compactTask", compactTask: CompactTask.fromPartial(object.task.compactTask) }; - } - if ( - object.task?.$case === "vacuumTask" && object.task?.vacuumTask !== undefined && object.task?.vacuumTask !== null - ) { - message.task = { $case: "vacuumTask", vacuumTask: VacuumTask.fromPartial(object.task.vacuumTask) }; - } - if ( - object.task?.$case === "fullScanTask" && - object.task?.fullScanTask !== undefined && - object.task?.fullScanTask !== null - ) { - message.task = { $case: "fullScanTask", fullScanTask: FullScanTask.fromPartial(object.task.fullScanTask) }; - } - if ( - object.task?.$case === "validationTask" && - object.task?.validationTask !== undefined && - object.task?.validationTask !== null - ) { - message.task = { - $case: "validationTask", - validationTask: ValidationTask.fromPartial(object.task.validationTask), - }; - } - if ( - object.task?.$case === "cancelCompactTask" && - object.task?.cancelCompactTask !== undefined && - object.task?.cancelCompactTask !== null - ) { - message.task = { - $case: "cancelCompactTask", - cancelCompactTask: CancelCompactTask.fromPartial(object.task.cancelCompactTask), - }; - } - return message; - }, -}; - -function createBaseVacuumTask(): VacuumTask { - return { sstableObjectIds: [] }; -} - -export const VacuumTask = { - fromJSON(object: any): VacuumTask { - return { - sstableObjectIds: Array.isArray(object?.sstableObjectIds) - ? object.sstableObjectIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: VacuumTask): unknown { - const obj: any = {}; - if (message.sstableObjectIds) { - obj.sstableObjectIds = message.sstableObjectIds.map((e) => Math.round(e)); - } else { - obj.sstableObjectIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): VacuumTask { - const message = createBaseVacuumTask(); - message.sstableObjectIds = object.sstableObjectIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseFullScanTask(): FullScanTask { - return { sstRetentionTimeSec: 0 }; -} - -export const FullScanTask = { - fromJSON(object: any): FullScanTask { - return { sstRetentionTimeSec: isSet(object.sstRetentionTimeSec) ? Number(object.sstRetentionTimeSec) : 0 }; - }, - - toJSON(message: FullScanTask): unknown { - const obj: any = {}; - message.sstRetentionTimeSec !== undefined && (obj.sstRetentionTimeSec = Math.round(message.sstRetentionTimeSec)); - return obj; - }, - - fromPartial, I>>(object: I): FullScanTask { - const message = createBaseFullScanTask(); - message.sstRetentionTimeSec = object.sstRetentionTimeSec ?? 0; - return message; - }, -}; - -function createBaseCancelCompactTask(): CancelCompactTask { - return { contextId: 0, taskId: 0 }; -} - -export const CancelCompactTask = { - fromJSON(object: any): CancelCompactTask { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - }; - }, - - toJSON(message: CancelCompactTask): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - return obj; - }, - - fromPartial, I>>(object: I): CancelCompactTask { - const message = createBaseCancelCompactTask(); - message.contextId = object.contextId ?? 0; - message.taskId = object.taskId ?? 0; - return message; - }, -}; - -function createBaseReportVacuumTaskRequest(): ReportVacuumTaskRequest { - return { vacuumTask: undefined }; -} - -export const ReportVacuumTaskRequest = { - fromJSON(object: any): ReportVacuumTaskRequest { - return { vacuumTask: isSet(object.vacuumTask) ? VacuumTask.fromJSON(object.vacuumTask) : undefined }; - }, - - toJSON(message: ReportVacuumTaskRequest): unknown { - const obj: any = {}; - message.vacuumTask !== undefined && - (obj.vacuumTask = message.vacuumTask ? VacuumTask.toJSON(message.vacuumTask) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReportVacuumTaskRequest { - const message = createBaseReportVacuumTaskRequest(); - message.vacuumTask = (object.vacuumTask !== undefined && object.vacuumTask !== null) - ? VacuumTask.fromPartial(object.vacuumTask) - : undefined; - return message; - }, -}; - -function createBaseReportVacuumTaskResponse(): ReportVacuumTaskResponse { - return { status: undefined }; -} - -export const ReportVacuumTaskResponse = { - fromJSON(object: any): ReportVacuumTaskResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportVacuumTaskResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReportVacuumTaskResponse { - const message = createBaseReportVacuumTaskResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseTriggerManualCompactionRequest(): TriggerManualCompactionRequest { - return { compactionGroupId: 0, keyRange: undefined, tableId: 0, level: 0, sstIds: [] }; -} - -export const TriggerManualCompactionRequest = { - fromJSON(object: any): TriggerManualCompactionRequest { - return { - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - keyRange: isSet(object.keyRange) ? KeyRange.fromJSON(object.keyRange) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - level: isSet(object.level) ? Number(object.level) : 0, - sstIds: Array.isArray(object?.sstIds) ? object.sstIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: TriggerManualCompactionRequest): unknown { - const obj: any = {}; - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - message.keyRange !== undefined && (obj.keyRange = message.keyRange ? KeyRange.toJSON(message.keyRange) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.level !== undefined && (obj.level = Math.round(message.level)); - if (message.sstIds) { - obj.sstIds = message.sstIds.map((e) => Math.round(e)); - } else { - obj.sstIds = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): TriggerManualCompactionRequest { - const message = createBaseTriggerManualCompactionRequest(); - message.compactionGroupId = object.compactionGroupId ?? 0; - message.keyRange = (object.keyRange !== undefined && object.keyRange !== null) - ? KeyRange.fromPartial(object.keyRange) - : undefined; - message.tableId = object.tableId ?? 0; - message.level = object.level ?? 0; - message.sstIds = object.sstIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTriggerManualCompactionResponse(): TriggerManualCompactionResponse { - return { status: undefined }; -} - -export const TriggerManualCompactionResponse = { - fromJSON(object: any): TriggerManualCompactionResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: TriggerManualCompactionResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TriggerManualCompactionResponse { - const message = createBaseTriggerManualCompactionResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseReportFullScanTaskRequest(): ReportFullScanTaskRequest { - return { objectIds: [] }; -} - -export const ReportFullScanTaskRequest = { - fromJSON(object: any): ReportFullScanTaskRequest { - return { objectIds: Array.isArray(object?.objectIds) ? object.objectIds.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: ReportFullScanTaskRequest): unknown { - const obj: any = {}; - if (message.objectIds) { - obj.objectIds = message.objectIds.map((e) => Math.round(e)); - } else { - obj.objectIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ReportFullScanTaskRequest { - const message = createBaseReportFullScanTaskRequest(); - message.objectIds = object.objectIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseReportFullScanTaskResponse(): ReportFullScanTaskResponse { - return { status: undefined }; -} - -export const ReportFullScanTaskResponse = { - fromJSON(object: any): ReportFullScanTaskResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ReportFullScanTaskResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReportFullScanTaskResponse { - const message = createBaseReportFullScanTaskResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseTriggerFullGCRequest(): TriggerFullGCRequest { - return { sstRetentionTimeSec: 0 }; -} - -export const TriggerFullGCRequest = { - fromJSON(object: any): TriggerFullGCRequest { - return { sstRetentionTimeSec: isSet(object.sstRetentionTimeSec) ? Number(object.sstRetentionTimeSec) : 0 }; - }, - - toJSON(message: TriggerFullGCRequest): unknown { - const obj: any = {}; - message.sstRetentionTimeSec !== undefined && (obj.sstRetentionTimeSec = Math.round(message.sstRetentionTimeSec)); - return obj; - }, - - fromPartial, I>>(object: I): TriggerFullGCRequest { - const message = createBaseTriggerFullGCRequest(); - message.sstRetentionTimeSec = object.sstRetentionTimeSec ?? 0; - return message; - }, -}; - -function createBaseTriggerFullGCResponse(): TriggerFullGCResponse { - return { status: undefined }; -} - -export const TriggerFullGCResponse = { - fromJSON(object: any): TriggerFullGCResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: TriggerFullGCResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TriggerFullGCResponse { - const message = createBaseTriggerFullGCResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseListVersionDeltasRequest(): ListVersionDeltasRequest { - return { startId: 0, numLimit: 0, committedEpochLimit: 0 }; -} - -export const ListVersionDeltasRequest = { - fromJSON(object: any): ListVersionDeltasRequest { - return { - startId: isSet(object.startId) ? Number(object.startId) : 0, - numLimit: isSet(object.numLimit) ? Number(object.numLimit) : 0, - committedEpochLimit: isSet(object.committedEpochLimit) ? Number(object.committedEpochLimit) : 0, - }; - }, - - toJSON(message: ListVersionDeltasRequest): unknown { - const obj: any = {}; - message.startId !== undefined && (obj.startId = Math.round(message.startId)); - message.numLimit !== undefined && (obj.numLimit = Math.round(message.numLimit)); - message.committedEpochLimit !== undefined && (obj.committedEpochLimit = Math.round(message.committedEpochLimit)); - return obj; - }, - - fromPartial, I>>(object: I): ListVersionDeltasRequest { - const message = createBaseListVersionDeltasRequest(); - message.startId = object.startId ?? 0; - message.numLimit = object.numLimit ?? 0; - message.committedEpochLimit = object.committedEpochLimit ?? 0; - return message; - }, -}; - -function createBaseListVersionDeltasResponse(): ListVersionDeltasResponse { - return { versionDeltas: undefined }; -} - -export const ListVersionDeltasResponse = { - fromJSON(object: any): ListVersionDeltasResponse { - return { - versionDeltas: isSet(object.versionDeltas) ? HummockVersionDeltas.fromJSON(object.versionDeltas) : undefined, - }; - }, - - toJSON(message: ListVersionDeltasResponse): unknown { - const obj: any = {}; - message.versionDeltas !== undefined && - (obj.versionDeltas = message.versionDeltas ? HummockVersionDeltas.toJSON(message.versionDeltas) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ListVersionDeltasResponse { - const message = createBaseListVersionDeltasResponse(); - message.versionDeltas = (object.versionDeltas !== undefined && object.versionDeltas !== null) - ? HummockVersionDeltas.fromPartial(object.versionDeltas) - : undefined; - return message; - }, -}; - -function createBasePinnedVersionsSummary(): PinnedVersionsSummary { - return { pinnedVersions: [], workers: {} }; -} - -export const PinnedVersionsSummary = { - fromJSON(object: any): PinnedVersionsSummary { - return { - pinnedVersions: Array.isArray(object?.pinnedVersions) - ? object.pinnedVersions.map((e: any) => HummockPinnedVersion.fromJSON(e)) - : [], - workers: isObject(object.workers) - ? Object.entries(object.workers).reduce<{ [key: number]: WorkerNode }>((acc, [key, value]) => { - acc[Number(key)] = WorkerNode.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: PinnedVersionsSummary): unknown { - const obj: any = {}; - if (message.pinnedVersions) { - obj.pinnedVersions = message.pinnedVersions.map((e) => e ? HummockPinnedVersion.toJSON(e) : undefined); - } else { - obj.pinnedVersions = []; - } - obj.workers = {}; - if (message.workers) { - Object.entries(message.workers).forEach(([k, v]) => { - obj.workers[k] = WorkerNode.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): PinnedVersionsSummary { - const message = createBasePinnedVersionsSummary(); - message.pinnedVersions = object.pinnedVersions?.map((e) => HummockPinnedVersion.fromPartial(e)) || []; - message.workers = Object.entries(object.workers ?? {}).reduce<{ [key: number]: WorkerNode }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = WorkerNode.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBasePinnedVersionsSummary_WorkersEntry(): PinnedVersionsSummary_WorkersEntry { - return { key: 0, value: undefined }; -} - -export const PinnedVersionsSummary_WorkersEntry = { - fromJSON(object: any): PinnedVersionsSummary_WorkersEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? WorkerNode.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: PinnedVersionsSummary_WorkersEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? WorkerNode.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): PinnedVersionsSummary_WorkersEntry { - const message = createBasePinnedVersionsSummary_WorkersEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? WorkerNode.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBasePinnedSnapshotsSummary(): PinnedSnapshotsSummary { - return { pinnedSnapshots: [], workers: {} }; -} - -export const PinnedSnapshotsSummary = { - fromJSON(object: any): PinnedSnapshotsSummary { - return { - pinnedSnapshots: Array.isArray(object?.pinnedSnapshots) - ? object.pinnedSnapshots.map((e: any) => HummockPinnedSnapshot.fromJSON(e)) - : [], - workers: isObject(object.workers) - ? Object.entries(object.workers).reduce<{ [key: number]: WorkerNode }>((acc, [key, value]) => { - acc[Number(key)] = WorkerNode.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: PinnedSnapshotsSummary): unknown { - const obj: any = {}; - if (message.pinnedSnapshots) { - obj.pinnedSnapshots = message.pinnedSnapshots.map((e) => e ? HummockPinnedSnapshot.toJSON(e) : undefined); - } else { - obj.pinnedSnapshots = []; - } - obj.workers = {}; - if (message.workers) { - Object.entries(message.workers).forEach(([k, v]) => { - obj.workers[k] = WorkerNode.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): PinnedSnapshotsSummary { - const message = createBasePinnedSnapshotsSummary(); - message.pinnedSnapshots = object.pinnedSnapshots?.map((e) => HummockPinnedSnapshot.fromPartial(e)) || []; - message.workers = Object.entries(object.workers ?? {}).reduce<{ [key: number]: WorkerNode }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = WorkerNode.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBasePinnedSnapshotsSummary_WorkersEntry(): PinnedSnapshotsSummary_WorkersEntry { - return { key: 0, value: undefined }; -} - -export const PinnedSnapshotsSummary_WorkersEntry = { - fromJSON(object: any): PinnedSnapshotsSummary_WorkersEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? WorkerNode.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: PinnedSnapshotsSummary_WorkersEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? WorkerNode.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): PinnedSnapshotsSummary_WorkersEntry { - const message = createBasePinnedSnapshotsSummary_WorkersEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? WorkerNode.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseRiseCtlGetPinnedVersionsSummaryRequest(): RiseCtlGetPinnedVersionsSummaryRequest { - return {}; -} - -export const RiseCtlGetPinnedVersionsSummaryRequest = { - fromJSON(_: any): RiseCtlGetPinnedVersionsSummaryRequest { - return {}; - }, - - toJSON(_: RiseCtlGetPinnedVersionsSummaryRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): RiseCtlGetPinnedVersionsSummaryRequest { - const message = createBaseRiseCtlGetPinnedVersionsSummaryRequest(); - return message; - }, -}; - -function createBaseRiseCtlGetPinnedVersionsSummaryResponse(): RiseCtlGetPinnedVersionsSummaryResponse { - return { summary: undefined }; -} - -export const RiseCtlGetPinnedVersionsSummaryResponse = { - fromJSON(object: any): RiseCtlGetPinnedVersionsSummaryResponse { - return { summary: isSet(object.summary) ? PinnedVersionsSummary.fromJSON(object.summary) : undefined }; - }, - - toJSON(message: RiseCtlGetPinnedVersionsSummaryResponse): unknown { - const obj: any = {}; - message.summary !== undefined && - (obj.summary = message.summary ? PinnedVersionsSummary.toJSON(message.summary) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlGetPinnedVersionsSummaryResponse { - const message = createBaseRiseCtlGetPinnedVersionsSummaryResponse(); - message.summary = (object.summary !== undefined && object.summary !== null) - ? PinnedVersionsSummary.fromPartial(object.summary) - : undefined; - return message; - }, -}; - -function createBaseRiseCtlGetPinnedSnapshotsSummaryRequest(): RiseCtlGetPinnedSnapshotsSummaryRequest { - return {}; -} - -export const RiseCtlGetPinnedSnapshotsSummaryRequest = { - fromJSON(_: any): RiseCtlGetPinnedSnapshotsSummaryRequest { - return {}; - }, - - toJSON(_: RiseCtlGetPinnedSnapshotsSummaryRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): RiseCtlGetPinnedSnapshotsSummaryRequest { - const message = createBaseRiseCtlGetPinnedSnapshotsSummaryRequest(); - return message; - }, -}; - -function createBaseRiseCtlGetPinnedSnapshotsSummaryResponse(): RiseCtlGetPinnedSnapshotsSummaryResponse { - return { summary: undefined }; -} - -export const RiseCtlGetPinnedSnapshotsSummaryResponse = { - fromJSON(object: any): RiseCtlGetPinnedSnapshotsSummaryResponse { - return { summary: isSet(object.summary) ? PinnedSnapshotsSummary.fromJSON(object.summary) : undefined }; - }, - - toJSON(message: RiseCtlGetPinnedSnapshotsSummaryResponse): unknown { - const obj: any = {}; - message.summary !== undefined && - (obj.summary = message.summary ? PinnedSnapshotsSummary.toJSON(message.summary) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlGetPinnedSnapshotsSummaryResponse { - const message = createBaseRiseCtlGetPinnedSnapshotsSummaryResponse(); - message.summary = (object.summary !== undefined && object.summary !== null) - ? PinnedSnapshotsSummary.fromPartial(object.summary) - : undefined; - return message; - }, -}; - -function createBaseInitMetadataForReplayRequest(): InitMetadataForReplayRequest { - return { tables: [], compactionGroups: [] }; -} - -export const InitMetadataForReplayRequest = { - fromJSON(object: any): InitMetadataForReplayRequest { - return { - tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => Table.fromJSON(e)) : [], - compactionGroups: Array.isArray(object?.compactionGroups) - ? object.compactionGroups.map((e: any) => CompactionGroupInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: InitMetadataForReplayRequest): unknown { - const obj: any = {}; - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - if (message.compactionGroups) { - obj.compactionGroups = message.compactionGroups.map((e) => e ? CompactionGroupInfo.toJSON(e) : undefined); - } else { - obj.compactionGroups = []; - } - return obj; - }, - - fromPartial, I>>(object: I): InitMetadataForReplayRequest { - const message = createBaseInitMetadataForReplayRequest(); - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - message.compactionGroups = object.compactionGroups?.map((e) => CompactionGroupInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseInitMetadataForReplayResponse(): InitMetadataForReplayResponse { - return {}; -} - -export const InitMetadataForReplayResponse = { - fromJSON(_: any): InitMetadataForReplayResponse { - return {}; - }, - - toJSON(_: InitMetadataForReplayResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): InitMetadataForReplayResponse { - const message = createBaseInitMetadataForReplayResponse(); - return message; - }, -}; - -function createBaseReplayVersionDeltaRequest(): ReplayVersionDeltaRequest { - return { versionDelta: undefined }; -} - -export const ReplayVersionDeltaRequest = { - fromJSON(object: any): ReplayVersionDeltaRequest { - return { versionDelta: isSet(object.versionDelta) ? HummockVersionDelta.fromJSON(object.versionDelta) : undefined }; - }, - - toJSON(message: ReplayVersionDeltaRequest): unknown { - const obj: any = {}; - message.versionDelta !== undefined && - (obj.versionDelta = message.versionDelta ? HummockVersionDelta.toJSON(message.versionDelta) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ReplayVersionDeltaRequest { - const message = createBaseReplayVersionDeltaRequest(); - message.versionDelta = (object.versionDelta !== undefined && object.versionDelta !== null) - ? HummockVersionDelta.fromPartial(object.versionDelta) - : undefined; - return message; - }, -}; - -function createBaseReplayVersionDeltaResponse(): ReplayVersionDeltaResponse { - return { version: undefined, modifiedCompactionGroups: [] }; -} - -export const ReplayVersionDeltaResponse = { - fromJSON(object: any): ReplayVersionDeltaResponse { - return { - version: isSet(object.version) ? HummockVersion.fromJSON(object.version) : undefined, - modifiedCompactionGroups: Array.isArray(object?.modifiedCompactionGroups) - ? object.modifiedCompactionGroups.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: ReplayVersionDeltaResponse): unknown { - const obj: any = {}; - message.version !== undefined && - (obj.version = message.version ? HummockVersion.toJSON(message.version) : undefined); - if (message.modifiedCompactionGroups) { - obj.modifiedCompactionGroups = message.modifiedCompactionGroups.map((e) => Math.round(e)); - } else { - obj.modifiedCompactionGroups = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ReplayVersionDeltaResponse { - const message = createBaseReplayVersionDeltaResponse(); - message.version = (object.version !== undefined && object.version !== null) - ? HummockVersion.fromPartial(object.version) - : undefined; - message.modifiedCompactionGroups = object.modifiedCompactionGroups?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTriggerCompactionDeterministicRequest(): TriggerCompactionDeterministicRequest { - return { versionId: 0, compactionGroups: [] }; -} - -export const TriggerCompactionDeterministicRequest = { - fromJSON(object: any): TriggerCompactionDeterministicRequest { - return { - versionId: isSet(object.versionId) ? Number(object.versionId) : 0, - compactionGroups: Array.isArray(object?.compactionGroups) - ? object.compactionGroups.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: TriggerCompactionDeterministicRequest): unknown { - const obj: any = {}; - message.versionId !== undefined && (obj.versionId = Math.round(message.versionId)); - if (message.compactionGroups) { - obj.compactionGroups = message.compactionGroups.map((e) => Math.round(e)); - } else { - obj.compactionGroups = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): TriggerCompactionDeterministicRequest { - const message = createBaseTriggerCompactionDeterministicRequest(); - message.versionId = object.versionId ?? 0; - message.compactionGroups = object.compactionGroups?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTriggerCompactionDeterministicResponse(): TriggerCompactionDeterministicResponse { - return {}; -} - -export const TriggerCompactionDeterministicResponse = { - fromJSON(_: any): TriggerCompactionDeterministicResponse { - return {}; - }, - - toJSON(_: TriggerCompactionDeterministicResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): TriggerCompactionDeterministicResponse { - const message = createBaseTriggerCompactionDeterministicResponse(); - return message; - }, -}; - -function createBaseDisableCommitEpochRequest(): DisableCommitEpochRequest { - return {}; -} - -export const DisableCommitEpochRequest = { - fromJSON(_: any): DisableCommitEpochRequest { - return {}; - }, - - toJSON(_: DisableCommitEpochRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): DisableCommitEpochRequest { - const message = createBaseDisableCommitEpochRequest(); - return message; - }, -}; - -function createBaseDisableCommitEpochResponse(): DisableCommitEpochResponse { - return { currentVersion: undefined }; -} - -export const DisableCommitEpochResponse = { - fromJSON(object: any): DisableCommitEpochResponse { - return { - currentVersion: isSet(object.currentVersion) ? HummockVersion.fromJSON(object.currentVersion) : undefined, - }; - }, - - toJSON(message: DisableCommitEpochResponse): unknown { - const obj: any = {}; - message.currentVersion !== undefined && - (obj.currentVersion = message.currentVersion ? HummockVersion.toJSON(message.currentVersion) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DisableCommitEpochResponse { - const message = createBaseDisableCommitEpochResponse(); - message.currentVersion = (object.currentVersion !== undefined && object.currentVersion !== null) - ? HummockVersion.fromPartial(object.currentVersion) - : undefined; - return message; - }, -}; - -function createBaseRiseCtlListCompactionGroupRequest(): RiseCtlListCompactionGroupRequest { - return {}; -} - -export const RiseCtlListCompactionGroupRequest = { - fromJSON(_: any): RiseCtlListCompactionGroupRequest { - return {}; - }, - - toJSON(_: RiseCtlListCompactionGroupRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): RiseCtlListCompactionGroupRequest { - const message = createBaseRiseCtlListCompactionGroupRequest(); - return message; - }, -}; - -function createBaseRiseCtlListCompactionGroupResponse(): RiseCtlListCompactionGroupResponse { - return { status: undefined, compactionGroups: [] }; -} - -export const RiseCtlListCompactionGroupResponse = { - fromJSON(object: any): RiseCtlListCompactionGroupResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - compactionGroups: Array.isArray(object?.compactionGroups) - ? object.compactionGroups.map((e: any) => CompactionGroupInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: RiseCtlListCompactionGroupResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - if (message.compactionGroups) { - obj.compactionGroups = message.compactionGroups.map((e) => e ? CompactionGroupInfo.toJSON(e) : undefined); - } else { - obj.compactionGroups = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlListCompactionGroupResponse { - const message = createBaseRiseCtlListCompactionGroupResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.compactionGroups = object.compactionGroups?.map((e) => CompactionGroupInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseRiseCtlUpdateCompactionConfigRequest(): RiseCtlUpdateCompactionConfigRequest { - return { compactionGroupIds: [], configs: [] }; -} - -export const RiseCtlUpdateCompactionConfigRequest = { - fromJSON(object: any): RiseCtlUpdateCompactionConfigRequest { - return { - compactionGroupIds: Array.isArray(object?.compactionGroupIds) - ? object.compactionGroupIds.map((e: any) => Number(e)) - : [], - configs: Array.isArray(object?.configs) - ? object.configs.map((e: any) => RiseCtlUpdateCompactionConfigRequest_MutableConfig.fromJSON(e)) - : [], - }; - }, - - toJSON(message: RiseCtlUpdateCompactionConfigRequest): unknown { - const obj: any = {}; - if (message.compactionGroupIds) { - obj.compactionGroupIds = message.compactionGroupIds.map((e) => Math.round(e)); - } else { - obj.compactionGroupIds = []; - } - if (message.configs) { - obj.configs = message.configs.map((e) => - e ? RiseCtlUpdateCompactionConfigRequest_MutableConfig.toJSON(e) : undefined - ); - } else { - obj.configs = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlUpdateCompactionConfigRequest { - const message = createBaseRiseCtlUpdateCompactionConfigRequest(); - message.compactionGroupIds = object.compactionGroupIds?.map((e) => e) || []; - message.configs = object.configs?.map((e) => RiseCtlUpdateCompactionConfigRequest_MutableConfig.fromPartial(e)) || - []; - return message; - }, -}; - -function createBaseRiseCtlUpdateCompactionConfigRequest_MutableConfig(): RiseCtlUpdateCompactionConfigRequest_MutableConfig { - return { mutableConfig: undefined }; -} - -export const RiseCtlUpdateCompactionConfigRequest_MutableConfig = { - fromJSON(object: any): RiseCtlUpdateCompactionConfigRequest_MutableConfig { - return { - mutableConfig: isSet(object.maxBytesForLevelBase) - ? { $case: "maxBytesForLevelBase", maxBytesForLevelBase: Number(object.maxBytesForLevelBase) } - : isSet(object.maxBytesForLevelMultiplier) - ? { $case: "maxBytesForLevelMultiplier", maxBytesForLevelMultiplier: Number(object.maxBytesForLevelMultiplier) } - : isSet(object.maxCompactionBytes) - ? { $case: "maxCompactionBytes", maxCompactionBytes: Number(object.maxCompactionBytes) } - : isSet(object.subLevelMaxCompactionBytes) - ? { $case: "subLevelMaxCompactionBytes", subLevelMaxCompactionBytes: Number(object.subLevelMaxCompactionBytes) } - : isSet(object.level0TierCompactFileNumber) - ? { - $case: "level0TierCompactFileNumber", - level0TierCompactFileNumber: Number(object.level0TierCompactFileNumber), - } - : isSet(object.targetFileSizeBase) - ? { $case: "targetFileSizeBase", targetFileSizeBase: Number(object.targetFileSizeBase) } - : isSet(object.compactionFilterMask) - ? { $case: "compactionFilterMask", compactionFilterMask: Number(object.compactionFilterMask) } - : isSet(object.maxSubCompaction) - ? { $case: "maxSubCompaction", maxSubCompaction: Number(object.maxSubCompaction) } - : isSet(object.level0StopWriteThresholdSubLevelNumber) - ? { - $case: "level0StopWriteThresholdSubLevelNumber", - level0StopWriteThresholdSubLevelNumber: Number(object.level0StopWriteThresholdSubLevelNumber), - } - : undefined, - }; - }, - - toJSON(message: RiseCtlUpdateCompactionConfigRequest_MutableConfig): unknown { - const obj: any = {}; - message.mutableConfig?.$case === "maxBytesForLevelBase" && - (obj.maxBytesForLevelBase = Math.round(message.mutableConfig?.maxBytesForLevelBase)); - message.mutableConfig?.$case === "maxBytesForLevelMultiplier" && - (obj.maxBytesForLevelMultiplier = Math.round(message.mutableConfig?.maxBytesForLevelMultiplier)); - message.mutableConfig?.$case === "maxCompactionBytes" && - (obj.maxCompactionBytes = Math.round(message.mutableConfig?.maxCompactionBytes)); - message.mutableConfig?.$case === "subLevelMaxCompactionBytes" && - (obj.subLevelMaxCompactionBytes = Math.round(message.mutableConfig?.subLevelMaxCompactionBytes)); - message.mutableConfig?.$case === "level0TierCompactFileNumber" && - (obj.level0TierCompactFileNumber = Math.round(message.mutableConfig?.level0TierCompactFileNumber)); - message.mutableConfig?.$case === "targetFileSizeBase" && - (obj.targetFileSizeBase = Math.round(message.mutableConfig?.targetFileSizeBase)); - message.mutableConfig?.$case === "compactionFilterMask" && - (obj.compactionFilterMask = Math.round(message.mutableConfig?.compactionFilterMask)); - message.mutableConfig?.$case === "maxSubCompaction" && - (obj.maxSubCompaction = Math.round(message.mutableConfig?.maxSubCompaction)); - message.mutableConfig?.$case === "level0StopWriteThresholdSubLevelNumber" && - (obj.level0StopWriteThresholdSubLevelNumber = Math.round( - message.mutableConfig?.level0StopWriteThresholdSubLevelNumber, - )); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlUpdateCompactionConfigRequest_MutableConfig { - const message = createBaseRiseCtlUpdateCompactionConfigRequest_MutableConfig(); - if ( - object.mutableConfig?.$case === "maxBytesForLevelBase" && - object.mutableConfig?.maxBytesForLevelBase !== undefined && - object.mutableConfig?.maxBytesForLevelBase !== null - ) { - message.mutableConfig = { - $case: "maxBytesForLevelBase", - maxBytesForLevelBase: object.mutableConfig.maxBytesForLevelBase, - }; - } - if ( - object.mutableConfig?.$case === "maxBytesForLevelMultiplier" && - object.mutableConfig?.maxBytesForLevelMultiplier !== undefined && - object.mutableConfig?.maxBytesForLevelMultiplier !== null - ) { - message.mutableConfig = { - $case: "maxBytesForLevelMultiplier", - maxBytesForLevelMultiplier: object.mutableConfig.maxBytesForLevelMultiplier, - }; - } - if ( - object.mutableConfig?.$case === "maxCompactionBytes" && - object.mutableConfig?.maxCompactionBytes !== undefined && - object.mutableConfig?.maxCompactionBytes !== null - ) { - message.mutableConfig = { - $case: "maxCompactionBytes", - maxCompactionBytes: object.mutableConfig.maxCompactionBytes, - }; - } - if ( - object.mutableConfig?.$case === "subLevelMaxCompactionBytes" && - object.mutableConfig?.subLevelMaxCompactionBytes !== undefined && - object.mutableConfig?.subLevelMaxCompactionBytes !== null - ) { - message.mutableConfig = { - $case: "subLevelMaxCompactionBytes", - subLevelMaxCompactionBytes: object.mutableConfig.subLevelMaxCompactionBytes, - }; - } - if ( - object.mutableConfig?.$case === "level0TierCompactFileNumber" && - object.mutableConfig?.level0TierCompactFileNumber !== undefined && - object.mutableConfig?.level0TierCompactFileNumber !== null - ) { - message.mutableConfig = { - $case: "level0TierCompactFileNumber", - level0TierCompactFileNumber: object.mutableConfig.level0TierCompactFileNumber, - }; - } - if ( - object.mutableConfig?.$case === "targetFileSizeBase" && - object.mutableConfig?.targetFileSizeBase !== undefined && - object.mutableConfig?.targetFileSizeBase !== null - ) { - message.mutableConfig = { - $case: "targetFileSizeBase", - targetFileSizeBase: object.mutableConfig.targetFileSizeBase, - }; - } - if ( - object.mutableConfig?.$case === "compactionFilterMask" && - object.mutableConfig?.compactionFilterMask !== undefined && - object.mutableConfig?.compactionFilterMask !== null - ) { - message.mutableConfig = { - $case: "compactionFilterMask", - compactionFilterMask: object.mutableConfig.compactionFilterMask, - }; - } - if ( - object.mutableConfig?.$case === "maxSubCompaction" && - object.mutableConfig?.maxSubCompaction !== undefined && - object.mutableConfig?.maxSubCompaction !== null - ) { - message.mutableConfig = { $case: "maxSubCompaction", maxSubCompaction: object.mutableConfig.maxSubCompaction }; - } - if ( - object.mutableConfig?.$case === "level0StopWriteThresholdSubLevelNumber" && - object.mutableConfig?.level0StopWriteThresholdSubLevelNumber !== undefined && - object.mutableConfig?.level0StopWriteThresholdSubLevelNumber !== null - ) { - message.mutableConfig = { - $case: "level0StopWriteThresholdSubLevelNumber", - level0StopWriteThresholdSubLevelNumber: object.mutableConfig.level0StopWriteThresholdSubLevelNumber, - }; - } - return message; - }, -}; - -function createBaseRiseCtlUpdateCompactionConfigResponse(): RiseCtlUpdateCompactionConfigResponse { - return { status: undefined }; -} - -export const RiseCtlUpdateCompactionConfigResponse = { - fromJSON(object: any): RiseCtlUpdateCompactionConfigResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: RiseCtlUpdateCompactionConfigResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RiseCtlUpdateCompactionConfigResponse { - const message = createBaseRiseCtlUpdateCompactionConfigResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseSetCompactorRuntimeConfigRequest(): SetCompactorRuntimeConfigRequest { - return { contextId: 0, config: undefined }; -} - -export const SetCompactorRuntimeConfigRequest = { - fromJSON(object: any): SetCompactorRuntimeConfigRequest { - return { - contextId: isSet(object.contextId) ? Number(object.contextId) : 0, - config: isSet(object.config) ? CompactorRuntimeConfig.fromJSON(object.config) : undefined, - }; - }, - - toJSON(message: SetCompactorRuntimeConfigRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - message.config !== undefined && - (obj.config = message.config ? CompactorRuntimeConfig.toJSON(message.config) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SetCompactorRuntimeConfigRequest { - const message = createBaseSetCompactorRuntimeConfigRequest(); - message.contextId = object.contextId ?? 0; - message.config = (object.config !== undefined && object.config !== null) - ? CompactorRuntimeConfig.fromPartial(object.config) - : undefined; - return message; - }, -}; - -function createBaseSetCompactorRuntimeConfigResponse(): SetCompactorRuntimeConfigResponse { - return {}; -} - -export const SetCompactorRuntimeConfigResponse = { - fromJSON(_: any): SetCompactorRuntimeConfigResponse { - return {}; - }, - - toJSON(_: SetCompactorRuntimeConfigResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>( - _: I, - ): SetCompactorRuntimeConfigResponse { - const message = createBaseSetCompactorRuntimeConfigResponse(); - return message; - }, -}; - -function createBasePinVersionRequest(): PinVersionRequest { - return { contextId: 0 }; -} - -export const PinVersionRequest = { - fromJSON(object: any): PinVersionRequest { - return { contextId: isSet(object.contextId) ? Number(object.contextId) : 0 }; - }, - - toJSON(message: PinVersionRequest): unknown { - const obj: any = {}; - message.contextId !== undefined && (obj.contextId = Math.round(message.contextId)); - return obj; - }, - - fromPartial, I>>(object: I): PinVersionRequest { - const message = createBasePinVersionRequest(); - message.contextId = object.contextId ?? 0; - return message; - }, -}; - -function createBasePinVersionResponse(): PinVersionResponse { - return { pinnedVersion: undefined }; -} - -export const PinVersionResponse = { - fromJSON(object: any): PinVersionResponse { - return { pinnedVersion: isSet(object.pinnedVersion) ? HummockVersion.fromJSON(object.pinnedVersion) : undefined }; - }, - - toJSON(message: PinVersionResponse): unknown { - const obj: any = {}; - message.pinnedVersion !== undefined && - (obj.pinnedVersion = message.pinnedVersion ? HummockVersion.toJSON(message.pinnedVersion) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PinVersionResponse { - const message = createBasePinVersionResponse(); - message.pinnedVersion = (object.pinnedVersion !== undefined && object.pinnedVersion !== null) - ? HummockVersion.fromPartial(object.pinnedVersion) - : undefined; - return message; - }, -}; - -function createBaseSplitCompactionGroupRequest(): SplitCompactionGroupRequest { - return { groupId: 0, tableIds: [] }; -} - -export const SplitCompactionGroupRequest = { - fromJSON(object: any): SplitCompactionGroupRequest { - return { - groupId: isSet(object.groupId) ? Number(object.groupId) : 0, - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: SplitCompactionGroupRequest): unknown { - const obj: any = {}; - message.groupId !== undefined && (obj.groupId = Math.round(message.groupId)); - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): SplitCompactionGroupRequest { - const message = createBaseSplitCompactionGroupRequest(); - message.groupId = object.groupId ?? 0; - message.tableIds = object.tableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseSplitCompactionGroupResponse(): SplitCompactionGroupResponse { - return { newGroupId: 0 }; -} - -export const SplitCompactionGroupResponse = { - fromJSON(object: any): SplitCompactionGroupResponse { - return { newGroupId: isSet(object.newGroupId) ? Number(object.newGroupId) : 0 }; - }, - - toJSON(message: SplitCompactionGroupResponse): unknown { - const obj: any = {}; - message.newGroupId !== undefined && (obj.newGroupId = Math.round(message.newGroupId)); - return obj; - }, - - fromPartial, I>>(object: I): SplitCompactionGroupResponse { - const message = createBaseSplitCompactionGroupResponse(); - message.newGroupId = object.newGroupId ?? 0; - return message; - }, -}; - -function createBaseCompactionConfig(): CompactionConfig { - return { - maxBytesForLevelBase: 0, - maxLevel: 0, - maxBytesForLevelMultiplier: 0, - maxCompactionBytes: 0, - subLevelMaxCompactionBytes: 0, - level0TierCompactFileNumber: 0, - compactionMode: CompactionConfig_CompactionMode.UNSPECIFIED, - compressionAlgorithm: [], - targetFileSizeBase: 0, - compactionFilterMask: 0, - maxSubCompaction: 0, - maxSpaceReclaimBytes: 0, - splitByStateTable: false, - level0StopWriteThresholdSubLevelNumber: 0, - level0MaxCompactFileNumber: 0, - }; -} - -export const CompactionConfig = { - fromJSON(object: any): CompactionConfig { - return { - maxBytesForLevelBase: isSet(object.maxBytesForLevelBase) ? Number(object.maxBytesForLevelBase) : 0, - maxLevel: isSet(object.maxLevel) ? Number(object.maxLevel) : 0, - maxBytesForLevelMultiplier: isSet(object.maxBytesForLevelMultiplier) - ? Number(object.maxBytesForLevelMultiplier) - : 0, - maxCompactionBytes: isSet(object.maxCompactionBytes) ? Number(object.maxCompactionBytes) : 0, - subLevelMaxCompactionBytes: isSet(object.subLevelMaxCompactionBytes) - ? Number(object.subLevelMaxCompactionBytes) - : 0, - level0TierCompactFileNumber: isSet(object.level0TierCompactFileNumber) - ? Number(object.level0TierCompactFileNumber) - : 0, - compactionMode: isSet(object.compactionMode) - ? compactionConfig_CompactionModeFromJSON(object.compactionMode) - : CompactionConfig_CompactionMode.UNSPECIFIED, - compressionAlgorithm: Array.isArray(object?.compressionAlgorithm) - ? object.compressionAlgorithm.map((e: any) => String(e)) - : [], - targetFileSizeBase: isSet(object.targetFileSizeBase) ? Number(object.targetFileSizeBase) : 0, - compactionFilterMask: isSet(object.compactionFilterMask) ? Number(object.compactionFilterMask) : 0, - maxSubCompaction: isSet(object.maxSubCompaction) ? Number(object.maxSubCompaction) : 0, - maxSpaceReclaimBytes: isSet(object.maxSpaceReclaimBytes) ? Number(object.maxSpaceReclaimBytes) : 0, - splitByStateTable: isSet(object.splitByStateTable) ? Boolean(object.splitByStateTable) : false, - level0StopWriteThresholdSubLevelNumber: isSet(object.level0StopWriteThresholdSubLevelNumber) - ? Number(object.level0StopWriteThresholdSubLevelNumber) - : 0, - level0MaxCompactFileNumber: isSet(object.level0MaxCompactFileNumber) - ? Number(object.level0MaxCompactFileNumber) - : 0, - }; - }, - - toJSON(message: CompactionConfig): unknown { - const obj: any = {}; - message.maxBytesForLevelBase !== undefined && (obj.maxBytesForLevelBase = Math.round(message.maxBytesForLevelBase)); - message.maxLevel !== undefined && (obj.maxLevel = Math.round(message.maxLevel)); - message.maxBytesForLevelMultiplier !== undefined && - (obj.maxBytesForLevelMultiplier = Math.round(message.maxBytesForLevelMultiplier)); - message.maxCompactionBytes !== undefined && (obj.maxCompactionBytes = Math.round(message.maxCompactionBytes)); - message.subLevelMaxCompactionBytes !== undefined && - (obj.subLevelMaxCompactionBytes = Math.round(message.subLevelMaxCompactionBytes)); - message.level0TierCompactFileNumber !== undefined && - (obj.level0TierCompactFileNumber = Math.round(message.level0TierCompactFileNumber)); - message.compactionMode !== undefined && - (obj.compactionMode = compactionConfig_CompactionModeToJSON(message.compactionMode)); - if (message.compressionAlgorithm) { - obj.compressionAlgorithm = message.compressionAlgorithm.map((e) => e); - } else { - obj.compressionAlgorithm = []; - } - message.targetFileSizeBase !== undefined && (obj.targetFileSizeBase = Math.round(message.targetFileSizeBase)); - message.compactionFilterMask !== undefined && (obj.compactionFilterMask = Math.round(message.compactionFilterMask)); - message.maxSubCompaction !== undefined && (obj.maxSubCompaction = Math.round(message.maxSubCompaction)); - message.maxSpaceReclaimBytes !== undefined && (obj.maxSpaceReclaimBytes = Math.round(message.maxSpaceReclaimBytes)); - message.splitByStateTable !== undefined && (obj.splitByStateTable = message.splitByStateTable); - message.level0StopWriteThresholdSubLevelNumber !== undefined && - (obj.level0StopWriteThresholdSubLevelNumber = Math.round(message.level0StopWriteThresholdSubLevelNumber)); - message.level0MaxCompactFileNumber !== undefined && - (obj.level0MaxCompactFileNumber = Math.round(message.level0MaxCompactFileNumber)); - return obj; - }, - - fromPartial, I>>(object: I): CompactionConfig { - const message = createBaseCompactionConfig(); - message.maxBytesForLevelBase = object.maxBytesForLevelBase ?? 0; - message.maxLevel = object.maxLevel ?? 0; - message.maxBytesForLevelMultiplier = object.maxBytesForLevelMultiplier ?? 0; - message.maxCompactionBytes = object.maxCompactionBytes ?? 0; - message.subLevelMaxCompactionBytes = object.subLevelMaxCompactionBytes ?? 0; - message.level0TierCompactFileNumber = object.level0TierCompactFileNumber ?? 0; - message.compactionMode = object.compactionMode ?? CompactionConfig_CompactionMode.UNSPECIFIED; - message.compressionAlgorithm = object.compressionAlgorithm?.map((e) => e) || []; - message.targetFileSizeBase = object.targetFileSizeBase ?? 0; - message.compactionFilterMask = object.compactionFilterMask ?? 0; - message.maxSubCompaction = object.maxSubCompaction ?? 0; - message.maxSpaceReclaimBytes = object.maxSpaceReclaimBytes ?? 0; - message.splitByStateTable = object.splitByStateTable ?? false; - message.level0StopWriteThresholdSubLevelNumber = object.level0StopWriteThresholdSubLevelNumber ?? 0; - message.level0MaxCompactFileNumber = object.level0MaxCompactFileNumber ?? 0; - return message; - }, -}; - -function createBaseTableStats(): TableStats { - return { totalKeySize: 0, totalValueSize: 0, totalKeyCount: 0 }; -} - -export const TableStats = { - fromJSON(object: any): TableStats { - return { - totalKeySize: isSet(object.totalKeySize) ? Number(object.totalKeySize) : 0, - totalValueSize: isSet(object.totalValueSize) ? Number(object.totalValueSize) : 0, - totalKeyCount: isSet(object.totalKeyCount) ? Number(object.totalKeyCount) : 0, - }; - }, - - toJSON(message: TableStats): unknown { - const obj: any = {}; - message.totalKeySize !== undefined && (obj.totalKeySize = Math.round(message.totalKeySize)); - message.totalValueSize !== undefined && (obj.totalValueSize = Math.round(message.totalValueSize)); - message.totalKeyCount !== undefined && (obj.totalKeyCount = Math.round(message.totalKeyCount)); - return obj; - }, - - fromPartial, I>>(object: I): TableStats { - const message = createBaseTableStats(); - message.totalKeySize = object.totalKeySize ?? 0; - message.totalValueSize = object.totalValueSize ?? 0; - message.totalKeyCount = object.totalKeyCount ?? 0; - return message; - }, -}; - -function createBaseHummockVersionStats(): HummockVersionStats { - return { hummockVersionId: 0, tableStats: {} }; -} - -export const HummockVersionStats = { - fromJSON(object: any): HummockVersionStats { - return { - hummockVersionId: isSet(object.hummockVersionId) ? Number(object.hummockVersionId) : 0, - tableStats: isObject(object.tableStats) - ? Object.entries(object.tableStats).reduce<{ [key: number]: TableStats }>((acc, [key, value]) => { - acc[Number(key)] = TableStats.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: HummockVersionStats): unknown { - const obj: any = {}; - message.hummockVersionId !== undefined && (obj.hummockVersionId = Math.round(message.hummockVersionId)); - obj.tableStats = {}; - if (message.tableStats) { - Object.entries(message.tableStats).forEach(([k, v]) => { - obj.tableStats[k] = TableStats.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): HummockVersionStats { - const message = createBaseHummockVersionStats(); - message.hummockVersionId = object.hummockVersionId ?? 0; - message.tableStats = Object.entries(object.tableStats ?? {}).reduce<{ [key: number]: TableStats }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableStats.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseHummockVersionStats_TableStatsEntry(): HummockVersionStats_TableStatsEntry { - return { key: 0, value: undefined }; -} - -export const HummockVersionStats_TableStatsEntry = { - fromJSON(object: any): HummockVersionStats_TableStatsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableStats.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HummockVersionStats_TableStatsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableStats.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): HummockVersionStats_TableStatsEntry { - const message = createBaseHummockVersionStats_TableStatsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableStats.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseWriteLimits(): WriteLimits { - return { writeLimits: {} }; -} - -export const WriteLimits = { - fromJSON(object: any): WriteLimits { - return { - writeLimits: isObject(object.writeLimits) - ? Object.entries(object.writeLimits).reduce<{ [key: number]: WriteLimits_WriteLimit }>((acc, [key, value]) => { - acc[Number(key)] = WriteLimits_WriteLimit.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: WriteLimits): unknown { - const obj: any = {}; - obj.writeLimits = {}; - if (message.writeLimits) { - Object.entries(message.writeLimits).forEach(([k, v]) => { - obj.writeLimits[k] = WriteLimits_WriteLimit.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): WriteLimits { - const message = createBaseWriteLimits(); - message.writeLimits = Object.entries(object.writeLimits ?? {}).reduce<{ [key: number]: WriteLimits_WriteLimit }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = WriteLimits_WriteLimit.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseWriteLimits_WriteLimit(): WriteLimits_WriteLimit { - return { tableIds: [], reason: "" }; -} - -export const WriteLimits_WriteLimit = { - fromJSON(object: any): WriteLimits_WriteLimit { - return { - tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [], - reason: isSet(object.reason) ? String(object.reason) : "", - }; - }, - - toJSON(message: WriteLimits_WriteLimit): unknown { - const obj: any = {}; - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - message.reason !== undefined && (obj.reason = message.reason); - return obj; - }, - - fromPartial, I>>(object: I): WriteLimits_WriteLimit { - const message = createBaseWriteLimits_WriteLimit(); - message.tableIds = object.tableIds?.map((e) => e) || []; - message.reason = object.reason ?? ""; - return message; - }, -}; - -function createBaseWriteLimits_WriteLimitsEntry(): WriteLimits_WriteLimitsEntry { - return { key: 0, value: undefined }; -} - -export const WriteLimits_WriteLimitsEntry = { - fromJSON(object: any): WriteLimits_WriteLimitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? WriteLimits_WriteLimit.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: WriteLimits_WriteLimitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? WriteLimits_WriteLimit.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): WriteLimits_WriteLimitsEntry { - const message = createBaseWriteLimits_WriteLimitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? WriteLimits_WriteLimit.fromPartial(object.value) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/java_binding.ts b/dashboard/proto/gen/java_binding.ts deleted file mode 100644 index 5cc7e19adaf82..0000000000000 --- a/dashboard/proto/gen/java_binding.ts +++ /dev/null @@ -1,237 +0,0 @@ -/* eslint-disable */ -import { Table } from "./catalog"; -import { HummockVersion } from "./hummock"; - -export const protobufPackage = "java_binding"; - -/** When `left` or `right` is none, it represents unbounded. */ -export interface KeyRange { - left: Uint8Array; - right: Uint8Array; - leftBound: KeyRange_Bound; - rightBound: KeyRange_Bound; -} - -export const KeyRange_Bound = { - UNSPECIFIED: "UNSPECIFIED", - UNBOUNDED: "UNBOUNDED", - INCLUDED: "INCLUDED", - EXCLUDED: "EXCLUDED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type KeyRange_Bound = typeof KeyRange_Bound[keyof typeof KeyRange_Bound]; - -export function keyRange_BoundFromJSON(object: any): KeyRange_Bound { - switch (object) { - case 0: - case "UNSPECIFIED": - return KeyRange_Bound.UNSPECIFIED; - case 1: - case "UNBOUNDED": - return KeyRange_Bound.UNBOUNDED; - case 2: - case "INCLUDED": - return KeyRange_Bound.INCLUDED; - case 3: - case "EXCLUDED": - return KeyRange_Bound.EXCLUDED; - case -1: - case "UNRECOGNIZED": - default: - return KeyRange_Bound.UNRECOGNIZED; - } -} - -export function keyRange_BoundToJSON(object: KeyRange_Bound): string { - switch (object) { - case KeyRange_Bound.UNSPECIFIED: - return "UNSPECIFIED"; - case KeyRange_Bound.UNBOUNDED: - return "UNBOUNDED"; - case KeyRange_Bound.INCLUDED: - return "INCLUDED"; - case KeyRange_Bound.EXCLUDED: - return "EXCLUDED"; - case KeyRange_Bound.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface ReadPlan { - objectStoreUrl: string; - dataDir: string; - keyRange: KeyRange | undefined; - tableId: number; - epoch: number; - version: HummockVersion | undefined; - tableCatalog: Table | undefined; - vnodeIds: number[]; -} - -function createBaseKeyRange(): KeyRange { - return { - left: new Uint8Array(), - right: new Uint8Array(), - leftBound: KeyRange_Bound.UNSPECIFIED, - rightBound: KeyRange_Bound.UNSPECIFIED, - }; -} - -export const KeyRange = { - fromJSON(object: any): KeyRange { - return { - left: isSet(object.left) ? bytesFromBase64(object.left) : new Uint8Array(), - right: isSet(object.right) ? bytesFromBase64(object.right) : new Uint8Array(), - leftBound: isSet(object.leftBound) ? keyRange_BoundFromJSON(object.leftBound) : KeyRange_Bound.UNSPECIFIED, - rightBound: isSet(object.rightBound) ? keyRange_BoundFromJSON(object.rightBound) : KeyRange_Bound.UNSPECIFIED, - }; - }, - - toJSON(message: KeyRange): unknown { - const obj: any = {}; - message.left !== undefined && - (obj.left = base64FromBytes(message.left !== undefined ? message.left : new Uint8Array())); - message.right !== undefined && - (obj.right = base64FromBytes(message.right !== undefined ? message.right : new Uint8Array())); - message.leftBound !== undefined && (obj.leftBound = keyRange_BoundToJSON(message.leftBound)); - message.rightBound !== undefined && (obj.rightBound = keyRange_BoundToJSON(message.rightBound)); - return obj; - }, - - fromPartial, I>>(object: I): KeyRange { - const message = createBaseKeyRange(); - message.left = object.left ?? new Uint8Array(); - message.right = object.right ?? new Uint8Array(); - message.leftBound = object.leftBound ?? KeyRange_Bound.UNSPECIFIED; - message.rightBound = object.rightBound ?? KeyRange_Bound.UNSPECIFIED; - return message; - }, -}; - -function createBaseReadPlan(): ReadPlan { - return { - objectStoreUrl: "", - dataDir: "", - keyRange: undefined, - tableId: 0, - epoch: 0, - version: undefined, - tableCatalog: undefined, - vnodeIds: [], - }; -} - -export const ReadPlan = { - fromJSON(object: any): ReadPlan { - return { - objectStoreUrl: isSet(object.objectStoreUrl) ? String(object.objectStoreUrl) : "", - dataDir: isSet(object.dataDir) ? String(object.dataDir) : "", - keyRange: isSet(object.keyRange) ? KeyRange.fromJSON(object.keyRange) : undefined, - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - epoch: isSet(object.epoch) ? Number(object.epoch) : 0, - version: isSet(object.version) ? HummockVersion.fromJSON(object.version) : undefined, - tableCatalog: isSet(object.tableCatalog) ? Table.fromJSON(object.tableCatalog) : undefined, - vnodeIds: Array.isArray(object?.vnodeIds) ? object.vnodeIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ReadPlan): unknown { - const obj: any = {}; - message.objectStoreUrl !== undefined && (obj.objectStoreUrl = message.objectStoreUrl); - message.dataDir !== undefined && (obj.dataDir = message.dataDir); - message.keyRange !== undefined && (obj.keyRange = message.keyRange ? KeyRange.toJSON(message.keyRange) : undefined); - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - message.version !== undefined && - (obj.version = message.version ? HummockVersion.toJSON(message.version) : undefined); - message.tableCatalog !== undefined && - (obj.tableCatalog = message.tableCatalog ? Table.toJSON(message.tableCatalog) : undefined); - if (message.vnodeIds) { - obj.vnodeIds = message.vnodeIds.map((e) => Math.round(e)); - } else { - obj.vnodeIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ReadPlan { - const message = createBaseReadPlan(); - message.objectStoreUrl = object.objectStoreUrl ?? ""; - message.dataDir = object.dataDir ?? ""; - message.keyRange = (object.keyRange !== undefined && object.keyRange !== null) - ? KeyRange.fromPartial(object.keyRange) - : undefined; - message.tableId = object.tableId ?? 0; - message.epoch = object.epoch ?? 0; - message.version = (object.version !== undefined && object.version !== null) - ? HummockVersion.fromPartial(object.version) - : undefined; - message.tableCatalog = (object.tableCatalog !== undefined && object.tableCatalog !== null) - ? Table.fromPartial(object.tableCatalog) - : undefined; - message.vnodeIds = object.vnodeIds?.map((e) => e) || []; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/meta.ts b/dashboard/proto/gen/meta.ts deleted file mode 100644 index fda7e6edeb8c0..0000000000000 --- a/dashboard/proto/gen/meta.ts +++ /dev/null @@ -1,2665 +0,0 @@ -/* eslint-disable */ -import { MetaBackupManifestId } from "./backup_service"; -import { Database, Function, Index, Schema, Sink, Source, Table, View } from "./catalog"; -import { - HostAddress, - ParallelUnit, - ParallelUnitMapping, - Status, - WorkerNode, - WorkerType, - workerTypeFromJSON, - workerTypeToJSON, -} from "./common"; -import { HummockSnapshot, HummockVersion, HummockVersionDeltas, WriteLimits } from "./hummock"; -import { ConnectorSplits } from "./source"; -import { Dispatcher, StreamActor, StreamEnvironment, StreamNode } from "./stream_plan"; -import { UserInfo } from "./user"; - -export const protobufPackage = "meta"; - -export const SubscribeType = { - UNSPECIFIED: "UNSPECIFIED", - FRONTEND: "FRONTEND", - HUMMOCK: "HUMMOCK", - COMPACTOR: "COMPACTOR", - COMPUTE: "COMPUTE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SubscribeType = typeof SubscribeType[keyof typeof SubscribeType]; - -export function subscribeTypeFromJSON(object: any): SubscribeType { - switch (object) { - case 0: - case "UNSPECIFIED": - return SubscribeType.UNSPECIFIED; - case 1: - case "FRONTEND": - return SubscribeType.FRONTEND; - case 2: - case "HUMMOCK": - return SubscribeType.HUMMOCK; - case 3: - case "COMPACTOR": - return SubscribeType.COMPACTOR; - case 4: - case "COMPUTE": - return SubscribeType.COMPUTE; - case -1: - case "UNRECOGNIZED": - default: - return SubscribeType.UNRECOGNIZED; - } -} - -export function subscribeTypeToJSON(object: SubscribeType): string { - switch (object) { - case SubscribeType.UNSPECIFIED: - return "UNSPECIFIED"; - case SubscribeType.FRONTEND: - return "FRONTEND"; - case SubscribeType.HUMMOCK: - return "HUMMOCK"; - case SubscribeType.COMPACTOR: - return "COMPACTOR"; - case SubscribeType.COMPUTE: - return "COMPUTE"; - case SubscribeType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface HeartbeatRequest { - nodeId: number; - /** Lightweight info piggybacked by heartbeat request. */ - info: HeartbeatRequest_ExtraInfo[]; -} - -export interface HeartbeatRequest_ExtraInfo { - info?: { $case: "hummockGcWatermark"; hummockGcWatermark: number }; -} - -export interface HeartbeatResponse { - status: Status | undefined; -} - -/** Fragments of a Streaming Job */ -export interface TableFragments { - tableId: number; - state: TableFragments_State; - fragments: { [key: number]: TableFragments_Fragment }; - actorStatus: { [key: number]: TableFragments_ActorStatus }; - actorSplits: { [key: number]: ConnectorSplits }; - env: StreamEnvironment | undefined; -} - -/** The state of the fragments of this table */ -export const TableFragments_State = { - UNSPECIFIED: "UNSPECIFIED", - /** INITIAL - The streaming job is initial. */ - INITIAL: "INITIAL", - /** CREATING - The streaming job is creating. */ - CREATING: "CREATING", - /** CREATED - The streaming job has been created. */ - CREATED: "CREATED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFragments_State = typeof TableFragments_State[keyof typeof TableFragments_State]; - -export function tableFragments_StateFromJSON(object: any): TableFragments_State { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFragments_State.UNSPECIFIED; - case 1: - case "INITIAL": - return TableFragments_State.INITIAL; - case 2: - case "CREATING": - return TableFragments_State.CREATING; - case 3: - case "CREATED": - return TableFragments_State.CREATED; - case -1: - case "UNRECOGNIZED": - default: - return TableFragments_State.UNRECOGNIZED; - } -} - -export function tableFragments_StateToJSON(object: TableFragments_State): string { - switch (object) { - case TableFragments_State.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFragments_State.INITIAL: - return "INITIAL"; - case TableFragments_State.CREATING: - return "CREATING"; - case TableFragments_State.CREATED: - return "CREATED"; - case TableFragments_State.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Runtime information of an actor */ -export interface TableFragments_ActorStatus { - /** Current on which parallel unit */ - parallelUnit: - | ParallelUnit - | undefined; - /** Current state */ - state: TableFragments_ActorStatus_ActorState; -} - -/** Current state of actor */ -export const TableFragments_ActorStatus_ActorState = { - UNSPECIFIED: "UNSPECIFIED", - /** INACTIVE - Initial state after creation */ - INACTIVE: "INACTIVE", - /** RUNNING - Running normally */ - RUNNING: "RUNNING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFragments_ActorStatus_ActorState = - typeof TableFragments_ActorStatus_ActorState[keyof typeof TableFragments_ActorStatus_ActorState]; - -export function tableFragments_ActorStatus_ActorStateFromJSON(object: any): TableFragments_ActorStatus_ActorState { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFragments_ActorStatus_ActorState.UNSPECIFIED; - case 1: - case "INACTIVE": - return TableFragments_ActorStatus_ActorState.INACTIVE; - case 2: - case "RUNNING": - return TableFragments_ActorStatus_ActorState.RUNNING; - case -1: - case "UNRECOGNIZED": - default: - return TableFragments_ActorStatus_ActorState.UNRECOGNIZED; - } -} - -export function tableFragments_ActorStatus_ActorStateToJSON(object: TableFragments_ActorStatus_ActorState): string { - switch (object) { - case TableFragments_ActorStatus_ActorState.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFragments_ActorStatus_ActorState.INACTIVE: - return "INACTIVE"; - case TableFragments_ActorStatus_ActorState.RUNNING: - return "RUNNING"; - case TableFragments_ActorStatus_ActorState.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableFragments_Fragment { - fragmentId: number; - /** Bitwise-OR of FragmentTypeFlags */ - fragmentTypeMask: number; - distributionType: TableFragments_Fragment_FragmentDistributionType; - actors: StreamActor[]; - /** - * Vnode mapping (which should be set in upstream dispatcher) of the fragment. - * This field is always set to `Some`. For singleton, the parallel unit for all vnodes will be the same. - */ - vnodeMapping: ParallelUnitMapping | undefined; - stateTableIds: number[]; - /** - * Note that this can be derived backwards from the upstream actors of the Actor held by the Fragment, - * but in some scenarios (e.g. Scaling) it will lead to a lot of duplicate code, - * so we pre-generate and store it here, this member will only be initialized when creating the Fragment - * and modified when creating the mv-on-mv - */ - upstreamFragmentIds: number[]; -} - -export const TableFragments_Fragment_FragmentDistributionType = { - UNSPECIFIED: "UNSPECIFIED", - SINGLE: "SINGLE", - HASH: "HASH", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TableFragments_Fragment_FragmentDistributionType = - typeof TableFragments_Fragment_FragmentDistributionType[ - keyof typeof TableFragments_Fragment_FragmentDistributionType - ]; - -export function tableFragments_Fragment_FragmentDistributionTypeFromJSON( - object: any, -): TableFragments_Fragment_FragmentDistributionType { - switch (object) { - case 0: - case "UNSPECIFIED": - return TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED; - case 1: - case "SINGLE": - return TableFragments_Fragment_FragmentDistributionType.SINGLE; - case 2: - case "HASH": - return TableFragments_Fragment_FragmentDistributionType.HASH; - case -1: - case "UNRECOGNIZED": - default: - return TableFragments_Fragment_FragmentDistributionType.UNRECOGNIZED; - } -} - -export function tableFragments_Fragment_FragmentDistributionTypeToJSON( - object: TableFragments_Fragment_FragmentDistributionType, -): string { - switch (object) { - case TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED: - return "UNSPECIFIED"; - case TableFragments_Fragment_FragmentDistributionType.SINGLE: - return "SINGLE"; - case TableFragments_Fragment_FragmentDistributionType.HASH: - return "HASH"; - case TableFragments_Fragment_FragmentDistributionType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface TableFragments_FragmentsEntry { - key: number; - value: TableFragments_Fragment | undefined; -} - -export interface TableFragments_ActorStatusEntry { - key: number; - value: TableFragments_ActorStatus | undefined; -} - -export interface TableFragments_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -/** / Parallel unit mapping with fragment id, used for notification. */ -export interface FragmentParallelUnitMapping { - fragmentId: number; - mapping: ParallelUnitMapping | undefined; -} - -/** TODO: remove this when dashboard refactored. */ -export interface ActorLocation { - node: WorkerNode | undefined; - actors: StreamActor[]; -} - -export interface FlushRequest { - checkpoint: boolean; -} - -export interface FlushResponse { - status: Status | undefined; - snapshot: HummockSnapshot | undefined; -} - -export interface CreatingJobInfo { - databaseId: number; - schemaId: number; - name: string; -} - -export interface CancelCreatingJobsRequest { - infos: CreatingJobInfo[]; -} - -export interface CancelCreatingJobsResponse { - status: Status | undefined; -} - -export interface ListTableFragmentsRequest { - tableIds: number[]; -} - -export interface ListTableFragmentsResponse { - tableFragments: { [key: number]: ListTableFragmentsResponse_TableFragmentInfo }; -} - -export interface ListTableFragmentsResponse_ActorInfo { - id: number; - node: StreamNode | undefined; - dispatcher: Dispatcher[]; -} - -export interface ListTableFragmentsResponse_FragmentInfo { - id: number; - actors: ListTableFragmentsResponse_ActorInfo[]; -} - -export interface ListTableFragmentsResponse_TableFragmentInfo { - fragments: ListTableFragmentsResponse_FragmentInfo[]; - env: StreamEnvironment | undefined; -} - -export interface ListTableFragmentsResponse_TableFragmentsEntry { - key: number; - value: ListTableFragmentsResponse_TableFragmentInfo | undefined; -} - -export interface AddWorkerNodeRequest { - workerType: WorkerType; - host: HostAddress | undefined; - workerNodeParallelism: number; -} - -export interface AddWorkerNodeResponse { - status: Status | undefined; - node: WorkerNode | undefined; -} - -export interface ActivateWorkerNodeRequest { - host: HostAddress | undefined; -} - -export interface ActivateWorkerNodeResponse { - status: Status | undefined; -} - -export interface DeleteWorkerNodeRequest { - host: HostAddress | undefined; -} - -export interface DeleteWorkerNodeResponse { - status: Status | undefined; -} - -export interface ListAllNodesRequest { - workerType: WorkerType; - /** Whether to include nodes still starting */ - includeStartingNodes: boolean; -} - -export interface ListAllNodesResponse { - status: Status | undefined; - nodes: WorkerNode[]; -} - -/** Below for notification service. */ -export interface SubscribeRequest { - subscribeType: SubscribeType; - host: HostAddress | undefined; - workerId: number; -} - -export interface MetaSnapshot { - databases: Database[]; - schemas: Schema[]; - sources: Source[]; - sinks: Sink[]; - tables: Table[]; - indexes: Index[]; - views: View[]; - functions: Function[]; - users: UserInfo[]; - parallelUnitMappings: FragmentParallelUnitMapping[]; - nodes: WorkerNode[]; - hummockSnapshot: HummockSnapshot | undefined; - hummockVersion: HummockVersion | undefined; - metaBackupManifestId: MetaBackupManifestId | undefined; - hummockWriteLimits: WriteLimits | undefined; - version: MetaSnapshot_SnapshotVersion | undefined; -} - -export interface MetaSnapshot_SnapshotVersion { - catalogVersion: number; - parallelUnitMappingVersion: number; - workerNodeVersion: number; -} - -export interface SubscribeResponse { - status: Status | undefined; - operation: SubscribeResponse_Operation; - version: number; - info?: - | { $case: "database"; database: Database } - | { $case: "schema"; schema: Schema } - | { $case: "table"; table: Table } - | { $case: "source"; source: Source } - | { $case: "sink"; sink: Sink } - | { $case: "index"; index: Index } - | { $case: "view"; view: View } - | { $case: "function"; function: Function } - | { $case: "user"; user: UserInfo } - | { $case: "parallelUnitMapping"; parallelUnitMapping: FragmentParallelUnitMapping } - | { $case: "node"; node: WorkerNode } - | { $case: "hummockSnapshot"; hummockSnapshot: HummockSnapshot } - | { $case: "hummockVersionDeltas"; hummockVersionDeltas: HummockVersionDeltas } - | { $case: "snapshot"; snapshot: MetaSnapshot } - | { $case: "metaBackupManifestId"; metaBackupManifestId: MetaBackupManifestId } - | { $case: "systemParams"; systemParams: SystemParams } - | { $case: "hummockWriteLimits"; hummockWriteLimits: WriteLimits }; -} - -export const SubscribeResponse_Operation = { - UNSPECIFIED: "UNSPECIFIED", - ADD: "ADD", - DELETE: "DELETE", - UPDATE: "UPDATE", - SNAPSHOT: "SNAPSHOT", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type SubscribeResponse_Operation = typeof SubscribeResponse_Operation[keyof typeof SubscribeResponse_Operation]; - -export function subscribeResponse_OperationFromJSON(object: any): SubscribeResponse_Operation { - switch (object) { - case 0: - case "UNSPECIFIED": - return SubscribeResponse_Operation.UNSPECIFIED; - case 1: - case "ADD": - return SubscribeResponse_Operation.ADD; - case 2: - case "DELETE": - return SubscribeResponse_Operation.DELETE; - case 3: - case "UPDATE": - return SubscribeResponse_Operation.UPDATE; - case 4: - case "SNAPSHOT": - return SubscribeResponse_Operation.SNAPSHOT; - case -1: - case "UNRECOGNIZED": - default: - return SubscribeResponse_Operation.UNRECOGNIZED; - } -} - -export function subscribeResponse_OperationToJSON(object: SubscribeResponse_Operation): string { - switch (object) { - case SubscribeResponse_Operation.UNSPECIFIED: - return "UNSPECIFIED"; - case SubscribeResponse_Operation.ADD: - return "ADD"; - case SubscribeResponse_Operation.DELETE: - return "DELETE"; - case SubscribeResponse_Operation.UPDATE: - return "UPDATE"; - case SubscribeResponse_Operation.SNAPSHOT: - return "SNAPSHOT"; - case SubscribeResponse_Operation.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface PauseRequest { -} - -export interface PauseResponse { -} - -export interface ResumeRequest { -} - -export interface ResumeResponse { -} - -export interface GetClusterInfoRequest { -} - -export interface GetClusterInfoResponse { - workerNodes: WorkerNode[]; - tableFragments: TableFragments[]; - actorSplits: { [key: number]: ConnectorSplits }; - sourceInfos: { [key: number]: Source }; -} - -export interface GetClusterInfoResponse_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface GetClusterInfoResponse_SourceInfosEntry { - key: number; - value: Source | undefined; -} - -export interface RescheduleRequest { - /** reschedule plan for each fragment */ - reschedules: { [key: number]: RescheduleRequest_Reschedule }; -} - -export interface RescheduleRequest_Reschedule { - addedParallelUnits: number[]; - removedParallelUnits: number[]; -} - -export interface RescheduleRequest_ReschedulesEntry { - key: number; - value: RescheduleRequest_Reschedule | undefined; -} - -export interface RescheduleResponse { - success: boolean; -} - -export interface MembersRequest { -} - -export interface MetaMember { - address: HostAddress | undefined; - isLeader: boolean; -} - -export interface MembersResponse { - members: MetaMember[]; -} - -/** - * The schema for persisted system parameters. - * Note on backward compatibility: - * - Do not remove deprecated fields. Mark them as deprecated both after the field definition and in `system_params/mod.rs` instead. - * - Do not rename existing fields, since each field is stored separately in the meta store with the field name as the key. - * - To modify (rename, change the type or semantic of) a field, introduce a new field suffixed by the version. - */ -export interface SystemParams { - barrierIntervalMs?: number | undefined; - checkpointFrequency?: number | undefined; - sstableSizeMb?: number | undefined; - blockSizeKb?: number | undefined; - bloomFalsePositive?: number | undefined; - stateStore?: string | undefined; - dataDirectory?: string | undefined; - backupStorageUrl?: string | undefined; - backupStorageDirectory?: string | undefined; -} - -export interface GetSystemParamsRequest { -} - -export interface GetSystemParamsResponse { - params: SystemParams | undefined; -} - -export interface SetSystemParamRequest { - param: string; - /** None means set to default value. */ - value?: string | undefined; -} - -export interface SetSystemParamResponse { -} - -function createBaseHeartbeatRequest(): HeartbeatRequest { - return { nodeId: 0, info: [] }; -} - -export const HeartbeatRequest = { - fromJSON(object: any): HeartbeatRequest { - return { - nodeId: isSet(object.nodeId) ? Number(object.nodeId) : 0, - info: Array.isArray(object?.info) ? object.info.map((e: any) => HeartbeatRequest_ExtraInfo.fromJSON(e)) : [], - }; - }, - - toJSON(message: HeartbeatRequest): unknown { - const obj: any = {}; - message.nodeId !== undefined && (obj.nodeId = Math.round(message.nodeId)); - if (message.info) { - obj.info = message.info.map((e) => e ? HeartbeatRequest_ExtraInfo.toJSON(e) : undefined); - } else { - obj.info = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HeartbeatRequest { - const message = createBaseHeartbeatRequest(); - message.nodeId = object.nodeId ?? 0; - message.info = object.info?.map((e) => HeartbeatRequest_ExtraInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseHeartbeatRequest_ExtraInfo(): HeartbeatRequest_ExtraInfo { - return { info: undefined }; -} - -export const HeartbeatRequest_ExtraInfo = { - fromJSON(object: any): HeartbeatRequest_ExtraInfo { - return { - info: isSet(object.hummockGcWatermark) - ? { $case: "hummockGcWatermark", hummockGcWatermark: Number(object.hummockGcWatermark) } - : undefined, - }; - }, - - toJSON(message: HeartbeatRequest_ExtraInfo): unknown { - const obj: any = {}; - message.info?.$case === "hummockGcWatermark" && - (obj.hummockGcWatermark = Math.round(message.info?.hummockGcWatermark)); - return obj; - }, - - fromPartial, I>>(object: I): HeartbeatRequest_ExtraInfo { - const message = createBaseHeartbeatRequest_ExtraInfo(); - if ( - object.info?.$case === "hummockGcWatermark" && - object.info?.hummockGcWatermark !== undefined && - object.info?.hummockGcWatermark !== null - ) { - message.info = { $case: "hummockGcWatermark", hummockGcWatermark: object.info.hummockGcWatermark }; - } - return message; - }, -}; - -function createBaseHeartbeatResponse(): HeartbeatResponse { - return { status: undefined }; -} - -export const HeartbeatResponse = { - fromJSON(object: any): HeartbeatResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: HeartbeatResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): HeartbeatResponse { - const message = createBaseHeartbeatResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseTableFragments(): TableFragments { - return { - tableId: 0, - state: TableFragments_State.UNSPECIFIED, - fragments: {}, - actorStatus: {}, - actorSplits: {}, - env: undefined, - }; -} - -export const TableFragments = { - fromJSON(object: any): TableFragments { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - state: isSet(object.state) ? tableFragments_StateFromJSON(object.state) : TableFragments_State.UNSPECIFIED, - fragments: isObject(object.fragments) - ? Object.entries(object.fragments).reduce<{ [key: number]: TableFragments_Fragment }>((acc, [key, value]) => { - acc[Number(key)] = TableFragments_Fragment.fromJSON(value); - return acc; - }, {}) - : {}, - actorStatus: isObject(object.actorStatus) - ? Object.entries(object.actorStatus).reduce<{ [key: number]: TableFragments_ActorStatus }>( - (acc, [key, value]) => { - acc[Number(key)] = TableFragments_ActorStatus.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - env: isSet(object.env) ? StreamEnvironment.fromJSON(object.env) : undefined, - }; - }, - - toJSON(message: TableFragments): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.state !== undefined && (obj.state = tableFragments_StateToJSON(message.state)); - obj.fragments = {}; - if (message.fragments) { - Object.entries(message.fragments).forEach(([k, v]) => { - obj.fragments[k] = TableFragments_Fragment.toJSON(v); - }); - } - obj.actorStatus = {}; - if (message.actorStatus) { - Object.entries(message.actorStatus).forEach(([k, v]) => { - obj.actorStatus[k] = TableFragments_ActorStatus.toJSON(v); - }); - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - message.env !== undefined && (obj.env = message.env ? StreamEnvironment.toJSON(message.env) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): TableFragments { - const message = createBaseTableFragments(); - message.tableId = object.tableId ?? 0; - message.state = object.state ?? TableFragments_State.UNSPECIFIED; - message.fragments = Object.entries(object.fragments ?? {}).reduce<{ [key: number]: TableFragments_Fragment }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableFragments_Fragment.fromPartial(value); - } - return acc; - }, - {}, - ); - message.actorStatus = Object.entries(object.actorStatus ?? {}).reduce< - { [key: number]: TableFragments_ActorStatus } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableFragments_ActorStatus.fromPartial(value); - } - return acc; - }, {}); - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - message.env = (object.env !== undefined && object.env !== null) - ? StreamEnvironment.fromPartial(object.env) - : undefined; - return message; - }, -}; - -function createBaseTableFragments_ActorStatus(): TableFragments_ActorStatus { - return { parallelUnit: undefined, state: TableFragments_ActorStatus_ActorState.UNSPECIFIED }; -} - -export const TableFragments_ActorStatus = { - fromJSON(object: any): TableFragments_ActorStatus { - return { - parallelUnit: isSet(object.parallelUnit) ? ParallelUnit.fromJSON(object.parallelUnit) : undefined, - state: isSet(object.state) - ? tableFragments_ActorStatus_ActorStateFromJSON(object.state) - : TableFragments_ActorStatus_ActorState.UNSPECIFIED, - }; - }, - - toJSON(message: TableFragments_ActorStatus): unknown { - const obj: any = {}; - message.parallelUnit !== undefined && - (obj.parallelUnit = message.parallelUnit ? ParallelUnit.toJSON(message.parallelUnit) : undefined); - message.state !== undefined && (obj.state = tableFragments_ActorStatus_ActorStateToJSON(message.state)); - return obj; - }, - - fromPartial, I>>(object: I): TableFragments_ActorStatus { - const message = createBaseTableFragments_ActorStatus(); - message.parallelUnit = (object.parallelUnit !== undefined && object.parallelUnit !== null) - ? ParallelUnit.fromPartial(object.parallelUnit) - : undefined; - message.state = object.state ?? TableFragments_ActorStatus_ActorState.UNSPECIFIED; - return message; - }, -}; - -function createBaseTableFragments_Fragment(): TableFragments_Fragment { - return { - fragmentId: 0, - fragmentTypeMask: 0, - distributionType: TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED, - actors: [], - vnodeMapping: undefined, - stateTableIds: [], - upstreamFragmentIds: [], - }; -} - -export const TableFragments_Fragment = { - fromJSON(object: any): TableFragments_Fragment { - return { - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - fragmentTypeMask: isSet(object.fragmentTypeMask) ? Number(object.fragmentTypeMask) : 0, - distributionType: isSet(object.distributionType) - ? tableFragments_Fragment_FragmentDistributionTypeFromJSON(object.distributionType) - : TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED, - actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => StreamActor.fromJSON(e)) : [], - vnodeMapping: isSet(object.vnodeMapping) ? ParallelUnitMapping.fromJSON(object.vnodeMapping) : undefined, - stateTableIds: Array.isArray(object?.stateTableIds) ? object.stateTableIds.map((e: any) => Number(e)) : [], - upstreamFragmentIds: Array.isArray(object?.upstreamFragmentIds) - ? object.upstreamFragmentIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: TableFragments_Fragment): unknown { - const obj: any = {}; - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.fragmentTypeMask !== undefined && (obj.fragmentTypeMask = Math.round(message.fragmentTypeMask)); - message.distributionType !== undefined && - (obj.distributionType = tableFragments_Fragment_FragmentDistributionTypeToJSON(message.distributionType)); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? StreamActor.toJSON(e) : undefined); - } else { - obj.actors = []; - } - message.vnodeMapping !== undefined && - (obj.vnodeMapping = message.vnodeMapping ? ParallelUnitMapping.toJSON(message.vnodeMapping) : undefined); - if (message.stateTableIds) { - obj.stateTableIds = message.stateTableIds.map((e) => Math.round(e)); - } else { - obj.stateTableIds = []; - } - if (message.upstreamFragmentIds) { - obj.upstreamFragmentIds = message.upstreamFragmentIds.map((e) => Math.round(e)); - } else { - obj.upstreamFragmentIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): TableFragments_Fragment { - const message = createBaseTableFragments_Fragment(); - message.fragmentId = object.fragmentId ?? 0; - message.fragmentTypeMask = object.fragmentTypeMask ?? 0; - message.distributionType = object.distributionType ?? TableFragments_Fragment_FragmentDistributionType.UNSPECIFIED; - message.actors = object.actors?.map((e) => StreamActor.fromPartial(e)) || []; - message.vnodeMapping = (object.vnodeMapping !== undefined && object.vnodeMapping !== null) - ? ParallelUnitMapping.fromPartial(object.vnodeMapping) - : undefined; - message.stateTableIds = object.stateTableIds?.map((e) => e) || []; - message.upstreamFragmentIds = object.upstreamFragmentIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseTableFragments_FragmentsEntry(): TableFragments_FragmentsEntry { - return { key: 0, value: undefined }; -} - -export const TableFragments_FragmentsEntry = { - fromJSON(object: any): TableFragments_FragmentsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableFragments_Fragment.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: TableFragments_FragmentsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? TableFragments_Fragment.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TableFragments_FragmentsEntry { - const message = createBaseTableFragments_FragmentsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableFragments_Fragment.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseTableFragments_ActorStatusEntry(): TableFragments_ActorStatusEntry { - return { key: 0, value: undefined }; -} - -export const TableFragments_ActorStatusEntry = { - fromJSON(object: any): TableFragments_ActorStatusEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableFragments_ActorStatus.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: TableFragments_ActorStatusEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? TableFragments_ActorStatus.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TableFragments_ActorStatusEntry { - const message = createBaseTableFragments_ActorStatusEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableFragments_ActorStatus.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseTableFragments_ActorSplitsEntry(): TableFragments_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const TableFragments_ActorSplitsEntry = { - fromJSON(object: any): TableFragments_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: TableFragments_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): TableFragments_ActorSplitsEntry { - const message = createBaseTableFragments_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseFragmentParallelUnitMapping(): FragmentParallelUnitMapping { - return { fragmentId: 0, mapping: undefined }; -} - -export const FragmentParallelUnitMapping = { - fromJSON(object: any): FragmentParallelUnitMapping { - return { - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - mapping: isSet(object.mapping) ? ParallelUnitMapping.fromJSON(object.mapping) : undefined, - }; - }, - - toJSON(message: FragmentParallelUnitMapping): unknown { - const obj: any = {}; - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.mapping !== undefined && - (obj.mapping = message.mapping ? ParallelUnitMapping.toJSON(message.mapping) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FragmentParallelUnitMapping { - const message = createBaseFragmentParallelUnitMapping(); - message.fragmentId = object.fragmentId ?? 0; - message.mapping = (object.mapping !== undefined && object.mapping !== null) - ? ParallelUnitMapping.fromPartial(object.mapping) - : undefined; - return message; - }, -}; - -function createBaseActorLocation(): ActorLocation { - return { node: undefined, actors: [] }; -} - -export const ActorLocation = { - fromJSON(object: any): ActorLocation { - return { - node: isSet(object.node) ? WorkerNode.fromJSON(object.node) : undefined, - actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => StreamActor.fromJSON(e)) : [], - }; - }, - - toJSON(message: ActorLocation): unknown { - const obj: any = {}; - message.node !== undefined && (obj.node = message.node ? WorkerNode.toJSON(message.node) : undefined); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? StreamActor.toJSON(e) : undefined); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ActorLocation { - const message = createBaseActorLocation(); - message.node = (object.node !== undefined && object.node !== null) - ? WorkerNode.fromPartial(object.node) - : undefined; - message.actors = object.actors?.map((e) => StreamActor.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseFlushRequest(): FlushRequest { - return { checkpoint: false }; -} - -export const FlushRequest = { - fromJSON(object: any): FlushRequest { - return { checkpoint: isSet(object.checkpoint) ? Boolean(object.checkpoint) : false }; - }, - - toJSON(message: FlushRequest): unknown { - const obj: any = {}; - message.checkpoint !== undefined && (obj.checkpoint = message.checkpoint); - return obj; - }, - - fromPartial, I>>(object: I): FlushRequest { - const message = createBaseFlushRequest(); - message.checkpoint = object.checkpoint ?? false; - return message; - }, -}; - -function createBaseFlushResponse(): FlushResponse { - return { status: undefined, snapshot: undefined }; -} - -export const FlushResponse = { - fromJSON(object: any): FlushResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - snapshot: isSet(object.snapshot) ? HummockSnapshot.fromJSON(object.snapshot) : undefined, - }; - }, - - toJSON(message: FlushResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.snapshot !== undefined && - (obj.snapshot = message.snapshot ? HummockSnapshot.toJSON(message.snapshot) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FlushResponse { - const message = createBaseFlushResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) - ? HummockSnapshot.fromPartial(object.snapshot) - : undefined; - return message; - }, -}; - -function createBaseCreatingJobInfo(): CreatingJobInfo { - return { databaseId: 0, schemaId: 0, name: "" }; -} - -export const CreatingJobInfo = { - fromJSON(object: any): CreatingJobInfo { - return { - databaseId: isSet(object.databaseId) ? Number(object.databaseId) : 0, - schemaId: isSet(object.schemaId) ? Number(object.schemaId) : 0, - name: isSet(object.name) ? String(object.name) : "", - }; - }, - - toJSON(message: CreatingJobInfo): unknown { - const obj: any = {}; - message.databaseId !== undefined && (obj.databaseId = Math.round(message.databaseId)); - message.schemaId !== undefined && (obj.schemaId = Math.round(message.schemaId)); - message.name !== undefined && (obj.name = message.name); - return obj; - }, - - fromPartial, I>>(object: I): CreatingJobInfo { - const message = createBaseCreatingJobInfo(); - message.databaseId = object.databaseId ?? 0; - message.schemaId = object.schemaId ?? 0; - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseCancelCreatingJobsRequest(): CancelCreatingJobsRequest { - return { infos: [] }; -} - -export const CancelCreatingJobsRequest = { - fromJSON(object: any): CancelCreatingJobsRequest { - return { infos: Array.isArray(object?.infos) ? object.infos.map((e: any) => CreatingJobInfo.fromJSON(e)) : [] }; - }, - - toJSON(message: CancelCreatingJobsRequest): unknown { - const obj: any = {}; - if (message.infos) { - obj.infos = message.infos.map((e) => e ? CreatingJobInfo.toJSON(e) : undefined); - } else { - obj.infos = []; - } - return obj; - }, - - fromPartial, I>>(object: I): CancelCreatingJobsRequest { - const message = createBaseCancelCreatingJobsRequest(); - message.infos = object.infos?.map((e) => CreatingJobInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseCancelCreatingJobsResponse(): CancelCreatingJobsResponse { - return { status: undefined }; -} - -export const CancelCreatingJobsResponse = { - fromJSON(object: any): CancelCreatingJobsResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: CancelCreatingJobsResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CancelCreatingJobsResponse { - const message = createBaseCancelCreatingJobsResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseListTableFragmentsRequest(): ListTableFragmentsRequest { - return { tableIds: [] }; -} - -export const ListTableFragmentsRequest = { - fromJSON(object: any): ListTableFragmentsRequest { - return { tableIds: Array.isArray(object?.tableIds) ? object.tableIds.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: ListTableFragmentsRequest): unknown { - const obj: any = {}; - if (message.tableIds) { - obj.tableIds = message.tableIds.map((e) => Math.round(e)); - } else { - obj.tableIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ListTableFragmentsRequest { - const message = createBaseListTableFragmentsRequest(); - message.tableIds = object.tableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseListTableFragmentsResponse(): ListTableFragmentsResponse { - return { tableFragments: {} }; -} - -export const ListTableFragmentsResponse = { - fromJSON(object: any): ListTableFragmentsResponse { - return { - tableFragments: isObject(object.tableFragments) - ? Object.entries(object.tableFragments).reduce<{ [key: number]: ListTableFragmentsResponse_TableFragmentInfo }>( - (acc, [key, value]) => { - acc[Number(key)] = ListTableFragmentsResponse_TableFragmentInfo.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: ListTableFragmentsResponse): unknown { - const obj: any = {}; - obj.tableFragments = {}; - if (message.tableFragments) { - Object.entries(message.tableFragments).forEach(([k, v]) => { - obj.tableFragments[k] = ListTableFragmentsResponse_TableFragmentInfo.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): ListTableFragmentsResponse { - const message = createBaseListTableFragmentsResponse(); - message.tableFragments = Object.entries(object.tableFragments ?? {}).reduce< - { [key: number]: ListTableFragmentsResponse_TableFragmentInfo } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ListTableFragmentsResponse_TableFragmentInfo.fromPartial(value); - } - return acc; - }, {}); - return message; - }, -}; - -function createBaseListTableFragmentsResponse_ActorInfo(): ListTableFragmentsResponse_ActorInfo { - return { id: 0, node: undefined, dispatcher: [] }; -} - -export const ListTableFragmentsResponse_ActorInfo = { - fromJSON(object: any): ListTableFragmentsResponse_ActorInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - node: isSet(object.node) ? StreamNode.fromJSON(object.node) : undefined, - dispatcher: Array.isArray(object?.dispatcher) ? object.dispatcher.map((e: any) => Dispatcher.fromJSON(e)) : [], - }; - }, - - toJSON(message: ListTableFragmentsResponse_ActorInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.node !== undefined && (obj.node = message.node ? StreamNode.toJSON(message.node) : undefined); - if (message.dispatcher) { - obj.dispatcher = message.dispatcher.map((e) => e ? Dispatcher.toJSON(e) : undefined); - } else { - obj.dispatcher = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_ActorInfo { - const message = createBaseListTableFragmentsResponse_ActorInfo(); - message.id = object.id ?? 0; - message.node = (object.node !== undefined && object.node !== null) - ? StreamNode.fromPartial(object.node) - : undefined; - message.dispatcher = object.dispatcher?.map((e) => Dispatcher.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListTableFragmentsResponse_FragmentInfo(): ListTableFragmentsResponse_FragmentInfo { - return { id: 0, actors: [] }; -} - -export const ListTableFragmentsResponse_FragmentInfo = { - fromJSON(object: any): ListTableFragmentsResponse_FragmentInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - actors: Array.isArray(object?.actors) - ? object.actors.map((e: any) => ListTableFragmentsResponse_ActorInfo.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ListTableFragmentsResponse_FragmentInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? ListTableFragmentsResponse_ActorInfo.toJSON(e) : undefined); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_FragmentInfo { - const message = createBaseListTableFragmentsResponse_FragmentInfo(); - message.id = object.id ?? 0; - message.actors = object.actors?.map((e) => ListTableFragmentsResponse_ActorInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseListTableFragmentsResponse_TableFragmentInfo(): ListTableFragmentsResponse_TableFragmentInfo { - return { fragments: [], env: undefined }; -} - -export const ListTableFragmentsResponse_TableFragmentInfo = { - fromJSON(object: any): ListTableFragmentsResponse_TableFragmentInfo { - return { - fragments: Array.isArray(object?.fragments) - ? object.fragments.map((e: any) => ListTableFragmentsResponse_FragmentInfo.fromJSON(e)) - : [], - env: isSet(object.env) ? StreamEnvironment.fromJSON(object.env) : undefined, - }; - }, - - toJSON(message: ListTableFragmentsResponse_TableFragmentInfo): unknown { - const obj: any = {}; - if (message.fragments) { - obj.fragments = message.fragments.map((e) => e ? ListTableFragmentsResponse_FragmentInfo.toJSON(e) : undefined); - } else { - obj.fragments = []; - } - message.env !== undefined && (obj.env = message.env ? StreamEnvironment.toJSON(message.env) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_TableFragmentInfo { - const message = createBaseListTableFragmentsResponse_TableFragmentInfo(); - message.fragments = object.fragments?.map((e) => ListTableFragmentsResponse_FragmentInfo.fromPartial(e)) || []; - message.env = (object.env !== undefined && object.env !== null) - ? StreamEnvironment.fromPartial(object.env) - : undefined; - return message; - }, -}; - -function createBaseListTableFragmentsResponse_TableFragmentsEntry(): ListTableFragmentsResponse_TableFragmentsEntry { - return { key: 0, value: undefined }; -} - -export const ListTableFragmentsResponse_TableFragmentsEntry = { - fromJSON(object: any): ListTableFragmentsResponse_TableFragmentsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ListTableFragmentsResponse_TableFragmentInfo.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: ListTableFragmentsResponse_TableFragmentsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? ListTableFragmentsResponse_TableFragmentInfo.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): ListTableFragmentsResponse_TableFragmentsEntry { - const message = createBaseListTableFragmentsResponse_TableFragmentsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ListTableFragmentsResponse_TableFragmentInfo.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseAddWorkerNodeRequest(): AddWorkerNodeRequest { - return { workerType: WorkerType.UNSPECIFIED, host: undefined, workerNodeParallelism: 0 }; -} - -export const AddWorkerNodeRequest = { - fromJSON(object: any): AddWorkerNodeRequest { - return { - workerType: isSet(object.workerType) ? workerTypeFromJSON(object.workerType) : WorkerType.UNSPECIFIED, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - workerNodeParallelism: isSet(object.workerNodeParallelism) ? Number(object.workerNodeParallelism) : 0, - }; - }, - - toJSON(message: AddWorkerNodeRequest): unknown { - const obj: any = {}; - message.workerType !== undefined && (obj.workerType = workerTypeToJSON(message.workerType)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.workerNodeParallelism !== undefined && - (obj.workerNodeParallelism = Math.round(message.workerNodeParallelism)); - return obj; - }, - - fromPartial, I>>(object: I): AddWorkerNodeRequest { - const message = createBaseAddWorkerNodeRequest(); - message.workerType = object.workerType ?? WorkerType.UNSPECIFIED; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - message.workerNodeParallelism = object.workerNodeParallelism ?? 0; - return message; - }, -}; - -function createBaseAddWorkerNodeResponse(): AddWorkerNodeResponse { - return { status: undefined, node: undefined }; -} - -export const AddWorkerNodeResponse = { - fromJSON(object: any): AddWorkerNodeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - node: isSet(object.node) ? WorkerNode.fromJSON(object.node) : undefined, - }; - }, - - toJSON(message: AddWorkerNodeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.node !== undefined && (obj.node = message.node ? WorkerNode.toJSON(message.node) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AddWorkerNodeResponse { - const message = createBaseAddWorkerNodeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.node = (object.node !== undefined && object.node !== null) - ? WorkerNode.fromPartial(object.node) - : undefined; - return message; - }, -}; - -function createBaseActivateWorkerNodeRequest(): ActivateWorkerNodeRequest { - return { host: undefined }; -} - -export const ActivateWorkerNodeRequest = { - fromJSON(object: any): ActivateWorkerNodeRequest { - return { host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined }; - }, - - toJSON(message: ActivateWorkerNodeRequest): unknown { - const obj: any = {}; - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ActivateWorkerNodeRequest { - const message = createBaseActivateWorkerNodeRequest(); - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - return message; - }, -}; - -function createBaseActivateWorkerNodeResponse(): ActivateWorkerNodeResponse { - return { status: undefined }; -} - -export const ActivateWorkerNodeResponse = { - fromJSON(object: any): ActivateWorkerNodeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: ActivateWorkerNodeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ActivateWorkerNodeResponse { - const message = createBaseActivateWorkerNodeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseDeleteWorkerNodeRequest(): DeleteWorkerNodeRequest { - return { host: undefined }; -} - -export const DeleteWorkerNodeRequest = { - fromJSON(object: any): DeleteWorkerNodeRequest { - return { host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined }; - }, - - toJSON(message: DeleteWorkerNodeRequest): unknown { - const obj: any = {}; - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DeleteWorkerNodeRequest { - const message = createBaseDeleteWorkerNodeRequest(); - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - return message; - }, -}; - -function createBaseDeleteWorkerNodeResponse(): DeleteWorkerNodeResponse { - return { status: undefined }; -} - -export const DeleteWorkerNodeResponse = { - fromJSON(object: any): DeleteWorkerNodeResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: DeleteWorkerNodeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DeleteWorkerNodeResponse { - const message = createBaseDeleteWorkerNodeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseListAllNodesRequest(): ListAllNodesRequest { - return { workerType: WorkerType.UNSPECIFIED, includeStartingNodes: false }; -} - -export const ListAllNodesRequest = { - fromJSON(object: any): ListAllNodesRequest { - return { - workerType: isSet(object.workerType) ? workerTypeFromJSON(object.workerType) : WorkerType.UNSPECIFIED, - includeStartingNodes: isSet(object.includeStartingNodes) ? Boolean(object.includeStartingNodes) : false, - }; - }, - - toJSON(message: ListAllNodesRequest): unknown { - const obj: any = {}; - message.workerType !== undefined && (obj.workerType = workerTypeToJSON(message.workerType)); - message.includeStartingNodes !== undefined && (obj.includeStartingNodes = message.includeStartingNodes); - return obj; - }, - - fromPartial, I>>(object: I): ListAllNodesRequest { - const message = createBaseListAllNodesRequest(); - message.workerType = object.workerType ?? WorkerType.UNSPECIFIED; - message.includeStartingNodes = object.includeStartingNodes ?? false; - return message; - }, -}; - -function createBaseListAllNodesResponse(): ListAllNodesResponse { - return { status: undefined, nodes: [] }; -} - -export const ListAllNodesResponse = { - fromJSON(object: any): ListAllNodesResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - nodes: Array.isArray(object?.nodes) ? object.nodes.map((e: any) => WorkerNode.fromJSON(e)) : [], - }; - }, - - toJSON(message: ListAllNodesResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - if (message.nodes) { - obj.nodes = message.nodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.nodes = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ListAllNodesResponse { - const message = createBaseListAllNodesResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.nodes = object.nodes?.map((e) => WorkerNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSubscribeRequest(): SubscribeRequest { - return { subscribeType: SubscribeType.UNSPECIFIED, host: undefined, workerId: 0 }; -} - -export const SubscribeRequest = { - fromJSON(object: any): SubscribeRequest { - return { - subscribeType: isSet(object.subscribeType) - ? subscribeTypeFromJSON(object.subscribeType) - : SubscribeType.UNSPECIFIED, - host: isSet(object.host) ? HostAddress.fromJSON(object.host) : undefined, - workerId: isSet(object.workerId) ? Number(object.workerId) : 0, - }; - }, - - toJSON(message: SubscribeRequest): unknown { - const obj: any = {}; - message.subscribeType !== undefined && (obj.subscribeType = subscribeTypeToJSON(message.subscribeType)); - message.host !== undefined && (obj.host = message.host ? HostAddress.toJSON(message.host) : undefined); - message.workerId !== undefined && (obj.workerId = Math.round(message.workerId)); - return obj; - }, - - fromPartial, I>>(object: I): SubscribeRequest { - const message = createBaseSubscribeRequest(); - message.subscribeType = object.subscribeType ?? SubscribeType.UNSPECIFIED; - message.host = (object.host !== undefined && object.host !== null) - ? HostAddress.fromPartial(object.host) - : undefined; - message.workerId = object.workerId ?? 0; - return message; - }, -}; - -function createBaseMetaSnapshot(): MetaSnapshot { - return { - databases: [], - schemas: [], - sources: [], - sinks: [], - tables: [], - indexes: [], - views: [], - functions: [], - users: [], - parallelUnitMappings: [], - nodes: [], - hummockSnapshot: undefined, - hummockVersion: undefined, - metaBackupManifestId: undefined, - hummockWriteLimits: undefined, - version: undefined, - }; -} - -export const MetaSnapshot = { - fromJSON(object: any): MetaSnapshot { - return { - databases: Array.isArray(object?.databases) ? object.databases.map((e: any) => Database.fromJSON(e)) : [], - schemas: Array.isArray(object?.schemas) ? object.schemas.map((e: any) => Schema.fromJSON(e)) : [], - sources: Array.isArray(object?.sources) ? object.sources.map((e: any) => Source.fromJSON(e)) : [], - sinks: Array.isArray(object?.sinks) ? object.sinks.map((e: any) => Sink.fromJSON(e)) : [], - tables: Array.isArray(object?.tables) ? object.tables.map((e: any) => Table.fromJSON(e)) : [], - indexes: Array.isArray(object?.indexes) ? object.indexes.map((e: any) => Index.fromJSON(e)) : [], - views: Array.isArray(object?.views) ? object.views.map((e: any) => View.fromJSON(e)) : [], - functions: Array.isArray(object?.functions) ? object.functions.map((e: any) => Function.fromJSON(e)) : [], - users: Array.isArray(object?.users) ? object.users.map((e: any) => UserInfo.fromJSON(e)) : [], - parallelUnitMappings: Array.isArray(object?.parallelUnitMappings) - ? object.parallelUnitMappings.map((e: any) => FragmentParallelUnitMapping.fromJSON(e)) - : [], - nodes: Array.isArray(object?.nodes) - ? object.nodes.map((e: any) => WorkerNode.fromJSON(e)) - : [], - hummockSnapshot: isSet(object.hummockSnapshot) ? HummockSnapshot.fromJSON(object.hummockSnapshot) : undefined, - hummockVersion: isSet(object.hummockVersion) ? HummockVersion.fromJSON(object.hummockVersion) : undefined, - metaBackupManifestId: isSet(object.metaBackupManifestId) - ? MetaBackupManifestId.fromJSON(object.metaBackupManifestId) - : undefined, - hummockWriteLimits: isSet(object.hummockWriteLimits) - ? WriteLimits.fromJSON(object.hummockWriteLimits) - : undefined, - version: isSet(object.version) ? MetaSnapshot_SnapshotVersion.fromJSON(object.version) : undefined, - }; - }, - - toJSON(message: MetaSnapshot): unknown { - const obj: any = {}; - if (message.databases) { - obj.databases = message.databases.map((e) => e ? Database.toJSON(e) : undefined); - } else { - obj.databases = []; - } - if (message.schemas) { - obj.schemas = message.schemas.map((e) => e ? Schema.toJSON(e) : undefined); - } else { - obj.schemas = []; - } - if (message.sources) { - obj.sources = message.sources.map((e) => e ? Source.toJSON(e) : undefined); - } else { - obj.sources = []; - } - if (message.sinks) { - obj.sinks = message.sinks.map((e) => e ? Sink.toJSON(e) : undefined); - } else { - obj.sinks = []; - } - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - if (message.indexes) { - obj.indexes = message.indexes.map((e) => e ? Index.toJSON(e) : undefined); - } else { - obj.indexes = []; - } - if (message.views) { - obj.views = message.views.map((e) => e ? View.toJSON(e) : undefined); - } else { - obj.views = []; - } - if (message.functions) { - obj.functions = message.functions.map((e) => e ? Function.toJSON(e) : undefined); - } else { - obj.functions = []; - } - if (message.users) { - obj.users = message.users.map((e) => e ? UserInfo.toJSON(e) : undefined); - } else { - obj.users = []; - } - if (message.parallelUnitMappings) { - obj.parallelUnitMappings = message.parallelUnitMappings.map((e) => - e ? FragmentParallelUnitMapping.toJSON(e) : undefined - ); - } else { - obj.parallelUnitMappings = []; - } - if (message.nodes) { - obj.nodes = message.nodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.nodes = []; - } - message.hummockSnapshot !== undefined && - (obj.hummockSnapshot = message.hummockSnapshot ? HummockSnapshot.toJSON(message.hummockSnapshot) : undefined); - message.hummockVersion !== undefined && - (obj.hummockVersion = message.hummockVersion ? HummockVersion.toJSON(message.hummockVersion) : undefined); - message.metaBackupManifestId !== undefined && (obj.metaBackupManifestId = message.metaBackupManifestId - ? MetaBackupManifestId.toJSON(message.metaBackupManifestId) - : undefined); - message.hummockWriteLimits !== undefined && - (obj.hummockWriteLimits = message.hummockWriteLimits - ? WriteLimits.toJSON(message.hummockWriteLimits) - : undefined); - message.version !== undefined && - (obj.version = message.version ? MetaSnapshot_SnapshotVersion.toJSON(message.version) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshot { - const message = createBaseMetaSnapshot(); - message.databases = object.databases?.map((e) => Database.fromPartial(e)) || []; - message.schemas = object.schemas?.map((e) => Schema.fromPartial(e)) || []; - message.sources = object.sources?.map((e) => Source.fromPartial(e)) || []; - message.sinks = object.sinks?.map((e) => Sink.fromPartial(e)) || []; - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - message.indexes = object.indexes?.map((e) => Index.fromPartial(e)) || []; - message.views = object.views?.map((e) => View.fromPartial(e)) || []; - message.functions = object.functions?.map((e) => Function.fromPartial(e)) || []; - message.users = object.users?.map((e) => UserInfo.fromPartial(e)) || []; - message.parallelUnitMappings = - object.parallelUnitMappings?.map((e) => FragmentParallelUnitMapping.fromPartial(e)) || []; - message.nodes = object.nodes?.map((e) => WorkerNode.fromPartial(e)) || []; - message.hummockSnapshot = (object.hummockSnapshot !== undefined && object.hummockSnapshot !== null) - ? HummockSnapshot.fromPartial(object.hummockSnapshot) - : undefined; - message.hummockVersion = (object.hummockVersion !== undefined && object.hummockVersion !== null) - ? HummockVersion.fromPartial(object.hummockVersion) - : undefined; - message.metaBackupManifestId = (object.metaBackupManifestId !== undefined && object.metaBackupManifestId !== null) - ? MetaBackupManifestId.fromPartial(object.metaBackupManifestId) - : undefined; - message.hummockWriteLimits = (object.hummockWriteLimits !== undefined && object.hummockWriteLimits !== null) - ? WriteLimits.fromPartial(object.hummockWriteLimits) - : undefined; - message.version = (object.version !== undefined && object.version !== null) - ? MetaSnapshot_SnapshotVersion.fromPartial(object.version) - : undefined; - return message; - }, -}; - -function createBaseMetaSnapshot_SnapshotVersion(): MetaSnapshot_SnapshotVersion { - return { catalogVersion: 0, parallelUnitMappingVersion: 0, workerNodeVersion: 0 }; -} - -export const MetaSnapshot_SnapshotVersion = { - fromJSON(object: any): MetaSnapshot_SnapshotVersion { - return { - catalogVersion: isSet(object.catalogVersion) ? Number(object.catalogVersion) : 0, - parallelUnitMappingVersion: isSet(object.parallelUnitMappingVersion) - ? Number(object.parallelUnitMappingVersion) - : 0, - workerNodeVersion: isSet(object.workerNodeVersion) ? Number(object.workerNodeVersion) : 0, - }; - }, - - toJSON(message: MetaSnapshot_SnapshotVersion): unknown { - const obj: any = {}; - message.catalogVersion !== undefined && (obj.catalogVersion = Math.round(message.catalogVersion)); - message.parallelUnitMappingVersion !== undefined && - (obj.parallelUnitMappingVersion = Math.round(message.parallelUnitMappingVersion)); - message.workerNodeVersion !== undefined && (obj.workerNodeVersion = Math.round(message.workerNodeVersion)); - return obj; - }, - - fromPartial, I>>(object: I): MetaSnapshot_SnapshotVersion { - const message = createBaseMetaSnapshot_SnapshotVersion(); - message.catalogVersion = object.catalogVersion ?? 0; - message.parallelUnitMappingVersion = object.parallelUnitMappingVersion ?? 0; - message.workerNodeVersion = object.workerNodeVersion ?? 0; - return message; - }, -}; - -function createBaseSubscribeResponse(): SubscribeResponse { - return { status: undefined, operation: SubscribeResponse_Operation.UNSPECIFIED, version: 0, info: undefined }; -} - -export const SubscribeResponse = { - fromJSON(object: any): SubscribeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - operation: isSet(object.operation) - ? subscribeResponse_OperationFromJSON(object.operation) - : SubscribeResponse_Operation.UNSPECIFIED, - version: isSet(object.version) ? Number(object.version) : 0, - info: isSet(object.database) - ? { $case: "database", database: Database.fromJSON(object.database) } - : isSet(object.schema) - ? { $case: "schema", schema: Schema.fromJSON(object.schema) } - : isSet(object.table) - ? { $case: "table", table: Table.fromJSON(object.table) } - : isSet(object.source) - ? { $case: "source", source: Source.fromJSON(object.source) } - : isSet(object.sink) - ? { $case: "sink", sink: Sink.fromJSON(object.sink) } - : isSet(object.index) - ? { $case: "index", index: Index.fromJSON(object.index) } - : isSet(object.view) - ? { $case: "view", view: View.fromJSON(object.view) } - : isSet(object.function) - ? { $case: "function", function: Function.fromJSON(object.function) } - : isSet(object.user) - ? { $case: "user", user: UserInfo.fromJSON(object.user) } - : isSet(object.parallelUnitMapping) - ? { - $case: "parallelUnitMapping", - parallelUnitMapping: FragmentParallelUnitMapping.fromJSON(object.parallelUnitMapping), - } - : isSet(object.node) - ? { $case: "node", node: WorkerNode.fromJSON(object.node) } - : isSet(object.hummockSnapshot) - ? { $case: "hummockSnapshot", hummockSnapshot: HummockSnapshot.fromJSON(object.hummockSnapshot) } - : isSet(object.hummockVersionDeltas) - ? { - $case: "hummockVersionDeltas", - hummockVersionDeltas: HummockVersionDeltas.fromJSON(object.hummockVersionDeltas), - } - : isSet(object.snapshot) - ? { $case: "snapshot", snapshot: MetaSnapshot.fromJSON(object.snapshot) } - : isSet(object.metaBackupManifestId) - ? { - $case: "metaBackupManifestId", - metaBackupManifestId: MetaBackupManifestId.fromJSON(object.metaBackupManifestId), - } - : isSet(object.systemParams) - ? { $case: "systemParams", systemParams: SystemParams.fromJSON(object.systemParams) } - : isSet(object.hummockWriteLimits) - ? { $case: "hummockWriteLimits", hummockWriteLimits: WriteLimits.fromJSON(object.hummockWriteLimits) } - : undefined, - }; - }, - - toJSON(message: SubscribeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.operation !== undefined && (obj.operation = subscribeResponse_OperationToJSON(message.operation)); - message.version !== undefined && (obj.version = Math.round(message.version)); - message.info?.$case === "database" && - (obj.database = message.info?.database ? Database.toJSON(message.info?.database) : undefined); - message.info?.$case === "schema" && - (obj.schema = message.info?.schema ? Schema.toJSON(message.info?.schema) : undefined); - message.info?.$case === "table" && - (obj.table = message.info?.table ? Table.toJSON(message.info?.table) : undefined); - message.info?.$case === "source" && - (obj.source = message.info?.source ? Source.toJSON(message.info?.source) : undefined); - message.info?.$case === "sink" && (obj.sink = message.info?.sink ? Sink.toJSON(message.info?.sink) : undefined); - message.info?.$case === "index" && - (obj.index = message.info?.index ? Index.toJSON(message.info?.index) : undefined); - message.info?.$case === "view" && (obj.view = message.info?.view ? View.toJSON(message.info?.view) : undefined); - message.info?.$case === "function" && - (obj.function = message.info?.function ? Function.toJSON(message.info?.function) : undefined); - message.info?.$case === "user" && (obj.user = message.info?.user ? UserInfo.toJSON(message.info?.user) : undefined); - message.info?.$case === "parallelUnitMapping" && (obj.parallelUnitMapping = message.info?.parallelUnitMapping - ? FragmentParallelUnitMapping.toJSON(message.info?.parallelUnitMapping) - : undefined); - message.info?.$case === "node" && - (obj.node = message.info?.node ? WorkerNode.toJSON(message.info?.node) : undefined); - message.info?.$case === "hummockSnapshot" && (obj.hummockSnapshot = message.info?.hummockSnapshot - ? HummockSnapshot.toJSON(message.info?.hummockSnapshot) - : undefined); - message.info?.$case === "hummockVersionDeltas" && (obj.hummockVersionDeltas = message.info?.hummockVersionDeltas - ? HummockVersionDeltas.toJSON(message.info?.hummockVersionDeltas) - : undefined); - message.info?.$case === "snapshot" && - (obj.snapshot = message.info?.snapshot ? MetaSnapshot.toJSON(message.info?.snapshot) : undefined); - message.info?.$case === "metaBackupManifestId" && (obj.metaBackupManifestId = message.info?.metaBackupManifestId - ? MetaBackupManifestId.toJSON(message.info?.metaBackupManifestId) - : undefined); - message.info?.$case === "systemParams" && - (obj.systemParams = message.info?.systemParams ? SystemParams.toJSON(message.info?.systemParams) : undefined); - message.info?.$case === "hummockWriteLimits" && (obj.hummockWriteLimits = message.info?.hummockWriteLimits - ? WriteLimits.toJSON(message.info?.hummockWriteLimits) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SubscribeResponse { - const message = createBaseSubscribeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.operation = object.operation ?? SubscribeResponse_Operation.UNSPECIFIED; - message.version = object.version ?? 0; - if (object.info?.$case === "database" && object.info?.database !== undefined && object.info?.database !== null) { - message.info = { $case: "database", database: Database.fromPartial(object.info.database) }; - } - if (object.info?.$case === "schema" && object.info?.schema !== undefined && object.info?.schema !== null) { - message.info = { $case: "schema", schema: Schema.fromPartial(object.info.schema) }; - } - if (object.info?.$case === "table" && object.info?.table !== undefined && object.info?.table !== null) { - message.info = { $case: "table", table: Table.fromPartial(object.info.table) }; - } - if (object.info?.$case === "source" && object.info?.source !== undefined && object.info?.source !== null) { - message.info = { $case: "source", source: Source.fromPartial(object.info.source) }; - } - if (object.info?.$case === "sink" && object.info?.sink !== undefined && object.info?.sink !== null) { - message.info = { $case: "sink", sink: Sink.fromPartial(object.info.sink) }; - } - if (object.info?.$case === "index" && object.info?.index !== undefined && object.info?.index !== null) { - message.info = { $case: "index", index: Index.fromPartial(object.info.index) }; - } - if (object.info?.$case === "view" && object.info?.view !== undefined && object.info?.view !== null) { - message.info = { $case: "view", view: View.fromPartial(object.info.view) }; - } - if (object.info?.$case === "function" && object.info?.function !== undefined && object.info?.function !== null) { - message.info = { $case: "function", function: Function.fromPartial(object.info.function) }; - } - if (object.info?.$case === "user" && object.info?.user !== undefined && object.info?.user !== null) { - message.info = { $case: "user", user: UserInfo.fromPartial(object.info.user) }; - } - if ( - object.info?.$case === "parallelUnitMapping" && - object.info?.parallelUnitMapping !== undefined && - object.info?.parallelUnitMapping !== null - ) { - message.info = { - $case: "parallelUnitMapping", - parallelUnitMapping: FragmentParallelUnitMapping.fromPartial(object.info.parallelUnitMapping), - }; - } - if (object.info?.$case === "node" && object.info?.node !== undefined && object.info?.node !== null) { - message.info = { $case: "node", node: WorkerNode.fromPartial(object.info.node) }; - } - if ( - object.info?.$case === "hummockSnapshot" && - object.info?.hummockSnapshot !== undefined && - object.info?.hummockSnapshot !== null - ) { - message.info = { - $case: "hummockSnapshot", - hummockSnapshot: HummockSnapshot.fromPartial(object.info.hummockSnapshot), - }; - } - if ( - object.info?.$case === "hummockVersionDeltas" && - object.info?.hummockVersionDeltas !== undefined && - object.info?.hummockVersionDeltas !== null - ) { - message.info = { - $case: "hummockVersionDeltas", - hummockVersionDeltas: HummockVersionDeltas.fromPartial(object.info.hummockVersionDeltas), - }; - } - if (object.info?.$case === "snapshot" && object.info?.snapshot !== undefined && object.info?.snapshot !== null) { - message.info = { $case: "snapshot", snapshot: MetaSnapshot.fromPartial(object.info.snapshot) }; - } - if ( - object.info?.$case === "metaBackupManifestId" && - object.info?.metaBackupManifestId !== undefined && - object.info?.metaBackupManifestId !== null - ) { - message.info = { - $case: "metaBackupManifestId", - metaBackupManifestId: MetaBackupManifestId.fromPartial(object.info.metaBackupManifestId), - }; - } - if ( - object.info?.$case === "systemParams" && - object.info?.systemParams !== undefined && - object.info?.systemParams !== null - ) { - message.info = { $case: "systemParams", systemParams: SystemParams.fromPartial(object.info.systemParams) }; - } - if ( - object.info?.$case === "hummockWriteLimits" && - object.info?.hummockWriteLimits !== undefined && - object.info?.hummockWriteLimits !== null - ) { - message.info = { - $case: "hummockWriteLimits", - hummockWriteLimits: WriteLimits.fromPartial(object.info.hummockWriteLimits), - }; - } - return message; - }, -}; - -function createBasePauseRequest(): PauseRequest { - return {}; -} - -export const PauseRequest = { - fromJSON(_: any): PauseRequest { - return {}; - }, - - toJSON(_: PauseRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): PauseRequest { - const message = createBasePauseRequest(); - return message; - }, -}; - -function createBasePauseResponse(): PauseResponse { - return {}; -} - -export const PauseResponse = { - fromJSON(_: any): PauseResponse { - return {}; - }, - - toJSON(_: PauseResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): PauseResponse { - const message = createBasePauseResponse(); - return message; - }, -}; - -function createBaseResumeRequest(): ResumeRequest { - return {}; -} - -export const ResumeRequest = { - fromJSON(_: any): ResumeRequest { - return {}; - }, - - toJSON(_: ResumeRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ResumeRequest { - const message = createBaseResumeRequest(); - return message; - }, -}; - -function createBaseResumeResponse(): ResumeResponse { - return {}; -} - -export const ResumeResponse = { - fromJSON(_: any): ResumeResponse { - return {}; - }, - - toJSON(_: ResumeResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ResumeResponse { - const message = createBaseResumeResponse(); - return message; - }, -}; - -function createBaseGetClusterInfoRequest(): GetClusterInfoRequest { - return {}; -} - -export const GetClusterInfoRequest = { - fromJSON(_: any): GetClusterInfoRequest { - return {}; - }, - - toJSON(_: GetClusterInfoRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetClusterInfoRequest { - const message = createBaseGetClusterInfoRequest(); - return message; - }, -}; - -function createBaseGetClusterInfoResponse(): GetClusterInfoResponse { - return { workerNodes: [], tableFragments: [], actorSplits: {}, sourceInfos: {} }; -} - -export const GetClusterInfoResponse = { - fromJSON(object: any): GetClusterInfoResponse { - return { - workerNodes: Array.isArray(object?.workerNodes) ? object.workerNodes.map((e: any) => WorkerNode.fromJSON(e)) : [], - tableFragments: Array.isArray(object?.tableFragments) - ? object.tableFragments.map((e: any) => TableFragments.fromJSON(e)) - : [], - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - sourceInfos: isObject(object.sourceInfos) - ? Object.entries(object.sourceInfos).reduce<{ [key: number]: Source }>((acc, [key, value]) => { - acc[Number(key)] = Source.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: GetClusterInfoResponse): unknown { - const obj: any = {}; - if (message.workerNodes) { - obj.workerNodes = message.workerNodes.map((e) => e ? WorkerNode.toJSON(e) : undefined); - } else { - obj.workerNodes = []; - } - if (message.tableFragments) { - obj.tableFragments = message.tableFragments.map((e) => e ? TableFragments.toJSON(e) : undefined); - } else { - obj.tableFragments = []; - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - obj.sourceInfos = {}; - if (message.sourceInfos) { - Object.entries(message.sourceInfos).forEach(([k, v]) => { - obj.sourceInfos[k] = Source.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): GetClusterInfoResponse { - const message = createBaseGetClusterInfoResponse(); - message.workerNodes = object.workerNodes?.map((e) => WorkerNode.fromPartial(e)) || []; - message.tableFragments = object.tableFragments?.map((e) => TableFragments.fromPartial(e)) || []; - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - message.sourceInfos = Object.entries(object.sourceInfos ?? {}).reduce<{ [key: number]: Source }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Source.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseGetClusterInfoResponse_ActorSplitsEntry(): GetClusterInfoResponse_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const GetClusterInfoResponse_ActorSplitsEntry = { - fromJSON(object: any): GetClusterInfoResponse_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: GetClusterInfoResponse_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetClusterInfoResponse_ActorSplitsEntry { - const message = createBaseGetClusterInfoResponse_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseGetClusterInfoResponse_SourceInfosEntry(): GetClusterInfoResponse_SourceInfosEntry { - return { key: 0, value: undefined }; -} - -export const GetClusterInfoResponse_SourceInfosEntry = { - fromJSON(object: any): GetClusterInfoResponse_SourceInfosEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Source.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: GetClusterInfoResponse_SourceInfosEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Source.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GetClusterInfoResponse_SourceInfosEntry { - const message = createBaseGetClusterInfoResponse_SourceInfosEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? Source.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseRescheduleRequest(): RescheduleRequest { - return { reschedules: {} }; -} - -export const RescheduleRequest = { - fromJSON(object: any): RescheduleRequest { - return { - reschedules: isObject(object.reschedules) - ? Object.entries(object.reschedules).reduce<{ [key: number]: RescheduleRequest_Reschedule }>( - (acc, [key, value]) => { - acc[Number(key)] = RescheduleRequest_Reschedule.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - }; - }, - - toJSON(message: RescheduleRequest): unknown { - const obj: any = {}; - obj.reschedules = {}; - if (message.reschedules) { - Object.entries(message.reschedules).forEach(([k, v]) => { - obj.reschedules[k] = RescheduleRequest_Reschedule.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): RescheduleRequest { - const message = createBaseRescheduleRequest(); - message.reschedules = Object.entries(object.reschedules ?? {}).reduce< - { [key: number]: RescheduleRequest_Reschedule } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = RescheduleRequest_Reschedule.fromPartial(value); - } - return acc; - }, {}); - return message; - }, -}; - -function createBaseRescheduleRequest_Reschedule(): RescheduleRequest_Reschedule { - return { addedParallelUnits: [], removedParallelUnits: [] }; -} - -export const RescheduleRequest_Reschedule = { - fromJSON(object: any): RescheduleRequest_Reschedule { - return { - addedParallelUnits: Array.isArray(object?.addedParallelUnits) - ? object.addedParallelUnits.map((e: any) => Number(e)) - : [], - removedParallelUnits: Array.isArray(object?.removedParallelUnits) - ? object.removedParallelUnits.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: RescheduleRequest_Reschedule): unknown { - const obj: any = {}; - if (message.addedParallelUnits) { - obj.addedParallelUnits = message.addedParallelUnits.map((e) => Math.round(e)); - } else { - obj.addedParallelUnits = []; - } - if (message.removedParallelUnits) { - obj.removedParallelUnits = message.removedParallelUnits.map((e) => Math.round(e)); - } else { - obj.removedParallelUnits = []; - } - return obj; - }, - - fromPartial, I>>(object: I): RescheduleRequest_Reschedule { - const message = createBaseRescheduleRequest_Reschedule(); - message.addedParallelUnits = object.addedParallelUnits?.map((e) => e) || []; - message.removedParallelUnits = object.removedParallelUnits?.map((e) => e) || []; - return message; - }, -}; - -function createBaseRescheduleRequest_ReschedulesEntry(): RescheduleRequest_ReschedulesEntry { - return { key: 0, value: undefined }; -} - -export const RescheduleRequest_ReschedulesEntry = { - fromJSON(object: any): RescheduleRequest_ReschedulesEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? RescheduleRequest_Reschedule.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: RescheduleRequest_ReschedulesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? RescheduleRequest_Reschedule.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): RescheduleRequest_ReschedulesEntry { - const message = createBaseRescheduleRequest_ReschedulesEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? RescheduleRequest_Reschedule.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseRescheduleResponse(): RescheduleResponse { - return { success: false }; -} - -export const RescheduleResponse = { - fromJSON(object: any): RescheduleResponse { - return { success: isSet(object.success) ? Boolean(object.success) : false }; - }, - - toJSON(message: RescheduleResponse): unknown { - const obj: any = {}; - message.success !== undefined && (obj.success = message.success); - return obj; - }, - - fromPartial, I>>(object: I): RescheduleResponse { - const message = createBaseRescheduleResponse(); - message.success = object.success ?? false; - return message; - }, -}; - -function createBaseMembersRequest(): MembersRequest { - return {}; -} - -export const MembersRequest = { - fromJSON(_: any): MembersRequest { - return {}; - }, - - toJSON(_: MembersRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): MembersRequest { - const message = createBaseMembersRequest(); - return message; - }, -}; - -function createBaseMetaMember(): MetaMember { - return { address: undefined, isLeader: false }; -} - -export const MetaMember = { - fromJSON(object: any): MetaMember { - return { - address: isSet(object.address) ? HostAddress.fromJSON(object.address) : undefined, - isLeader: isSet(object.isLeader) ? Boolean(object.isLeader) : false, - }; - }, - - toJSON(message: MetaMember): unknown { - const obj: any = {}; - message.address !== undefined && (obj.address = message.address ? HostAddress.toJSON(message.address) : undefined); - message.isLeader !== undefined && (obj.isLeader = message.isLeader); - return obj; - }, - - fromPartial, I>>(object: I): MetaMember { - const message = createBaseMetaMember(); - message.address = (object.address !== undefined && object.address !== null) - ? HostAddress.fromPartial(object.address) - : undefined; - message.isLeader = object.isLeader ?? false; - return message; - }, -}; - -function createBaseMembersResponse(): MembersResponse { - return { members: [] }; -} - -export const MembersResponse = { - fromJSON(object: any): MembersResponse { - return { members: Array.isArray(object?.members) ? object.members.map((e: any) => MetaMember.fromJSON(e)) : [] }; - }, - - toJSON(message: MembersResponse): unknown { - const obj: any = {}; - if (message.members) { - obj.members = message.members.map((e) => e ? MetaMember.toJSON(e) : undefined); - } else { - obj.members = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MembersResponse { - const message = createBaseMembersResponse(); - message.members = object.members?.map((e) => MetaMember.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSystemParams(): SystemParams { - return { - barrierIntervalMs: undefined, - checkpointFrequency: undefined, - sstableSizeMb: undefined, - blockSizeKb: undefined, - bloomFalsePositive: undefined, - stateStore: undefined, - dataDirectory: undefined, - backupStorageUrl: undefined, - backupStorageDirectory: undefined, - }; -} - -export const SystemParams = { - fromJSON(object: any): SystemParams { - return { - barrierIntervalMs: isSet(object.barrierIntervalMs) ? Number(object.barrierIntervalMs) : undefined, - checkpointFrequency: isSet(object.checkpointFrequency) ? Number(object.checkpointFrequency) : undefined, - sstableSizeMb: isSet(object.sstableSizeMb) ? Number(object.sstableSizeMb) : undefined, - blockSizeKb: isSet(object.blockSizeKb) ? Number(object.blockSizeKb) : undefined, - bloomFalsePositive: isSet(object.bloomFalsePositive) ? Number(object.bloomFalsePositive) : undefined, - stateStore: isSet(object.stateStore) ? String(object.stateStore) : undefined, - dataDirectory: isSet(object.dataDirectory) ? String(object.dataDirectory) : undefined, - backupStorageUrl: isSet(object.backupStorageUrl) ? String(object.backupStorageUrl) : undefined, - backupStorageDirectory: isSet(object.backupStorageDirectory) ? String(object.backupStorageDirectory) : undefined, - }; - }, - - toJSON(message: SystemParams): unknown { - const obj: any = {}; - message.barrierIntervalMs !== undefined && (obj.barrierIntervalMs = Math.round(message.barrierIntervalMs)); - message.checkpointFrequency !== undefined && (obj.checkpointFrequency = Math.round(message.checkpointFrequency)); - message.sstableSizeMb !== undefined && (obj.sstableSizeMb = Math.round(message.sstableSizeMb)); - message.blockSizeKb !== undefined && (obj.blockSizeKb = Math.round(message.blockSizeKb)); - message.bloomFalsePositive !== undefined && (obj.bloomFalsePositive = message.bloomFalsePositive); - message.stateStore !== undefined && (obj.stateStore = message.stateStore); - message.dataDirectory !== undefined && (obj.dataDirectory = message.dataDirectory); - message.backupStorageUrl !== undefined && (obj.backupStorageUrl = message.backupStorageUrl); - message.backupStorageDirectory !== undefined && (obj.backupStorageDirectory = message.backupStorageDirectory); - return obj; - }, - - fromPartial, I>>(object: I): SystemParams { - const message = createBaseSystemParams(); - message.barrierIntervalMs = object.barrierIntervalMs ?? undefined; - message.checkpointFrequency = object.checkpointFrequency ?? undefined; - message.sstableSizeMb = object.sstableSizeMb ?? undefined; - message.blockSizeKb = object.blockSizeKb ?? undefined; - message.bloomFalsePositive = object.bloomFalsePositive ?? undefined; - message.stateStore = object.stateStore ?? undefined; - message.dataDirectory = object.dataDirectory ?? undefined; - message.backupStorageUrl = object.backupStorageUrl ?? undefined; - message.backupStorageDirectory = object.backupStorageDirectory ?? undefined; - return message; - }, -}; - -function createBaseGetSystemParamsRequest(): GetSystemParamsRequest { - return {}; -} - -export const GetSystemParamsRequest = { - fromJSON(_: any): GetSystemParamsRequest { - return {}; - }, - - toJSON(_: GetSystemParamsRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): GetSystemParamsRequest { - const message = createBaseGetSystemParamsRequest(); - return message; - }, -}; - -function createBaseGetSystemParamsResponse(): GetSystemParamsResponse { - return { params: undefined }; -} - -export const GetSystemParamsResponse = { - fromJSON(object: any): GetSystemParamsResponse { - return { params: isSet(object.params) ? SystemParams.fromJSON(object.params) : undefined }; - }, - - toJSON(message: GetSystemParamsResponse): unknown { - const obj: any = {}; - message.params !== undefined && (obj.params = message.params ? SystemParams.toJSON(message.params) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetSystemParamsResponse { - const message = createBaseGetSystemParamsResponse(); - message.params = (object.params !== undefined && object.params !== null) - ? SystemParams.fromPartial(object.params) - : undefined; - return message; - }, -}; - -function createBaseSetSystemParamRequest(): SetSystemParamRequest { - return { param: "", value: undefined }; -} - -export const SetSystemParamRequest = { - fromJSON(object: any): SetSystemParamRequest { - return { - param: isSet(object.param) ? String(object.param) : "", - value: isSet(object.value) ? String(object.value) : undefined, - }; - }, - - toJSON(message: SetSystemParamRequest): unknown { - const obj: any = {}; - message.param !== undefined && (obj.param = message.param); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SetSystemParamRequest { - const message = createBaseSetSystemParamRequest(); - message.param = object.param ?? ""; - message.value = object.value ?? undefined; - return message; - }, -}; - -function createBaseSetSystemParamResponse(): SetSystemParamResponse { - return {}; -} - -export const SetSystemParamResponse = { - fromJSON(_: any): SetSystemParamResponse { - return {}; - }, - - toJSON(_: SetSystemParamResponse): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): SetSystemParamResponse { - const message = createBaseSetSystemParamResponse(); - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/monitor_service.ts b/dashboard/proto/gen/monitor_service.ts deleted file mode 100644 index 3719692cb88de..0000000000000 --- a/dashboard/proto/gen/monitor_service.ts +++ /dev/null @@ -1,274 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "monitor_service"; - -export interface StackTraceRequest { -} - -export interface StackTraceResponse { - actorTraces: { [key: number]: string }; - rpcTraces: { [key: string]: string }; -} - -export interface StackTraceResponse_ActorTracesEntry { - key: number; - value: string; -} - -export interface StackTraceResponse_RpcTracesEntry { - key: string; - value: string; -} - -export interface ProfilingRequest { - /** How long the profiling should last. */ - sleepS: number; -} - -export interface ProfilingResponse { - result: Uint8Array; -} - -function createBaseStackTraceRequest(): StackTraceRequest { - return {}; -} - -export const StackTraceRequest = { - fromJSON(_: any): StackTraceRequest { - return {}; - }, - - toJSON(_: StackTraceRequest): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): StackTraceRequest { - const message = createBaseStackTraceRequest(); - return message; - }, -}; - -function createBaseStackTraceResponse(): StackTraceResponse { - return { actorTraces: {}, rpcTraces: {} }; -} - -export const StackTraceResponse = { - fromJSON(object: any): StackTraceResponse { - return { - actorTraces: isObject(object.actorTraces) - ? Object.entries(object.actorTraces).reduce<{ [key: number]: string }>((acc, [key, value]) => { - acc[Number(key)] = String(value); - return acc; - }, {}) - : {}, - rpcTraces: isObject(object.rpcTraces) - ? Object.entries(object.rpcTraces).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: StackTraceResponse): unknown { - const obj: any = {}; - obj.actorTraces = {}; - if (message.actorTraces) { - Object.entries(message.actorTraces).forEach(([k, v]) => { - obj.actorTraces[k] = v; - }); - } - obj.rpcTraces = {}; - if (message.rpcTraces) { - Object.entries(message.rpcTraces).forEach(([k, v]) => { - obj.rpcTraces[k] = v; - }); - } - return obj; - }, - - fromPartial, I>>(object: I): StackTraceResponse { - const message = createBaseStackTraceResponse(); - message.actorTraces = Object.entries(object.actorTraces ?? {}).reduce<{ [key: number]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = String(value); - } - return acc; - }, - {}, - ); - message.rpcTraces = Object.entries(object.rpcTraces ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseStackTraceResponse_ActorTracesEntry(): StackTraceResponse_ActorTracesEntry { - return { key: 0, value: "" }; -} - -export const StackTraceResponse_ActorTracesEntry = { - fromJSON(object: any): StackTraceResponse_ActorTracesEntry { - return { key: isSet(object.key) ? Number(object.key) : 0, value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: StackTraceResponse_ActorTracesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StackTraceResponse_ActorTracesEntry { - const message = createBaseStackTraceResponse_ActorTracesEntry(); - message.key = object.key ?? 0; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseStackTraceResponse_RpcTracesEntry(): StackTraceResponse_RpcTracesEntry { - return { key: "", value: "" }; -} - -export const StackTraceResponse_RpcTracesEntry = { - fromJSON(object: any): StackTraceResponse_RpcTracesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: StackTraceResponse_RpcTracesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StackTraceResponse_RpcTracesEntry { - const message = createBaseStackTraceResponse_RpcTracesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseProfilingRequest(): ProfilingRequest { - return { sleepS: 0 }; -} - -export const ProfilingRequest = { - fromJSON(object: any): ProfilingRequest { - return { sleepS: isSet(object.sleepS) ? Number(object.sleepS) : 0 }; - }, - - toJSON(message: ProfilingRequest): unknown { - const obj: any = {}; - message.sleepS !== undefined && (obj.sleepS = Math.round(message.sleepS)); - return obj; - }, - - fromPartial, I>>(object: I): ProfilingRequest { - const message = createBaseProfilingRequest(); - message.sleepS = object.sleepS ?? 0; - return message; - }, -}; - -function createBaseProfilingResponse(): ProfilingResponse { - return { result: new Uint8Array() }; -} - -export const ProfilingResponse = { - fromJSON(object: any): ProfilingResponse { - return { result: isSet(object.result) ? bytesFromBase64(object.result) : new Uint8Array() }; - }, - - toJSON(message: ProfilingResponse): unknown { - const obj: any = {}; - message.result !== undefined && - (obj.result = base64FromBytes(message.result !== undefined ? message.result : new Uint8Array())); - return obj; - }, - - fromPartial, I>>(object: I): ProfilingResponse { - const message = createBaseProfilingResponse(); - message.result = object.result ?? new Uint8Array(); - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/order.ts b/dashboard/proto/gen/order.ts deleted file mode 100644 index 6037394eadcee..0000000000000 --- a/dashboard/proto/gen/order.ts +++ /dev/null @@ -1,128 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "order"; - -export const PbDirection = { - PbDirection_UNSPECIFIED: "PbDirection_UNSPECIFIED", - PbDirection_ASCENDING: "PbDirection_ASCENDING", - PbDirection_DESCENDING: "PbDirection_DESCENDING", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type PbDirection = typeof PbDirection[keyof typeof PbDirection]; - -export function pbDirectionFromJSON(object: any): PbDirection { - switch (object) { - case 0: - case "PbDirection_UNSPECIFIED": - return PbDirection.PbDirection_UNSPECIFIED; - case 1: - case "PbDirection_ASCENDING": - return PbDirection.PbDirection_ASCENDING; - case 2: - case "PbDirection_DESCENDING": - return PbDirection.PbDirection_DESCENDING; - case -1: - case "UNRECOGNIZED": - default: - return PbDirection.UNRECOGNIZED; - } -} - -export function pbDirectionToJSON(object: PbDirection): string { - switch (object) { - case PbDirection.PbDirection_UNSPECIFIED: - return "PbDirection_UNSPECIFIED"; - case PbDirection.PbDirection_ASCENDING: - return "PbDirection_ASCENDING"; - case PbDirection.PbDirection_DESCENDING: - return "PbDirection_DESCENDING"; - case PbDirection.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface PbOrderType { - /** - * TODO(rc): enable `NULLS FIRST | LAST` - * PbNullsAre nulls_are = 2; - */ - direction: PbDirection; -} - -/** Column index with an order type (ASC or DESC). Used to represent a sort key (`repeated PbColumnOrder`). */ -export interface PbColumnOrder { - columnIndex: number; - orderType: PbOrderType | undefined; -} - -function createBasePbOrderType(): PbOrderType { - return { direction: PbDirection.PbDirection_UNSPECIFIED }; -} - -export const PbOrderType = { - fromJSON(object: any): PbOrderType { - return { - direction: isSet(object.direction) ? pbDirectionFromJSON(object.direction) : PbDirection.PbDirection_UNSPECIFIED, - }; - }, - - toJSON(message: PbOrderType): unknown { - const obj: any = {}; - message.direction !== undefined && (obj.direction = pbDirectionToJSON(message.direction)); - return obj; - }, - - fromPartial, I>>(object: I): PbOrderType { - const message = createBasePbOrderType(); - message.direction = object.direction ?? PbDirection.PbDirection_UNSPECIFIED; - return message; - }, -}; - -function createBasePbColumnOrder(): PbColumnOrder { - return { columnIndex: 0, orderType: undefined }; -} - -export const PbColumnOrder = { - fromJSON(object: any): PbColumnOrder { - return { - columnIndex: isSet(object.columnIndex) ? Number(object.columnIndex) : 0, - orderType: isSet(object.orderType) ? PbOrderType.fromJSON(object.orderType) : undefined, - }; - }, - - toJSON(message: PbColumnOrder): unknown { - const obj: any = {}; - message.columnIndex !== undefined && (obj.columnIndex = Math.round(message.columnIndex)); - message.orderType !== undefined && - (obj.orderType = message.orderType ? PbOrderType.toJSON(message.orderType) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): PbColumnOrder { - const message = createBasePbColumnOrder(); - message.columnIndex = object.columnIndex ?? 0; - message.orderType = (object.orderType !== undefined && object.orderType !== null) - ? PbOrderType.fromPartial(object.orderType) - : undefined; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/plan_common.ts b/dashboard/proto/gen/plan_common.ts deleted file mode 100644 index 38a14ad1a05a8..0000000000000 --- a/dashboard/proto/gen/plan_common.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* eslint-disable */ -import { ColumnOrder } from "./common"; -import { DataType } from "./data"; - -export const protobufPackage = "plan_common"; - -export const JoinType = { - /** - * UNSPECIFIED - Note that it comes from Calcite's JoinRelType. - * DO NOT HAVE direction for SEMI and ANTI now. - */ - UNSPECIFIED: "UNSPECIFIED", - INNER: "INNER", - LEFT_OUTER: "LEFT_OUTER", - RIGHT_OUTER: "RIGHT_OUTER", - FULL_OUTER: "FULL_OUTER", - LEFT_SEMI: "LEFT_SEMI", - LEFT_ANTI: "LEFT_ANTI", - RIGHT_SEMI: "RIGHT_SEMI", - RIGHT_ANTI: "RIGHT_ANTI", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type JoinType = typeof JoinType[keyof typeof JoinType]; - -export function joinTypeFromJSON(object: any): JoinType { - switch (object) { - case 0: - case "UNSPECIFIED": - return JoinType.UNSPECIFIED; - case 1: - case "INNER": - return JoinType.INNER; - case 2: - case "LEFT_OUTER": - return JoinType.LEFT_OUTER; - case 3: - case "RIGHT_OUTER": - return JoinType.RIGHT_OUTER; - case 4: - case "FULL_OUTER": - return JoinType.FULL_OUTER; - case 5: - case "LEFT_SEMI": - return JoinType.LEFT_SEMI; - case 6: - case "LEFT_ANTI": - return JoinType.LEFT_ANTI; - case 7: - case "RIGHT_SEMI": - return JoinType.RIGHT_SEMI; - case 8: - case "RIGHT_ANTI": - return JoinType.RIGHT_ANTI; - case -1: - case "UNRECOGNIZED": - default: - return JoinType.UNRECOGNIZED; - } -} - -export function joinTypeToJSON(object: JoinType): string { - switch (object) { - case JoinType.UNSPECIFIED: - return "UNSPECIFIED"; - case JoinType.INNER: - return "INNER"; - case JoinType.LEFT_OUTER: - return "LEFT_OUTER"; - case JoinType.RIGHT_OUTER: - return "RIGHT_OUTER"; - case JoinType.FULL_OUTER: - return "FULL_OUTER"; - case JoinType.LEFT_SEMI: - return "LEFT_SEMI"; - case JoinType.LEFT_ANTI: - return "LEFT_ANTI"; - case JoinType.RIGHT_SEMI: - return "RIGHT_SEMI"; - case JoinType.RIGHT_ANTI: - return "RIGHT_ANTI"; - case JoinType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const RowFormatType = { - ROW_UNSPECIFIED: "ROW_UNSPECIFIED", - JSON: "JSON", - PROTOBUF: "PROTOBUF", - DEBEZIUM_JSON: "DEBEZIUM_JSON", - AVRO: "AVRO", - MAXWELL: "MAXWELL", - CANAL_JSON: "CANAL_JSON", - CSV: "CSV", - NATIVE: "NATIVE", - DEBEZIUM_AVRO: "DEBEZIUM_AVRO", - UPSERT_JSON: "UPSERT_JSON", - UPSERT_AVRO: "UPSERT_AVRO", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type RowFormatType = typeof RowFormatType[keyof typeof RowFormatType]; - -export function rowFormatTypeFromJSON(object: any): RowFormatType { - switch (object) { - case 0: - case "ROW_UNSPECIFIED": - return RowFormatType.ROW_UNSPECIFIED; - case 1: - case "JSON": - return RowFormatType.JSON; - case 2: - case "PROTOBUF": - return RowFormatType.PROTOBUF; - case 3: - case "DEBEZIUM_JSON": - return RowFormatType.DEBEZIUM_JSON; - case 4: - case "AVRO": - return RowFormatType.AVRO; - case 5: - case "MAXWELL": - return RowFormatType.MAXWELL; - case 6: - case "CANAL_JSON": - return RowFormatType.CANAL_JSON; - case 7: - case "CSV": - return RowFormatType.CSV; - case 8: - case "NATIVE": - return RowFormatType.NATIVE; - case 9: - case "DEBEZIUM_AVRO": - return RowFormatType.DEBEZIUM_AVRO; - case 10: - case "UPSERT_JSON": - return RowFormatType.UPSERT_JSON; - case 11: - case "UPSERT_AVRO": - return RowFormatType.UPSERT_AVRO; - case -1: - case "UNRECOGNIZED": - default: - return RowFormatType.UNRECOGNIZED; - } -} - -export function rowFormatTypeToJSON(object: RowFormatType): string { - switch (object) { - case RowFormatType.ROW_UNSPECIFIED: - return "ROW_UNSPECIFIED"; - case RowFormatType.JSON: - return "JSON"; - case RowFormatType.PROTOBUF: - return "PROTOBUF"; - case RowFormatType.DEBEZIUM_JSON: - return "DEBEZIUM_JSON"; - case RowFormatType.AVRO: - return "AVRO"; - case RowFormatType.MAXWELL: - return "MAXWELL"; - case RowFormatType.CANAL_JSON: - return "CANAL_JSON"; - case RowFormatType.CSV: - return "CSV"; - case RowFormatType.NATIVE: - return "NATIVE"; - case RowFormatType.DEBEZIUM_AVRO: - return "DEBEZIUM_AVRO"; - case RowFormatType.UPSERT_JSON: - return "UPSERT_JSON"; - case RowFormatType.UPSERT_AVRO: - return "UPSERT_AVRO"; - case RowFormatType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** Field is a column in the streaming or batch plan. */ -export interface Field { - dataType: DataType | undefined; - name: string; -} - -export interface ColumnDesc { - columnType: DataType | undefined; - columnId: number; - /** - * we store the column name in column desc now just for debug, but in future - * we should store it in ColumnCatalog but not here - */ - name: string; - /** For STRUCT type. */ - fieldDescs: ColumnDesc[]; - /** - * The user-defined type's name. Empty if the column type is a builtin type. - * For example, when the type is created from a protobuf schema file, - * this field will store the message name. - */ - typeName: string; -} - -export interface ColumnCatalog { - columnDesc: ColumnDesc | undefined; - isHidden: boolean; -} - -export interface StorageTableDesc { - tableId: number; - columns: ColumnDesc[]; - /** TODO: may refactor primary key representations */ - pk: ColumnOrder[]; - distKeyIndices: number[]; - retentionSeconds: number; - valueIndices: number[]; - readPrefixLenHint: number; - /** - * Whether the table is versioned. If `true`, column-aware row encoding will be used - * to be compatible with schema changes. - */ - versioned: boolean; -} - -function createBaseField(): Field { - return { dataType: undefined, name: "" }; -} - -export const Field = { - fromJSON(object: any): Field { - return { - dataType: isSet(object.dataType) ? DataType.fromJSON(object.dataType) : undefined, - name: isSet(object.name) ? String(object.name) : "", - }; - }, - - toJSON(message: Field): unknown { - const obj: any = {}; - message.dataType !== undefined && (obj.dataType = message.dataType ? DataType.toJSON(message.dataType) : undefined); - message.name !== undefined && (obj.name = message.name); - return obj; - }, - - fromPartial, I>>(object: I): Field { - const message = createBaseField(); - message.dataType = (object.dataType !== undefined && object.dataType !== null) - ? DataType.fromPartial(object.dataType) - : undefined; - message.name = object.name ?? ""; - return message; - }, -}; - -function createBaseColumnDesc(): ColumnDesc { - return { columnType: undefined, columnId: 0, name: "", fieldDescs: [], typeName: "" }; -} - -export const ColumnDesc = { - fromJSON(object: any): ColumnDesc { - return { - columnType: isSet(object.columnType) ? DataType.fromJSON(object.columnType) : undefined, - columnId: isSet(object.columnId) ? Number(object.columnId) : 0, - name: isSet(object.name) ? String(object.name) : "", - fieldDescs: Array.isArray(object?.fieldDescs) ? object.fieldDescs.map((e: any) => ColumnDesc.fromJSON(e)) : [], - typeName: isSet(object.typeName) ? String(object.typeName) : "", - }; - }, - - toJSON(message: ColumnDesc): unknown { - const obj: any = {}; - message.columnType !== undefined && - (obj.columnType = message.columnType ? DataType.toJSON(message.columnType) : undefined); - message.columnId !== undefined && (obj.columnId = Math.round(message.columnId)); - message.name !== undefined && (obj.name = message.name); - if (message.fieldDescs) { - obj.fieldDescs = message.fieldDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.fieldDescs = []; - } - message.typeName !== undefined && (obj.typeName = message.typeName); - return obj; - }, - - fromPartial, I>>(object: I): ColumnDesc { - const message = createBaseColumnDesc(); - message.columnType = (object.columnType !== undefined && object.columnType !== null) - ? DataType.fromPartial(object.columnType) - : undefined; - message.columnId = object.columnId ?? 0; - message.name = object.name ?? ""; - message.fieldDescs = object.fieldDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.typeName = object.typeName ?? ""; - return message; - }, -}; - -function createBaseColumnCatalog(): ColumnCatalog { - return { columnDesc: undefined, isHidden: false }; -} - -export const ColumnCatalog = { - fromJSON(object: any): ColumnCatalog { - return { - columnDesc: isSet(object.columnDesc) ? ColumnDesc.fromJSON(object.columnDesc) : undefined, - isHidden: isSet(object.isHidden) ? Boolean(object.isHidden) : false, - }; - }, - - toJSON(message: ColumnCatalog): unknown { - const obj: any = {}; - message.columnDesc !== undefined && - (obj.columnDesc = message.columnDesc ? ColumnDesc.toJSON(message.columnDesc) : undefined); - message.isHidden !== undefined && (obj.isHidden = message.isHidden); - return obj; - }, - - fromPartial, I>>(object: I): ColumnCatalog { - const message = createBaseColumnCatalog(); - message.columnDesc = (object.columnDesc !== undefined && object.columnDesc !== null) - ? ColumnDesc.fromPartial(object.columnDesc) - : undefined; - message.isHidden = object.isHidden ?? false; - return message; - }, -}; - -function createBaseStorageTableDesc(): StorageTableDesc { - return { - tableId: 0, - columns: [], - pk: [], - distKeyIndices: [], - retentionSeconds: 0, - valueIndices: [], - readPrefixLenHint: 0, - versioned: false, - }; -} - -export const StorageTableDesc = { - fromJSON(object: any): StorageTableDesc { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnDesc.fromJSON(e)) : [], - pk: Array.isArray(object?.pk) ? object.pk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - distKeyIndices: Array.isArray(object?.distKeyIndices) ? object.distKeyIndices.map((e: any) => Number(e)) : [], - retentionSeconds: isSet(object.retentionSeconds) ? Number(object.retentionSeconds) : 0, - valueIndices: Array.isArray(object?.valueIndices) ? object.valueIndices.map((e: any) => Number(e)) : [], - readPrefixLenHint: isSet(object.readPrefixLenHint) ? Number(object.readPrefixLenHint) : 0, - versioned: isSet(object.versioned) ? Boolean(object.versioned) : false, - }; - }, - - toJSON(message: StorageTableDesc): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pk) { - obj.pk = message.pk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.pk = []; - } - if (message.distKeyIndices) { - obj.distKeyIndices = message.distKeyIndices.map((e) => Math.round(e)); - } else { - obj.distKeyIndices = []; - } - message.retentionSeconds !== undefined && (obj.retentionSeconds = Math.round(message.retentionSeconds)); - if (message.valueIndices) { - obj.valueIndices = message.valueIndices.map((e) => Math.round(e)); - } else { - obj.valueIndices = []; - } - message.readPrefixLenHint !== undefined && (obj.readPrefixLenHint = Math.round(message.readPrefixLenHint)); - message.versioned !== undefined && (obj.versioned = message.versioned); - return obj; - }, - - fromPartial, I>>(object: I): StorageTableDesc { - const message = createBaseStorageTableDesc(); - message.tableId = object.tableId ?? 0; - message.columns = object.columns?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.pk = object.pk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.distKeyIndices = object.distKeyIndices?.map((e) => e) || []; - message.retentionSeconds = object.retentionSeconds ?? 0; - message.valueIndices = object.valueIndices?.map((e) => e) || []; - message.readPrefixLenHint = object.readPrefixLenHint ?? 0; - message.versioned = object.versioned ?? false; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/source.ts b/dashboard/proto/gen/source.ts deleted file mode 100644 index 1d45c28375e74..0000000000000 --- a/dashboard/proto/gen/source.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* eslint-disable */ - -export const protobufPackage = "source"; - -export interface ConnectorSplit { - splitType: string; - encodedSplit: Uint8Array; -} - -export interface ConnectorSplits { - splits: ConnectorSplit[]; -} - -export interface SourceActorInfo { - actorId: number; - splits: ConnectorSplits | undefined; -} - -function createBaseConnectorSplit(): ConnectorSplit { - return { splitType: "", encodedSplit: new Uint8Array() }; -} - -export const ConnectorSplit = { - fromJSON(object: any): ConnectorSplit { - return { - splitType: isSet(object.splitType) ? String(object.splitType) : "", - encodedSplit: isSet(object.encodedSplit) ? bytesFromBase64(object.encodedSplit) : new Uint8Array(), - }; - }, - - toJSON(message: ConnectorSplit): unknown { - const obj: any = {}; - message.splitType !== undefined && (obj.splitType = message.splitType); - message.encodedSplit !== undefined && - (obj.encodedSplit = base64FromBytes( - message.encodedSplit !== undefined ? message.encodedSplit : new Uint8Array(), - )); - return obj; - }, - - fromPartial, I>>(object: I): ConnectorSplit { - const message = createBaseConnectorSplit(); - message.splitType = object.splitType ?? ""; - message.encodedSplit = object.encodedSplit ?? new Uint8Array(); - return message; - }, -}; - -function createBaseConnectorSplits(): ConnectorSplits { - return { splits: [] }; -} - -export const ConnectorSplits = { - fromJSON(object: any): ConnectorSplits { - return { splits: Array.isArray(object?.splits) ? object.splits.map((e: any) => ConnectorSplit.fromJSON(e)) : [] }; - }, - - toJSON(message: ConnectorSplits): unknown { - const obj: any = {}; - if (message.splits) { - obj.splits = message.splits.map((e) => e ? ConnectorSplit.toJSON(e) : undefined); - } else { - obj.splits = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ConnectorSplits { - const message = createBaseConnectorSplits(); - message.splits = object.splits?.map((e) => ConnectorSplit.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSourceActorInfo(): SourceActorInfo { - return { actorId: 0, splits: undefined }; -} - -export const SourceActorInfo = { - fromJSON(object: any): SourceActorInfo { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - splits: isSet(object.splits) ? ConnectorSplits.fromJSON(object.splits) : undefined, - }; - }, - - toJSON(message: SourceActorInfo): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.splits !== undefined && (obj.splits = message.splits ? ConnectorSplits.toJSON(message.splits) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SourceActorInfo { - const message = createBaseSourceActorInfo(); - message.actorId = object.actorId ?? 0; - message.splits = (object.splits !== undefined && object.splits !== null) - ? ConnectorSplits.fromPartial(object.splits) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/stream_plan.ts b/dashboard/proto/gen/stream_plan.ts deleted file mode 100644 index 528c7adaf466c..0000000000000 --- a/dashboard/proto/gen/stream_plan.ts +++ /dev/null @@ -1,4595 +0,0 @@ -/* eslint-disable */ -import { SinkType, sinkTypeFromJSON, sinkTypeToJSON, StreamSourceInfo, Table, WatermarkDesc } from "./catalog"; -import { Buffer, ColumnOrder } from "./common"; -import { Datum, Epoch, IntervalUnit, StreamChunk } from "./data"; -import { AggCall, ExprNode, InputRef, ProjectSetSelectItem } from "./expr"; -import { - ColumnCatalog, - ColumnDesc, - Field, - JoinType, - joinTypeFromJSON, - joinTypeToJSON, - StorageTableDesc, -} from "./plan_common"; -import { ConnectorSplits } from "./source"; - -export const protobufPackage = "stream_plan"; - -export const HandleConflictBehavior = { - NO_CHECK_UNSPECIFIED: "NO_CHECK_UNSPECIFIED", - OVERWRITE: "OVERWRITE", - IGNORE: "IGNORE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type HandleConflictBehavior = typeof HandleConflictBehavior[keyof typeof HandleConflictBehavior]; - -export function handleConflictBehaviorFromJSON(object: any): HandleConflictBehavior { - switch (object) { - case 0: - case "NO_CHECK_UNSPECIFIED": - return HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - case 1: - case "OVERWRITE": - return HandleConflictBehavior.OVERWRITE; - case 2: - case "IGNORE": - return HandleConflictBehavior.IGNORE; - case -1: - case "UNRECOGNIZED": - default: - return HandleConflictBehavior.UNRECOGNIZED; - } -} - -export function handleConflictBehaviorToJSON(object: HandleConflictBehavior): string { - switch (object) { - case HandleConflictBehavior.NO_CHECK_UNSPECIFIED: - return "NO_CHECK_UNSPECIFIED"; - case HandleConflictBehavior.OVERWRITE: - return "OVERWRITE"; - case HandleConflictBehavior.IGNORE: - return "IGNORE"; - case HandleConflictBehavior.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const ChainType = { - CHAIN_UNSPECIFIED: "CHAIN_UNSPECIFIED", - /** CHAIN - CHAIN is corresponding to the chain executor. */ - CHAIN: "CHAIN", - /** REARRANGE - REARRANGE is corresponding to the rearranged chain executor. */ - REARRANGE: "REARRANGE", - /** BACKFILL - BACKFILL is corresponding to the backfill executor. */ - BACKFILL: "BACKFILL", - /** UPSTREAM_ONLY - UPSTREAM_ONLY is corresponding to the chain executor, but doesn't consume the snapshot. */ - UPSTREAM_ONLY: "UPSTREAM_ONLY", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type ChainType = typeof ChainType[keyof typeof ChainType]; - -export function chainTypeFromJSON(object: any): ChainType { - switch (object) { - case 0: - case "CHAIN_UNSPECIFIED": - return ChainType.CHAIN_UNSPECIFIED; - case 1: - case "CHAIN": - return ChainType.CHAIN; - case 2: - case "REARRANGE": - return ChainType.REARRANGE; - case 3: - case "BACKFILL": - return ChainType.BACKFILL; - case 4: - case "UPSTREAM_ONLY": - return ChainType.UPSTREAM_ONLY; - case -1: - case "UNRECOGNIZED": - default: - return ChainType.UNRECOGNIZED; - } -} - -export function chainTypeToJSON(object: ChainType): string { - switch (object) { - case ChainType.CHAIN_UNSPECIFIED: - return "CHAIN_UNSPECIFIED"; - case ChainType.CHAIN: - return "CHAIN"; - case ChainType.REARRANGE: - return "REARRANGE"; - case ChainType.BACKFILL: - return "BACKFILL"; - case ChainType.UPSTREAM_ONLY: - return "UPSTREAM_ONLY"; - case ChainType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const DispatcherType = { - UNSPECIFIED: "UNSPECIFIED", - /** HASH - Dispatch by hash key, hashed by consistent hash. */ - HASH: "HASH", - /** - * BROADCAST - Broadcast to all downstreams. - * - * Note a broadcast cannot be represented as multiple simple dispatchers, since they are - * different when we update dispatchers during scaling. - */ - BROADCAST: "BROADCAST", - /** SIMPLE - Only one downstream. */ - SIMPLE: "SIMPLE", - /** - * NO_SHUFFLE - A special kind of exchange that doesn't involve shuffle. The upstream actor will be directly - * piped into the downstream actor, if there are the same number of actors. If number of actors - * are not the same, should use hash instead. Should be only used when distribution is the same. - */ - NO_SHUFFLE: "NO_SHUFFLE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type DispatcherType = typeof DispatcherType[keyof typeof DispatcherType]; - -export function dispatcherTypeFromJSON(object: any): DispatcherType { - switch (object) { - case 0: - case "UNSPECIFIED": - return DispatcherType.UNSPECIFIED; - case 1: - case "HASH": - return DispatcherType.HASH; - case 2: - case "BROADCAST": - return DispatcherType.BROADCAST; - case 3: - case "SIMPLE": - return DispatcherType.SIMPLE; - case 4: - case "NO_SHUFFLE": - return DispatcherType.NO_SHUFFLE; - case -1: - case "UNRECOGNIZED": - default: - return DispatcherType.UNRECOGNIZED; - } -} - -export function dispatcherTypeToJSON(object: DispatcherType): string { - switch (object) { - case DispatcherType.UNSPECIFIED: - return "UNSPECIFIED"; - case DispatcherType.HASH: - return "HASH"; - case DispatcherType.BROADCAST: - return "BROADCAST"; - case DispatcherType.SIMPLE: - return "SIMPLE"; - case DispatcherType.NO_SHUFFLE: - return "NO_SHUFFLE"; - case DispatcherType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export const FragmentTypeFlag = { - FRAGMENT_UNSPECIFIED: "FRAGMENT_UNSPECIFIED", - SOURCE: "SOURCE", - MVIEW: "MVIEW", - SINK: "SINK", - NOW: "NOW", - CHAIN_NODE: "CHAIN_NODE", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type FragmentTypeFlag = typeof FragmentTypeFlag[keyof typeof FragmentTypeFlag]; - -export function fragmentTypeFlagFromJSON(object: any): FragmentTypeFlag { - switch (object) { - case 0: - case "FRAGMENT_UNSPECIFIED": - return FragmentTypeFlag.FRAGMENT_UNSPECIFIED; - case 1: - case "SOURCE": - return FragmentTypeFlag.SOURCE; - case 2: - case "MVIEW": - return FragmentTypeFlag.MVIEW; - case 4: - case "SINK": - return FragmentTypeFlag.SINK; - case 8: - case "NOW": - return FragmentTypeFlag.NOW; - case 16: - case "CHAIN_NODE": - return FragmentTypeFlag.CHAIN_NODE; - case -1: - case "UNRECOGNIZED": - default: - return FragmentTypeFlag.UNRECOGNIZED; - } -} - -export function fragmentTypeFlagToJSON(object: FragmentTypeFlag): string { - switch (object) { - case FragmentTypeFlag.FRAGMENT_UNSPECIFIED: - return "FRAGMENT_UNSPECIFIED"; - case FragmentTypeFlag.SOURCE: - return "SOURCE"; - case FragmentTypeFlag.MVIEW: - return "MVIEW"; - case FragmentTypeFlag.SINK: - return "SINK"; - case FragmentTypeFlag.NOW: - return "NOW"; - case FragmentTypeFlag.CHAIN_NODE: - return "CHAIN_NODE"; - case FragmentTypeFlag.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface AddMutation { - /** New dispatchers for each actor. */ - actorDispatchers: { [key: number]: AddMutation_Dispatchers }; - /** - * We may embed a source change split mutation here. - * TODO: we may allow multiple mutations in a single barrier. - */ - actorSplits: { [key: number]: ConnectorSplits }; -} - -export interface AddMutation_Dispatchers { - dispatchers: Dispatcher[]; -} - -export interface AddMutation_ActorDispatchersEntry { - key: number; - value: AddMutation_Dispatchers | undefined; -} - -export interface AddMutation_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface StopMutation { - actors: number[]; -} - -export interface UpdateMutation { - /** Dispatcher updates. */ - dispatcherUpdate: UpdateMutation_DispatcherUpdate[]; - /** Merge updates. */ - mergeUpdate: UpdateMutation_MergeUpdate[]; - /** Vnode bitmap updates for each actor. */ - actorVnodeBitmapUpdate: { [key: number]: Buffer }; - /** All actors to be dropped in this update. */ - droppedActors: number[]; - /** Source updates. */ - actorSplits: { [key: number]: ConnectorSplits }; -} - -export interface UpdateMutation_DispatcherUpdate { - /** Dispatcher can be uniquely identified by a combination of actor id and dispatcher id. */ - actorId: number; - dispatcherId: number; - /** - * The hash mapping for consistent hash. - * For dispatcher types other than HASH, this is ignored. - */ - hashMapping: - | ActorMapping - | undefined; - /** Added downstream actors. */ - addedDownstreamActorId: number[]; - /** Removed downstream actors. */ - removedDownstreamActorId: number[]; -} - -export interface UpdateMutation_MergeUpdate { - /** Merge executor can be uniquely identified by a combination of actor id and upstream fragment id. */ - actorId: number; - upstreamFragmentId: number; - /** - * - For scaling, this is always `None`. - * - For plan change, the upstream fragment will be changed to a new one, and this will be `Some`. - * In this case, all the upstream actors should be removed and replaced by the `new` ones. - */ - newUpstreamFragmentId?: - | number - | undefined; - /** Added upstream actors. */ - addedUpstreamActorId: number[]; - /** Removed upstream actors. */ - removedUpstreamActorId: number[]; -} - -export interface UpdateMutation_ActorVnodeBitmapUpdateEntry { - key: number; - value: Buffer | undefined; -} - -export interface UpdateMutation_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface SourceChangeSplitMutation { - actorSplits: { [key: number]: ConnectorSplits }; -} - -export interface SourceChangeSplitMutation_ActorSplitsEntry { - key: number; - value: ConnectorSplits | undefined; -} - -export interface PauseMutation { -} - -export interface ResumeMutation { -} - -export interface Barrier { - epoch: Epoch | undefined; - mutation?: - | { $case: "add"; add: AddMutation } - | { $case: "stop"; stop: StopMutation } - | { $case: "update"; update: UpdateMutation } - | { $case: "splits"; splits: SourceChangeSplitMutation } - | { $case: "pause"; pause: PauseMutation } - | { $case: "resume"; resume: ResumeMutation }; - /** Used for tracing. */ - span: Uint8Array; - /** Whether this barrier do checkpoint */ - checkpoint: boolean; - /** Record the actors that the barrier has passed. Only used for debugging. */ - passedActors: number[]; -} - -export interface Watermark { - /** The reference to the watermark column in the stream's schema. */ - column: - | InputRef - | undefined; - /** The watermark value, there will be no record having a greater value in the watermark column. */ - val: Datum | undefined; -} - -export interface StreamMessage { - streamMessage?: { $case: "streamChunk"; streamChunk: StreamChunk } | { $case: "barrier"; barrier: Barrier } | { - $case: "watermark"; - watermark: Watermark; - }; -} - -/** Hash mapping for compute node. Stores mapping from virtual node to actor id. */ -export interface ActorMapping { - originalIndices: number[]; - data: number[]; -} - -export interface StreamSource { - sourceId: number; - stateTable: Table | undefined; - rowIdIndex?: number | undefined; - columns: ColumnCatalog[]; - pkColumnIds: number[]; - properties: { [key: string]: string }; - info: StreamSourceInfo | undefined; - sourceName: string; -} - -export interface StreamSource_PropertiesEntry { - key: string; - value: string; -} - -/** - * The executor only for receiving barrier from the meta service. It always resides in the leaves - * of the streaming graph. - */ -export interface BarrierRecvNode { -} - -export interface SourceNode { - /** - * The source node can contain either a stream source or nothing. So here we extract all - * information about stream source to a message, and here it will be an `Option` in Rust. - */ - sourceInner: StreamSource | undefined; -} - -export interface SinkDesc { - id: number; - name: string; - definition: string; - columns: ColumnDesc[]; - pk: ColumnOrder[]; - streamKey: number[]; - distributionKey: number[]; - properties: { [key: string]: string }; - sinkType: SinkType; -} - -export interface SinkDesc_PropertiesEntry { - key: string; - value: string; -} - -export interface SinkNode { - sinkDesc: SinkDesc | undefined; -} - -export interface ProjectNode { - selectList: ExprNode[]; - /** - * this two field is expressing a list of usize pair, which means when project receives a - * watermark with `watermark_input_key[i]` column index, it should derive a new watermark - * with `watermark_output_key[i]`th expression - */ - watermarkInputKey: number[]; - watermarkOutputKey: number[]; -} - -export interface FilterNode { - searchCondition: ExprNode | undefined; -} - -/** - * A materialized view is regarded as a table. - * In addition, we also specify primary key to MV for efficient point lookup during update and deletion. - * - * The node will be used for both create mv and create index. - * - When creating mv, `pk == distribution_key == column_orders`. - * - When creating index, `column_orders` will contain both - * arrange columns and pk columns, while distribution key will be arrange columns. - */ -export interface MaterializeNode { - tableId: number; - /** Column indexes and orders of primary key. */ - columnOrders: ColumnOrder[]; - /** Used for internal table states. */ - table: - | Table - | undefined; - /** Used to handle pk conflict, open it when upstream executor is source executor. */ - handlePkConflictBehavior: HandleConflictBehavior; -} - -export interface AggCallState { - inner?: { $case: "resultValueState"; resultValueState: AggCallState_ResultValueState } | { - $case: "tableState"; - tableState: AggCallState_TableState; - } | { $case: "materializedInputState"; materializedInputState: AggCallState_MaterializedInputState }; -} - -/** use the one column of stream's result table as the AggCall's state, used for count/sum/append-only extreme. */ -export interface AggCallState_ResultValueState { -} - -/** use untransformed result as the AggCall's state, used for append-only approx count distinct. */ -export interface AggCallState_TableState { - table: Table | undefined; -} - -/** use the some column of the Upstream's materialization as the AggCall's state, used for extreme/string_agg/array_agg. */ -export interface AggCallState_MaterializedInputState { - table: - | Table - | undefined; - /** for constructing state table column mapping */ - includedUpstreamIndices: number[]; - tableValueIndices: number[]; -} - -export interface SimpleAggNode { - aggCalls: AggCall[]; - /** Only used for local simple agg, not used for global simple agg. */ - distributionKey: number[]; - aggCallStates: AggCallState[]; - resultTable: - | Table - | undefined; - /** - * Whether to optimize for append only stream. - * It is true when the input is append-only - */ - isAppendOnly: boolean; - distinctDedupTables: { [key: number]: Table }; - rowCountIndex: number; -} - -export interface SimpleAggNode_DistinctDedupTablesEntry { - key: number; - value: Table | undefined; -} - -export interface HashAggNode { - groupKey: number[]; - aggCalls: AggCall[]; - aggCallStates: AggCallState[]; - resultTable: - | Table - | undefined; - /** - * Whether to optimize for append only stream. - * It is true when the input is append-only - */ - isAppendOnly: boolean; - distinctDedupTables: { [key: number]: Table }; - rowCountIndex: number; -} - -export interface HashAggNode_DistinctDedupTablesEntry { - key: number; - value: Table | undefined; -} - -export interface TopNNode { - /** 0 means no limit as limit of 0 means this node should be optimized away */ - limit: number; - offset: number; - table: Table | undefined; - orderBy: ColumnOrder[]; - withTies: boolean; -} - -export interface GroupTopNNode { - /** 0 means no limit as limit of 0 means this node should be optimized away */ - limit: number; - offset: number; - groupKey: number[]; - table: Table | undefined; - orderBy: ColumnOrder[]; - withTies: boolean; -} - -export interface HashJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - condition: - | ExprNode - | undefined; - /** Used for internal table states. */ - leftTable: - | Table - | undefined; - /** Used for internal table states. */ - rightTable: - | Table - | undefined; - /** Used for internal table states. */ - leftDegreeTable: - | Table - | undefined; - /** Used for internal table states. */ - rightDegreeTable: - | Table - | undefined; - /** The output indices of current node */ - outputIndices: number[]; - /** - * Left deduped input pk indices. The pk of the left_table and - * left_degree_table is [left_join_key | left_deduped_input_pk_indices] - * and is expected to be the shortest key which starts with - * the join key and satisfies unique constrain. - */ - leftDedupedInputPkIndices: number[]; - /** - * Right deduped input pk indices. The pk of the right_table and - * right_degree_table is [right_join_key | right_deduped_input_pk_indices] - * and is expected to be the shortest key which starts with - * the join key and satisfies unique constrain. - */ - rightDedupedInputPkIndices: number[]; - nullSafe: boolean[]; - /** - * Whether to optimize for append only stream. - * It is true when the input is append-only - */ - isAppendOnly: boolean; -} - -export interface TemporalJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - nullSafe: boolean[]; - condition: - | ExprNode - | undefined; - /** The output indices of current node */ - outputIndices: number[]; - /** The table desc of the lookup side table. */ - tableDesc: - | StorageTableDesc - | undefined; - /** The output indices of the lookup side table */ - tableOutputIndices: number[]; -} - -export interface DynamicFilterNode { - leftKey: number; - /** Must be one of <, <=, >, >= */ - condition: - | ExprNode - | undefined; - /** Left table stores all states with predicate possibly not NULL. */ - leftTable: - | Table - | undefined; - /** Right table stores single value from RHS of predicate. */ - rightTable: Table | undefined; -} - -/** - * Delta join with two indexes. This is a pseudo plan node generated on frontend. On meta - * service, it will be rewritten into lookup joins. - */ -export interface DeltaIndexJoinNode { - joinType: JoinType; - leftKey: number[]; - rightKey: number[]; - condition: - | ExprNode - | undefined; - /** Table id of the left index. */ - leftTableId: number; - /** Table id of the right index. */ - rightTableId: number; - /** Info about the left index */ - leftInfo: - | ArrangementInfo - | undefined; - /** Info about the right index */ - rightInfo: - | ArrangementInfo - | undefined; - /** the output indices of current node */ - outputIndices: number[]; -} - -export interface HopWindowNode { - timeCol: number; - windowSlide: IntervalUnit | undefined; - windowSize: IntervalUnit | undefined; - outputIndices: number[]; - windowStartExprs: ExprNode[]; - windowEndExprs: ExprNode[]; -} - -export interface MergeNode { - upstreamActorId: number[]; - upstreamFragmentId: number; - /** - * Type of the upstream dispatcher. If there's always one upstream according to this - * type, the compute node may use the `ReceiverExecutor` as an optimization. - */ - upstreamDispatcherType: DispatcherType; - /** The schema of input columns. TODO: remove this field. */ - fields: Field[]; -} - -/** - * passed from frontend to meta, used by fragmenter to generate `MergeNode` - * and maybe `DispatcherNode` later. - */ -export interface ExchangeNode { - strategy: DispatchStrategy | undefined; -} - -/** - * ChainNode is used for mv on mv. - * ChainNode is like a "UNION" on mv snapshot and streaming. So it takes two inputs with fixed order: - * 1. MergeNode (as a placeholder) for streaming read. - * 2. BatchPlanNode for snapshot read. - */ -export interface ChainNode { - tableId: number; - /** - * The columns from the upstream table that'll be internally required by this chain node. - * - For non-backfill chain node, it's the same as the output columns. - * - For backfill chain node, there're additionally primary key columns. - */ - upstreamColumnIds: number[]; - /** - * The columns to be output by this chain node. The index is based on the internal required columns. - * - For non-backfill chain node, it's simply all the columns. - * - For backfill chain node, this strips the primary key columns if they're unnecessary. - */ - outputIndices: number[]; - /** - * Generally, the barrier needs to be rearranged during the MV creation process, so that data can - * be flushed to shared buffer periodically, instead of making the first epoch from batch query extra - * large. However, in some cases, e.g., shared state, the barrier cannot be rearranged in ChainNode. - * ChainType is used to decide which implementation for the ChainNode. - */ - chainType: ChainType; - /** The upstream materialized view info used by backfill. */ - tableDesc: StorageTableDesc | undefined; -} - -/** - * BatchPlanNode is used for mv on mv snapshot read. - * BatchPlanNode is supposed to carry a batch plan that can be optimized with the streaming plan_common. - * Currently, streaming to batch push down is not yet supported, BatchPlanNode is simply a table scan. - */ -export interface BatchPlanNode { - tableDesc: StorageTableDesc | undefined; - columnIds: number[]; -} - -export interface ArrangementInfo { - /** - * Order key of the arrangement, including order by columns and pk from the materialize - * executor. - */ - arrangeKeyOrders: ColumnOrder[]; - /** Column descs of the arrangement */ - columnDescs: ColumnDesc[]; - /** Used to build storage table by stream lookup join of delta join. */ - tableDesc: StorageTableDesc | undefined; -} - -/** - * Special node for shared state, which will only be produced in fragmenter. ArrangeNode will - * produce a special Materialize executor, which materializes data for downstream to query. - */ -export interface ArrangeNode { - /** Info about the arrangement */ - tableInfo: - | ArrangementInfo - | undefined; - /** Hash key of the materialize node, which is a subset of pk. */ - distributionKey: number[]; - /** Used for internal table states. */ - table: - | Table - | undefined; - /** Used to control whether doing sanity check, open it when upstream executor is source executor. */ - handlePkConflictBehavior: HandleConflictBehavior; -} - -/** Special node for shared state. LookupNode will join an arrangement with a stream. */ -export interface LookupNode { - /** Join key of the arrangement side */ - arrangeKey: number[]; - /** Join key of the stream side */ - streamKey: number[]; - /** Whether to join the current epoch of arrangement */ - useCurrentEpoch: boolean; - /** - * Sometimes we need to re-order the output data to meet the requirement of schema. - * By default, lookup executor will produce ``. We - * will then apply the column mapping to the combined result. - */ - columnMapping: number[]; - arrangementTableId?: - | { $case: "tableId"; tableId: number } - | { $case: "indexId"; indexId: number }; - /** Info about the arrangement */ - arrangementTableInfo: ArrangementInfo | undefined; -} - -/** WatermarkFilter needs to filter the upstream data by the water mark. */ -export interface WatermarkFilterNode { - /** The watermark descs */ - watermarkDescs: WatermarkDesc[]; - /** The tables used to persist watermarks, the key is vnode. */ - tables: Table[]; -} - -/** Acts like a merger, but on different inputs. */ -export interface UnionNode { -} - -/** Special node for shared state. Merge and align barrier from upstreams. Pipe inputs in order. */ -export interface LookupUnionNode { - order: number[]; -} - -export interface ExpandNode { - columnSubsets: ExpandNode_Subset[]; -} - -export interface ExpandNode_Subset { - columnIndices: number[]; -} - -export interface ProjectSetNode { - selectList: ProjectSetSelectItem[]; -} - -/** Sorts inputs and outputs ordered data based on watermark. */ -export interface SortNode { - /** Persists data above watermark. */ - stateTable: - | Table - | undefined; - /** Column index of watermark to perform sorting. */ - sortColumnIndex: number; -} - -/** Merges two streams from streaming and batch for data manipulation. */ -export interface DmlNode { - /** Id of the table on which DML performs. */ - tableId: number; - /** Version of the table. */ - tableVersionId: number; - /** Column descriptions of the table. */ - columnDescs: ColumnDesc[]; -} - -export interface RowIdGenNode { - rowIdIndex: number; -} - -export interface NowNode { - /** Persists emitted 'now'. */ - stateTable: Table | undefined; -} - -export interface StreamNode { - nodeBody?: - | { $case: "source"; source: SourceNode } - | { $case: "project"; project: ProjectNode } - | { $case: "filter"; filter: FilterNode } - | { $case: "materialize"; materialize: MaterializeNode } - | { $case: "localSimpleAgg"; localSimpleAgg: SimpleAggNode } - | { $case: "globalSimpleAgg"; globalSimpleAgg: SimpleAggNode } - | { $case: "hashAgg"; hashAgg: HashAggNode } - | { $case: "appendOnlyTopN"; appendOnlyTopN: TopNNode } - | { $case: "hashJoin"; hashJoin: HashJoinNode } - | { $case: "topN"; topN: TopNNode } - | { $case: "hopWindow"; hopWindow: HopWindowNode } - | { $case: "merge"; merge: MergeNode } - | { $case: "exchange"; exchange: ExchangeNode } - | { $case: "chain"; chain: ChainNode } - | { $case: "batchPlan"; batchPlan: BatchPlanNode } - | { $case: "lookup"; lookup: LookupNode } - | { $case: "arrange"; arrange: ArrangeNode } - | { $case: "lookupUnion"; lookupUnion: LookupUnionNode } - | { $case: "union"; union: UnionNode } - | { $case: "deltaIndexJoin"; deltaIndexJoin: DeltaIndexJoinNode } - | { $case: "sink"; sink: SinkNode } - | { $case: "expand"; expand: ExpandNode } - | { $case: "dynamicFilter"; dynamicFilter: DynamicFilterNode } - | { $case: "projectSet"; projectSet: ProjectSetNode } - | { $case: "groupTopN"; groupTopN: GroupTopNNode } - | { $case: "sort"; sort: SortNode } - | { $case: "watermarkFilter"; watermarkFilter: WatermarkFilterNode } - | { $case: "dml"; dml: DmlNode } - | { $case: "rowIdGen"; rowIdGen: RowIdGenNode } - | { $case: "now"; now: NowNode } - | { $case: "appendOnlyGroupTopN"; appendOnlyGroupTopN: GroupTopNNode } - | { $case: "temporalJoin"; temporalJoin: TemporalJoinNode } - | { $case: "barrierRecv"; barrierRecv: BarrierRecvNode }; - /** - * The id for the operator. This is local per mview. - * TODO: should better be a uint32. - */ - operatorId: number; - /** Child node in plan aka. upstream nodes in the streaming DAG */ - input: StreamNode[]; - streamKey: number[]; - appendOnly: boolean; - identity: string; - /** The schema of the plan node */ - fields: Field[]; -} - -/** - * The property of an edge in the fragment graph. - * This is essientially a "logical" version of `Dispatcher`. See the doc of `Dispatcher` for more details. - */ -export interface DispatchStrategy { - type: DispatcherType; - distKeyIndices: number[]; - outputIndices: number[]; -} - -/** - * A dispatcher redistribute messages. - * We encode both the type and other usage information in the proto. - */ -export interface Dispatcher { - type: DispatcherType; - /** - * Indices of the columns to be used for hashing. - * For dispatcher types other than HASH, this is ignored. - */ - distKeyIndices: number[]; - /** - * Indices of the columns to output. - * In most cases, this contains all columns in the input. But for some cases like MV on MV or - * schema change, we may only output a subset of the columns. - */ - outputIndices: number[]; - /** - * The hash mapping for consistent hash. - * For dispatcher types other than HASH, this is ignored. - */ - hashMapping: - | ActorMapping - | undefined; - /** - * Dispatcher can be uniquely identified by a combination of actor id and dispatcher id. - * This is exactly the same as its downstream fragment id. - */ - dispatcherId: number; - /** Number of downstreams decides how many endpoints a dispatcher should dispatch. */ - downstreamActorId: number[]; -} - -/** A StreamActor is a running fragment of the overall stream graph, */ -export interface StreamActor { - actorId: number; - fragmentId: number; - nodes: StreamNode | undefined; - dispatcher: Dispatcher[]; - /** - * The actors that send messages to this actor. - * Note that upstream actor ids are also stored in the proto of merge nodes. - * It is painstaking to traverse through the node tree and get upstream actor id from the root StreamNode. - * We duplicate the information here to ease the parsing logic in stream manager. - */ - upstreamActorId: number[]; - /** - * Vnodes that the executors in this actor own. - * If the fragment is a singleton, this field will not be set and leave a `None`. - */ - vnodeBitmap: - | Buffer - | undefined; - /** The SQL definition of this materialized view. Used for debugging only. */ - mviewDefinition: string; -} - -/** The environment associated with a stream plan */ -export interface StreamEnvironment { - /** The timezone associated with the streaming plan. Only applies to MV for now. */ - timezone: string; -} - -export interface StreamFragmentGraph { - /** all the fragments in the graph. */ - fragments: { [key: number]: StreamFragmentGraph_StreamFragment }; - /** edges between fragments. */ - edges: StreamFragmentGraph_StreamFragmentEdge[]; - dependentRelationIds: number[]; - tableIdsCnt: number; - env: - | StreamEnvironment - | undefined; - /** If none, default parallelism will be applied. */ - parallelism: StreamFragmentGraph_Parallelism | undefined; -} - -export interface StreamFragmentGraph_StreamFragment { - /** 0-based on frontend, and will be rewritten to global id on meta. */ - fragmentId: number; - /** root stream node in this fragment. */ - node: - | StreamNode - | undefined; - /** Bitwise-OR of FragmentTypeFlags */ - fragmentTypeMask: number; - /** - * Mark whether this fragment requires exactly one actor. - * Note: if this is `false`, the fragment may still be a singleton according to the scheduler. - * One should check `meta.Fragment.distribution_type` for the final result. - */ - requiresSingleton: boolean; - /** Number of table ids (stateful states) for this fragment. */ - tableIdsCnt: number; - /** Mark the upstream table ids of this fragment, Used for fragments with `Chain`s. */ - upstreamTableIds: number[]; -} - -export interface StreamFragmentGraph_StreamFragmentEdge { - /** Dispatch strategy for the fragment. */ - dispatchStrategy: - | DispatchStrategy - | undefined; - /** - * A unique identifier of this edge. Generally it should be exchange node's operator id. When - * rewriting fragments into delta joins or when inserting 1-to-1 exchange, there will be - * virtual links generated. - */ - linkId: number; - upstreamId: number; - downstreamId: number; -} - -export interface StreamFragmentGraph_Parallelism { - parallelism: number; -} - -export interface StreamFragmentGraph_FragmentsEntry { - key: number; - value: StreamFragmentGraph_StreamFragment | undefined; -} - -function createBaseAddMutation(): AddMutation { - return { actorDispatchers: {}, actorSplits: {} }; -} - -export const AddMutation = { - fromJSON(object: any): AddMutation { - return { - actorDispatchers: isObject(object.actorDispatchers) - ? Object.entries(object.actorDispatchers).reduce<{ [key: number]: AddMutation_Dispatchers }>( - (acc, [key, value]) => { - acc[Number(key)] = AddMutation_Dispatchers.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: AddMutation): unknown { - const obj: any = {}; - obj.actorDispatchers = {}; - if (message.actorDispatchers) { - Object.entries(message.actorDispatchers).forEach(([k, v]) => { - obj.actorDispatchers[k] = AddMutation_Dispatchers.toJSON(v); - }); - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): AddMutation { - const message = createBaseAddMutation(); - message.actorDispatchers = Object.entries(object.actorDispatchers ?? {}).reduce< - { [key: number]: AddMutation_Dispatchers } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = AddMutation_Dispatchers.fromPartial(value); - } - return acc; - }, {}); - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseAddMutation_Dispatchers(): AddMutation_Dispatchers { - return { dispatchers: [] }; -} - -export const AddMutation_Dispatchers = { - fromJSON(object: any): AddMutation_Dispatchers { - return { - dispatchers: Array.isArray(object?.dispatchers) ? object.dispatchers.map((e: any) => Dispatcher.fromJSON(e)) : [], - }; - }, - - toJSON(message: AddMutation_Dispatchers): unknown { - const obj: any = {}; - if (message.dispatchers) { - obj.dispatchers = message.dispatchers.map((e) => e ? Dispatcher.toJSON(e) : undefined); - } else { - obj.dispatchers = []; - } - return obj; - }, - - fromPartial, I>>(object: I): AddMutation_Dispatchers { - const message = createBaseAddMutation_Dispatchers(); - message.dispatchers = object.dispatchers?.map((e) => Dispatcher.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseAddMutation_ActorDispatchersEntry(): AddMutation_ActorDispatchersEntry { - return { key: 0, value: undefined }; -} - -export const AddMutation_ActorDispatchersEntry = { - fromJSON(object: any): AddMutation_ActorDispatchersEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? AddMutation_Dispatchers.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: AddMutation_ActorDispatchersEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? AddMutation_Dispatchers.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): AddMutation_ActorDispatchersEntry { - const message = createBaseAddMutation_ActorDispatchersEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? AddMutation_Dispatchers.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseAddMutation_ActorSplitsEntry(): AddMutation_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const AddMutation_ActorSplitsEntry = { - fromJSON(object: any): AddMutation_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: AddMutation_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AddMutation_ActorSplitsEntry { - const message = createBaseAddMutation_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseStopMutation(): StopMutation { - return { actors: [] }; -} - -export const StopMutation = { - fromJSON(object: any): StopMutation { - return { actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: StopMutation): unknown { - const obj: any = {}; - if (message.actors) { - obj.actors = message.actors.map((e) => Math.round(e)); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StopMutation { - const message = createBaseStopMutation(); - message.actors = object.actors?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateMutation(): UpdateMutation { - return { dispatcherUpdate: [], mergeUpdate: [], actorVnodeBitmapUpdate: {}, droppedActors: [], actorSplits: {} }; -} - -export const UpdateMutation = { - fromJSON(object: any): UpdateMutation { - return { - dispatcherUpdate: Array.isArray(object?.dispatcherUpdate) - ? object.dispatcherUpdate.map((e: any) => UpdateMutation_DispatcherUpdate.fromJSON(e)) - : [], - mergeUpdate: Array.isArray(object?.mergeUpdate) - ? object.mergeUpdate.map((e: any) => UpdateMutation_MergeUpdate.fromJSON(e)) - : [], - actorVnodeBitmapUpdate: isObject(object.actorVnodeBitmapUpdate) - ? Object.entries(object.actorVnodeBitmapUpdate).reduce<{ [key: number]: Buffer }>((acc, [key, value]) => { - acc[Number(key)] = Buffer.fromJSON(value); - return acc; - }, {}) - : {}, - droppedActors: Array.isArray(object?.droppedActors) - ? object.droppedActors.map((e: any) => Number(e)) - : [], - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: UpdateMutation): unknown { - const obj: any = {}; - if (message.dispatcherUpdate) { - obj.dispatcherUpdate = message.dispatcherUpdate.map((e) => - e ? UpdateMutation_DispatcherUpdate.toJSON(e) : undefined - ); - } else { - obj.dispatcherUpdate = []; - } - if (message.mergeUpdate) { - obj.mergeUpdate = message.mergeUpdate.map((e) => e ? UpdateMutation_MergeUpdate.toJSON(e) : undefined); - } else { - obj.mergeUpdate = []; - } - obj.actorVnodeBitmapUpdate = {}; - if (message.actorVnodeBitmapUpdate) { - Object.entries(message.actorVnodeBitmapUpdate).forEach(([k, v]) => { - obj.actorVnodeBitmapUpdate[k] = Buffer.toJSON(v); - }); - } - if (message.droppedActors) { - obj.droppedActors = message.droppedActors.map((e) => Math.round(e)); - } else { - obj.droppedActors = []; - } - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateMutation { - const message = createBaseUpdateMutation(); - message.dispatcherUpdate = object.dispatcherUpdate?.map((e) => UpdateMutation_DispatcherUpdate.fromPartial(e)) || - []; - message.mergeUpdate = object.mergeUpdate?.map((e) => UpdateMutation_MergeUpdate.fromPartial(e)) || []; - message.actorVnodeBitmapUpdate = Object.entries(object.actorVnodeBitmapUpdate ?? {}).reduce< - { [key: number]: Buffer } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Buffer.fromPartial(value); - } - return acc; - }, {}); - message.droppedActors = object.droppedActors?.map((e) => e) || []; - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseUpdateMutation_DispatcherUpdate(): UpdateMutation_DispatcherUpdate { - return { - actorId: 0, - dispatcherId: 0, - hashMapping: undefined, - addedDownstreamActorId: [], - removedDownstreamActorId: [], - }; -} - -export const UpdateMutation_DispatcherUpdate = { - fromJSON(object: any): UpdateMutation_DispatcherUpdate { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - dispatcherId: isSet(object.dispatcherId) ? Number(object.dispatcherId) : 0, - hashMapping: isSet(object.hashMapping) ? ActorMapping.fromJSON(object.hashMapping) : undefined, - addedDownstreamActorId: Array.isArray(object?.addedDownstreamActorId) - ? object.addedDownstreamActorId.map((e: any) => Number(e)) - : [], - removedDownstreamActorId: Array.isArray(object?.removedDownstreamActorId) - ? object.removedDownstreamActorId.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: UpdateMutation_DispatcherUpdate): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.dispatcherId !== undefined && (obj.dispatcherId = Math.round(message.dispatcherId)); - message.hashMapping !== undefined && - (obj.hashMapping = message.hashMapping ? ActorMapping.toJSON(message.hashMapping) : undefined); - if (message.addedDownstreamActorId) { - obj.addedDownstreamActorId = message.addedDownstreamActorId.map((e) => Math.round(e)); - } else { - obj.addedDownstreamActorId = []; - } - if (message.removedDownstreamActorId) { - obj.removedDownstreamActorId = message.removedDownstreamActorId.map((e) => Math.round(e)); - } else { - obj.removedDownstreamActorId = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): UpdateMutation_DispatcherUpdate { - const message = createBaseUpdateMutation_DispatcherUpdate(); - message.actorId = object.actorId ?? 0; - message.dispatcherId = object.dispatcherId ?? 0; - message.hashMapping = (object.hashMapping !== undefined && object.hashMapping !== null) - ? ActorMapping.fromPartial(object.hashMapping) - : undefined; - message.addedDownstreamActorId = object.addedDownstreamActorId?.map((e) => e) || []; - message.removedDownstreamActorId = object.removedDownstreamActorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateMutation_MergeUpdate(): UpdateMutation_MergeUpdate { - return { - actorId: 0, - upstreamFragmentId: 0, - newUpstreamFragmentId: undefined, - addedUpstreamActorId: [], - removedUpstreamActorId: [], - }; -} - -export const UpdateMutation_MergeUpdate = { - fromJSON(object: any): UpdateMutation_MergeUpdate { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - upstreamFragmentId: isSet(object.upstreamFragmentId) ? Number(object.upstreamFragmentId) : 0, - newUpstreamFragmentId: isSet(object.newUpstreamFragmentId) ? Number(object.newUpstreamFragmentId) : undefined, - addedUpstreamActorId: Array.isArray(object?.addedUpstreamActorId) - ? object.addedUpstreamActorId.map((e: any) => Number(e)) - : [], - removedUpstreamActorId: Array.isArray(object?.removedUpstreamActorId) - ? object.removedUpstreamActorId.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: UpdateMutation_MergeUpdate): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.upstreamFragmentId !== undefined && (obj.upstreamFragmentId = Math.round(message.upstreamFragmentId)); - message.newUpstreamFragmentId !== undefined && - (obj.newUpstreamFragmentId = Math.round(message.newUpstreamFragmentId)); - if (message.addedUpstreamActorId) { - obj.addedUpstreamActorId = message.addedUpstreamActorId.map((e) => Math.round(e)); - } else { - obj.addedUpstreamActorId = []; - } - if (message.removedUpstreamActorId) { - obj.removedUpstreamActorId = message.removedUpstreamActorId.map((e) => Math.round(e)); - } else { - obj.removedUpstreamActorId = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateMutation_MergeUpdate { - const message = createBaseUpdateMutation_MergeUpdate(); - message.actorId = object.actorId ?? 0; - message.upstreamFragmentId = object.upstreamFragmentId ?? 0; - message.newUpstreamFragmentId = object.newUpstreamFragmentId ?? undefined; - message.addedUpstreamActorId = object.addedUpstreamActorId?.map((e) => e) || []; - message.removedUpstreamActorId = object.removedUpstreamActorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateMutation_ActorVnodeBitmapUpdateEntry(): UpdateMutation_ActorVnodeBitmapUpdateEntry { - return { key: 0, value: undefined }; -} - -export const UpdateMutation_ActorVnodeBitmapUpdateEntry = { - fromJSON(object: any): UpdateMutation_ActorVnodeBitmapUpdateEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Buffer.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: UpdateMutation_ActorVnodeBitmapUpdateEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Buffer.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): UpdateMutation_ActorVnodeBitmapUpdateEntry { - const message = createBaseUpdateMutation_ActorVnodeBitmapUpdateEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? Buffer.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseUpdateMutation_ActorSplitsEntry(): UpdateMutation_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const UpdateMutation_ActorSplitsEntry = { - fromJSON(object: any): UpdateMutation_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: UpdateMutation_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): UpdateMutation_ActorSplitsEntry { - const message = createBaseUpdateMutation_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseSourceChangeSplitMutation(): SourceChangeSplitMutation { - return { actorSplits: {} }; -} - -export const SourceChangeSplitMutation = { - fromJSON(object: any): SourceChangeSplitMutation { - return { - actorSplits: isObject(object.actorSplits) - ? Object.entries(object.actorSplits).reduce<{ [key: number]: ConnectorSplits }>((acc, [key, value]) => { - acc[Number(key)] = ConnectorSplits.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: SourceChangeSplitMutation): unknown { - const obj: any = {}; - obj.actorSplits = {}; - if (message.actorSplits) { - Object.entries(message.actorSplits).forEach(([k, v]) => { - obj.actorSplits[k] = ConnectorSplits.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>(object: I): SourceChangeSplitMutation { - const message = createBaseSourceChangeSplitMutation(); - message.actorSplits = Object.entries(object.actorSplits ?? {}).reduce<{ [key: number]: ConnectorSplits }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = ConnectorSplits.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseSourceChangeSplitMutation_ActorSplitsEntry(): SourceChangeSplitMutation_ActorSplitsEntry { - return { key: 0, value: undefined }; -} - -export const SourceChangeSplitMutation_ActorSplitsEntry = { - fromJSON(object: any): SourceChangeSplitMutation_ActorSplitsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? ConnectorSplits.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: SourceChangeSplitMutation_ActorSplitsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? ConnectorSplits.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SourceChangeSplitMutation_ActorSplitsEntry { - const message = createBaseSourceChangeSplitMutation_ActorSplitsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? ConnectorSplits.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBasePauseMutation(): PauseMutation { - return {}; -} - -export const PauseMutation = { - fromJSON(_: any): PauseMutation { - return {}; - }, - - toJSON(_: PauseMutation): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): PauseMutation { - const message = createBasePauseMutation(); - return message; - }, -}; - -function createBaseResumeMutation(): ResumeMutation { - return {}; -} - -export const ResumeMutation = { - fromJSON(_: any): ResumeMutation { - return {}; - }, - - toJSON(_: ResumeMutation): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): ResumeMutation { - const message = createBaseResumeMutation(); - return message; - }, -}; - -function createBaseBarrier(): Barrier { - return { epoch: undefined, mutation: undefined, span: new Uint8Array(), checkpoint: false, passedActors: [] }; -} - -export const Barrier = { - fromJSON(object: any): Barrier { - return { - epoch: isSet(object.epoch) ? Epoch.fromJSON(object.epoch) : undefined, - mutation: isSet(object.add) - ? { $case: "add", add: AddMutation.fromJSON(object.add) } - : isSet(object.stop) - ? { $case: "stop", stop: StopMutation.fromJSON(object.stop) } - : isSet(object.update) - ? { $case: "update", update: UpdateMutation.fromJSON(object.update) } - : isSet(object.splits) - ? { $case: "splits", splits: SourceChangeSplitMutation.fromJSON(object.splits) } - : isSet(object.pause) - ? { $case: "pause", pause: PauseMutation.fromJSON(object.pause) } - : isSet(object.resume) - ? { $case: "resume", resume: ResumeMutation.fromJSON(object.resume) } - : undefined, - span: isSet(object.span) ? bytesFromBase64(object.span) : new Uint8Array(), - checkpoint: isSet(object.checkpoint) ? Boolean(object.checkpoint) : false, - passedActors: Array.isArray(object?.passedActors) - ? object.passedActors.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: Barrier): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = message.epoch ? Epoch.toJSON(message.epoch) : undefined); - message.mutation?.$case === "add" && - (obj.add = message.mutation?.add ? AddMutation.toJSON(message.mutation?.add) : undefined); - message.mutation?.$case === "stop" && - (obj.stop = message.mutation?.stop ? StopMutation.toJSON(message.mutation?.stop) : undefined); - message.mutation?.$case === "update" && - (obj.update = message.mutation?.update ? UpdateMutation.toJSON(message.mutation?.update) : undefined); - message.mutation?.$case === "splits" && - (obj.splits = message.mutation?.splits ? SourceChangeSplitMutation.toJSON(message.mutation?.splits) : undefined); - message.mutation?.$case === "pause" && - (obj.pause = message.mutation?.pause ? PauseMutation.toJSON(message.mutation?.pause) : undefined); - message.mutation?.$case === "resume" && - (obj.resume = message.mutation?.resume ? ResumeMutation.toJSON(message.mutation?.resume) : undefined); - message.span !== undefined && - (obj.span = base64FromBytes(message.span !== undefined ? message.span : new Uint8Array())); - message.checkpoint !== undefined && (obj.checkpoint = message.checkpoint); - if (message.passedActors) { - obj.passedActors = message.passedActors.map((e) => Math.round(e)); - } else { - obj.passedActors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Barrier { - const message = createBaseBarrier(); - message.epoch = (object.epoch !== undefined && object.epoch !== null) ? Epoch.fromPartial(object.epoch) : undefined; - if (object.mutation?.$case === "add" && object.mutation?.add !== undefined && object.mutation?.add !== null) { - message.mutation = { $case: "add", add: AddMutation.fromPartial(object.mutation.add) }; - } - if (object.mutation?.$case === "stop" && object.mutation?.stop !== undefined && object.mutation?.stop !== null) { - message.mutation = { $case: "stop", stop: StopMutation.fromPartial(object.mutation.stop) }; - } - if ( - object.mutation?.$case === "update" && object.mutation?.update !== undefined && object.mutation?.update !== null - ) { - message.mutation = { $case: "update", update: UpdateMutation.fromPartial(object.mutation.update) }; - } - if ( - object.mutation?.$case === "splits" && object.mutation?.splits !== undefined && object.mutation?.splits !== null - ) { - message.mutation = { $case: "splits", splits: SourceChangeSplitMutation.fromPartial(object.mutation.splits) }; - } - if (object.mutation?.$case === "pause" && object.mutation?.pause !== undefined && object.mutation?.pause !== null) { - message.mutation = { $case: "pause", pause: PauseMutation.fromPartial(object.mutation.pause) }; - } - if ( - object.mutation?.$case === "resume" && object.mutation?.resume !== undefined && object.mutation?.resume !== null - ) { - message.mutation = { $case: "resume", resume: ResumeMutation.fromPartial(object.mutation.resume) }; - } - message.span = object.span ?? new Uint8Array(); - message.checkpoint = object.checkpoint ?? false; - message.passedActors = object.passedActors?.map((e) => e) || []; - return message; - }, -}; - -function createBaseWatermark(): Watermark { - return { column: undefined, val: undefined }; -} - -export const Watermark = { - fromJSON(object: any): Watermark { - return { - column: isSet(object.column) ? InputRef.fromJSON(object.column) : undefined, - val: isSet(object.val) ? Datum.fromJSON(object.val) : undefined, - }; - }, - - toJSON(message: Watermark): unknown { - const obj: any = {}; - message.column !== undefined && (obj.column = message.column ? InputRef.toJSON(message.column) : undefined); - message.val !== undefined && (obj.val = message.val ? Datum.toJSON(message.val) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): Watermark { - const message = createBaseWatermark(); - message.column = (object.column !== undefined && object.column !== null) - ? InputRef.fromPartial(object.column) - : undefined; - message.val = (object.val !== undefined && object.val !== null) ? Datum.fromPartial(object.val) : undefined; - return message; - }, -}; - -function createBaseStreamMessage(): StreamMessage { - return { streamMessage: undefined }; -} - -export const StreamMessage = { - fromJSON(object: any): StreamMessage { - return { - streamMessage: isSet(object.streamChunk) - ? { $case: "streamChunk", streamChunk: StreamChunk.fromJSON(object.streamChunk) } - : isSet(object.barrier) - ? { $case: "barrier", barrier: Barrier.fromJSON(object.barrier) } - : isSet(object.watermark) - ? { $case: "watermark", watermark: Watermark.fromJSON(object.watermark) } - : undefined, - }; - }, - - toJSON(message: StreamMessage): unknown { - const obj: any = {}; - message.streamMessage?.$case === "streamChunk" && (obj.streamChunk = message.streamMessage?.streamChunk - ? StreamChunk.toJSON(message.streamMessage?.streamChunk) - : undefined); - message.streamMessage?.$case === "barrier" && - (obj.barrier = message.streamMessage?.barrier ? Barrier.toJSON(message.streamMessage?.barrier) : undefined); - message.streamMessage?.$case === "watermark" && - (obj.watermark = message.streamMessage?.watermark - ? Watermark.toJSON(message.streamMessage?.watermark) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): StreamMessage { - const message = createBaseStreamMessage(); - if ( - object.streamMessage?.$case === "streamChunk" && - object.streamMessage?.streamChunk !== undefined && - object.streamMessage?.streamChunk !== null - ) { - message.streamMessage = { - $case: "streamChunk", - streamChunk: StreamChunk.fromPartial(object.streamMessage.streamChunk), - }; - } - if ( - object.streamMessage?.$case === "barrier" && - object.streamMessage?.barrier !== undefined && - object.streamMessage?.barrier !== null - ) { - message.streamMessage = { $case: "barrier", barrier: Barrier.fromPartial(object.streamMessage.barrier) }; - } - if ( - object.streamMessage?.$case === "watermark" && - object.streamMessage?.watermark !== undefined && - object.streamMessage?.watermark !== null - ) { - message.streamMessage = { $case: "watermark", watermark: Watermark.fromPartial(object.streamMessage.watermark) }; - } - return message; - }, -}; - -function createBaseActorMapping(): ActorMapping { - return { originalIndices: [], data: [] }; -} - -export const ActorMapping = { - fromJSON(object: any): ActorMapping { - return { - originalIndices: Array.isArray(object?.originalIndices) ? object.originalIndices.map((e: any) => Number(e)) : [], - data: Array.isArray(object?.data) ? object.data.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ActorMapping): unknown { - const obj: any = {}; - if (message.originalIndices) { - obj.originalIndices = message.originalIndices.map((e) => Math.round(e)); - } else { - obj.originalIndices = []; - } - if (message.data) { - obj.data = message.data.map((e) => Math.round(e)); - } else { - obj.data = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ActorMapping { - const message = createBaseActorMapping(); - message.originalIndices = object.originalIndices?.map((e) => e) || []; - message.data = object.data?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStreamSource(): StreamSource { - return { - sourceId: 0, - stateTable: undefined, - rowIdIndex: undefined, - columns: [], - pkColumnIds: [], - properties: {}, - info: undefined, - sourceName: "", - }; -} - -export const StreamSource = { - fromJSON(object: any): StreamSource { - return { - sourceId: isSet(object.sourceId) ? Number(object.sourceId) : 0, - stateTable: isSet(object.stateTable) ? Table.fromJSON(object.stateTable) : undefined, - rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : undefined, - columns: Array.isArray(object?.columns) ? object.columns.map((e: any) => ColumnCatalog.fromJSON(e)) : [], - pkColumnIds: Array.isArray(object?.pkColumnIds) ? object.pkColumnIds.map((e: any) => Number(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - info: isSet(object.info) ? StreamSourceInfo.fromJSON(object.info) : undefined, - sourceName: isSet(object.sourceName) ? String(object.sourceName) : "", - }; - }, - - toJSON(message: StreamSource): unknown { - const obj: any = {}; - message.sourceId !== undefined && (obj.sourceId = Math.round(message.sourceId)); - message.stateTable !== undefined && - (obj.stateTable = message.stateTable ? Table.toJSON(message.stateTable) : undefined); - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnCatalog.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pkColumnIds) { - obj.pkColumnIds = message.pkColumnIds.map((e) => Math.round(e)); - } else { - obj.pkColumnIds = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.info !== undefined && (obj.info = message.info ? StreamSourceInfo.toJSON(message.info) : undefined); - message.sourceName !== undefined && (obj.sourceName = message.sourceName); - return obj; - }, - - fromPartial, I>>(object: I): StreamSource { - const message = createBaseStreamSource(); - message.sourceId = object.sourceId ?? 0; - message.stateTable = (object.stateTable !== undefined && object.stateTable !== null) - ? Table.fromPartial(object.stateTable) - : undefined; - message.rowIdIndex = object.rowIdIndex ?? undefined; - message.columns = object.columns?.map((e) => ColumnCatalog.fromPartial(e)) || []; - message.pkColumnIds = object.pkColumnIds?.map((e) => e) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.info = (object.info !== undefined && object.info !== null) - ? StreamSourceInfo.fromPartial(object.info) - : undefined; - message.sourceName = object.sourceName ?? ""; - return message; - }, -}; - -function createBaseStreamSource_PropertiesEntry(): StreamSource_PropertiesEntry { - return { key: "", value: "" }; -} - -export const StreamSource_PropertiesEntry = { - fromJSON(object: any): StreamSource_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: StreamSource_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): StreamSource_PropertiesEntry { - const message = createBaseStreamSource_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseBarrierRecvNode(): BarrierRecvNode { - return {}; -} - -export const BarrierRecvNode = { - fromJSON(_: any): BarrierRecvNode { - return {}; - }, - - toJSON(_: BarrierRecvNode): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): BarrierRecvNode { - const message = createBaseBarrierRecvNode(); - return message; - }, -}; - -function createBaseSourceNode(): SourceNode { - return { sourceInner: undefined }; -} - -export const SourceNode = { - fromJSON(object: any): SourceNode { - return { sourceInner: isSet(object.sourceInner) ? StreamSource.fromJSON(object.sourceInner) : undefined }; - }, - - toJSON(message: SourceNode): unknown { - const obj: any = {}; - message.sourceInner !== undefined && - (obj.sourceInner = message.sourceInner ? StreamSource.toJSON(message.sourceInner) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SourceNode { - const message = createBaseSourceNode(); - message.sourceInner = (object.sourceInner !== undefined && object.sourceInner !== null) - ? StreamSource.fromPartial(object.sourceInner) - : undefined; - return message; - }, -}; - -function createBaseSinkDesc(): SinkDesc { - return { - id: 0, - name: "", - definition: "", - columns: [], - pk: [], - streamKey: [], - distributionKey: [], - properties: {}, - sinkType: SinkType.UNSPECIFIED, - }; -} - -export const SinkDesc = { - fromJSON(object: any): SinkDesc { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - definition: isSet(object.definition) ? String(object.definition) : "", - columns: Array.isArray(object?.columns) - ? object.columns.map((e: any) => ColumnDesc.fromJSON(e)) - : [], - pk: Array.isArray(object?.pk) ? object.pk.map((e: any) => ColumnOrder.fromJSON(e)) : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - distributionKey: Array.isArray(object?.distributionKey) ? object.distributionKey.map((e: any) => Number(e)) : [], - properties: isObject(object.properties) - ? Object.entries(object.properties).reduce<{ [key: string]: string }>((acc, [key, value]) => { - acc[key] = String(value); - return acc; - }, {}) - : {}, - sinkType: isSet(object.sinkType) ? sinkTypeFromJSON(object.sinkType) : SinkType.UNSPECIFIED, - }; - }, - - toJSON(message: SinkDesc): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.definition !== undefined && (obj.definition = message.definition); - if (message.columns) { - obj.columns = message.columns.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columns = []; - } - if (message.pk) { - obj.pk = message.pk.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.pk = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => Math.round(e)); - } else { - obj.streamKey = []; - } - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - obj.properties = {}; - if (message.properties) { - Object.entries(message.properties).forEach(([k, v]) => { - obj.properties[k] = v; - }); - } - message.sinkType !== undefined && (obj.sinkType = sinkTypeToJSON(message.sinkType)); - return obj; - }, - - fromPartial, I>>(object: I): SinkDesc { - const message = createBaseSinkDesc(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - message.definition = object.definition ?? ""; - message.columns = object.columns?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.pk = object.pk?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.properties = Object.entries(object.properties ?? {}).reduce<{ [key: string]: string }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = String(value); - } - return acc; - }, - {}, - ); - message.sinkType = object.sinkType ?? SinkType.UNSPECIFIED; - return message; - }, -}; - -function createBaseSinkDesc_PropertiesEntry(): SinkDesc_PropertiesEntry { - return { key: "", value: "" }; -} - -export const SinkDesc_PropertiesEntry = { - fromJSON(object: any): SinkDesc_PropertiesEntry { - return { key: isSet(object.key) ? String(object.key) : "", value: isSet(object.value) ? String(object.value) : "" }; - }, - - toJSON(message: SinkDesc_PropertiesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - - fromPartial, I>>(object: I): SinkDesc_PropertiesEntry { - const message = createBaseSinkDesc_PropertiesEntry(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; - -function createBaseSinkNode(): SinkNode { - return { sinkDesc: undefined }; -} - -export const SinkNode = { - fromJSON(object: any): SinkNode { - return { sinkDesc: isSet(object.sinkDesc) ? SinkDesc.fromJSON(object.sinkDesc) : undefined }; - }, - - toJSON(message: SinkNode): unknown { - const obj: any = {}; - message.sinkDesc !== undefined && (obj.sinkDesc = message.sinkDesc ? SinkDesc.toJSON(message.sinkDesc) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): SinkNode { - const message = createBaseSinkNode(); - message.sinkDesc = (object.sinkDesc !== undefined && object.sinkDesc !== null) - ? SinkDesc.fromPartial(object.sinkDesc) - : undefined; - return message; - }, -}; - -function createBaseProjectNode(): ProjectNode { - return { selectList: [], watermarkInputKey: [], watermarkOutputKey: [] }; -} - -export const ProjectNode = { - fromJSON(object: any): ProjectNode { - return { - selectList: Array.isArray(object?.selectList) ? object.selectList.map((e: any) => ExprNode.fromJSON(e)) : [], - watermarkInputKey: Array.isArray(object?.watermarkInputKey) - ? object.watermarkInputKey.map((e: any) => Number(e)) - : [], - watermarkOutputKey: Array.isArray(object?.watermarkOutputKey) - ? object.watermarkOutputKey.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: ProjectNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - if (message.watermarkInputKey) { - obj.watermarkInputKey = message.watermarkInputKey.map((e) => Math.round(e)); - } else { - obj.watermarkInputKey = []; - } - if (message.watermarkOutputKey) { - obj.watermarkOutputKey = message.watermarkOutputKey.map((e) => Math.round(e)); - } else { - obj.watermarkOutputKey = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectNode { - const message = createBaseProjectNode(); - message.selectList = object.selectList?.map((e) => ExprNode.fromPartial(e)) || []; - message.watermarkInputKey = object.watermarkInputKey?.map((e) => e) || []; - message.watermarkOutputKey = object.watermarkOutputKey?.map((e) => e) || []; - return message; - }, -}; - -function createBaseFilterNode(): FilterNode { - return { searchCondition: undefined }; -} - -export const FilterNode = { - fromJSON(object: any): FilterNode { - return { searchCondition: isSet(object.searchCondition) ? ExprNode.fromJSON(object.searchCondition) : undefined }; - }, - - toJSON(message: FilterNode): unknown { - const obj: any = {}; - message.searchCondition !== undefined && - (obj.searchCondition = message.searchCondition ? ExprNode.toJSON(message.searchCondition) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): FilterNode { - const message = createBaseFilterNode(); - message.searchCondition = (object.searchCondition !== undefined && object.searchCondition !== null) - ? ExprNode.fromPartial(object.searchCondition) - : undefined; - return message; - }, -}; - -function createBaseMaterializeNode(): MaterializeNode { - return { - tableId: 0, - columnOrders: [], - table: undefined, - handlePkConflictBehavior: HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; -} - -export const MaterializeNode = { - fromJSON(object: any): MaterializeNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - columnOrders: Array.isArray(object?.columnOrders) - ? object.columnOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - handlePkConflictBehavior: isSet(object.handlePkConflictBehavior) - ? handleConflictBehaviorFromJSON(object.handlePkConflictBehavior) - : HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; - }, - - toJSON(message: MaterializeNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.columnOrders) { - obj.columnOrders = message.columnOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.columnOrders = []; - } - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - message.handlePkConflictBehavior !== undefined && - (obj.handlePkConflictBehavior = handleConflictBehaviorToJSON(message.handlePkConflictBehavior)); - return obj; - }, - - fromPartial, I>>(object: I): MaterializeNode { - const message = createBaseMaterializeNode(); - message.tableId = object.tableId ?? 0; - message.columnOrders = object.columnOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.handlePkConflictBehavior = object.handlePkConflictBehavior ?? HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - return message; - }, -}; - -function createBaseAggCallState(): AggCallState { - return { inner: undefined }; -} - -export const AggCallState = { - fromJSON(object: any): AggCallState { - return { - inner: isSet(object.resultValueState) - ? { - $case: "resultValueState", - resultValueState: AggCallState_ResultValueState.fromJSON(object.resultValueState), - } - : isSet(object.tableState) - ? { $case: "tableState", tableState: AggCallState_TableState.fromJSON(object.tableState) } - : isSet(object.materializedInputState) - ? { - $case: "materializedInputState", - materializedInputState: AggCallState_MaterializedInputState.fromJSON(object.materializedInputState), - } - : undefined, - }; - }, - - toJSON(message: AggCallState): unknown { - const obj: any = {}; - message.inner?.$case === "resultValueState" && (obj.resultValueState = message.inner?.resultValueState - ? AggCallState_ResultValueState.toJSON(message.inner?.resultValueState) - : undefined); - message.inner?.$case === "tableState" && (obj.tableState = message.inner?.tableState - ? AggCallState_TableState.toJSON(message.inner?.tableState) - : undefined); - message.inner?.$case === "materializedInputState" && - (obj.materializedInputState = message.inner?.materializedInputState - ? AggCallState_MaterializedInputState.toJSON(message.inner?.materializedInputState) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AggCallState { - const message = createBaseAggCallState(); - if ( - object.inner?.$case === "resultValueState" && - object.inner?.resultValueState !== undefined && - object.inner?.resultValueState !== null - ) { - message.inner = { - $case: "resultValueState", - resultValueState: AggCallState_ResultValueState.fromPartial(object.inner.resultValueState), - }; - } - if ( - object.inner?.$case === "tableState" && - object.inner?.tableState !== undefined && - object.inner?.tableState !== null - ) { - message.inner = { $case: "tableState", tableState: AggCallState_TableState.fromPartial(object.inner.tableState) }; - } - if ( - object.inner?.$case === "materializedInputState" && - object.inner?.materializedInputState !== undefined && - object.inner?.materializedInputState !== null - ) { - message.inner = { - $case: "materializedInputState", - materializedInputState: AggCallState_MaterializedInputState.fromPartial(object.inner.materializedInputState), - }; - } - return message; - }, -}; - -function createBaseAggCallState_ResultValueState(): AggCallState_ResultValueState { - return {}; -} - -export const AggCallState_ResultValueState = { - fromJSON(_: any): AggCallState_ResultValueState { - return {}; - }, - - toJSON(_: AggCallState_ResultValueState): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): AggCallState_ResultValueState { - const message = createBaseAggCallState_ResultValueState(); - return message; - }, -}; - -function createBaseAggCallState_TableState(): AggCallState_TableState { - return { table: undefined }; -} - -export const AggCallState_TableState = { - fromJSON(object: any): AggCallState_TableState { - return { table: isSet(object.table) ? Table.fromJSON(object.table) : undefined }; - }, - - toJSON(message: AggCallState_TableState): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AggCallState_TableState { - const message = createBaseAggCallState_TableState(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - return message; - }, -}; - -function createBaseAggCallState_MaterializedInputState(): AggCallState_MaterializedInputState { - return { table: undefined, includedUpstreamIndices: [], tableValueIndices: [] }; -} - -export const AggCallState_MaterializedInputState = { - fromJSON(object: any): AggCallState_MaterializedInputState { - return { - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - includedUpstreamIndices: Array.isArray(object?.includedUpstreamIndices) - ? object.includedUpstreamIndices.map((e: any) => Number(e)) - : [], - tableValueIndices: Array.isArray(object?.tableValueIndices) - ? object.tableValueIndices.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: AggCallState_MaterializedInputState): unknown { - const obj: any = {}; - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - if (message.includedUpstreamIndices) { - obj.includedUpstreamIndices = message.includedUpstreamIndices.map((e) => Math.round(e)); - } else { - obj.includedUpstreamIndices = []; - } - if (message.tableValueIndices) { - obj.tableValueIndices = message.tableValueIndices.map((e) => Math.round(e)); - } else { - obj.tableValueIndices = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): AggCallState_MaterializedInputState { - const message = createBaseAggCallState_MaterializedInputState(); - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.includedUpstreamIndices = object.includedUpstreamIndices?.map((e) => e) || []; - message.tableValueIndices = object.tableValueIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseSimpleAggNode(): SimpleAggNode { - return { - aggCalls: [], - distributionKey: [], - aggCallStates: [], - resultTable: undefined, - isAppendOnly: false, - distinctDedupTables: {}, - rowCountIndex: 0, - }; -} - -export const SimpleAggNode = { - fromJSON(object: any): SimpleAggNode { - return { - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - distributionKey: Array.isArray(object?.distributionKey) ? object.distributionKey.map((e: any) => Number(e)) : [], - aggCallStates: Array.isArray(object?.aggCallStates) - ? object.aggCallStates.map((e: any) => AggCallState.fromJSON(e)) - : [], - resultTable: isSet(object.resultTable) ? Table.fromJSON(object.resultTable) : undefined, - isAppendOnly: isSet(object.isAppendOnly) ? Boolean(object.isAppendOnly) : false, - distinctDedupTables: isObject(object.distinctDedupTables) - ? Object.entries(object.distinctDedupTables).reduce<{ [key: number]: Table }>((acc, [key, value]) => { - acc[Number(key)] = Table.fromJSON(value); - return acc; - }, {}) - : {}, - rowCountIndex: isSet(object.rowCountIndex) ? Number(object.rowCountIndex) : 0, - }; - }, - - toJSON(message: SimpleAggNode): unknown { - const obj: any = {}; - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - if (message.aggCallStates) { - obj.aggCallStates = message.aggCallStates.map((e) => e ? AggCallState.toJSON(e) : undefined); - } else { - obj.aggCallStates = []; - } - message.resultTable !== undefined && - (obj.resultTable = message.resultTable ? Table.toJSON(message.resultTable) : undefined); - message.isAppendOnly !== undefined && (obj.isAppendOnly = message.isAppendOnly); - obj.distinctDedupTables = {}; - if (message.distinctDedupTables) { - Object.entries(message.distinctDedupTables).forEach(([k, v]) => { - obj.distinctDedupTables[k] = Table.toJSON(v); - }); - } - message.rowCountIndex !== undefined && (obj.rowCountIndex = Math.round(message.rowCountIndex)); - return obj; - }, - - fromPartial, I>>(object: I): SimpleAggNode { - const message = createBaseSimpleAggNode(); - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.aggCallStates = object.aggCallStates?.map((e) => AggCallState.fromPartial(e)) || []; - message.resultTable = (object.resultTable !== undefined && object.resultTable !== null) - ? Table.fromPartial(object.resultTable) - : undefined; - message.isAppendOnly = object.isAppendOnly ?? false; - message.distinctDedupTables = Object.entries(object.distinctDedupTables ?? {}).reduce<{ [key: number]: Table }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Table.fromPartial(value); - } - return acc; - }, - {}, - ); - message.rowCountIndex = object.rowCountIndex ?? 0; - return message; - }, -}; - -function createBaseSimpleAggNode_DistinctDedupTablesEntry(): SimpleAggNode_DistinctDedupTablesEntry { - return { key: 0, value: undefined }; -} - -export const SimpleAggNode_DistinctDedupTablesEntry = { - fromJSON(object: any): SimpleAggNode_DistinctDedupTablesEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Table.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: SimpleAggNode_DistinctDedupTablesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Table.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): SimpleAggNode_DistinctDedupTablesEntry { - const message = createBaseSimpleAggNode_DistinctDedupTablesEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) ? Table.fromPartial(object.value) : undefined; - return message; - }, -}; - -function createBaseHashAggNode(): HashAggNode { - return { - groupKey: [], - aggCalls: [], - aggCallStates: [], - resultTable: undefined, - isAppendOnly: false, - distinctDedupTables: {}, - rowCountIndex: 0, - }; -} - -export const HashAggNode = { - fromJSON(object: any): HashAggNode { - return { - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => Number(e)) : [], - aggCalls: Array.isArray(object?.aggCalls) ? object.aggCalls.map((e: any) => AggCall.fromJSON(e)) : [], - aggCallStates: Array.isArray(object?.aggCallStates) - ? object.aggCallStates.map((e: any) => AggCallState.fromJSON(e)) - : [], - resultTable: isSet(object.resultTable) ? Table.fromJSON(object.resultTable) : undefined, - isAppendOnly: isSet(object.isAppendOnly) ? Boolean(object.isAppendOnly) : false, - distinctDedupTables: isObject(object.distinctDedupTables) - ? Object.entries(object.distinctDedupTables).reduce<{ [key: number]: Table }>((acc, [key, value]) => { - acc[Number(key)] = Table.fromJSON(value); - return acc; - }, {}) - : {}, - rowCountIndex: isSet(object.rowCountIndex) ? Number(object.rowCountIndex) : 0, - }; - }, - - toJSON(message: HashAggNode): unknown { - const obj: any = {}; - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - if (message.aggCalls) { - obj.aggCalls = message.aggCalls.map((e) => e ? AggCall.toJSON(e) : undefined); - } else { - obj.aggCalls = []; - } - if (message.aggCallStates) { - obj.aggCallStates = message.aggCallStates.map((e) => e ? AggCallState.toJSON(e) : undefined); - } else { - obj.aggCallStates = []; - } - message.resultTable !== undefined && - (obj.resultTable = message.resultTable ? Table.toJSON(message.resultTable) : undefined); - message.isAppendOnly !== undefined && (obj.isAppendOnly = message.isAppendOnly); - obj.distinctDedupTables = {}; - if (message.distinctDedupTables) { - Object.entries(message.distinctDedupTables).forEach(([k, v]) => { - obj.distinctDedupTables[k] = Table.toJSON(v); - }); - } - message.rowCountIndex !== undefined && (obj.rowCountIndex = Math.round(message.rowCountIndex)); - return obj; - }, - - fromPartial, I>>(object: I): HashAggNode { - const message = createBaseHashAggNode(); - message.groupKey = object.groupKey?.map((e) => e) || []; - message.aggCalls = object.aggCalls?.map((e) => AggCall.fromPartial(e)) || []; - message.aggCallStates = object.aggCallStates?.map((e) => AggCallState.fromPartial(e)) || []; - message.resultTable = (object.resultTable !== undefined && object.resultTable !== null) - ? Table.fromPartial(object.resultTable) - : undefined; - message.isAppendOnly = object.isAppendOnly ?? false; - message.distinctDedupTables = Object.entries(object.distinctDedupTables ?? {}).reduce<{ [key: number]: Table }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = Table.fromPartial(value); - } - return acc; - }, - {}, - ); - message.rowCountIndex = object.rowCountIndex ?? 0; - return message; - }, -}; - -function createBaseHashAggNode_DistinctDedupTablesEntry(): HashAggNode_DistinctDedupTablesEntry { - return { key: 0, value: undefined }; -} - -export const HashAggNode_DistinctDedupTablesEntry = { - fromJSON(object: any): HashAggNode_DistinctDedupTablesEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? Table.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: HashAggNode_DistinctDedupTablesEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? Table.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): HashAggNode_DistinctDedupTablesEntry { - const message = createBaseHashAggNode_DistinctDedupTablesEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) ? Table.fromPartial(object.value) : undefined; - return message; - }, -}; - -function createBaseTopNNode(): TopNNode { - return { limit: 0, offset: 0, table: undefined, orderBy: [], withTies: false }; -} - -export const TopNNode = { - fromJSON(object: any): TopNNode { - return { - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - orderBy: Array.isArray(object?.orderBy) ? object.orderBy.map((e: any) => ColumnOrder.fromJSON(e)) : [], - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: TopNNode): unknown { - const obj: any = {}; - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - if (message.orderBy) { - obj.orderBy = message.orderBy.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.orderBy = []; - } - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): TopNNode { - const message = createBaseTopNNode(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.orderBy = object.orderBy?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseGroupTopNNode(): GroupTopNNode { - return { limit: 0, offset: 0, groupKey: [], table: undefined, orderBy: [], withTies: false }; -} - -export const GroupTopNNode = { - fromJSON(object: any): GroupTopNNode { - return { - limit: isSet(object.limit) ? Number(object.limit) : 0, - offset: isSet(object.offset) ? Number(object.offset) : 0, - groupKey: Array.isArray(object?.groupKey) ? object.groupKey.map((e: any) => Number(e)) : [], - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - orderBy: Array.isArray(object?.orderBy) ? object.orderBy.map((e: any) => ColumnOrder.fromJSON(e)) : [], - withTies: isSet(object.withTies) ? Boolean(object.withTies) : false, - }; - }, - - toJSON(message: GroupTopNNode): unknown { - const obj: any = {}; - message.limit !== undefined && (obj.limit = Math.round(message.limit)); - message.offset !== undefined && (obj.offset = Math.round(message.offset)); - if (message.groupKey) { - obj.groupKey = message.groupKey.map((e) => Math.round(e)); - } else { - obj.groupKey = []; - } - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - if (message.orderBy) { - obj.orderBy = message.orderBy.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.orderBy = []; - } - message.withTies !== undefined && (obj.withTies = message.withTies); - return obj; - }, - - fromPartial, I>>(object: I): GroupTopNNode { - const message = createBaseGroupTopNNode(); - message.limit = object.limit ?? 0; - message.offset = object.offset ?? 0; - message.groupKey = object.groupKey?.map((e) => e) || []; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.orderBy = object.orderBy?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.withTies = object.withTies ?? false; - return message; - }, -}; - -function createBaseHashJoinNode(): HashJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - condition: undefined, - leftTable: undefined, - rightTable: undefined, - leftDegreeTable: undefined, - rightDegreeTable: undefined, - outputIndices: [], - leftDedupedInputPkIndices: [], - rightDedupedInputPkIndices: [], - nullSafe: [], - isAppendOnly: false, - }; -} - -export const HashJoinNode = { - fromJSON(object: any): HashJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - leftTable: isSet(object.leftTable) ? Table.fromJSON(object.leftTable) : undefined, - rightTable: isSet(object.rightTable) ? Table.fromJSON(object.rightTable) : undefined, - leftDegreeTable: isSet(object.leftDegreeTable) ? Table.fromJSON(object.leftDegreeTable) : undefined, - rightDegreeTable: isSet(object.rightDegreeTable) ? Table.fromJSON(object.rightDegreeTable) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - leftDedupedInputPkIndices: Array.isArray(object?.leftDedupedInputPkIndices) - ? object.leftDedupedInputPkIndices.map((e: any) => Number(e)) - : [], - rightDedupedInputPkIndices: Array.isArray(object?.rightDedupedInputPkIndices) - ? object.rightDedupedInputPkIndices.map((e: any) => Number(e)) - : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - isAppendOnly: isSet(object.isAppendOnly) ? Boolean(object.isAppendOnly) : false, - }; - }, - - toJSON(message: HashJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - message.leftTable !== undefined && - (obj.leftTable = message.leftTable ? Table.toJSON(message.leftTable) : undefined); - message.rightTable !== undefined && - (obj.rightTable = message.rightTable ? Table.toJSON(message.rightTable) : undefined); - message.leftDegreeTable !== undefined && - (obj.leftDegreeTable = message.leftDegreeTable ? Table.toJSON(message.leftDegreeTable) : undefined); - message.rightDegreeTable !== undefined && - (obj.rightDegreeTable = message.rightDegreeTable ? Table.toJSON(message.rightDegreeTable) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.leftDedupedInputPkIndices) { - obj.leftDedupedInputPkIndices = message.leftDedupedInputPkIndices.map((e) => Math.round(e)); - } else { - obj.leftDedupedInputPkIndices = []; - } - if (message.rightDedupedInputPkIndices) { - obj.rightDedupedInputPkIndices = message.rightDedupedInputPkIndices.map((e) => Math.round(e)); - } else { - obj.rightDedupedInputPkIndices = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - message.isAppendOnly !== undefined && (obj.isAppendOnly = message.isAppendOnly); - return obj; - }, - - fromPartial, I>>(object: I): HashJoinNode { - const message = createBaseHashJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.leftTable = (object.leftTable !== undefined && object.leftTable !== null) - ? Table.fromPartial(object.leftTable) - : undefined; - message.rightTable = (object.rightTable !== undefined && object.rightTable !== null) - ? Table.fromPartial(object.rightTable) - : undefined; - message.leftDegreeTable = (object.leftDegreeTable !== undefined && object.leftDegreeTable !== null) - ? Table.fromPartial(object.leftDegreeTable) - : undefined; - message.rightDegreeTable = (object.rightDegreeTable !== undefined && object.rightDegreeTable !== null) - ? Table.fromPartial(object.rightDegreeTable) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.leftDedupedInputPkIndices = object.leftDedupedInputPkIndices?.map((e) => e) || []; - message.rightDedupedInputPkIndices = object.rightDedupedInputPkIndices?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - message.isAppendOnly = object.isAppendOnly ?? false; - return message; - }, -}; - -function createBaseTemporalJoinNode(): TemporalJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - nullSafe: [], - condition: undefined, - outputIndices: [], - tableDesc: undefined, - tableOutputIndices: [], - }; -} - -export const TemporalJoinNode = { - fromJSON(object: any): TemporalJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - nullSafe: Array.isArray(object?.nullSafe) ? object.nullSafe.map((e: any) => Boolean(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - tableOutputIndices: Array.isArray(object?.tableOutputIndices) - ? object.tableOutputIndices.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: TemporalJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - if (message.nullSafe) { - obj.nullSafe = message.nullSafe.map((e) => e); - } else { - obj.nullSafe = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - if (message.tableOutputIndices) { - obj.tableOutputIndices = message.tableOutputIndices.map((e) => Math.round(e)); - } else { - obj.tableOutputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): TemporalJoinNode { - const message = createBaseTemporalJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.nullSafe = object.nullSafe?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - message.tableOutputIndices = object.tableOutputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDynamicFilterNode(): DynamicFilterNode { - return { leftKey: 0, condition: undefined, leftTable: undefined, rightTable: undefined }; -} - -export const DynamicFilterNode = { - fromJSON(object: any): DynamicFilterNode { - return { - leftKey: isSet(object.leftKey) ? Number(object.leftKey) : 0, - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - leftTable: isSet(object.leftTable) ? Table.fromJSON(object.leftTable) : undefined, - rightTable: isSet(object.rightTable) ? Table.fromJSON(object.rightTable) : undefined, - }; - }, - - toJSON(message: DynamicFilterNode): unknown { - const obj: any = {}; - message.leftKey !== undefined && (obj.leftKey = Math.round(message.leftKey)); - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - message.leftTable !== undefined && - (obj.leftTable = message.leftTable ? Table.toJSON(message.leftTable) : undefined); - message.rightTable !== undefined && - (obj.rightTable = message.rightTable ? Table.toJSON(message.rightTable) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DynamicFilterNode { - const message = createBaseDynamicFilterNode(); - message.leftKey = object.leftKey ?? 0; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.leftTable = (object.leftTable !== undefined && object.leftTable !== null) - ? Table.fromPartial(object.leftTable) - : undefined; - message.rightTable = (object.rightTable !== undefined && object.rightTable !== null) - ? Table.fromPartial(object.rightTable) - : undefined; - return message; - }, -}; - -function createBaseDeltaIndexJoinNode(): DeltaIndexJoinNode { - return { - joinType: JoinType.UNSPECIFIED, - leftKey: [], - rightKey: [], - condition: undefined, - leftTableId: 0, - rightTableId: 0, - leftInfo: undefined, - rightInfo: undefined, - outputIndices: [], - }; -} - -export const DeltaIndexJoinNode = { - fromJSON(object: any): DeltaIndexJoinNode { - return { - joinType: isSet(object.joinType) ? joinTypeFromJSON(object.joinType) : JoinType.UNSPECIFIED, - leftKey: Array.isArray(object?.leftKey) ? object.leftKey.map((e: any) => Number(e)) : [], - rightKey: Array.isArray(object?.rightKey) ? object.rightKey.map((e: any) => Number(e)) : [], - condition: isSet(object.condition) ? ExprNode.fromJSON(object.condition) : undefined, - leftTableId: isSet(object.leftTableId) ? Number(object.leftTableId) : 0, - rightTableId: isSet(object.rightTableId) ? Number(object.rightTableId) : 0, - leftInfo: isSet(object.leftInfo) ? ArrangementInfo.fromJSON(object.leftInfo) : undefined, - rightInfo: isSet(object.rightInfo) ? ArrangementInfo.fromJSON(object.rightInfo) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: DeltaIndexJoinNode): unknown { - const obj: any = {}; - message.joinType !== undefined && (obj.joinType = joinTypeToJSON(message.joinType)); - if (message.leftKey) { - obj.leftKey = message.leftKey.map((e) => Math.round(e)); - } else { - obj.leftKey = []; - } - if (message.rightKey) { - obj.rightKey = message.rightKey.map((e) => Math.round(e)); - } else { - obj.rightKey = []; - } - message.condition !== undefined && - (obj.condition = message.condition ? ExprNode.toJSON(message.condition) : undefined); - message.leftTableId !== undefined && (obj.leftTableId = Math.round(message.leftTableId)); - message.rightTableId !== undefined && (obj.rightTableId = Math.round(message.rightTableId)); - message.leftInfo !== undefined && - (obj.leftInfo = message.leftInfo ? ArrangementInfo.toJSON(message.leftInfo) : undefined); - message.rightInfo !== undefined && - (obj.rightInfo = message.rightInfo ? ArrangementInfo.toJSON(message.rightInfo) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DeltaIndexJoinNode { - const message = createBaseDeltaIndexJoinNode(); - message.joinType = object.joinType ?? JoinType.UNSPECIFIED; - message.leftKey = object.leftKey?.map((e) => e) || []; - message.rightKey = object.rightKey?.map((e) => e) || []; - message.condition = (object.condition !== undefined && object.condition !== null) - ? ExprNode.fromPartial(object.condition) - : undefined; - message.leftTableId = object.leftTableId ?? 0; - message.rightTableId = object.rightTableId ?? 0; - message.leftInfo = (object.leftInfo !== undefined && object.leftInfo !== null) - ? ArrangementInfo.fromPartial(object.leftInfo) - : undefined; - message.rightInfo = (object.rightInfo !== undefined && object.rightInfo !== null) - ? ArrangementInfo.fromPartial(object.rightInfo) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseHopWindowNode(): HopWindowNode { - return { - timeCol: 0, - windowSlide: undefined, - windowSize: undefined, - outputIndices: [], - windowStartExprs: [], - windowEndExprs: [], - }; -} - -export const HopWindowNode = { - fromJSON(object: any): HopWindowNode { - return { - timeCol: isSet(object.timeCol) ? Number(object.timeCol) : 0, - windowSlide: isSet(object.windowSlide) ? IntervalUnit.fromJSON(object.windowSlide) : undefined, - windowSize: isSet(object.windowSize) ? IntervalUnit.fromJSON(object.windowSize) : undefined, - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - windowStartExprs: Array.isArray(object?.windowStartExprs) - ? object.windowStartExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - windowEndExprs: Array.isArray(object?.windowEndExprs) - ? object.windowEndExprs.map((e: any) => ExprNode.fromJSON(e)) - : [], - }; - }, - - toJSON(message: HopWindowNode): unknown { - const obj: any = {}; - message.timeCol !== undefined && (obj.timeCol = Math.round(message.timeCol)); - message.windowSlide !== undefined && - (obj.windowSlide = message.windowSlide ? IntervalUnit.toJSON(message.windowSlide) : undefined); - message.windowSize !== undefined && - (obj.windowSize = message.windowSize ? IntervalUnit.toJSON(message.windowSize) : undefined); - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - if (message.windowStartExprs) { - obj.windowStartExprs = message.windowStartExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowStartExprs = []; - } - if (message.windowEndExprs) { - obj.windowEndExprs = message.windowEndExprs.map((e) => e ? ExprNode.toJSON(e) : undefined); - } else { - obj.windowEndExprs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): HopWindowNode { - const message = createBaseHopWindowNode(); - message.timeCol = object.timeCol ?? 0; - message.windowSlide = (object.windowSlide !== undefined && object.windowSlide !== null) - ? IntervalUnit.fromPartial(object.windowSlide) - : undefined; - message.windowSize = (object.windowSize !== undefined && object.windowSize !== null) - ? IntervalUnit.fromPartial(object.windowSize) - : undefined; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.windowStartExprs = object.windowStartExprs?.map((e) => ExprNode.fromPartial(e)) || []; - message.windowEndExprs = object.windowEndExprs?.map((e) => ExprNode.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseMergeNode(): MergeNode { - return { upstreamActorId: [], upstreamFragmentId: 0, upstreamDispatcherType: DispatcherType.UNSPECIFIED, fields: [] }; -} - -export const MergeNode = { - fromJSON(object: any): MergeNode { - return { - upstreamActorId: Array.isArray(object?.upstreamActorId) ? object.upstreamActorId.map((e: any) => Number(e)) : [], - upstreamFragmentId: isSet(object.upstreamFragmentId) ? Number(object.upstreamFragmentId) : 0, - upstreamDispatcherType: isSet(object.upstreamDispatcherType) - ? dispatcherTypeFromJSON(object.upstreamDispatcherType) - : DispatcherType.UNSPECIFIED, - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: MergeNode): unknown { - const obj: any = {}; - if (message.upstreamActorId) { - obj.upstreamActorId = message.upstreamActorId.map((e) => Math.round(e)); - } else { - obj.upstreamActorId = []; - } - message.upstreamFragmentId !== undefined && (obj.upstreamFragmentId = Math.round(message.upstreamFragmentId)); - message.upstreamDispatcherType !== undefined && - (obj.upstreamDispatcherType = dispatcherTypeToJSON(message.upstreamDispatcherType)); - if (message.fields) { - obj.fields = message.fields.map((e) => e ? Field.toJSON(e) : undefined); - } else { - obj.fields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): MergeNode { - const message = createBaseMergeNode(); - message.upstreamActorId = object.upstreamActorId?.map((e) => e) || []; - message.upstreamFragmentId = object.upstreamFragmentId ?? 0; - message.upstreamDispatcherType = object.upstreamDispatcherType ?? DispatcherType.UNSPECIFIED; - message.fields = object.fields?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExchangeNode(): ExchangeNode { - return { strategy: undefined }; -} - -export const ExchangeNode = { - fromJSON(object: any): ExchangeNode { - return { strategy: isSet(object.strategy) ? DispatchStrategy.fromJSON(object.strategy) : undefined }; - }, - - toJSON(message: ExchangeNode): unknown { - const obj: any = {}; - message.strategy !== undefined && - (obj.strategy = message.strategy ? DispatchStrategy.toJSON(message.strategy) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExchangeNode { - const message = createBaseExchangeNode(); - message.strategy = (object.strategy !== undefined && object.strategy !== null) - ? DispatchStrategy.fromPartial(object.strategy) - : undefined; - return message; - }, -}; - -function createBaseChainNode(): ChainNode { - return { - tableId: 0, - upstreamColumnIds: [], - outputIndices: [], - chainType: ChainType.CHAIN_UNSPECIFIED, - tableDesc: undefined, - }; -} - -export const ChainNode = { - fromJSON(object: any): ChainNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - upstreamColumnIds: Array.isArray(object?.upstreamColumnIds) - ? object.upstreamColumnIds.map((e: any) => Number(e)) - : [], - outputIndices: Array.isArray(object?.outputIndices) - ? object.outputIndices.map((e: any) => Number(e)) - : [], - chainType: isSet(object.chainType) ? chainTypeFromJSON(object.chainType) : ChainType.CHAIN_UNSPECIFIED, - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - }; - }, - - toJSON(message: ChainNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - if (message.upstreamColumnIds) { - obj.upstreamColumnIds = message.upstreamColumnIds.map((e) => Math.round(e)); - } else { - obj.upstreamColumnIds = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - message.chainType !== undefined && (obj.chainType = chainTypeToJSON(message.chainType)); - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ChainNode { - const message = createBaseChainNode(); - message.tableId = object.tableId ?? 0; - message.upstreamColumnIds = object.upstreamColumnIds?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.chainType = object.chainType ?? ChainType.CHAIN_UNSPECIFIED; - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - return message; - }, -}; - -function createBaseBatchPlanNode(): BatchPlanNode { - return { tableDesc: undefined, columnIds: [] }; -} - -export const BatchPlanNode = { - fromJSON(object: any): BatchPlanNode { - return { - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - columnIds: Array.isArray(object?.columnIds) ? object.columnIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: BatchPlanNode): unknown { - const obj: any = {}; - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - if (message.columnIds) { - obj.columnIds = message.columnIds.map((e) => Math.round(e)); - } else { - obj.columnIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): BatchPlanNode { - const message = createBaseBatchPlanNode(); - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - message.columnIds = object.columnIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseArrangementInfo(): ArrangementInfo { - return { arrangeKeyOrders: [], columnDescs: [], tableDesc: undefined }; -} - -export const ArrangementInfo = { - fromJSON(object: any): ArrangementInfo { - return { - arrangeKeyOrders: Array.isArray(object?.arrangeKeyOrders) - ? object.arrangeKeyOrders.map((e: any) => ColumnOrder.fromJSON(e)) - : [], - columnDescs: Array.isArray(object?.columnDescs) - ? object.columnDescs.map((e: any) => ColumnDesc.fromJSON(e)) - : [], - tableDesc: isSet(object.tableDesc) ? StorageTableDesc.fromJSON(object.tableDesc) : undefined, - }; - }, - - toJSON(message: ArrangementInfo): unknown { - const obj: any = {}; - if (message.arrangeKeyOrders) { - obj.arrangeKeyOrders = message.arrangeKeyOrders.map((e) => e ? ColumnOrder.toJSON(e) : undefined); - } else { - obj.arrangeKeyOrders = []; - } - if (message.columnDescs) { - obj.columnDescs = message.columnDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columnDescs = []; - } - message.tableDesc !== undefined && - (obj.tableDesc = message.tableDesc ? StorageTableDesc.toJSON(message.tableDesc) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ArrangementInfo { - const message = createBaseArrangementInfo(); - message.arrangeKeyOrders = object.arrangeKeyOrders?.map((e) => ColumnOrder.fromPartial(e)) || []; - message.columnDescs = object.columnDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - message.tableDesc = (object.tableDesc !== undefined && object.tableDesc !== null) - ? StorageTableDesc.fromPartial(object.tableDesc) - : undefined; - return message; - }, -}; - -function createBaseArrangeNode(): ArrangeNode { - return { - tableInfo: undefined, - distributionKey: [], - table: undefined, - handlePkConflictBehavior: HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; -} - -export const ArrangeNode = { - fromJSON(object: any): ArrangeNode { - return { - tableInfo: isSet(object.tableInfo) ? ArrangementInfo.fromJSON(object.tableInfo) : undefined, - distributionKey: Array.isArray(object?.distributionKey) ? object.distributionKey.map((e: any) => Number(e)) : [], - table: isSet(object.table) ? Table.fromJSON(object.table) : undefined, - handlePkConflictBehavior: isSet(object.handlePkConflictBehavior) - ? handleConflictBehaviorFromJSON(object.handlePkConflictBehavior) - : HandleConflictBehavior.NO_CHECK_UNSPECIFIED, - }; - }, - - toJSON(message: ArrangeNode): unknown { - const obj: any = {}; - message.tableInfo !== undefined && - (obj.tableInfo = message.tableInfo ? ArrangementInfo.toJSON(message.tableInfo) : undefined); - if (message.distributionKey) { - obj.distributionKey = message.distributionKey.map((e) => Math.round(e)); - } else { - obj.distributionKey = []; - } - message.table !== undefined && (obj.table = message.table ? Table.toJSON(message.table) : undefined); - message.handlePkConflictBehavior !== undefined && - (obj.handlePkConflictBehavior = handleConflictBehaviorToJSON(message.handlePkConflictBehavior)); - return obj; - }, - - fromPartial, I>>(object: I): ArrangeNode { - const message = createBaseArrangeNode(); - message.tableInfo = (object.tableInfo !== undefined && object.tableInfo !== null) - ? ArrangementInfo.fromPartial(object.tableInfo) - : undefined; - message.distributionKey = object.distributionKey?.map((e) => e) || []; - message.table = (object.table !== undefined && object.table !== null) ? Table.fromPartial(object.table) : undefined; - message.handlePkConflictBehavior = object.handlePkConflictBehavior ?? HandleConflictBehavior.NO_CHECK_UNSPECIFIED; - return message; - }, -}; - -function createBaseLookupNode(): LookupNode { - return { - arrangeKey: [], - streamKey: [], - useCurrentEpoch: false, - columnMapping: [], - arrangementTableId: undefined, - arrangementTableInfo: undefined, - }; -} - -export const LookupNode = { - fromJSON(object: any): LookupNode { - return { - arrangeKey: Array.isArray(object?.arrangeKey) ? object.arrangeKey.map((e: any) => Number(e)) : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - useCurrentEpoch: isSet(object.useCurrentEpoch) ? Boolean(object.useCurrentEpoch) : false, - columnMapping: Array.isArray(object?.columnMapping) ? object.columnMapping.map((e: any) => Number(e)) : [], - arrangementTableId: isSet(object.tableId) - ? { $case: "tableId", tableId: Number(object.tableId) } - : isSet(object.indexId) - ? { $case: "indexId", indexId: Number(object.indexId) } - : undefined, - arrangementTableInfo: isSet(object.arrangementTableInfo) - ? ArrangementInfo.fromJSON(object.arrangementTableInfo) - : undefined, - }; - }, - - toJSON(message: LookupNode): unknown { - const obj: any = {}; - if (message.arrangeKey) { - obj.arrangeKey = message.arrangeKey.map((e) => Math.round(e)); - } else { - obj.arrangeKey = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => Math.round(e)); - } else { - obj.streamKey = []; - } - message.useCurrentEpoch !== undefined && (obj.useCurrentEpoch = message.useCurrentEpoch); - if (message.columnMapping) { - obj.columnMapping = message.columnMapping.map((e) => Math.round(e)); - } else { - obj.columnMapping = []; - } - message.arrangementTableId?.$case === "tableId" && (obj.tableId = Math.round(message.arrangementTableId?.tableId)); - message.arrangementTableId?.$case === "indexId" && (obj.indexId = Math.round(message.arrangementTableId?.indexId)); - message.arrangementTableInfo !== undefined && (obj.arrangementTableInfo = message.arrangementTableInfo - ? ArrangementInfo.toJSON(message.arrangementTableInfo) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): LookupNode { - const message = createBaseLookupNode(); - message.arrangeKey = object.arrangeKey?.map((e) => e) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.useCurrentEpoch = object.useCurrentEpoch ?? false; - message.columnMapping = object.columnMapping?.map((e) => e) || []; - if ( - object.arrangementTableId?.$case === "tableId" && - object.arrangementTableId?.tableId !== undefined && - object.arrangementTableId?.tableId !== null - ) { - message.arrangementTableId = { $case: "tableId", tableId: object.arrangementTableId.tableId }; - } - if ( - object.arrangementTableId?.$case === "indexId" && - object.arrangementTableId?.indexId !== undefined && - object.arrangementTableId?.indexId !== null - ) { - message.arrangementTableId = { $case: "indexId", indexId: object.arrangementTableId.indexId }; - } - message.arrangementTableInfo = (object.arrangementTableInfo !== undefined && object.arrangementTableInfo !== null) - ? ArrangementInfo.fromPartial(object.arrangementTableInfo) - : undefined; - return message; - }, -}; - -function createBaseWatermarkFilterNode(): WatermarkFilterNode { - return { watermarkDescs: [], tables: [] }; -} - -export const WatermarkFilterNode = { - fromJSON(object: any): WatermarkFilterNode { - return { - watermarkDescs: Array.isArray(object?.watermarkDescs) - ? object.watermarkDescs.map((e: any) => WatermarkDesc.fromJSON(e)) - : [], - tables: Array.isArray(object?.tables) - ? object.tables.map((e: any) => Table.fromJSON(e)) - : [], - }; - }, - - toJSON(message: WatermarkFilterNode): unknown { - const obj: any = {}; - if (message.watermarkDescs) { - obj.watermarkDescs = message.watermarkDescs.map((e) => e ? WatermarkDesc.toJSON(e) : undefined); - } else { - obj.watermarkDescs = []; - } - if (message.tables) { - obj.tables = message.tables.map((e) => e ? Table.toJSON(e) : undefined); - } else { - obj.tables = []; - } - return obj; - }, - - fromPartial, I>>(object: I): WatermarkFilterNode { - const message = createBaseWatermarkFilterNode(); - message.watermarkDescs = object.watermarkDescs?.map((e) => WatermarkDesc.fromPartial(e)) || []; - message.tables = object.tables?.map((e) => Table.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUnionNode(): UnionNode { - return {}; -} - -export const UnionNode = { - fromJSON(_: any): UnionNode { - return {}; - }, - - toJSON(_: UnionNode): unknown { - const obj: any = {}; - return obj; - }, - - fromPartial, I>>(_: I): UnionNode { - const message = createBaseUnionNode(); - return message; - }, -}; - -function createBaseLookupUnionNode(): LookupUnionNode { - return { order: [] }; -} - -export const LookupUnionNode = { - fromJSON(object: any): LookupUnionNode { - return { order: Array.isArray(object?.order) ? object.order.map((e: any) => Number(e)) : [] }; - }, - - toJSON(message: LookupUnionNode): unknown { - const obj: any = {}; - if (message.order) { - obj.order = message.order.map((e) => Math.round(e)); - } else { - obj.order = []; - } - return obj; - }, - - fromPartial, I>>(object: I): LookupUnionNode { - const message = createBaseLookupUnionNode(); - message.order = object.order?.map((e) => e) || []; - return message; - }, -}; - -function createBaseExpandNode(): ExpandNode { - return { columnSubsets: [] }; -} - -export const ExpandNode = { - fromJSON(object: any): ExpandNode { - return { - columnSubsets: Array.isArray(object?.columnSubsets) - ? object.columnSubsets.map((e: any) => ExpandNode_Subset.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ExpandNode): unknown { - const obj: any = {}; - if (message.columnSubsets) { - obj.columnSubsets = message.columnSubsets.map((e) => e ? ExpandNode_Subset.toJSON(e) : undefined); - } else { - obj.columnSubsets = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode { - const message = createBaseExpandNode(); - message.columnSubsets = object.columnSubsets?.map((e) => ExpandNode_Subset.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseExpandNode_Subset(): ExpandNode_Subset { - return { columnIndices: [] }; -} - -export const ExpandNode_Subset = { - fromJSON(object: any): ExpandNode_Subset { - return { - columnIndices: Array.isArray(object?.columnIndices) ? object.columnIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: ExpandNode_Subset): unknown { - const obj: any = {}; - if (message.columnIndices) { - obj.columnIndices = message.columnIndices.map((e) => Math.round(e)); - } else { - obj.columnIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ExpandNode_Subset { - const message = createBaseExpandNode_Subset(); - message.columnIndices = object.columnIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseProjectSetNode(): ProjectSetNode { - return { selectList: [] }; -} - -export const ProjectSetNode = { - fromJSON(object: any): ProjectSetNode { - return { - selectList: Array.isArray(object?.selectList) - ? object.selectList.map((e: any) => ProjectSetSelectItem.fromJSON(e)) - : [], - }; - }, - - toJSON(message: ProjectSetNode): unknown { - const obj: any = {}; - if (message.selectList) { - obj.selectList = message.selectList.map((e) => e ? ProjectSetSelectItem.toJSON(e) : undefined); - } else { - obj.selectList = []; - } - return obj; - }, - - fromPartial, I>>(object: I): ProjectSetNode { - const message = createBaseProjectSetNode(); - message.selectList = object.selectList?.map((e) => ProjectSetSelectItem.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseSortNode(): SortNode { - return { stateTable: undefined, sortColumnIndex: 0 }; -} - -export const SortNode = { - fromJSON(object: any): SortNode { - return { - stateTable: isSet(object.stateTable) ? Table.fromJSON(object.stateTable) : undefined, - sortColumnIndex: isSet(object.sortColumnIndex) ? Number(object.sortColumnIndex) : 0, - }; - }, - - toJSON(message: SortNode): unknown { - const obj: any = {}; - message.stateTable !== undefined && - (obj.stateTable = message.stateTable ? Table.toJSON(message.stateTable) : undefined); - message.sortColumnIndex !== undefined && (obj.sortColumnIndex = Math.round(message.sortColumnIndex)); - return obj; - }, - - fromPartial, I>>(object: I): SortNode { - const message = createBaseSortNode(); - message.stateTable = (object.stateTable !== undefined && object.stateTable !== null) - ? Table.fromPartial(object.stateTable) - : undefined; - message.sortColumnIndex = object.sortColumnIndex ?? 0; - return message; - }, -}; - -function createBaseDmlNode(): DmlNode { - return { tableId: 0, tableVersionId: 0, columnDescs: [] }; -} - -export const DmlNode = { - fromJSON(object: any): DmlNode { - return { - tableId: isSet(object.tableId) ? Number(object.tableId) : 0, - tableVersionId: isSet(object.tableVersionId) ? Number(object.tableVersionId) : 0, - columnDescs: Array.isArray(object?.columnDescs) ? object.columnDescs.map((e: any) => ColumnDesc.fromJSON(e)) : [], - }; - }, - - toJSON(message: DmlNode): unknown { - const obj: any = {}; - message.tableId !== undefined && (obj.tableId = Math.round(message.tableId)); - message.tableVersionId !== undefined && (obj.tableVersionId = Math.round(message.tableVersionId)); - if (message.columnDescs) { - obj.columnDescs = message.columnDescs.map((e) => e ? ColumnDesc.toJSON(e) : undefined); - } else { - obj.columnDescs = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DmlNode { - const message = createBaseDmlNode(); - message.tableId = object.tableId ?? 0; - message.tableVersionId = object.tableVersionId ?? 0; - message.columnDescs = object.columnDescs?.map((e) => ColumnDesc.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseRowIdGenNode(): RowIdGenNode { - return { rowIdIndex: 0 }; -} - -export const RowIdGenNode = { - fromJSON(object: any): RowIdGenNode { - return { rowIdIndex: isSet(object.rowIdIndex) ? Number(object.rowIdIndex) : 0 }; - }, - - toJSON(message: RowIdGenNode): unknown { - const obj: any = {}; - message.rowIdIndex !== undefined && (obj.rowIdIndex = Math.round(message.rowIdIndex)); - return obj; - }, - - fromPartial, I>>(object: I): RowIdGenNode { - const message = createBaseRowIdGenNode(); - message.rowIdIndex = object.rowIdIndex ?? 0; - return message; - }, -}; - -function createBaseNowNode(): NowNode { - return { stateTable: undefined }; -} - -export const NowNode = { - fromJSON(object: any): NowNode { - return { stateTable: isSet(object.stateTable) ? Table.fromJSON(object.stateTable) : undefined }; - }, - - toJSON(message: NowNode): unknown { - const obj: any = {}; - message.stateTable !== undefined && - (obj.stateTable = message.stateTable ? Table.toJSON(message.stateTable) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): NowNode { - const message = createBaseNowNode(); - message.stateTable = (object.stateTable !== undefined && object.stateTable !== null) - ? Table.fromPartial(object.stateTable) - : undefined; - return message; - }, -}; - -function createBaseStreamNode(): StreamNode { - return { nodeBody: undefined, operatorId: 0, input: [], streamKey: [], appendOnly: false, identity: "", fields: [] }; -} - -export const StreamNode = { - fromJSON(object: any): StreamNode { - return { - nodeBody: isSet(object.source) - ? { $case: "source", source: SourceNode.fromJSON(object.source) } - : isSet(object.project) - ? { $case: "project", project: ProjectNode.fromJSON(object.project) } - : isSet(object.filter) - ? { $case: "filter", filter: FilterNode.fromJSON(object.filter) } - : isSet(object.materialize) - ? { $case: "materialize", materialize: MaterializeNode.fromJSON(object.materialize) } - : isSet(object.localSimpleAgg) - ? { $case: "localSimpleAgg", localSimpleAgg: SimpleAggNode.fromJSON(object.localSimpleAgg) } - : isSet(object.globalSimpleAgg) - ? { $case: "globalSimpleAgg", globalSimpleAgg: SimpleAggNode.fromJSON(object.globalSimpleAgg) } - : isSet(object.hashAgg) - ? { $case: "hashAgg", hashAgg: HashAggNode.fromJSON(object.hashAgg) } - : isSet(object.appendOnlyTopN) - ? { $case: "appendOnlyTopN", appendOnlyTopN: TopNNode.fromJSON(object.appendOnlyTopN) } - : isSet(object.hashJoin) - ? { $case: "hashJoin", hashJoin: HashJoinNode.fromJSON(object.hashJoin) } - : isSet(object.topN) - ? { $case: "topN", topN: TopNNode.fromJSON(object.topN) } - : isSet(object.hopWindow) - ? { $case: "hopWindow", hopWindow: HopWindowNode.fromJSON(object.hopWindow) } - : isSet(object.merge) - ? { $case: "merge", merge: MergeNode.fromJSON(object.merge) } - : isSet(object.exchange) - ? { $case: "exchange", exchange: ExchangeNode.fromJSON(object.exchange) } - : isSet(object.chain) - ? { $case: "chain", chain: ChainNode.fromJSON(object.chain) } - : isSet(object.batchPlan) - ? { $case: "batchPlan", batchPlan: BatchPlanNode.fromJSON(object.batchPlan) } - : isSet(object.lookup) - ? { $case: "lookup", lookup: LookupNode.fromJSON(object.lookup) } - : isSet(object.arrange) - ? { $case: "arrange", arrange: ArrangeNode.fromJSON(object.arrange) } - : isSet(object.lookupUnion) - ? { $case: "lookupUnion", lookupUnion: LookupUnionNode.fromJSON(object.lookupUnion) } - : isSet(object.union) - ? { $case: "union", union: UnionNode.fromJSON(object.union) } - : isSet(object.deltaIndexJoin) - ? { $case: "deltaIndexJoin", deltaIndexJoin: DeltaIndexJoinNode.fromJSON(object.deltaIndexJoin) } - : isSet(object.sink) - ? { $case: "sink", sink: SinkNode.fromJSON(object.sink) } - : isSet(object.expand) - ? { $case: "expand", expand: ExpandNode.fromJSON(object.expand) } - : isSet(object.dynamicFilter) - ? { $case: "dynamicFilter", dynamicFilter: DynamicFilterNode.fromJSON(object.dynamicFilter) } - : isSet(object.projectSet) - ? { $case: "projectSet", projectSet: ProjectSetNode.fromJSON(object.projectSet) } - : isSet(object.groupTopN) - ? { $case: "groupTopN", groupTopN: GroupTopNNode.fromJSON(object.groupTopN) } - : isSet(object.sort) - ? { $case: "sort", sort: SortNode.fromJSON(object.sort) } - : isSet(object.watermarkFilter) - ? { $case: "watermarkFilter", watermarkFilter: WatermarkFilterNode.fromJSON(object.watermarkFilter) } - : isSet(object.dml) - ? { $case: "dml", dml: DmlNode.fromJSON(object.dml) } - : isSet(object.rowIdGen) - ? { $case: "rowIdGen", rowIdGen: RowIdGenNode.fromJSON(object.rowIdGen) } - : isSet(object.now) - ? { $case: "now", now: NowNode.fromJSON(object.now) } - : isSet(object.appendOnlyGroupTopN) - ? { $case: "appendOnlyGroupTopN", appendOnlyGroupTopN: GroupTopNNode.fromJSON(object.appendOnlyGroupTopN) } - : isSet(object.temporalJoin) - ? { $case: "temporalJoin", temporalJoin: TemporalJoinNode.fromJSON(object.temporalJoin) } - : isSet(object.barrierRecv) - ? { $case: "barrierRecv", barrierRecv: BarrierRecvNode.fromJSON(object.barrierRecv) } - : undefined, - operatorId: isSet(object.operatorId) ? Number(object.operatorId) : 0, - input: Array.isArray(object?.input) - ? object.input.map((e: any) => StreamNode.fromJSON(e)) - : [], - streamKey: Array.isArray(object?.streamKey) ? object.streamKey.map((e: any) => Number(e)) : [], - appendOnly: isSet(object.appendOnly) ? Boolean(object.appendOnly) : false, - identity: isSet(object.identity) ? String(object.identity) : "", - fields: Array.isArray(object?.fields) ? object.fields.map((e: any) => Field.fromJSON(e)) : [], - }; - }, - - toJSON(message: StreamNode): unknown { - const obj: any = {}; - message.nodeBody?.$case === "source" && - (obj.source = message.nodeBody?.source ? SourceNode.toJSON(message.nodeBody?.source) : undefined); - message.nodeBody?.$case === "project" && - (obj.project = message.nodeBody?.project ? ProjectNode.toJSON(message.nodeBody?.project) : undefined); - message.nodeBody?.$case === "filter" && - (obj.filter = message.nodeBody?.filter ? FilterNode.toJSON(message.nodeBody?.filter) : undefined); - message.nodeBody?.$case === "materialize" && (obj.materialize = message.nodeBody?.materialize - ? MaterializeNode.toJSON(message.nodeBody?.materialize) - : undefined); - message.nodeBody?.$case === "localSimpleAgg" && (obj.localSimpleAgg = message.nodeBody?.localSimpleAgg - ? SimpleAggNode.toJSON(message.nodeBody?.localSimpleAgg) - : undefined); - message.nodeBody?.$case === "globalSimpleAgg" && (obj.globalSimpleAgg = message.nodeBody?.globalSimpleAgg - ? SimpleAggNode.toJSON(message.nodeBody?.globalSimpleAgg) - : undefined); - message.nodeBody?.$case === "hashAgg" && - (obj.hashAgg = message.nodeBody?.hashAgg ? HashAggNode.toJSON(message.nodeBody?.hashAgg) : undefined); - message.nodeBody?.$case === "appendOnlyTopN" && (obj.appendOnlyTopN = message.nodeBody?.appendOnlyTopN - ? TopNNode.toJSON(message.nodeBody?.appendOnlyTopN) - : undefined); - message.nodeBody?.$case === "hashJoin" && - (obj.hashJoin = message.nodeBody?.hashJoin ? HashJoinNode.toJSON(message.nodeBody?.hashJoin) : undefined); - message.nodeBody?.$case === "topN" && - (obj.topN = message.nodeBody?.topN ? TopNNode.toJSON(message.nodeBody?.topN) : undefined); - message.nodeBody?.$case === "hopWindow" && - (obj.hopWindow = message.nodeBody?.hopWindow ? HopWindowNode.toJSON(message.nodeBody?.hopWindow) : undefined); - message.nodeBody?.$case === "merge" && - (obj.merge = message.nodeBody?.merge ? MergeNode.toJSON(message.nodeBody?.merge) : undefined); - message.nodeBody?.$case === "exchange" && - (obj.exchange = message.nodeBody?.exchange ? ExchangeNode.toJSON(message.nodeBody?.exchange) : undefined); - message.nodeBody?.$case === "chain" && - (obj.chain = message.nodeBody?.chain ? ChainNode.toJSON(message.nodeBody?.chain) : undefined); - message.nodeBody?.$case === "batchPlan" && - (obj.batchPlan = message.nodeBody?.batchPlan ? BatchPlanNode.toJSON(message.nodeBody?.batchPlan) : undefined); - message.nodeBody?.$case === "lookup" && - (obj.lookup = message.nodeBody?.lookup ? LookupNode.toJSON(message.nodeBody?.lookup) : undefined); - message.nodeBody?.$case === "arrange" && - (obj.arrange = message.nodeBody?.arrange ? ArrangeNode.toJSON(message.nodeBody?.arrange) : undefined); - message.nodeBody?.$case === "lookupUnion" && (obj.lookupUnion = message.nodeBody?.lookupUnion - ? LookupUnionNode.toJSON(message.nodeBody?.lookupUnion) - : undefined); - message.nodeBody?.$case === "union" && - (obj.union = message.nodeBody?.union ? UnionNode.toJSON(message.nodeBody?.union) : undefined); - message.nodeBody?.$case === "deltaIndexJoin" && (obj.deltaIndexJoin = message.nodeBody?.deltaIndexJoin - ? DeltaIndexJoinNode.toJSON(message.nodeBody?.deltaIndexJoin) - : undefined); - message.nodeBody?.$case === "sink" && - (obj.sink = message.nodeBody?.sink ? SinkNode.toJSON(message.nodeBody?.sink) : undefined); - message.nodeBody?.$case === "expand" && - (obj.expand = message.nodeBody?.expand ? ExpandNode.toJSON(message.nodeBody?.expand) : undefined); - message.nodeBody?.$case === "dynamicFilter" && (obj.dynamicFilter = message.nodeBody?.dynamicFilter - ? DynamicFilterNode.toJSON(message.nodeBody?.dynamicFilter) - : undefined); - message.nodeBody?.$case === "projectSet" && - (obj.projectSet = message.nodeBody?.projectSet ? ProjectSetNode.toJSON(message.nodeBody?.projectSet) : undefined); - message.nodeBody?.$case === "groupTopN" && - (obj.groupTopN = message.nodeBody?.groupTopN ? GroupTopNNode.toJSON(message.nodeBody?.groupTopN) : undefined); - message.nodeBody?.$case === "sort" && - (obj.sort = message.nodeBody?.sort ? SortNode.toJSON(message.nodeBody?.sort) : undefined); - message.nodeBody?.$case === "watermarkFilter" && (obj.watermarkFilter = message.nodeBody?.watermarkFilter - ? WatermarkFilterNode.toJSON(message.nodeBody?.watermarkFilter) - : undefined); - message.nodeBody?.$case === "dml" && - (obj.dml = message.nodeBody?.dml ? DmlNode.toJSON(message.nodeBody?.dml) : undefined); - message.nodeBody?.$case === "rowIdGen" && - (obj.rowIdGen = message.nodeBody?.rowIdGen ? RowIdGenNode.toJSON(message.nodeBody?.rowIdGen) : undefined); - message.nodeBody?.$case === "now" && - (obj.now = message.nodeBody?.now ? NowNode.toJSON(message.nodeBody?.now) : undefined); - message.nodeBody?.$case === "appendOnlyGroupTopN" && - (obj.appendOnlyGroupTopN = message.nodeBody?.appendOnlyGroupTopN - ? GroupTopNNode.toJSON(message.nodeBody?.appendOnlyGroupTopN) - : undefined); - message.nodeBody?.$case === "temporalJoin" && (obj.temporalJoin = message.nodeBody?.temporalJoin - ? TemporalJoinNode.toJSON(message.nodeBody?.temporalJoin) - : undefined); - message.nodeBody?.$case === "barrierRecv" && (obj.barrierRecv = message.nodeBody?.barrierRecv - ? BarrierRecvNode.toJSON(message.nodeBody?.barrierRecv) - : undefined); - message.operatorId !== undefined && (obj.operatorId = Math.round(message.operatorId)); - if (message.input) { - obj.input = message.input.map((e) => - e ? StreamNode.toJSON(e) : undefined - ); - } else { - obj.input = []; - } - if (message.streamKey) { - obj.streamKey = message.streamKey.map((e) => - Math.round(e) - ); - } else { - obj.streamKey = []; - } - message.appendOnly !== undefined && (obj.appendOnly = message.appendOnly); - message.identity !== undefined && (obj.identity = message.identity); - if (message.fields) { - obj.fields = message.fields.map((e) => - e ? Field.toJSON(e) : undefined - ); - } else { - obj.fields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): StreamNode { - const message = createBaseStreamNode(); - if ( - object.nodeBody?.$case === "source" && object.nodeBody?.source !== undefined && object.nodeBody?.source !== null - ) { - message.nodeBody = { $case: "source", source: SourceNode.fromPartial(object.nodeBody.source) }; - } - if ( - object.nodeBody?.$case === "project" && - object.nodeBody?.project !== undefined && - object.nodeBody?.project !== null - ) { - message.nodeBody = { $case: "project", project: ProjectNode.fromPartial(object.nodeBody.project) }; - } - if ( - object.nodeBody?.$case === "filter" && object.nodeBody?.filter !== undefined && object.nodeBody?.filter !== null - ) { - message.nodeBody = { $case: "filter", filter: FilterNode.fromPartial(object.nodeBody.filter) }; - } - if ( - object.nodeBody?.$case === "materialize" && - object.nodeBody?.materialize !== undefined && - object.nodeBody?.materialize !== null - ) { - message.nodeBody = { - $case: "materialize", - materialize: MaterializeNode.fromPartial(object.nodeBody.materialize), - }; - } - if ( - object.nodeBody?.$case === "localSimpleAgg" && - object.nodeBody?.localSimpleAgg !== undefined && - object.nodeBody?.localSimpleAgg !== null - ) { - message.nodeBody = { - $case: "localSimpleAgg", - localSimpleAgg: SimpleAggNode.fromPartial(object.nodeBody.localSimpleAgg), - }; - } - if ( - object.nodeBody?.$case === "globalSimpleAgg" && - object.nodeBody?.globalSimpleAgg !== undefined && - object.nodeBody?.globalSimpleAgg !== null - ) { - message.nodeBody = { - $case: "globalSimpleAgg", - globalSimpleAgg: SimpleAggNode.fromPartial(object.nodeBody.globalSimpleAgg), - }; - } - if ( - object.nodeBody?.$case === "hashAgg" && - object.nodeBody?.hashAgg !== undefined && - object.nodeBody?.hashAgg !== null - ) { - message.nodeBody = { $case: "hashAgg", hashAgg: HashAggNode.fromPartial(object.nodeBody.hashAgg) }; - } - if ( - object.nodeBody?.$case === "appendOnlyTopN" && - object.nodeBody?.appendOnlyTopN !== undefined && - object.nodeBody?.appendOnlyTopN !== null - ) { - message.nodeBody = { - $case: "appendOnlyTopN", - appendOnlyTopN: TopNNode.fromPartial(object.nodeBody.appendOnlyTopN), - }; - } - if ( - object.nodeBody?.$case === "hashJoin" && - object.nodeBody?.hashJoin !== undefined && - object.nodeBody?.hashJoin !== null - ) { - message.nodeBody = { $case: "hashJoin", hashJoin: HashJoinNode.fromPartial(object.nodeBody.hashJoin) }; - } - if (object.nodeBody?.$case === "topN" && object.nodeBody?.topN !== undefined && object.nodeBody?.topN !== null) { - message.nodeBody = { $case: "topN", topN: TopNNode.fromPartial(object.nodeBody.topN) }; - } - if ( - object.nodeBody?.$case === "hopWindow" && - object.nodeBody?.hopWindow !== undefined && - object.nodeBody?.hopWindow !== null - ) { - message.nodeBody = { $case: "hopWindow", hopWindow: HopWindowNode.fromPartial(object.nodeBody.hopWindow) }; - } - if (object.nodeBody?.$case === "merge" && object.nodeBody?.merge !== undefined && object.nodeBody?.merge !== null) { - message.nodeBody = { $case: "merge", merge: MergeNode.fromPartial(object.nodeBody.merge) }; - } - if ( - object.nodeBody?.$case === "exchange" && - object.nodeBody?.exchange !== undefined && - object.nodeBody?.exchange !== null - ) { - message.nodeBody = { $case: "exchange", exchange: ExchangeNode.fromPartial(object.nodeBody.exchange) }; - } - if (object.nodeBody?.$case === "chain" && object.nodeBody?.chain !== undefined && object.nodeBody?.chain !== null) { - message.nodeBody = { $case: "chain", chain: ChainNode.fromPartial(object.nodeBody.chain) }; - } - if ( - object.nodeBody?.$case === "batchPlan" && - object.nodeBody?.batchPlan !== undefined && - object.nodeBody?.batchPlan !== null - ) { - message.nodeBody = { $case: "batchPlan", batchPlan: BatchPlanNode.fromPartial(object.nodeBody.batchPlan) }; - } - if ( - object.nodeBody?.$case === "lookup" && object.nodeBody?.lookup !== undefined && object.nodeBody?.lookup !== null - ) { - message.nodeBody = { $case: "lookup", lookup: LookupNode.fromPartial(object.nodeBody.lookup) }; - } - if ( - object.nodeBody?.$case === "arrange" && - object.nodeBody?.arrange !== undefined && - object.nodeBody?.arrange !== null - ) { - message.nodeBody = { $case: "arrange", arrange: ArrangeNode.fromPartial(object.nodeBody.arrange) }; - } - if ( - object.nodeBody?.$case === "lookupUnion" && - object.nodeBody?.lookupUnion !== undefined && - object.nodeBody?.lookupUnion !== null - ) { - message.nodeBody = { - $case: "lookupUnion", - lookupUnion: LookupUnionNode.fromPartial(object.nodeBody.lookupUnion), - }; - } - if (object.nodeBody?.$case === "union" && object.nodeBody?.union !== undefined && object.nodeBody?.union !== null) { - message.nodeBody = { $case: "union", union: UnionNode.fromPartial(object.nodeBody.union) }; - } - if ( - object.nodeBody?.$case === "deltaIndexJoin" && - object.nodeBody?.deltaIndexJoin !== undefined && - object.nodeBody?.deltaIndexJoin !== null - ) { - message.nodeBody = { - $case: "deltaIndexJoin", - deltaIndexJoin: DeltaIndexJoinNode.fromPartial(object.nodeBody.deltaIndexJoin), - }; - } - if (object.nodeBody?.$case === "sink" && object.nodeBody?.sink !== undefined && object.nodeBody?.sink !== null) { - message.nodeBody = { $case: "sink", sink: SinkNode.fromPartial(object.nodeBody.sink) }; - } - if ( - object.nodeBody?.$case === "expand" && object.nodeBody?.expand !== undefined && object.nodeBody?.expand !== null - ) { - message.nodeBody = { $case: "expand", expand: ExpandNode.fromPartial(object.nodeBody.expand) }; - } - if ( - object.nodeBody?.$case === "dynamicFilter" && - object.nodeBody?.dynamicFilter !== undefined && - object.nodeBody?.dynamicFilter !== null - ) { - message.nodeBody = { - $case: "dynamicFilter", - dynamicFilter: DynamicFilterNode.fromPartial(object.nodeBody.dynamicFilter), - }; - } - if ( - object.nodeBody?.$case === "projectSet" && - object.nodeBody?.projectSet !== undefined && - object.nodeBody?.projectSet !== null - ) { - message.nodeBody = { $case: "projectSet", projectSet: ProjectSetNode.fromPartial(object.nodeBody.projectSet) }; - } - if ( - object.nodeBody?.$case === "groupTopN" && - object.nodeBody?.groupTopN !== undefined && - object.nodeBody?.groupTopN !== null - ) { - message.nodeBody = { $case: "groupTopN", groupTopN: GroupTopNNode.fromPartial(object.nodeBody.groupTopN) }; - } - if (object.nodeBody?.$case === "sort" && object.nodeBody?.sort !== undefined && object.nodeBody?.sort !== null) { - message.nodeBody = { $case: "sort", sort: SortNode.fromPartial(object.nodeBody.sort) }; - } - if ( - object.nodeBody?.$case === "watermarkFilter" && - object.nodeBody?.watermarkFilter !== undefined && - object.nodeBody?.watermarkFilter !== null - ) { - message.nodeBody = { - $case: "watermarkFilter", - watermarkFilter: WatermarkFilterNode.fromPartial(object.nodeBody.watermarkFilter), - }; - } - if (object.nodeBody?.$case === "dml" && object.nodeBody?.dml !== undefined && object.nodeBody?.dml !== null) { - message.nodeBody = { $case: "dml", dml: DmlNode.fromPartial(object.nodeBody.dml) }; - } - if ( - object.nodeBody?.$case === "rowIdGen" && - object.nodeBody?.rowIdGen !== undefined && - object.nodeBody?.rowIdGen !== null - ) { - message.nodeBody = { $case: "rowIdGen", rowIdGen: RowIdGenNode.fromPartial(object.nodeBody.rowIdGen) }; - } - if (object.nodeBody?.$case === "now" && object.nodeBody?.now !== undefined && object.nodeBody?.now !== null) { - message.nodeBody = { $case: "now", now: NowNode.fromPartial(object.nodeBody.now) }; - } - if ( - object.nodeBody?.$case === "appendOnlyGroupTopN" && - object.nodeBody?.appendOnlyGroupTopN !== undefined && - object.nodeBody?.appendOnlyGroupTopN !== null - ) { - message.nodeBody = { - $case: "appendOnlyGroupTopN", - appendOnlyGroupTopN: GroupTopNNode.fromPartial(object.nodeBody.appendOnlyGroupTopN), - }; - } - if ( - object.nodeBody?.$case === "temporalJoin" && - object.nodeBody?.temporalJoin !== undefined && - object.nodeBody?.temporalJoin !== null - ) { - message.nodeBody = { - $case: "temporalJoin", - temporalJoin: TemporalJoinNode.fromPartial(object.nodeBody.temporalJoin), - }; - } - if ( - object.nodeBody?.$case === "barrierRecv" && - object.nodeBody?.barrierRecv !== undefined && - object.nodeBody?.barrierRecv !== null - ) { - message.nodeBody = { - $case: "barrierRecv", - barrierRecv: BarrierRecvNode.fromPartial(object.nodeBody.barrierRecv), - }; - } - message.operatorId = object.operatorId ?? 0; - message.input = object.input?.map((e) => StreamNode.fromPartial(e)) || []; - message.streamKey = object.streamKey?.map((e) => e) || []; - message.appendOnly = object.appendOnly ?? false; - message.identity = object.identity ?? ""; - message.fields = object.fields?.map((e) => Field.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseDispatchStrategy(): DispatchStrategy { - return { type: DispatcherType.UNSPECIFIED, distKeyIndices: [], outputIndices: [] }; -} - -export const DispatchStrategy = { - fromJSON(object: any): DispatchStrategy { - return { - type: isSet(object.type) ? dispatcherTypeFromJSON(object.type) : DispatcherType.UNSPECIFIED, - distKeyIndices: Array.isArray(object?.distKeyIndices) ? object.distKeyIndices.map((e: any) => Number(e)) : [], - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: DispatchStrategy): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = dispatcherTypeToJSON(message.type)); - if (message.distKeyIndices) { - obj.distKeyIndices = message.distKeyIndices.map((e) => Math.round(e)); - } else { - obj.distKeyIndices = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DispatchStrategy { - const message = createBaseDispatchStrategy(); - message.type = object.type ?? DispatcherType.UNSPECIFIED; - message.distKeyIndices = object.distKeyIndices?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDispatcher(): Dispatcher { - return { - type: DispatcherType.UNSPECIFIED, - distKeyIndices: [], - outputIndices: [], - hashMapping: undefined, - dispatcherId: 0, - downstreamActorId: [], - }; -} - -export const Dispatcher = { - fromJSON(object: any): Dispatcher { - return { - type: isSet(object.type) ? dispatcherTypeFromJSON(object.type) : DispatcherType.UNSPECIFIED, - distKeyIndices: Array.isArray(object?.distKeyIndices) ? object.distKeyIndices.map((e: any) => Number(e)) : [], - outputIndices: Array.isArray(object?.outputIndices) ? object.outputIndices.map((e: any) => Number(e)) : [], - hashMapping: isSet(object.hashMapping) ? ActorMapping.fromJSON(object.hashMapping) : undefined, - dispatcherId: isSet(object.dispatcherId) ? Number(object.dispatcherId) : 0, - downstreamActorId: Array.isArray(object?.downstreamActorId) - ? object.downstreamActorId.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: Dispatcher): unknown { - const obj: any = {}; - message.type !== undefined && (obj.type = dispatcherTypeToJSON(message.type)); - if (message.distKeyIndices) { - obj.distKeyIndices = message.distKeyIndices.map((e) => Math.round(e)); - } else { - obj.distKeyIndices = []; - } - if (message.outputIndices) { - obj.outputIndices = message.outputIndices.map((e) => Math.round(e)); - } else { - obj.outputIndices = []; - } - message.hashMapping !== undefined && - (obj.hashMapping = message.hashMapping ? ActorMapping.toJSON(message.hashMapping) : undefined); - message.dispatcherId !== undefined && (obj.dispatcherId = Math.round(message.dispatcherId)); - if (message.downstreamActorId) { - obj.downstreamActorId = message.downstreamActorId.map((e) => Math.round(e)); - } else { - obj.downstreamActorId = []; - } - return obj; - }, - - fromPartial, I>>(object: I): Dispatcher { - const message = createBaseDispatcher(); - message.type = object.type ?? DispatcherType.UNSPECIFIED; - message.distKeyIndices = object.distKeyIndices?.map((e) => e) || []; - message.outputIndices = object.outputIndices?.map((e) => e) || []; - message.hashMapping = (object.hashMapping !== undefined && object.hashMapping !== null) - ? ActorMapping.fromPartial(object.hashMapping) - : undefined; - message.dispatcherId = object.dispatcherId ?? 0; - message.downstreamActorId = object.downstreamActorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStreamActor(): StreamActor { - return { - actorId: 0, - fragmentId: 0, - nodes: undefined, - dispatcher: [], - upstreamActorId: [], - vnodeBitmap: undefined, - mviewDefinition: "", - }; -} - -export const StreamActor = { - fromJSON(object: any): StreamActor { - return { - actorId: isSet(object.actorId) ? Number(object.actorId) : 0, - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - nodes: isSet(object.nodes) ? StreamNode.fromJSON(object.nodes) : undefined, - dispatcher: Array.isArray(object?.dispatcher) ? object.dispatcher.map((e: any) => Dispatcher.fromJSON(e)) : [], - upstreamActorId: Array.isArray(object?.upstreamActorId) ? object.upstreamActorId.map((e: any) => Number(e)) : [], - vnodeBitmap: isSet(object.vnodeBitmap) ? Buffer.fromJSON(object.vnodeBitmap) : undefined, - mviewDefinition: isSet(object.mviewDefinition) ? String(object.mviewDefinition) : "", - }; - }, - - toJSON(message: StreamActor): unknown { - const obj: any = {}; - message.actorId !== undefined && (obj.actorId = Math.round(message.actorId)); - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.nodes !== undefined && (obj.nodes = message.nodes ? StreamNode.toJSON(message.nodes) : undefined); - if (message.dispatcher) { - obj.dispatcher = message.dispatcher.map((e) => e ? Dispatcher.toJSON(e) : undefined); - } else { - obj.dispatcher = []; - } - if (message.upstreamActorId) { - obj.upstreamActorId = message.upstreamActorId.map((e) => Math.round(e)); - } else { - obj.upstreamActorId = []; - } - message.vnodeBitmap !== undefined && - (obj.vnodeBitmap = message.vnodeBitmap ? Buffer.toJSON(message.vnodeBitmap) : undefined); - message.mviewDefinition !== undefined && (obj.mviewDefinition = message.mviewDefinition); - return obj; - }, - - fromPartial, I>>(object: I): StreamActor { - const message = createBaseStreamActor(); - message.actorId = object.actorId ?? 0; - message.fragmentId = object.fragmentId ?? 0; - message.nodes = (object.nodes !== undefined && object.nodes !== null) - ? StreamNode.fromPartial(object.nodes) - : undefined; - message.dispatcher = object.dispatcher?.map((e) => Dispatcher.fromPartial(e)) || []; - message.upstreamActorId = object.upstreamActorId?.map((e) => e) || []; - message.vnodeBitmap = (object.vnodeBitmap !== undefined && object.vnodeBitmap !== null) - ? Buffer.fromPartial(object.vnodeBitmap) - : undefined; - message.mviewDefinition = object.mviewDefinition ?? ""; - return message; - }, -}; - -function createBaseStreamEnvironment(): StreamEnvironment { - return { timezone: "" }; -} - -export const StreamEnvironment = { - fromJSON(object: any): StreamEnvironment { - return { timezone: isSet(object.timezone) ? String(object.timezone) : "" }; - }, - - toJSON(message: StreamEnvironment): unknown { - const obj: any = {}; - message.timezone !== undefined && (obj.timezone = message.timezone); - return obj; - }, - - fromPartial, I>>(object: I): StreamEnvironment { - const message = createBaseStreamEnvironment(); - message.timezone = object.timezone ?? ""; - return message; - }, -}; - -function createBaseStreamFragmentGraph(): StreamFragmentGraph { - return { fragments: {}, edges: [], dependentRelationIds: [], tableIdsCnt: 0, env: undefined, parallelism: undefined }; -} - -export const StreamFragmentGraph = { - fromJSON(object: any): StreamFragmentGraph { - return { - fragments: isObject(object.fragments) - ? Object.entries(object.fragments).reduce<{ [key: number]: StreamFragmentGraph_StreamFragment }>( - (acc, [key, value]) => { - acc[Number(key)] = StreamFragmentGraph_StreamFragment.fromJSON(value); - return acc; - }, - {}, - ) - : {}, - edges: Array.isArray(object?.edges) - ? object.edges.map((e: any) => StreamFragmentGraph_StreamFragmentEdge.fromJSON(e)) - : [], - dependentRelationIds: Array.isArray(object?.dependentRelationIds) - ? object.dependentRelationIds.map((e: any) => Number(e)) - : [], - tableIdsCnt: isSet(object.tableIdsCnt) ? Number(object.tableIdsCnt) : 0, - env: isSet(object.env) ? StreamEnvironment.fromJSON(object.env) : undefined, - parallelism: isSet(object.parallelism) ? StreamFragmentGraph_Parallelism.fromJSON(object.parallelism) : undefined, - }; - }, - - toJSON(message: StreamFragmentGraph): unknown { - const obj: any = {}; - obj.fragments = {}; - if (message.fragments) { - Object.entries(message.fragments).forEach(([k, v]) => { - obj.fragments[k] = StreamFragmentGraph_StreamFragment.toJSON(v); - }); - } - if (message.edges) { - obj.edges = message.edges.map((e) => e ? StreamFragmentGraph_StreamFragmentEdge.toJSON(e) : undefined); - } else { - obj.edges = []; - } - if (message.dependentRelationIds) { - obj.dependentRelationIds = message.dependentRelationIds.map((e) => Math.round(e)); - } else { - obj.dependentRelationIds = []; - } - message.tableIdsCnt !== undefined && (obj.tableIdsCnt = Math.round(message.tableIdsCnt)); - message.env !== undefined && (obj.env = message.env ? StreamEnvironment.toJSON(message.env) : undefined); - message.parallelism !== undefined && - (obj.parallelism = message.parallelism ? StreamFragmentGraph_Parallelism.toJSON(message.parallelism) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): StreamFragmentGraph { - const message = createBaseStreamFragmentGraph(); - message.fragments = Object.entries(object.fragments ?? {}).reduce< - { [key: number]: StreamFragmentGraph_StreamFragment } - >((acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = StreamFragmentGraph_StreamFragment.fromPartial(value); - } - return acc; - }, {}); - message.edges = object.edges?.map((e) => StreamFragmentGraph_StreamFragmentEdge.fromPartial(e)) || []; - message.dependentRelationIds = object.dependentRelationIds?.map((e) => e) || []; - message.tableIdsCnt = object.tableIdsCnt ?? 0; - message.env = (object.env !== undefined && object.env !== null) - ? StreamEnvironment.fromPartial(object.env) - : undefined; - message.parallelism = (object.parallelism !== undefined && object.parallelism !== null) - ? StreamFragmentGraph_Parallelism.fromPartial(object.parallelism) - : undefined; - return message; - }, -}; - -function createBaseStreamFragmentGraph_StreamFragment(): StreamFragmentGraph_StreamFragment { - return { - fragmentId: 0, - node: undefined, - fragmentTypeMask: 0, - requiresSingleton: false, - tableIdsCnt: 0, - upstreamTableIds: [], - }; -} - -export const StreamFragmentGraph_StreamFragment = { - fromJSON(object: any): StreamFragmentGraph_StreamFragment { - return { - fragmentId: isSet(object.fragmentId) ? Number(object.fragmentId) : 0, - node: isSet(object.node) ? StreamNode.fromJSON(object.node) : undefined, - fragmentTypeMask: isSet(object.fragmentTypeMask) ? Number(object.fragmentTypeMask) : 0, - requiresSingleton: isSet(object.requiresSingleton) ? Boolean(object.requiresSingleton) : false, - tableIdsCnt: isSet(object.tableIdsCnt) ? Number(object.tableIdsCnt) : 0, - upstreamTableIds: Array.isArray(object?.upstreamTableIds) - ? object.upstreamTableIds.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: StreamFragmentGraph_StreamFragment): unknown { - const obj: any = {}; - message.fragmentId !== undefined && (obj.fragmentId = Math.round(message.fragmentId)); - message.node !== undefined && (obj.node = message.node ? StreamNode.toJSON(message.node) : undefined); - message.fragmentTypeMask !== undefined && (obj.fragmentTypeMask = Math.round(message.fragmentTypeMask)); - message.requiresSingleton !== undefined && (obj.requiresSingleton = message.requiresSingleton); - message.tableIdsCnt !== undefined && (obj.tableIdsCnt = Math.round(message.tableIdsCnt)); - if (message.upstreamTableIds) { - obj.upstreamTableIds = message.upstreamTableIds.map((e) => Math.round(e)); - } else { - obj.upstreamTableIds = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_StreamFragment { - const message = createBaseStreamFragmentGraph_StreamFragment(); - message.fragmentId = object.fragmentId ?? 0; - message.node = (object.node !== undefined && object.node !== null) - ? StreamNode.fromPartial(object.node) - : undefined; - message.fragmentTypeMask = object.fragmentTypeMask ?? 0; - message.requiresSingleton = object.requiresSingleton ?? false; - message.tableIdsCnt = object.tableIdsCnt ?? 0; - message.upstreamTableIds = object.upstreamTableIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseStreamFragmentGraph_StreamFragmentEdge(): StreamFragmentGraph_StreamFragmentEdge { - return { dispatchStrategy: undefined, linkId: 0, upstreamId: 0, downstreamId: 0 }; -} - -export const StreamFragmentGraph_StreamFragmentEdge = { - fromJSON(object: any): StreamFragmentGraph_StreamFragmentEdge { - return { - dispatchStrategy: isSet(object.dispatchStrategy) ? DispatchStrategy.fromJSON(object.dispatchStrategy) : undefined, - linkId: isSet(object.linkId) ? Number(object.linkId) : 0, - upstreamId: isSet(object.upstreamId) ? Number(object.upstreamId) : 0, - downstreamId: isSet(object.downstreamId) ? Number(object.downstreamId) : 0, - }; - }, - - toJSON(message: StreamFragmentGraph_StreamFragmentEdge): unknown { - const obj: any = {}; - message.dispatchStrategy !== undefined && - (obj.dispatchStrategy = message.dispatchStrategy ? DispatchStrategy.toJSON(message.dispatchStrategy) : undefined); - message.linkId !== undefined && (obj.linkId = Math.round(message.linkId)); - message.upstreamId !== undefined && (obj.upstreamId = Math.round(message.upstreamId)); - message.downstreamId !== undefined && (obj.downstreamId = Math.round(message.downstreamId)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_StreamFragmentEdge { - const message = createBaseStreamFragmentGraph_StreamFragmentEdge(); - message.dispatchStrategy = (object.dispatchStrategy !== undefined && object.dispatchStrategy !== null) - ? DispatchStrategy.fromPartial(object.dispatchStrategy) - : undefined; - message.linkId = object.linkId ?? 0; - message.upstreamId = object.upstreamId ?? 0; - message.downstreamId = object.downstreamId ?? 0; - return message; - }, -}; - -function createBaseStreamFragmentGraph_Parallelism(): StreamFragmentGraph_Parallelism { - return { parallelism: 0 }; -} - -export const StreamFragmentGraph_Parallelism = { - fromJSON(object: any): StreamFragmentGraph_Parallelism { - return { parallelism: isSet(object.parallelism) ? Number(object.parallelism) : 0 }; - }, - - toJSON(message: StreamFragmentGraph_Parallelism): unknown { - const obj: any = {}; - message.parallelism !== undefined && (obj.parallelism = Math.round(message.parallelism)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_Parallelism { - const message = createBaseStreamFragmentGraph_Parallelism(); - message.parallelism = object.parallelism ?? 0; - return message; - }, -}; - -function createBaseStreamFragmentGraph_FragmentsEntry(): StreamFragmentGraph_FragmentsEntry { - return { key: 0, value: undefined }; -} - -export const StreamFragmentGraph_FragmentsEntry = { - fromJSON(object: any): StreamFragmentGraph_FragmentsEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? StreamFragmentGraph_StreamFragment.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: StreamFragmentGraph_FragmentsEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && - (obj.value = message.value ? StreamFragmentGraph_StreamFragment.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): StreamFragmentGraph_FragmentsEntry { - const message = createBaseStreamFragmentGraph_FragmentsEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? StreamFragmentGraph_StreamFragment.fromPartial(object.value) - : undefined; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/stream_service.ts b/dashboard/proto/gen/stream_service.ts deleted file mode 100644 index 2740cb287c6b2..0000000000000 --- a/dashboard/proto/gen/stream_service.ts +++ /dev/null @@ -1,725 +0,0 @@ -/* eslint-disable */ -import { ActorInfo, Status } from "./common"; -import { SstableInfo, TableStats } from "./hummock"; -import { Barrier, StreamActor } from "./stream_plan"; - -export const protobufPackage = "stream_service"; - -/** Describe the fragments which will be running on this node */ -export interface UpdateActorsRequest { - requestId: string; - actors: StreamActor[]; -} - -export interface UpdateActorsResponse { - status: Status | undefined; -} - -export interface BroadcastActorInfoTableRequest { - info: ActorInfo[]; -} - -/** Create channels and gRPC connections for a fragment */ -export interface BuildActorsRequest { - requestId: string; - actorId: number[]; -} - -export interface BuildActorsResponse { - requestId: string; - status: Status | undefined; -} - -export interface DropActorsRequest { - requestId: string; - actorIds: number[]; -} - -export interface DropActorsResponse { - requestId: string; - status: Status | undefined; -} - -export interface ForceStopActorsRequest { - requestId: string; -} - -export interface ForceStopActorsResponse { - requestId: string; - status: Status | undefined; -} - -export interface InjectBarrierRequest { - requestId: string; - barrier: Barrier | undefined; - actorIdsToSend: number[]; - actorIdsToCollect: number[]; -} - -export interface InjectBarrierResponse { - requestId: string; - status: Status | undefined; -} - -export interface BarrierCompleteRequest { - requestId: string; - prevEpoch: number; -} - -export interface BarrierCompleteResponse { - requestId: string; - status: Status | undefined; - createMviewProgress: BarrierCompleteResponse_CreateMviewProgress[]; - syncedSstables: BarrierCompleteResponse_GroupedSstableInfo[]; - workerId: number; -} - -export interface BarrierCompleteResponse_CreateMviewProgress { - chainActorId: number; - done: boolean; - consumedEpoch: number; - consumedRows: number; -} - -export interface BarrierCompleteResponse_GroupedSstableInfo { - compactionGroupId: number; - sst: SstableInfo | undefined; - tableStatsMap: { [key: number]: TableStats }; -} - -export interface BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - key: number; - value: TableStats | undefined; -} - -/** Before starting streaming, the leader node broadcast the actor-host table to needed workers. */ -export interface BroadcastActorInfoTableResponse { - status: Status | undefined; -} - -export interface WaitEpochCommitRequest { - epoch: number; -} - -export interface WaitEpochCommitResponse { - status: Status | undefined; -} - -function createBaseUpdateActorsRequest(): UpdateActorsRequest { - return { requestId: "", actors: [] }; -} - -export const UpdateActorsRequest = { - fromJSON(object: any): UpdateActorsRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - actors: Array.isArray(object?.actors) ? object.actors.map((e: any) => StreamActor.fromJSON(e)) : [], - }; - }, - - toJSON(message: UpdateActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - if (message.actors) { - obj.actors = message.actors.map((e) => e ? StreamActor.toJSON(e) : undefined); - } else { - obj.actors = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateActorsRequest { - const message = createBaseUpdateActorsRequest(); - message.requestId = object.requestId ?? ""; - message.actors = object.actors?.map((e) => StreamActor.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseUpdateActorsResponse(): UpdateActorsResponse { - return { status: undefined }; -} - -export const UpdateActorsResponse = { - fromJSON(object: any): UpdateActorsResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: UpdateActorsResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): UpdateActorsResponse { - const message = createBaseUpdateActorsResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseBroadcastActorInfoTableRequest(): BroadcastActorInfoTableRequest { - return { info: [] }; -} - -export const BroadcastActorInfoTableRequest = { - fromJSON(object: any): BroadcastActorInfoTableRequest { - return { info: Array.isArray(object?.info) ? object.info.map((e: any) => ActorInfo.fromJSON(e)) : [] }; - }, - - toJSON(message: BroadcastActorInfoTableRequest): unknown { - const obj: any = {}; - if (message.info) { - obj.info = message.info.map((e) => e ? ActorInfo.toJSON(e) : undefined); - } else { - obj.info = []; - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): BroadcastActorInfoTableRequest { - const message = createBaseBroadcastActorInfoTableRequest(); - message.info = object.info?.map((e) => ActorInfo.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseBuildActorsRequest(): BuildActorsRequest { - return { requestId: "", actorId: [] }; -} - -export const BuildActorsRequest = { - fromJSON(object: any): BuildActorsRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - actorId: Array.isArray(object?.actorId) ? object.actorId.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: BuildActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - if (message.actorId) { - obj.actorId = message.actorId.map((e) => Math.round(e)); - } else { - obj.actorId = []; - } - return obj; - }, - - fromPartial, I>>(object: I): BuildActorsRequest { - const message = createBaseBuildActorsRequest(); - message.requestId = object.requestId ?? ""; - message.actorId = object.actorId?.map((e) => e) || []; - return message; - }, -}; - -function createBaseBuildActorsResponse(): BuildActorsResponse { - return { requestId: "", status: undefined }; -} - -export const BuildActorsResponse = { - fromJSON(object: any): BuildActorsResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: BuildActorsResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): BuildActorsResponse { - const message = createBaseBuildActorsResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseDropActorsRequest(): DropActorsRequest { - return { requestId: "", actorIds: [] }; -} - -export const DropActorsRequest = { - fromJSON(object: any): DropActorsRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - actorIds: Array.isArray(object?.actorIds) ? object.actorIds.map((e: any) => Number(e)) : [], - }; - }, - - toJSON(message: DropActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - if (message.actorIds) { - obj.actorIds = message.actorIds.map((e) => Math.round(e)); - } else { - obj.actorIds = []; - } - return obj; - }, - - fromPartial, I>>(object: I): DropActorsRequest { - const message = createBaseDropActorsRequest(); - message.requestId = object.requestId ?? ""; - message.actorIds = object.actorIds?.map((e) => e) || []; - return message; - }, -}; - -function createBaseDropActorsResponse(): DropActorsResponse { - return { requestId: "", status: undefined }; -} - -export const DropActorsResponse = { - fromJSON(object: any): DropActorsResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: DropActorsResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): DropActorsResponse { - const message = createBaseDropActorsResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseForceStopActorsRequest(): ForceStopActorsRequest { - return { requestId: "" }; -} - -export const ForceStopActorsRequest = { - fromJSON(object: any): ForceStopActorsRequest { - return { requestId: isSet(object.requestId) ? String(object.requestId) : "" }; - }, - - toJSON(message: ForceStopActorsRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - return obj; - }, - - fromPartial, I>>(object: I): ForceStopActorsRequest { - const message = createBaseForceStopActorsRequest(); - message.requestId = object.requestId ?? ""; - return message; - }, -}; - -function createBaseForceStopActorsResponse(): ForceStopActorsResponse { - return { requestId: "", status: undefined }; -} - -export const ForceStopActorsResponse = { - fromJSON(object: any): ForceStopActorsResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: ForceStopActorsResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ForceStopActorsResponse { - const message = createBaseForceStopActorsResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseInjectBarrierRequest(): InjectBarrierRequest { - return { requestId: "", barrier: undefined, actorIdsToSend: [], actorIdsToCollect: [] }; -} - -export const InjectBarrierRequest = { - fromJSON(object: any): InjectBarrierRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - barrier: isSet(object.barrier) ? Barrier.fromJSON(object.barrier) : undefined, - actorIdsToSend: Array.isArray(object?.actorIdsToSend) ? object.actorIdsToSend.map((e: any) => Number(e)) : [], - actorIdsToCollect: Array.isArray(object?.actorIdsToCollect) - ? object.actorIdsToCollect.map((e: any) => Number(e)) - : [], - }; - }, - - toJSON(message: InjectBarrierRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.barrier !== undefined && (obj.barrier = message.barrier ? Barrier.toJSON(message.barrier) : undefined); - if (message.actorIdsToSend) { - obj.actorIdsToSend = message.actorIdsToSend.map((e) => Math.round(e)); - } else { - obj.actorIdsToSend = []; - } - if (message.actorIdsToCollect) { - obj.actorIdsToCollect = message.actorIdsToCollect.map((e) => Math.round(e)); - } else { - obj.actorIdsToCollect = []; - } - return obj; - }, - - fromPartial, I>>(object: I): InjectBarrierRequest { - const message = createBaseInjectBarrierRequest(); - message.requestId = object.requestId ?? ""; - message.barrier = (object.barrier !== undefined && object.barrier !== null) - ? Barrier.fromPartial(object.barrier) - : undefined; - message.actorIdsToSend = object.actorIdsToSend?.map((e) => e) || []; - message.actorIdsToCollect = object.actorIdsToCollect?.map((e) => e) || []; - return message; - }, -}; - -function createBaseInjectBarrierResponse(): InjectBarrierResponse { - return { requestId: "", status: undefined }; -} - -export const InjectBarrierResponse = { - fromJSON(object: any): InjectBarrierResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - }; - }, - - toJSON(message: InjectBarrierResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): InjectBarrierResponse { - const message = createBaseInjectBarrierResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseBarrierCompleteRequest(): BarrierCompleteRequest { - return { requestId: "", prevEpoch: 0 }; -} - -export const BarrierCompleteRequest = { - fromJSON(object: any): BarrierCompleteRequest { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - prevEpoch: isSet(object.prevEpoch) ? Number(object.prevEpoch) : 0, - }; - }, - - toJSON(message: BarrierCompleteRequest): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.prevEpoch !== undefined && (obj.prevEpoch = Math.round(message.prevEpoch)); - return obj; - }, - - fromPartial, I>>(object: I): BarrierCompleteRequest { - const message = createBaseBarrierCompleteRequest(); - message.requestId = object.requestId ?? ""; - message.prevEpoch = object.prevEpoch ?? 0; - return message; - }, -}; - -function createBaseBarrierCompleteResponse(): BarrierCompleteResponse { - return { requestId: "", status: undefined, createMviewProgress: [], syncedSstables: [], workerId: 0 }; -} - -export const BarrierCompleteResponse = { - fromJSON(object: any): BarrierCompleteResponse { - return { - requestId: isSet(object.requestId) ? String(object.requestId) : "", - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - createMviewProgress: Array.isArray(object?.createMviewProgress) - ? object.createMviewProgress.map((e: any) => BarrierCompleteResponse_CreateMviewProgress.fromJSON(e)) - : [], - syncedSstables: Array.isArray(object?.syncedSstables) - ? object.syncedSstables.map((e: any) => BarrierCompleteResponse_GroupedSstableInfo.fromJSON(e)) - : [], - workerId: isSet(object.workerId) ? Number(object.workerId) : 0, - }; - }, - - toJSON(message: BarrierCompleteResponse): unknown { - const obj: any = {}; - message.requestId !== undefined && (obj.requestId = message.requestId); - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - if (message.createMviewProgress) { - obj.createMviewProgress = message.createMviewProgress.map((e) => - e ? BarrierCompleteResponse_CreateMviewProgress.toJSON(e) : undefined - ); - } else { - obj.createMviewProgress = []; - } - if (message.syncedSstables) { - obj.syncedSstables = message.syncedSstables.map((e) => - e ? BarrierCompleteResponse_GroupedSstableInfo.toJSON(e) : undefined - ); - } else { - obj.syncedSstables = []; - } - message.workerId !== undefined && (obj.workerId = Math.round(message.workerId)); - return obj; - }, - - fromPartial, I>>(object: I): BarrierCompleteResponse { - const message = createBaseBarrierCompleteResponse(); - message.requestId = object.requestId ?? ""; - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.createMviewProgress = - object.createMviewProgress?.map((e) => BarrierCompleteResponse_CreateMviewProgress.fromPartial(e)) || []; - message.syncedSstables = - object.syncedSstables?.map((e) => BarrierCompleteResponse_GroupedSstableInfo.fromPartial(e)) || []; - message.workerId = object.workerId ?? 0; - return message; - }, -}; - -function createBaseBarrierCompleteResponse_CreateMviewProgress(): BarrierCompleteResponse_CreateMviewProgress { - return { chainActorId: 0, done: false, consumedEpoch: 0, consumedRows: 0 }; -} - -export const BarrierCompleteResponse_CreateMviewProgress = { - fromJSON(object: any): BarrierCompleteResponse_CreateMviewProgress { - return { - chainActorId: isSet(object.chainActorId) ? Number(object.chainActorId) : 0, - done: isSet(object.done) ? Boolean(object.done) : false, - consumedEpoch: isSet(object.consumedEpoch) ? Number(object.consumedEpoch) : 0, - consumedRows: isSet(object.consumedRows) ? Number(object.consumedRows) : 0, - }; - }, - - toJSON(message: BarrierCompleteResponse_CreateMviewProgress): unknown { - const obj: any = {}; - message.chainActorId !== undefined && (obj.chainActorId = Math.round(message.chainActorId)); - message.done !== undefined && (obj.done = message.done); - message.consumedEpoch !== undefined && (obj.consumedEpoch = Math.round(message.consumedEpoch)); - message.consumedRows !== undefined && (obj.consumedRows = Math.round(message.consumedRows)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): BarrierCompleteResponse_CreateMviewProgress { - const message = createBaseBarrierCompleteResponse_CreateMviewProgress(); - message.chainActorId = object.chainActorId ?? 0; - message.done = object.done ?? false; - message.consumedEpoch = object.consumedEpoch ?? 0; - message.consumedRows = object.consumedRows ?? 0; - return message; - }, -}; - -function createBaseBarrierCompleteResponse_GroupedSstableInfo(): BarrierCompleteResponse_GroupedSstableInfo { - return { compactionGroupId: 0, sst: undefined, tableStatsMap: {} }; -} - -export const BarrierCompleteResponse_GroupedSstableInfo = { - fromJSON(object: any): BarrierCompleteResponse_GroupedSstableInfo { - return { - compactionGroupId: isSet(object.compactionGroupId) ? Number(object.compactionGroupId) : 0, - sst: isSet(object.sst) ? SstableInfo.fromJSON(object.sst) : undefined, - tableStatsMap: isObject(object.tableStatsMap) - ? Object.entries(object.tableStatsMap).reduce<{ [key: number]: TableStats }>((acc, [key, value]) => { - acc[Number(key)] = TableStats.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - - toJSON(message: BarrierCompleteResponse_GroupedSstableInfo): unknown { - const obj: any = {}; - message.compactionGroupId !== undefined && (obj.compactionGroupId = Math.round(message.compactionGroupId)); - message.sst !== undefined && (obj.sst = message.sst ? SstableInfo.toJSON(message.sst) : undefined); - obj.tableStatsMap = {}; - if (message.tableStatsMap) { - Object.entries(message.tableStatsMap).forEach(([k, v]) => { - obj.tableStatsMap[k] = TableStats.toJSON(v); - }); - } - return obj; - }, - - fromPartial, I>>( - object: I, - ): BarrierCompleteResponse_GroupedSstableInfo { - const message = createBaseBarrierCompleteResponse_GroupedSstableInfo(); - message.compactionGroupId = object.compactionGroupId ?? 0; - message.sst = (object.sst !== undefined && object.sst !== null) ? SstableInfo.fromPartial(object.sst) : undefined; - message.tableStatsMap = Object.entries(object.tableStatsMap ?? {}).reduce<{ [key: number]: TableStats }>( - (acc, [key, value]) => { - if (value !== undefined) { - acc[Number(key)] = TableStats.fromPartial(value); - } - return acc; - }, - {}, - ); - return message; - }, -}; - -function createBaseBarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry(): BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - return { key: 0, value: undefined }; -} - -export const BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry = { - fromJSON(object: any): BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - return { - key: isSet(object.key) ? Number(object.key) : 0, - value: isSet(object.value) ? TableStats.fromJSON(object.value) : undefined, - }; - }, - - toJSON(message: BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = Math.round(message.key)); - message.value !== undefined && (obj.value = message.value ? TableStats.toJSON(message.value) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): BarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry { - const message = createBaseBarrierCompleteResponse_GroupedSstableInfo_TableStatsMapEntry(); - message.key = object.key ?? 0; - message.value = (object.value !== undefined && object.value !== null) - ? TableStats.fromPartial(object.value) - : undefined; - return message; - }, -}; - -function createBaseBroadcastActorInfoTableResponse(): BroadcastActorInfoTableResponse { - return { status: undefined }; -} - -export const BroadcastActorInfoTableResponse = { - fromJSON(object: any): BroadcastActorInfoTableResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: BroadcastActorInfoTableResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>( - object: I, - ): BroadcastActorInfoTableResponse { - const message = createBaseBroadcastActorInfoTableResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseWaitEpochCommitRequest(): WaitEpochCommitRequest { - return { epoch: 0 }; -} - -export const WaitEpochCommitRequest = { - fromJSON(object: any): WaitEpochCommitRequest { - return { epoch: isSet(object.epoch) ? Number(object.epoch) : 0 }; - }, - - toJSON(message: WaitEpochCommitRequest): unknown { - const obj: any = {}; - message.epoch !== undefined && (obj.epoch = Math.round(message.epoch)); - return obj; - }, - - fromPartial, I>>(object: I): WaitEpochCommitRequest { - const message = createBaseWaitEpochCommitRequest(); - message.epoch = object.epoch ?? 0; - return message; - }, -}; - -function createBaseWaitEpochCommitResponse(): WaitEpochCommitResponse { - return { status: undefined }; -} - -export const WaitEpochCommitResponse = { - fromJSON(object: any): WaitEpochCommitResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: WaitEpochCommitResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): WaitEpochCommitResponse { - const message = createBaseWaitEpochCommitResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isObject(value: any): boolean { - return typeof value === "object" && value !== null; -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/task_service.ts b/dashboard/proto/gen/task_service.ts deleted file mode 100644 index 2cfcb1d49bf04..0000000000000 --- a/dashboard/proto/gen/task_service.ts +++ /dev/null @@ -1,544 +0,0 @@ -/* eslint-disable */ -import { PlanFragment, TaskId as TaskId1, TaskOutputId } from "./batch_plan"; -import { BatchQueryEpoch, Status } from "./common"; -import { DataChunk } from "./data"; -import { StreamMessage } from "./stream_plan"; - -export const protobufPackage = "task_service"; - -/** Task is a running instance of Stage. */ -export interface TaskId { - queryId: string; - stageId: number; - taskId: number; -} - -export interface TaskInfoResponse { - taskId: TaskId1 | undefined; - taskStatus: TaskInfoResponse_TaskStatus; - /** Optional error message for failed task. */ - errorMessage: string; -} - -export const TaskInfoResponse_TaskStatus = { - /** UNSPECIFIED - Note: Requirement of proto3: first enum must be 0. */ - UNSPECIFIED: "UNSPECIFIED", - PENDING: "PENDING", - RUNNING: "RUNNING", - FINISHED: "FINISHED", - FAILED: "FAILED", - ABORTED: "ABORTED", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type TaskInfoResponse_TaskStatus = typeof TaskInfoResponse_TaskStatus[keyof typeof TaskInfoResponse_TaskStatus]; - -export function taskInfoResponse_TaskStatusFromJSON(object: any): TaskInfoResponse_TaskStatus { - switch (object) { - case 0: - case "UNSPECIFIED": - return TaskInfoResponse_TaskStatus.UNSPECIFIED; - case 2: - case "PENDING": - return TaskInfoResponse_TaskStatus.PENDING; - case 3: - case "RUNNING": - return TaskInfoResponse_TaskStatus.RUNNING; - case 6: - case "FINISHED": - return TaskInfoResponse_TaskStatus.FINISHED; - case 7: - case "FAILED": - return TaskInfoResponse_TaskStatus.FAILED; - case 8: - case "ABORTED": - return TaskInfoResponse_TaskStatus.ABORTED; - case -1: - case "UNRECOGNIZED": - default: - return TaskInfoResponse_TaskStatus.UNRECOGNIZED; - } -} - -export function taskInfoResponse_TaskStatusToJSON(object: TaskInfoResponse_TaskStatus): string { - switch (object) { - case TaskInfoResponse_TaskStatus.UNSPECIFIED: - return "UNSPECIFIED"; - case TaskInfoResponse_TaskStatus.PENDING: - return "PENDING"; - case TaskInfoResponse_TaskStatus.RUNNING: - return "RUNNING"; - case TaskInfoResponse_TaskStatus.FINISHED: - return "FINISHED"; - case TaskInfoResponse_TaskStatus.FAILED: - return "FAILED"; - case TaskInfoResponse_TaskStatus.ABORTED: - return "ABORTED"; - case TaskInfoResponse_TaskStatus.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface CreateTaskRequest { - taskId: TaskId1 | undefined; - plan: PlanFragment | undefined; - epoch: BatchQueryEpoch | undefined; -} - -export interface AbortTaskRequest { - taskId: TaskId1 | undefined; -} - -export interface AbortTaskResponse { - status: Status | undefined; -} - -export interface GetTaskInfoRequest { - taskId: TaskId1 | undefined; -} - -export interface GetDataResponse { - recordBatch: DataChunk | undefined; -} - -export interface ExecuteRequest { - taskId: TaskId1 | undefined; - plan: PlanFragment | undefined; - epoch: BatchQueryEpoch | undefined; -} - -export interface GetDataRequest { - taskOutputId: TaskOutputId | undefined; -} - -export interface GetStreamRequest { - value?: { $case: "get"; get: GetStreamRequest_Get } | { - $case: "addPermits"; - addPermits: GetStreamRequest_AddPermits; - }; -} - -/** The first message, which tells the upstream which channel this exchange stream is for. */ -export interface GetStreamRequest_Get { - upActorId: number; - downActorId: number; - upFragmentId: number; - downFragmentId: number; -} - -/** The following messages, which adds the permits back to the upstream to achieve back-pressure. */ -export interface GetStreamRequest_AddPermits { - permits: number; -} - -export interface GetStreamResponse { - message: - | StreamMessage - | undefined; - /** The number of permits acquired for this message, which should be sent back to the upstream with `AddPermits`. */ - permits: number; -} - -function createBaseTaskId(): TaskId { - return { queryId: "", stageId: 0, taskId: 0 }; -} - -export const TaskId = { - fromJSON(object: any): TaskId { - return { - queryId: isSet(object.queryId) ? String(object.queryId) : "", - stageId: isSet(object.stageId) ? Number(object.stageId) : 0, - taskId: isSet(object.taskId) ? Number(object.taskId) : 0, - }; - }, - - toJSON(message: TaskId): unknown { - const obj: any = {}; - message.queryId !== undefined && (obj.queryId = message.queryId); - message.stageId !== undefined && (obj.stageId = Math.round(message.stageId)); - message.taskId !== undefined && (obj.taskId = Math.round(message.taskId)); - return obj; - }, - - fromPartial, I>>(object: I): TaskId { - const message = createBaseTaskId(); - message.queryId = object.queryId ?? ""; - message.stageId = object.stageId ?? 0; - message.taskId = object.taskId ?? 0; - return message; - }, -}; - -function createBaseTaskInfoResponse(): TaskInfoResponse { - return { taskId: undefined, taskStatus: TaskInfoResponse_TaskStatus.UNSPECIFIED, errorMessage: "" }; -} - -export const TaskInfoResponse = { - fromJSON(object: any): TaskInfoResponse { - return { - taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined, - taskStatus: isSet(object.taskStatus) - ? taskInfoResponse_TaskStatusFromJSON(object.taskStatus) - : TaskInfoResponse_TaskStatus.UNSPECIFIED, - errorMessage: isSet(object.errorMessage) ? String(object.errorMessage) : "", - }; - }, - - toJSON(message: TaskInfoResponse): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - message.taskStatus !== undefined && (obj.taskStatus = taskInfoResponse_TaskStatusToJSON(message.taskStatus)); - message.errorMessage !== undefined && (obj.errorMessage = message.errorMessage); - return obj; - }, - - fromPartial, I>>(object: I): TaskInfoResponse { - const message = createBaseTaskInfoResponse(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - message.taskStatus = object.taskStatus ?? TaskInfoResponse_TaskStatus.UNSPECIFIED; - message.errorMessage = object.errorMessage ?? ""; - return message; - }, -}; - -function createBaseCreateTaskRequest(): CreateTaskRequest { - return { taskId: undefined, plan: undefined, epoch: undefined }; -} - -export const CreateTaskRequest = { - fromJSON(object: any): CreateTaskRequest { - return { - taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined, - plan: isSet(object.plan) ? PlanFragment.fromJSON(object.plan) : undefined, - epoch: isSet(object.epoch) ? BatchQueryEpoch.fromJSON(object.epoch) : undefined, - }; - }, - - toJSON(message: CreateTaskRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - message.plan !== undefined && (obj.plan = message.plan ? PlanFragment.toJSON(message.plan) : undefined); - message.epoch !== undefined && (obj.epoch = message.epoch ? BatchQueryEpoch.toJSON(message.epoch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateTaskRequest { - const message = createBaseCreateTaskRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - message.plan = (object.plan !== undefined && object.plan !== null) - ? PlanFragment.fromPartial(object.plan) - : undefined; - message.epoch = (object.epoch !== undefined && object.epoch !== null) - ? BatchQueryEpoch.fromPartial(object.epoch) - : undefined; - return message; - }, -}; - -function createBaseAbortTaskRequest(): AbortTaskRequest { - return { taskId: undefined }; -} - -export const AbortTaskRequest = { - fromJSON(object: any): AbortTaskRequest { - return { taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined }; - }, - - toJSON(message: AbortTaskRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AbortTaskRequest { - const message = createBaseAbortTaskRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - return message; - }, -}; - -function createBaseAbortTaskResponse(): AbortTaskResponse { - return { status: undefined }; -} - -export const AbortTaskResponse = { - fromJSON(object: any): AbortTaskResponse { - return { status: isSet(object.status) ? Status.fromJSON(object.status) : undefined }; - }, - - toJSON(message: AbortTaskResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): AbortTaskResponse { - const message = createBaseAbortTaskResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - return message; - }, -}; - -function createBaseGetTaskInfoRequest(): GetTaskInfoRequest { - return { taskId: undefined }; -} - -export const GetTaskInfoRequest = { - fromJSON(object: any): GetTaskInfoRequest { - return { taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined }; - }, - - toJSON(message: GetTaskInfoRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetTaskInfoRequest { - const message = createBaseGetTaskInfoRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - return message; - }, -}; - -function createBaseGetDataResponse(): GetDataResponse { - return { recordBatch: undefined }; -} - -export const GetDataResponse = { - fromJSON(object: any): GetDataResponse { - return { recordBatch: isSet(object.recordBatch) ? DataChunk.fromJSON(object.recordBatch) : undefined }; - }, - - toJSON(message: GetDataResponse): unknown { - const obj: any = {}; - message.recordBatch !== undefined && - (obj.recordBatch = message.recordBatch ? DataChunk.toJSON(message.recordBatch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetDataResponse { - const message = createBaseGetDataResponse(); - message.recordBatch = (object.recordBatch !== undefined && object.recordBatch !== null) - ? DataChunk.fromPartial(object.recordBatch) - : undefined; - return message; - }, -}; - -function createBaseExecuteRequest(): ExecuteRequest { - return { taskId: undefined, plan: undefined, epoch: undefined }; -} - -export const ExecuteRequest = { - fromJSON(object: any): ExecuteRequest { - return { - taskId: isSet(object.taskId) ? TaskId1.fromJSON(object.taskId) : undefined, - plan: isSet(object.plan) ? PlanFragment.fromJSON(object.plan) : undefined, - epoch: isSet(object.epoch) ? BatchQueryEpoch.fromJSON(object.epoch) : undefined, - }; - }, - - toJSON(message: ExecuteRequest): unknown { - const obj: any = {}; - message.taskId !== undefined && (obj.taskId = message.taskId ? TaskId1.toJSON(message.taskId) : undefined); - message.plan !== undefined && (obj.plan = message.plan ? PlanFragment.toJSON(message.plan) : undefined); - message.epoch !== undefined && (obj.epoch = message.epoch ? BatchQueryEpoch.toJSON(message.epoch) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): ExecuteRequest { - const message = createBaseExecuteRequest(); - message.taskId = (object.taskId !== undefined && object.taskId !== null) - ? TaskId1.fromPartial(object.taskId) - : undefined; - message.plan = (object.plan !== undefined && object.plan !== null) - ? PlanFragment.fromPartial(object.plan) - : undefined; - message.epoch = (object.epoch !== undefined && object.epoch !== null) - ? BatchQueryEpoch.fromPartial(object.epoch) - : undefined; - return message; - }, -}; - -function createBaseGetDataRequest(): GetDataRequest { - return { taskOutputId: undefined }; -} - -export const GetDataRequest = { - fromJSON(object: any): GetDataRequest { - return { taskOutputId: isSet(object.taskOutputId) ? TaskOutputId.fromJSON(object.taskOutputId) : undefined }; - }, - - toJSON(message: GetDataRequest): unknown { - const obj: any = {}; - message.taskOutputId !== undefined && - (obj.taskOutputId = message.taskOutputId ? TaskOutputId.toJSON(message.taskOutputId) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetDataRequest { - const message = createBaseGetDataRequest(); - message.taskOutputId = (object.taskOutputId !== undefined && object.taskOutputId !== null) - ? TaskOutputId.fromPartial(object.taskOutputId) - : undefined; - return message; - }, -}; - -function createBaseGetStreamRequest(): GetStreamRequest { - return { value: undefined }; -} - -export const GetStreamRequest = { - fromJSON(object: any): GetStreamRequest { - return { - value: isSet(object.get) - ? { $case: "get", get: GetStreamRequest_Get.fromJSON(object.get) } - : isSet(object.addPermits) - ? { $case: "addPermits", addPermits: GetStreamRequest_AddPermits.fromJSON(object.addPermits) } - : undefined, - }; - }, - - toJSON(message: GetStreamRequest): unknown { - const obj: any = {}; - message.value?.$case === "get" && - (obj.get = message.value?.get ? GetStreamRequest_Get.toJSON(message.value?.get) : undefined); - message.value?.$case === "addPermits" && (obj.addPermits = message.value?.addPermits - ? GetStreamRequest_AddPermits.toJSON(message.value?.addPermits) - : undefined); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamRequest { - const message = createBaseGetStreamRequest(); - if (object.value?.$case === "get" && object.value?.get !== undefined && object.value?.get !== null) { - message.value = { $case: "get", get: GetStreamRequest_Get.fromPartial(object.value.get) }; - } - if ( - object.value?.$case === "addPermits" && - object.value?.addPermits !== undefined && - object.value?.addPermits !== null - ) { - message.value = { - $case: "addPermits", - addPermits: GetStreamRequest_AddPermits.fromPartial(object.value.addPermits), - }; - } - return message; - }, -}; - -function createBaseGetStreamRequest_Get(): GetStreamRequest_Get { - return { upActorId: 0, downActorId: 0, upFragmentId: 0, downFragmentId: 0 }; -} - -export const GetStreamRequest_Get = { - fromJSON(object: any): GetStreamRequest_Get { - return { - upActorId: isSet(object.upActorId) ? Number(object.upActorId) : 0, - downActorId: isSet(object.downActorId) ? Number(object.downActorId) : 0, - upFragmentId: isSet(object.upFragmentId) ? Number(object.upFragmentId) : 0, - downFragmentId: isSet(object.downFragmentId) ? Number(object.downFragmentId) : 0, - }; - }, - - toJSON(message: GetStreamRequest_Get): unknown { - const obj: any = {}; - message.upActorId !== undefined && (obj.upActorId = Math.round(message.upActorId)); - message.downActorId !== undefined && (obj.downActorId = Math.round(message.downActorId)); - message.upFragmentId !== undefined && (obj.upFragmentId = Math.round(message.upFragmentId)); - message.downFragmentId !== undefined && (obj.downFragmentId = Math.round(message.downFragmentId)); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamRequest_Get { - const message = createBaseGetStreamRequest_Get(); - message.upActorId = object.upActorId ?? 0; - message.downActorId = object.downActorId ?? 0; - message.upFragmentId = object.upFragmentId ?? 0; - message.downFragmentId = object.downFragmentId ?? 0; - return message; - }, -}; - -function createBaseGetStreamRequest_AddPermits(): GetStreamRequest_AddPermits { - return { permits: 0 }; -} - -export const GetStreamRequest_AddPermits = { - fromJSON(object: any): GetStreamRequest_AddPermits { - return { permits: isSet(object.permits) ? Number(object.permits) : 0 }; - }, - - toJSON(message: GetStreamRequest_AddPermits): unknown { - const obj: any = {}; - message.permits !== undefined && (obj.permits = Math.round(message.permits)); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamRequest_AddPermits { - const message = createBaseGetStreamRequest_AddPermits(); - message.permits = object.permits ?? 0; - return message; - }, -}; - -function createBaseGetStreamResponse(): GetStreamResponse { - return { message: undefined, permits: 0 }; -} - -export const GetStreamResponse = { - fromJSON(object: any): GetStreamResponse { - return { - message: isSet(object.message) ? StreamMessage.fromJSON(object.message) : undefined, - permits: isSet(object.permits) ? Number(object.permits) : 0, - }; - }, - - toJSON(message: GetStreamResponse): unknown { - const obj: any = {}; - message.message !== undefined && - (obj.message = message.message ? StreamMessage.toJSON(message.message) : undefined); - message.permits !== undefined && (obj.permits = Math.round(message.permits)); - return obj; - }, - - fromPartial, I>>(object: I): GetStreamResponse { - const message = createBaseGetStreamResponse(); - message.message = (object.message !== undefined && object.message !== null) - ? StreamMessage.fromPartial(object.message) - : undefined; - message.permits = object.permits ?? 0; - return message; - }, -}; - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/proto/gen/user.ts b/dashboard/proto/gen/user.ts deleted file mode 100644 index cdf9070d84258..0000000000000 --- a/dashboard/proto/gen/user.ts +++ /dev/null @@ -1,889 +0,0 @@ -/* eslint-disable */ -import { Status } from "./common"; - -export const protobufPackage = "user"; - -/** AuthInfo is the information required to login to a server. */ -export interface AuthInfo { - encryptionType: AuthInfo_EncryptionType; - encryptedValue: Uint8Array; -} - -export const AuthInfo_EncryptionType = { - UNSPECIFIED: "UNSPECIFIED", - PLAINTEXT: "PLAINTEXT", - SHA256: "SHA256", - MD5: "MD5", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type AuthInfo_EncryptionType = typeof AuthInfo_EncryptionType[keyof typeof AuthInfo_EncryptionType]; - -export function authInfo_EncryptionTypeFromJSON(object: any): AuthInfo_EncryptionType { - switch (object) { - case 0: - case "UNSPECIFIED": - return AuthInfo_EncryptionType.UNSPECIFIED; - case 1: - case "PLAINTEXT": - return AuthInfo_EncryptionType.PLAINTEXT; - case 2: - case "SHA256": - return AuthInfo_EncryptionType.SHA256; - case 3: - case "MD5": - return AuthInfo_EncryptionType.MD5; - case -1: - case "UNRECOGNIZED": - default: - return AuthInfo_EncryptionType.UNRECOGNIZED; - } -} - -export function authInfo_EncryptionTypeToJSON(object: AuthInfo_EncryptionType): string { - switch (object) { - case AuthInfo_EncryptionType.UNSPECIFIED: - return "UNSPECIFIED"; - case AuthInfo_EncryptionType.PLAINTEXT: - return "PLAINTEXT"; - case AuthInfo_EncryptionType.SHA256: - return "SHA256"; - case AuthInfo_EncryptionType.MD5: - return "MD5"; - case AuthInfo_EncryptionType.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -/** User defines a user in the system. */ -export interface UserInfo { - id: number; - name: string; - isSuper: boolean; - canCreateDb: boolean; - canCreateUser: boolean; - canLogin: boolean; - authInfo: - | AuthInfo - | undefined; - /** / Granted privileges will be only updated through the command of GRANT/REVOKE. */ - grantPrivileges: GrantPrivilege[]; -} - -/** GrantPrivilege defines a privilege granted to a user. */ -export interface GrantPrivilege { - object?: - | { $case: "databaseId"; databaseId: number } - | { $case: "schemaId"; schemaId: number } - | { $case: "tableId"; tableId: number } - | { $case: "sourceId"; sourceId: number } - | { $case: "sinkId"; sinkId: number } - | { $case: "viewId"; viewId: number } - | { $case: "functionId"; functionId: number } - | { $case: "allTablesSchemaId"; allTablesSchemaId: number } - | { $case: "allSourcesSchemaId"; allSourcesSchemaId: number }; - actionWithOpts: GrantPrivilege_ActionWithGrantOption[]; -} - -export const GrantPrivilege_Action = { - UNSPECIFIED: "UNSPECIFIED", - SELECT: "SELECT", - INSERT: "INSERT", - UPDATE: "UPDATE", - DELETE: "DELETE", - CREATE: "CREATE", - CONNECT: "CONNECT", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type GrantPrivilege_Action = typeof GrantPrivilege_Action[keyof typeof GrantPrivilege_Action]; - -export function grantPrivilege_ActionFromJSON(object: any): GrantPrivilege_Action { - switch (object) { - case 0: - case "UNSPECIFIED": - return GrantPrivilege_Action.UNSPECIFIED; - case 1: - case "SELECT": - return GrantPrivilege_Action.SELECT; - case 2: - case "INSERT": - return GrantPrivilege_Action.INSERT; - case 3: - case "UPDATE": - return GrantPrivilege_Action.UPDATE; - case 4: - case "DELETE": - return GrantPrivilege_Action.DELETE; - case 5: - case "CREATE": - return GrantPrivilege_Action.CREATE; - case 6: - case "CONNECT": - return GrantPrivilege_Action.CONNECT; - case -1: - case "UNRECOGNIZED": - default: - return GrantPrivilege_Action.UNRECOGNIZED; - } -} - -export function grantPrivilege_ActionToJSON(object: GrantPrivilege_Action): string { - switch (object) { - case GrantPrivilege_Action.UNSPECIFIED: - return "UNSPECIFIED"; - case GrantPrivilege_Action.SELECT: - return "SELECT"; - case GrantPrivilege_Action.INSERT: - return "INSERT"; - case GrantPrivilege_Action.UPDATE: - return "UPDATE"; - case GrantPrivilege_Action.DELETE: - return "DELETE"; - case GrantPrivilege_Action.CREATE: - return "CREATE"; - case GrantPrivilege_Action.CONNECT: - return "CONNECT"; - case GrantPrivilege_Action.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface GrantPrivilege_ActionWithGrantOption { - action: GrantPrivilege_Action; - withGrantOption: boolean; - grantedBy: number; -} - -export interface CreateUserRequest { - user: UserInfo | undefined; -} - -export interface CreateUserResponse { - status: Status | undefined; - version: number; -} - -export interface DropUserRequest { - userId: number; -} - -export interface DropUserResponse { - status: Status | undefined; - version: number; -} - -export interface UpdateUserRequest { - user: UserInfo | undefined; - updateFields: UpdateUserRequest_UpdateField[]; -} - -export const UpdateUserRequest_UpdateField = { - UNSPECIFIED: "UNSPECIFIED", - SUPER: "SUPER", - LOGIN: "LOGIN", - CREATE_DB: "CREATE_DB", - AUTH_INFO: "AUTH_INFO", - RENAME: "RENAME", - CREATE_USER: "CREATE_USER", - UNRECOGNIZED: "UNRECOGNIZED", -} as const; - -export type UpdateUserRequest_UpdateField = - typeof UpdateUserRequest_UpdateField[keyof typeof UpdateUserRequest_UpdateField]; - -export function updateUserRequest_UpdateFieldFromJSON(object: any): UpdateUserRequest_UpdateField { - switch (object) { - case 0: - case "UNSPECIFIED": - return UpdateUserRequest_UpdateField.UNSPECIFIED; - case 1: - case "SUPER": - return UpdateUserRequest_UpdateField.SUPER; - case 2: - case "LOGIN": - return UpdateUserRequest_UpdateField.LOGIN; - case 3: - case "CREATE_DB": - return UpdateUserRequest_UpdateField.CREATE_DB; - case 4: - case "AUTH_INFO": - return UpdateUserRequest_UpdateField.AUTH_INFO; - case 5: - case "RENAME": - return UpdateUserRequest_UpdateField.RENAME; - case 6: - case "CREATE_USER": - return UpdateUserRequest_UpdateField.CREATE_USER; - case -1: - case "UNRECOGNIZED": - default: - return UpdateUserRequest_UpdateField.UNRECOGNIZED; - } -} - -export function updateUserRequest_UpdateFieldToJSON(object: UpdateUserRequest_UpdateField): string { - switch (object) { - case UpdateUserRequest_UpdateField.UNSPECIFIED: - return "UNSPECIFIED"; - case UpdateUserRequest_UpdateField.SUPER: - return "SUPER"; - case UpdateUserRequest_UpdateField.LOGIN: - return "LOGIN"; - case UpdateUserRequest_UpdateField.CREATE_DB: - return "CREATE_DB"; - case UpdateUserRequest_UpdateField.AUTH_INFO: - return "AUTH_INFO"; - case UpdateUserRequest_UpdateField.RENAME: - return "RENAME"; - case UpdateUserRequest_UpdateField.CREATE_USER: - return "CREATE_USER"; - case UpdateUserRequest_UpdateField.UNRECOGNIZED: - default: - return "UNRECOGNIZED"; - } -} - -export interface UpdateUserResponse { - status: Status | undefined; - version: number; -} - -export interface GrantPrivilegeRequest { - userIds: number[]; - privileges: GrantPrivilege[]; - withGrantOption: boolean; - grantedBy: number; -} - -export interface GrantPrivilegeResponse { - status: Status | undefined; - version: number; -} - -export interface RevokePrivilegeRequest { - userIds: number[]; - privileges: GrantPrivilege[]; - grantedBy: number; - revokeBy: number; - revokeGrantOption: boolean; - cascade: boolean; -} - -export interface RevokePrivilegeResponse { - status: Status | undefined; - version: number; -} - -function createBaseAuthInfo(): AuthInfo { - return { encryptionType: AuthInfo_EncryptionType.UNSPECIFIED, encryptedValue: new Uint8Array() }; -} - -export const AuthInfo = { - fromJSON(object: any): AuthInfo { - return { - encryptionType: isSet(object.encryptionType) - ? authInfo_EncryptionTypeFromJSON(object.encryptionType) - : AuthInfo_EncryptionType.UNSPECIFIED, - encryptedValue: isSet(object.encryptedValue) ? bytesFromBase64(object.encryptedValue) : new Uint8Array(), - }; - }, - - toJSON(message: AuthInfo): unknown { - const obj: any = {}; - message.encryptionType !== undefined && - (obj.encryptionType = authInfo_EncryptionTypeToJSON(message.encryptionType)); - message.encryptedValue !== undefined && - (obj.encryptedValue = base64FromBytes( - message.encryptedValue !== undefined ? message.encryptedValue : new Uint8Array(), - )); - return obj; - }, - - fromPartial, I>>(object: I): AuthInfo { - const message = createBaseAuthInfo(); - message.encryptionType = object.encryptionType ?? AuthInfo_EncryptionType.UNSPECIFIED; - message.encryptedValue = object.encryptedValue ?? new Uint8Array(); - return message; - }, -}; - -function createBaseUserInfo(): UserInfo { - return { - id: 0, - name: "", - isSuper: false, - canCreateDb: false, - canCreateUser: false, - canLogin: false, - authInfo: undefined, - grantPrivileges: [], - }; -} - -export const UserInfo = { - fromJSON(object: any): UserInfo { - return { - id: isSet(object.id) ? Number(object.id) : 0, - name: isSet(object.name) ? String(object.name) : "", - isSuper: isSet(object.isSuper) ? Boolean(object.isSuper) : false, - canCreateDb: isSet(object.canCreateDb) ? Boolean(object.canCreateDb) : false, - canCreateUser: isSet(object.canCreateUser) ? Boolean(object.canCreateUser) : false, - canLogin: isSet(object.canLogin) ? Boolean(object.canLogin) : false, - authInfo: isSet(object.authInfo) ? AuthInfo.fromJSON(object.authInfo) : undefined, - grantPrivileges: Array.isArray(object?.grantPrivileges) - ? object.grantPrivileges.map((e: any) => GrantPrivilege.fromJSON(e)) - : [], - }; - }, - - toJSON(message: UserInfo): unknown { - const obj: any = {}; - message.id !== undefined && (obj.id = Math.round(message.id)); - message.name !== undefined && (obj.name = message.name); - message.isSuper !== undefined && (obj.isSuper = message.isSuper); - message.canCreateDb !== undefined && (obj.canCreateDb = message.canCreateDb); - message.canCreateUser !== undefined && (obj.canCreateUser = message.canCreateUser); - message.canLogin !== undefined && (obj.canLogin = message.canLogin); - message.authInfo !== undefined && (obj.authInfo = message.authInfo ? AuthInfo.toJSON(message.authInfo) : undefined); - if (message.grantPrivileges) { - obj.grantPrivileges = message.grantPrivileges.map((e) => e ? GrantPrivilege.toJSON(e) : undefined); - } else { - obj.grantPrivileges = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UserInfo { - const message = createBaseUserInfo(); - message.id = object.id ?? 0; - message.name = object.name ?? ""; - message.isSuper = object.isSuper ?? false; - message.canCreateDb = object.canCreateDb ?? false; - message.canCreateUser = object.canCreateUser ?? false; - message.canLogin = object.canLogin ?? false; - message.authInfo = (object.authInfo !== undefined && object.authInfo !== null) - ? AuthInfo.fromPartial(object.authInfo) - : undefined; - message.grantPrivileges = object.grantPrivileges?.map((e) => GrantPrivilege.fromPartial(e)) || []; - return message; - }, -}; - -function createBaseGrantPrivilege(): GrantPrivilege { - return { object: undefined, actionWithOpts: [] }; -} - -export const GrantPrivilege = { - fromJSON(object: any): GrantPrivilege { - return { - object: isSet(object.databaseId) - ? { $case: "databaseId", databaseId: Number(object.databaseId) } - : isSet(object.schemaId) - ? { $case: "schemaId", schemaId: Number(object.schemaId) } - : isSet(object.tableId) - ? { $case: "tableId", tableId: Number(object.tableId) } - : isSet(object.sourceId) - ? { $case: "sourceId", sourceId: Number(object.sourceId) } - : isSet(object.sinkId) - ? { $case: "sinkId", sinkId: Number(object.sinkId) } - : isSet(object.viewId) - ? { $case: "viewId", viewId: Number(object.viewId) } - : isSet(object.functionId) - ? { $case: "functionId", functionId: Number(object.functionId) } - : isSet(object.allTablesSchemaId) - ? { $case: "allTablesSchemaId", allTablesSchemaId: Number(object.allTablesSchemaId) } - : isSet(object.allSourcesSchemaId) - ? { $case: "allSourcesSchemaId", allSourcesSchemaId: Number(object.allSourcesSchemaId) } - : undefined, - actionWithOpts: Array.isArray(object?.actionWithOpts) - ? object.actionWithOpts.map((e: any) => GrantPrivilege_ActionWithGrantOption.fromJSON(e)) - : [], - }; - }, - - toJSON(message: GrantPrivilege): unknown { - const obj: any = {}; - message.object?.$case === "databaseId" && (obj.databaseId = Math.round(message.object?.databaseId)); - message.object?.$case === "schemaId" && (obj.schemaId = Math.round(message.object?.schemaId)); - message.object?.$case === "tableId" && (obj.tableId = Math.round(message.object?.tableId)); - message.object?.$case === "sourceId" && (obj.sourceId = Math.round(message.object?.sourceId)); - message.object?.$case === "sinkId" && (obj.sinkId = Math.round(message.object?.sinkId)); - message.object?.$case === "viewId" && (obj.viewId = Math.round(message.object?.viewId)); - message.object?.$case === "functionId" && (obj.functionId = Math.round(message.object?.functionId)); - message.object?.$case === "allTablesSchemaId" && - (obj.allTablesSchemaId = Math.round(message.object?.allTablesSchemaId)); - message.object?.$case === "allSourcesSchemaId" && - (obj.allSourcesSchemaId = Math.round(message.object?.allSourcesSchemaId)); - if (message.actionWithOpts) { - obj.actionWithOpts = message.actionWithOpts.map((e) => - e ? GrantPrivilege_ActionWithGrantOption.toJSON(e) : undefined - ); - } else { - obj.actionWithOpts = []; - } - return obj; - }, - - fromPartial, I>>(object: I): GrantPrivilege { - const message = createBaseGrantPrivilege(); - if ( - object.object?.$case === "databaseId" && - object.object?.databaseId !== undefined && - object.object?.databaseId !== null - ) { - message.object = { $case: "databaseId", databaseId: object.object.databaseId }; - } - if ( - object.object?.$case === "schemaId" && object.object?.schemaId !== undefined && object.object?.schemaId !== null - ) { - message.object = { $case: "schemaId", schemaId: object.object.schemaId }; - } - if (object.object?.$case === "tableId" && object.object?.tableId !== undefined && object.object?.tableId !== null) { - message.object = { $case: "tableId", tableId: object.object.tableId }; - } - if ( - object.object?.$case === "sourceId" && object.object?.sourceId !== undefined && object.object?.sourceId !== null - ) { - message.object = { $case: "sourceId", sourceId: object.object.sourceId }; - } - if (object.object?.$case === "sinkId" && object.object?.sinkId !== undefined && object.object?.sinkId !== null) { - message.object = { $case: "sinkId", sinkId: object.object.sinkId }; - } - if (object.object?.$case === "viewId" && object.object?.viewId !== undefined && object.object?.viewId !== null) { - message.object = { $case: "viewId", viewId: object.object.viewId }; - } - if ( - object.object?.$case === "functionId" && - object.object?.functionId !== undefined && - object.object?.functionId !== null - ) { - message.object = { $case: "functionId", functionId: object.object.functionId }; - } - if ( - object.object?.$case === "allTablesSchemaId" && - object.object?.allTablesSchemaId !== undefined && - object.object?.allTablesSchemaId !== null - ) { - message.object = { $case: "allTablesSchemaId", allTablesSchemaId: object.object.allTablesSchemaId }; - } - if ( - object.object?.$case === "allSourcesSchemaId" && - object.object?.allSourcesSchemaId !== undefined && - object.object?.allSourcesSchemaId !== null - ) { - message.object = { $case: "allSourcesSchemaId", allSourcesSchemaId: object.object.allSourcesSchemaId }; - } - message.actionWithOpts = object.actionWithOpts?.map((e) => GrantPrivilege_ActionWithGrantOption.fromPartial(e)) || - []; - return message; - }, -}; - -function createBaseGrantPrivilege_ActionWithGrantOption(): GrantPrivilege_ActionWithGrantOption { - return { action: GrantPrivilege_Action.UNSPECIFIED, withGrantOption: false, grantedBy: 0 }; -} - -export const GrantPrivilege_ActionWithGrantOption = { - fromJSON(object: any): GrantPrivilege_ActionWithGrantOption { - return { - action: isSet(object.action) ? grantPrivilege_ActionFromJSON(object.action) : GrantPrivilege_Action.UNSPECIFIED, - withGrantOption: isSet(object.withGrantOption) ? Boolean(object.withGrantOption) : false, - grantedBy: isSet(object.grantedBy) ? Number(object.grantedBy) : 0, - }; - }, - - toJSON(message: GrantPrivilege_ActionWithGrantOption): unknown { - const obj: any = {}; - message.action !== undefined && (obj.action = grantPrivilege_ActionToJSON(message.action)); - message.withGrantOption !== undefined && (obj.withGrantOption = message.withGrantOption); - message.grantedBy !== undefined && (obj.grantedBy = Math.round(message.grantedBy)); - return obj; - }, - - fromPartial, I>>( - object: I, - ): GrantPrivilege_ActionWithGrantOption { - const message = createBaseGrantPrivilege_ActionWithGrantOption(); - message.action = object.action ?? GrantPrivilege_Action.UNSPECIFIED; - message.withGrantOption = object.withGrantOption ?? false; - message.grantedBy = object.grantedBy ?? 0; - return message; - }, -}; - -function createBaseCreateUserRequest(): CreateUserRequest { - return { user: undefined }; -} - -export const CreateUserRequest = { - fromJSON(object: any): CreateUserRequest { - return { user: isSet(object.user) ? UserInfo.fromJSON(object.user) : undefined }; - }, - - toJSON(message: CreateUserRequest): unknown { - const obj: any = {}; - message.user !== undefined && (obj.user = message.user ? UserInfo.toJSON(message.user) : undefined); - return obj; - }, - - fromPartial, I>>(object: I): CreateUserRequest { - const message = createBaseCreateUserRequest(); - message.user = (object.user !== undefined && object.user !== null) ? UserInfo.fromPartial(object.user) : undefined; - return message; - }, -}; - -function createBaseCreateUserResponse(): CreateUserResponse { - return { status: undefined, version: 0 }; -} - -export const CreateUserResponse = { - fromJSON(object: any): CreateUserResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: CreateUserResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): CreateUserResponse { - const message = createBaseCreateUserResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseDropUserRequest(): DropUserRequest { - return { userId: 0 }; -} - -export const DropUserRequest = { - fromJSON(object: any): DropUserRequest { - return { userId: isSet(object.userId) ? Number(object.userId) : 0 }; - }, - - toJSON(message: DropUserRequest): unknown { - const obj: any = {}; - message.userId !== undefined && (obj.userId = Math.round(message.userId)); - return obj; - }, - - fromPartial, I>>(object: I): DropUserRequest { - const message = createBaseDropUserRequest(); - message.userId = object.userId ?? 0; - return message; - }, -}; - -function createBaseDropUserResponse(): DropUserResponse { - return { status: undefined, version: 0 }; -} - -export const DropUserResponse = { - fromJSON(object: any): DropUserResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: DropUserResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): DropUserResponse { - const message = createBaseDropUserResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseUpdateUserRequest(): UpdateUserRequest { - return { user: undefined, updateFields: [] }; -} - -export const UpdateUserRequest = { - fromJSON(object: any): UpdateUserRequest { - return { - user: isSet(object.user) ? UserInfo.fromJSON(object.user) : undefined, - updateFields: Array.isArray(object?.updateFields) - ? object.updateFields.map((e: any) => updateUserRequest_UpdateFieldFromJSON(e)) - : [], - }; - }, - - toJSON(message: UpdateUserRequest): unknown { - const obj: any = {}; - message.user !== undefined && (obj.user = message.user ? UserInfo.toJSON(message.user) : undefined); - if (message.updateFields) { - obj.updateFields = message.updateFields.map((e) => updateUserRequest_UpdateFieldToJSON(e)); - } else { - obj.updateFields = []; - } - return obj; - }, - - fromPartial, I>>(object: I): UpdateUserRequest { - const message = createBaseUpdateUserRequest(); - message.user = (object.user !== undefined && object.user !== null) ? UserInfo.fromPartial(object.user) : undefined; - message.updateFields = object.updateFields?.map((e) => e) || []; - return message; - }, -}; - -function createBaseUpdateUserResponse(): UpdateUserResponse { - return { status: undefined, version: 0 }; -} - -export const UpdateUserResponse = { - fromJSON(object: any): UpdateUserResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: UpdateUserResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): UpdateUserResponse { - const message = createBaseUpdateUserResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseGrantPrivilegeRequest(): GrantPrivilegeRequest { - return { userIds: [], privileges: [], withGrantOption: false, grantedBy: 0 }; -} - -export const GrantPrivilegeRequest = { - fromJSON(object: any): GrantPrivilegeRequest { - return { - userIds: Array.isArray(object?.userIds) ? object.userIds.map((e: any) => Number(e)) : [], - privileges: Array.isArray(object?.privileges) - ? object.privileges.map((e: any) => GrantPrivilege.fromJSON(e)) - : [], - withGrantOption: isSet(object.withGrantOption) ? Boolean(object.withGrantOption) : false, - grantedBy: isSet(object.grantedBy) ? Number(object.grantedBy) : 0, - }; - }, - - toJSON(message: GrantPrivilegeRequest): unknown { - const obj: any = {}; - if (message.userIds) { - obj.userIds = message.userIds.map((e) => Math.round(e)); - } else { - obj.userIds = []; - } - if (message.privileges) { - obj.privileges = message.privileges.map((e) => e ? GrantPrivilege.toJSON(e) : undefined); - } else { - obj.privileges = []; - } - message.withGrantOption !== undefined && (obj.withGrantOption = message.withGrantOption); - message.grantedBy !== undefined && (obj.grantedBy = Math.round(message.grantedBy)); - return obj; - }, - - fromPartial, I>>(object: I): GrantPrivilegeRequest { - const message = createBaseGrantPrivilegeRequest(); - message.userIds = object.userIds?.map((e) => e) || []; - message.privileges = object.privileges?.map((e) => GrantPrivilege.fromPartial(e)) || []; - message.withGrantOption = object.withGrantOption ?? false; - message.grantedBy = object.grantedBy ?? 0; - return message; - }, -}; - -function createBaseGrantPrivilegeResponse(): GrantPrivilegeResponse { - return { status: undefined, version: 0 }; -} - -export const GrantPrivilegeResponse = { - fromJSON(object: any): GrantPrivilegeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: GrantPrivilegeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): GrantPrivilegeResponse { - const message = createBaseGrantPrivilegeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -function createBaseRevokePrivilegeRequest(): RevokePrivilegeRequest { - return { userIds: [], privileges: [], grantedBy: 0, revokeBy: 0, revokeGrantOption: false, cascade: false }; -} - -export const RevokePrivilegeRequest = { - fromJSON(object: any): RevokePrivilegeRequest { - return { - userIds: Array.isArray(object?.userIds) ? object.userIds.map((e: any) => Number(e)) : [], - privileges: Array.isArray(object?.privileges) - ? object.privileges.map((e: any) => GrantPrivilege.fromJSON(e)) - : [], - grantedBy: isSet(object.grantedBy) ? Number(object.grantedBy) : 0, - revokeBy: isSet(object.revokeBy) ? Number(object.revokeBy) : 0, - revokeGrantOption: isSet(object.revokeGrantOption) ? Boolean(object.revokeGrantOption) : false, - cascade: isSet(object.cascade) ? Boolean(object.cascade) : false, - }; - }, - - toJSON(message: RevokePrivilegeRequest): unknown { - const obj: any = {}; - if (message.userIds) { - obj.userIds = message.userIds.map((e) => Math.round(e)); - } else { - obj.userIds = []; - } - if (message.privileges) { - obj.privileges = message.privileges.map((e) => e ? GrantPrivilege.toJSON(e) : undefined); - } else { - obj.privileges = []; - } - message.grantedBy !== undefined && (obj.grantedBy = Math.round(message.grantedBy)); - message.revokeBy !== undefined && (obj.revokeBy = Math.round(message.revokeBy)); - message.revokeGrantOption !== undefined && (obj.revokeGrantOption = message.revokeGrantOption); - message.cascade !== undefined && (obj.cascade = message.cascade); - return obj; - }, - - fromPartial, I>>(object: I): RevokePrivilegeRequest { - const message = createBaseRevokePrivilegeRequest(); - message.userIds = object.userIds?.map((e) => e) || []; - message.privileges = object.privileges?.map((e) => GrantPrivilege.fromPartial(e)) || []; - message.grantedBy = object.grantedBy ?? 0; - message.revokeBy = object.revokeBy ?? 0; - message.revokeGrantOption = object.revokeGrantOption ?? false; - message.cascade = object.cascade ?? false; - return message; - }, -}; - -function createBaseRevokePrivilegeResponse(): RevokePrivilegeResponse { - return { status: undefined, version: 0 }; -} - -export const RevokePrivilegeResponse = { - fromJSON(object: any): RevokePrivilegeResponse { - return { - status: isSet(object.status) ? Status.fromJSON(object.status) : undefined, - version: isSet(object.version) ? Number(object.version) : 0, - }; - }, - - toJSON(message: RevokePrivilegeResponse): unknown { - const obj: any = {}; - message.status !== undefined && (obj.status = message.status ? Status.toJSON(message.status) : undefined); - message.version !== undefined && (obj.version = Math.round(message.version)); - return obj; - }, - - fromPartial, I>>(object: I): RevokePrivilegeResponse { - const message = createBaseRevokePrivilegeResponse(); - message.status = (object.status !== undefined && object.status !== null) - ? Status.fromPartial(object.status) - : undefined; - message.version = object.version ?? 0; - return message; - }, -}; - -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var globalThis: any = (() => { - if (typeof globalThis !== "undefined") { - return globalThis; - } - if (typeof self !== "undefined") { - return self; - } - if (typeof window !== "undefined") { - return window; - } - if (typeof global !== "undefined") { - return global; - } - throw "Unable to locate global object"; -})(); - -function bytesFromBase64(b64: string): Uint8Array { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} - -function base64FromBytes(arr: Uint8Array): string { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString("base64"); - } else { - const bin: string[] = []; - arr.forEach((byte) => { - bin.push(String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join("")); - } -} - -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; - -export type DeepPartial = T extends Builtin ? T - : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { $case: string } ? { [K in keyof Omit]?: DeepPartial } & { $case: T["$case"] } - : T extends {} ? { [K in keyof T]?: DeepPartial } - : Partial; - -type KeysOfUnion = T extends T ? keyof T : never; -export type Exact = P extends Builtin ? P - : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; - -function isSet(value: any): boolean { - return value !== null && value !== undefined; -} diff --git a/dashboard/scripts/generate_proto.sh b/dashboard/scripts/generate_proto.sh index 860820d56fea1..0ce74084a42aa 100755 --- a/dashboard/scripts/generate_proto.sh +++ b/dashboard/scripts/generate_proto.sh @@ -8,11 +8,13 @@ cp -a ../proto/*.proto tmp_gen # Array in proto will conflict with JavaScript's Array, so we replace it with RwArray. if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i "" -e "s/Array/RwArray/" "tmp_gen/data.proto" + sed -i "" -e "s/Array/RwArray/" "tmp_gen/data.proto" else - sed -i -e "s/Array/RwArray/" "tmp_gen/data.proto" + sed -i -e "s/Array/RwArray/" "tmp_gen/data.proto" fi +mkdir -p proto/gen + protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto \ --experimental_allow_proto3_optional \ --ts_proto_out=proto/gen/ \ diff --git a/docker/Dockerfile b/docker/Dockerfile index eeb2e8a746185..ed5f0c9e27fcc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -34,8 +34,9 @@ RUN rustup self update \ RUN cargo fetch -RUN cargo build -p risingwave_cmd_all --release --features "static-link static-log-level" && \ +RUN cargo build -p risingwave_cmd_all -p risingwave_java_binding --release --features "static-link static-log-level" && \ mkdir -p /risingwave/bin && mv /risingwave/target/release/risingwave /risingwave/bin/ && \ + mkdir -p /risingwave/lib && mv /risingwave/target/release/librisingwave_java_binding.so /risingwave/lib && \ cargo clean RUN cd /risingwave/java && mvn -B package -Dmaven.test.skip=true && \ @@ -47,10 +48,13 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install ca-certi FROM image-base as risingwave LABEL org.opencontainers.image.source https://github.com/risingwavelabs/risingwave -RUN mkdir -p /risingwave/bin/connector-node +RUN mkdir -p /risingwave/bin/connector-node && mkdir -p /risingwave/lib COPY --from=builder /risingwave/bin/risingwave /risingwave/bin/risingwave COPY --from=builder /risingwave/bin/connector-node /risingwave/bin/connector-node COPY --from=builder /risingwave/ui /risingwave/ui +COPY --from=builder /risingwave/lib/librisingwave_java_binding.so /risingwave/lib/librisingwave_java_binding.so +# Set java.library.path env to /risingwave/lib +ENV RW_JAVA_BINDING_LIB_PATH /risingwave/lib # Set default playground mode to docker-playground profile ENV PLAYGROUND_PROFILE docker-playground # Set default dashboard UI to local path instead of github proxy diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 461cad59cb2ab..3a422809599fc 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -13,8 +13,6 @@ services: - "0.0.0.0:1260" - "--metrics-level" - "1" - - "--state-store" - - "hummock+minio://hummockadmin:hummockadmin@minio-0:9301/hummock001" - "--meta-address" - "http://meta-node-0:5690" - "--config-path" @@ -30,6 +28,8 @@ services: - "./risingwave.toml:/risingwave.toml" environment: RUST_BACKTRACE: "1" + # If ENABLE_TELEMETRY is not set, telemetry will start by default + ENABLE_TELEMETRY: ${ENABLE_TELEMETRY} container_name: compactor-0 healthcheck: test: @@ -52,8 +52,6 @@ services: - "0.0.0.0:1222" - "--metrics-level" - "1" - - "--state-store" - - "hummock+minio://hummockadmin:hummockadmin@minio-0:9301/hummock001" - "--meta-address" - "http://meta-node-0:5690" - "--connector-rpc-endpoint" @@ -71,6 +69,8 @@ services: - "./risingwave.toml:/risingwave.toml" environment: RUST_BACKTRACE: "1" + # If ENABLE_TELEMETRY is not set, telemetry will start by default + ENABLE_TELEMETRY: ${ENABLE_TELEMETRY} container_name: compute-node-0 healthcheck: test: @@ -150,6 +150,8 @@ services: - "./risingwave.toml:/risingwave.toml" environment: RUST_BACKTRACE: "1" + # If ENABLE_TELEMETRY is not set, telemetry will start by default + ENABLE_TELEMETRY: ${ENABLE_TELEMETRY} container_name: frontend-node-0 healthcheck: test: @@ -203,6 +205,8 @@ services: - "etcd-0:2388" - "--connector-rpc-endpoint" - "connector-node:50051" + - "--state-store" + - "hummock+minio://hummockadmin:hummockadmin@minio-0:9301/hummock001" - "--config-path" - /risingwave.toml expose: @@ -218,6 +222,8 @@ services: - "./risingwave.toml:/risingwave.toml" environment: RUST_BACKTRACE: "1" + # If ENABLE_TELEMETRY is not set, telemetry will start by default + ENABLE_TELEMETRY: ${ENABLE_TELEMETRY} container_name: meta-node-0 healthcheck: test: @@ -246,7 +252,17 @@ services: depends_on: [] volumes: - "minio-0:/data" - entrypoint: "\n/bin/sh -c '\nset -e\nmkdir -p \"/data/hummock001\"\n/usr/bin/docker-entrypoint.sh \"$$0\" \"$$@\"\n'" + entrypoint: " + + /bin/sh -c ' + + set -e + + mkdir -p \"/data/hummock001\" + + /usr/bin/docker-entrypoint.sh \"$$0\" \"$$@\" + + '" environment: MINIO_CI_CD: "1" MINIO_PROMETHEUS_AUTH_TYPE: public diff --git a/docs/developer-guide.md b/docs/developer-guide.md index ba144ea04d983..2d517092682c8 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -72,7 +72,7 @@ RiseDev is the development mode of RisingWave. To develop RisingWave, you need t * OpenSSL * PostgreSQL (psql) (>= 14.1) * Tmux (>= v3.2a) -* LLVM 15 (To workaround some bugs in macOS toolchain, see https://github.com/risingwavelabs/risingwave/issues/6205). +* LLVM 15 (For macOS only, to workaround some bugs in macOS toolchain. See https://github.com/risingwavelabs/risingwave/issues/6205). To install the dependencies on macOS, run: @@ -90,6 +90,10 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh Then you'll be able to compile and start RiseDev! +> **Note** +> +> `.cargo/config.toml` contains `rustflags` configurations like `-Clink-arg` and `-Ctarget-feature`. Since it will be [merged](https://doc.rust-lang.org/cargo/reference/config.html#hierarchical-structure) with `$HOME/.cargo/config.toml`, check the config files and make sure they don't conflict if you have global `rustflags` configurations for e.g. linker there. + ## Start and monitor a dev cluster You can now build RiseDev and start a dev cluster. It is as simple as: diff --git a/e2e_test/batch/aggregate/array_agg.slt.part b/e2e_test/batch/aggregate/array_agg.slt.part index 4403d8089aa56..537af2eab3dc0 100644 --- a/e2e_test/batch/aggregate/array_agg.slt.part +++ b/e2e_test/batch/aggregate/array_agg.slt.part @@ -2,7 +2,7 @@ statement ok SET RW_IMPLICIT_FLUSH TO true; statement ok -create table t(v1 varchar, v2 int, v3 int) +create table t(v1 varchar, v2 int, v3 int); query T select array_agg(v1) from t; @@ -18,10 +18,7 @@ select array_agg(v1) from t; {NULL} statement ok -delete from t; - -statement ok -insert into t values ('aaa', 1, 1), ('bbb', 0, 2), ('ccc', 0, 5), ('ddd', 1, 4) +insert into t values ('aaa', 1, 1), ('bbb', 0, 2), ('ccc', 0, 5), ('ddd', 1, 4); query T select b from (select unnest(a) from (select array_agg(v3) as v3_arr from t) g(a)) p(b) order by b; @@ -30,16 +27,22 @@ select b from (select unnest(a) from (select array_agg(v3) as v3_arr from t) g(a 2 4 5 +NULL + +query T +select array_agg(v1 order by v3 asc nulls first) from t; +---- +{NULL,aaa,bbb,ddd,ccc} query T -select array_agg(v1 order by v3 desc) from t +select array_agg(v1 order by v3 desc) from t; ---- -{ccc,ddd,bbb,aaa} +{NULL,ccc,ddd,bbb,aaa} query T -select array_agg(v1 order by v2 asc, v3 desc) from t +select array_agg(v1 order by v2 asc nulls last, v3 desc) from t; ---- -{ccc,bbb,ddd,aaa} +{ccc,bbb,ddd,aaa,NULL} statement ok -drop table t +drop table t; diff --git a/e2e_test/batch/aggregate/sum.slt.part b/e2e_test/batch/aggregate/sum.slt.part index 7d847e4a2f81a..dd5529e3f8bfa 100644 --- a/e2e_test/batch/aggregate/sum.slt.part +++ b/e2e_test/batch/aggregate/sum.slt.part @@ -77,7 +77,7 @@ select sum(d) from t; statement ok insert into t values (9000000000000000000000000000); -statement error QueryError: Expr error: Numeric out of range +statement error Expr error: Numeric out of range select sum(d) from t; statement ok diff --git a/e2e_test/batch/basic/func.slt.part b/e2e_test/batch/basic/func.slt.part index b928c1b0ded0e..f7b57ae0d41e1 100644 --- a/e2e_test/batch/basic/func.slt.part +++ b/e2e_test/batch/basic/func.slt.part @@ -284,6 +284,9 @@ select pg_typeof(array[array[1, 2], array[3, 4]]); ---- integer[][] +query error unexpected arguments number +select pg_typeof(); + query I select count(current_database()); ---- diff --git a/e2e_test/batch/basic/generate_series.slt.part b/e2e_test/batch/basic/generate_series.slt.part index c65272bdbd44c..28420214d37c7 100644 --- a/e2e_test/batch/basic/generate_series.slt.part +++ b/e2e_test/batch/basic/generate_series.slt.part @@ -87,3 +87,7 @@ SELECT * FROM generate_series('2'::INT,'10'::INT,'0'::INT); query I SELECT * FROM generate_series('2'::INT,'10'::INT,'-2'::INT); ---- + +query I +SELECT * FROM generate_series(1, 100000000, 1) where 1=0; +---- diff --git a/e2e_test/batch/basic/index.slt.part b/e2e_test/batch/basic/index.slt.part index 0077867023710..a45cd724bb451 100644 --- a/e2e_test/batch/basic/index.slt.part +++ b/e2e_test/batch/basic/index.slt.part @@ -11,23 +11,23 @@ statement ok create index idx2 on t1(v2); statement ok -insert into t1 values(1, 2),(3,4),(5,6); +insert into t1 values (1, 2), (3, 4), (5, 6); statement ok -explain select v1,v2 from t1 where v1 = 1; +explain select v1, v2 from t1 where v1 = 1; query II -select v1,v2 from t1 where v1 = 1; +select v1, v2 from t1 where v1 = 1; ---- 1 2 query II -select v1,v2 from t1 where v2 = 4; +select v1, v2 from t1 where v2 = 4; ---- 3 4 query II -select v1,v2 from t1 where v1 = 1 or v2 = 4 order by v1, v2; +select v1, v2 from t1 where v1 = 1 or v2 = 4 order by v1, v2; ---- 1 2 3 4 @@ -36,10 +36,57 @@ statement ok delete from t1 where v1 = 1; query II -select v1,v2 from t1 order by v1, v2; +select v1, v2 from t1 order by v1, v2; ---- 3 4 5 6 +statement ok +insert into t1 values (NULL, 5); + +statement ok +create index idx3 on t1(v1 desc); + +statement ok +create index idx4 on t1(v1 nulls first); + +statement ok +create index idx5 on t1(v1 desc nulls last); + +query II +select v1, v2 from t1 order by v1; +---- +3 4 +5 6 +NULL 5 + +query II +select v1, v2 from t1 order by v1 desc; +---- +NULL 5 +5 6 +3 4 + +query II +select v1, v2 from t1 order by v1 asc nulls first; +---- +NULL 5 +3 4 +5 6 + +query II +select v1, v2 from t1 order by v1 desc nulls last; +---- +5 6 +3 4 +NULL 5 + +query II +select v1, v2 from t1 order by v1 desc nulls first; +---- +NULL 5 +5 6 +3 4 + statement ok drop table t1; diff --git a/e2e_test/batch/basic/join.slt.part b/e2e_test/batch/basic/join.slt.part index feeb793ba9e36..cf2ae46dd0772 100644 --- a/e2e_test/batch/basic/join.slt.part +++ b/e2e_test/batch/basic/join.slt.part @@ -92,7 +92,7 @@ statement ok insert into t values (1),(2),(3),(4),(5); query I rowsort -Select * from t join i using(x) +select * from t join i using(x) ---- 1 2 @@ -100,6 +100,11 @@ Select * from t join i using(x) 4 5 +query I +select * from t natural join (select * from t where 1=0); +---- + + statement ok drop index i; diff --git a/e2e_test/batch/basic/order_by.slt.part b/e2e_test/batch/basic/order_by.slt.part index 670280e8f5fff..3fae22b6386d2 100644 --- a/e2e_test/batch/basic/order_by.slt.part +++ b/e2e_test/batch/basic/order_by.slt.part @@ -5,10 +5,10 @@ statement ok create table t (v1 int, v2 int, v3 int); statement ok -insert into t values (1,4,2), (2,3,3), (3,4,4), (4,3,5) +insert into t values (1,4,2), (2,3,3), (3,4,4), (4,3,5); query III rowsort -select * from t +select * from t; ---- 1 4 2 2 3 3 @@ -16,7 +16,7 @@ select * from t 4 3 5 query III -select * from t order by v1 desc +select * from t order by v1 desc; ---- 4 3 5 3 4 4 @@ -48,17 +48,17 @@ select * from t order by v1 + v2, v1; 4 3 5 query III -select * from t order by v1 desc limit 1 +select * from t order by v1 desc limit 1; ---- 4 3 5 query III -select * from t order by v1 desc limit 1 offset 1 +select * from t order by v1 desc limit 1 offset 1; ---- 3 4 4 query III -select * from t order by v2, v1 +select * from t order by v2, v1; ---- 2 3 3 4 3 5 @@ -66,13 +66,13 @@ select * from t order by v2, v1 3 4 4 query III -select * from t order by v2, v1 limit 2 +select * from t order by v2, v1 limit 2; ---- 2 3 3 4 3 5 query III -select * from t order by v2, v1 limit 10 +select * from t order by v2, v1 limit 10; ---- 2 3 3 4 3 5 @@ -80,7 +80,7 @@ select * from t order by v2, v1 limit 10 3 4 4 query III -select * from t order by v2 desc, v1 limit 2 +select * from t order by v2 desc, v1 limit 2; ---- 1 4 2 3 4 4 @@ -94,6 +94,24 @@ select * from t order by v1 limit 2; 1 4 2 2 3 3 +query III +select * from t order by v1 asc limit 2; +---- +1 4 2 +2 3 3 + +query III +select * from t order by v1 nulls first limit 2; +---- +NULL 7 NULL +1 4 2 + +query III +select * from t order by v1 asc nulls last limit 2; +---- +1 4 2 +2 3 3 + query III select * from t order by v1 desc limit 7; ---- @@ -103,5 +121,23 @@ NULL 7 NULL 2 3 3 1 4 2 +query III +select * from t order by v1 desc nulls first limit 7; +---- +NULL 7 NULL +4 3 5 +3 4 4 +2 3 3 +1 4 2 + +query III +select * from t order by v1 desc nulls last limit 7; +---- +4 3 5 +3 4 4 +2 3 3 +1 4 2 +NULL 7 NULL + statement ok drop table t; diff --git a/e2e_test/batch/catalog/issue_8791.slt.part b/e2e_test/batch/catalog/issue_8791.slt.part new file mode 100644 index 0000000000000..b8339c44a23f4 --- /dev/null +++ b/e2e_test/batch/catalog/issue_8791.slt.part @@ -0,0 +1,16 @@ +# UNION and other complex queries should also be in local mode +query I +SELECT name FROM pg_catalog.pg_settings union select 'a'; +---- +a + +query T +SELECT name FROM (SELECT pg_catalog.lower(name) AS name FROM pg_catalog.pg_settings UNION ALL SELECT 'session authorization' UNION ALL SELECT 'all') ss WHERE substring(name,1,0)='' +LIMIT 1000 +---- +session authorization +all + +query I +with q as ( select name FROM pg_catalog.pg_settings ) select * from q; +---- diff --git a/e2e_test/batch/catalog/sysinfo.slt.part b/e2e_test/batch/catalog/sysinfo.slt.part index 84dd4ce52a111..9ea526c594e6d 100644 --- a/e2e_test/batch/catalog/sysinfo.slt.part +++ b/e2e_test/batch/catalog/sysinfo.slt.part @@ -7,3 +7,8 @@ query T SELECT pg_catalog.pg_get_userbyid(1); ---- root + +query T +select (SELECT pg_catalog.pg_get_userbyid(1)); +---- +root diff --git a/e2e_test/batch/explain.slt b/e2e_test/batch/explain.slt index 00e735d360aa0..cff6af31f2470 100644 --- a/e2e_test/batch/explain.slt +++ b/e2e_test/batch/explain.slt @@ -5,7 +5,7 @@ statement ok explain create index i on t(v); statement ok -explain create sink sink_t from t with ( connector = 'kafka', format = 'append_only' ) +explain create sink sink_t from t with ( connector = 'kafka', type = 'append-only' ) statement ok drop table t; diff --git a/e2e_test/batch/types/interval.slt.part b/e2e_test/batch/types/interval.slt.part index bd8972d3167e8..84e436a838087 100644 --- a/e2e_test/batch/types/interval.slt.part +++ b/e2e_test/batch/types/interval.slt.part @@ -150,3 +150,18 @@ select '-2562047788:00:54.775808'::interval; statement error select '-2562047788:00:54.775809'::interval; + +query T +select interval '3 mons -3 days' / 2; +---- +1 mon 14 days -12:00:00 + +# The following is an overflow bug present in PostgreSQL 15.2 +# Their `days` overflows to a negative value, leading to the latter smaller +# than the former. We report an error in this case. + +statement ok +select interval '2147483647 mons 2147483647 days' * 0.999999991; + +statement error out of range +select interval '2147483647 mons 2147483647 days' * 0.999999992; diff --git a/e2e_test/batch/types/temporal_arithmetic.slt.part b/e2e_test/batch/types/temporal_arithmetic.slt.part index 34e4f40ecc19c..80ef05e1310ab 100644 --- a/e2e_test/batch/types/temporal_arithmetic.slt.part +++ b/e2e_test/batch/types/temporal_arithmetic.slt.part @@ -151,7 +151,7 @@ select real '0' * interval '1' second; query T select real '86' * interval '849884'; ---- -2 years 4 mons 5 days 22:47:04 +20302:47:04 query T select interval '1' second * real '6.1'; @@ -176,7 +176,7 @@ select interval '1' second * real '0'; query T select interval '849884' * real '86'; ---- -2 years 4 mons 5 days 22:47:04 +20302:47:04 query T select '12:30:00'::time * 2; diff --git a/e2e_test/ddl/alter_rename_relation.slt b/e2e_test/ddl/alter_rename_relation.slt new file mode 100644 index 0000000000000..486f19713ae19 --- /dev/null +++ b/e2e_test/ddl/alter_rename_relation.slt @@ -0,0 +1,175 @@ +statement ok +SET RW_IMPLICIT_FLUSH TO true; + +statement ok +CREATE TABLE t (v1 INT primary key, v2 STRUCT>); + +statement ok +CREATE TABLE t_as AS ( WITH source_data AS ( SELECT 1 AS id) SELECT * FROM source_data); + +statement ok +CREATE MATERIALIZED VIEW mv AS SELECT v1, (t.v2).v1 AS v21 FROM t; + +statement ok +CREATE SINK sink AS SELECT mv3.v1 AS v1, mv3.v21 AS v2 FROM mv AS mv3 WITH ( + connector = 'blackhole' +); + +statement ok +CREATE SOURCE src (v INT) WITH ( + connector = 'datagen', + fields.v.kind = 'sequence', + fields.v.start = '1', + fields.v.end = '10', + datagen.rows.per.second='15', + datagen.split.num = '1' +) ROW FORMAT JSON; + +statement ok +CREATE VIEW v1 AS ( SELECT * FROM t_as WHERE id = 1); + +statement ok +CREATE VIEW v2 AS (SELECT COUNT(*) FROM t, t AS t2 WHERE t.v1 = t2.v1); + +statement ok +CREATE VIEW v3 AS (SELECT MAX((t.v2).v1) FROM t AS t); + +statement ok +CREATE VIEW v4 AS (SELECT * FROM t join t as t2 on (t.v1 = t2.v1) ORDER BY t.v1, t2.v1); + +statement ok +CREATE index idx ON t(v1); + +query TT +SHOW CREATE TABLE t; +---- +public.t CREATE TABLE t (v1 INT PRIMARY KEY, v2 STRUCT>) + +# alter table rename with alias conflict +statement ok +ALTER TABLE t RENAME TO t2; + +query TT +SHOW CREATE TABLE t2; +---- +public.t2 CREATE TABLE t2 (v1 INT PRIMARY KEY, v2 STRUCT>) + +query TT +SHOW CREATE VIEW v2; +---- +public.v2 CREATE VIEW v2 AS (SELECT COUNT(*) FROM t2 AS t, t2 AS t2 WHERE t.v1 = t2.v1) + +query TT +SHOW CREATE VIEW v3; +---- +public.v3 CREATE VIEW v3 AS (SELECT MAX((t.v2).v1) FROM t2 AS t) + +query TT +SHOW CREATE VIEW v4; +---- +public.v4 CREATE VIEW v4 AS (SELECT * FROM t2 AS t JOIN t2 AS t2 ON (t.v1 = t2.v1) ORDER BY t.v1, t2.v1) + +query TT +SHOW CREATE MATERIALIZED VIEW mv; +---- +public.mv CREATE MATERIALIZED VIEW mv AS SELECT v1, (t.v2).v1 AS v21 FROM t2 AS t + +# alter mview rename +statement ok +ALTER MATERIALIZED VIEW mv RENAME TO mv2; + +query TT +SHOW CREATE MATERIALIZED VIEW mv2; +---- +public.mv2 CREATE MATERIALIZED VIEW mv2 AS SELECT v1, (t.v2).v1 AS v21 FROM t2 AS t + +statement ok +ALTER SINK sink RENAME TO sink1; + +# alter mview rename with alias conflict, used by sink1 +statement ok +ALTER MATERIALIZED VIEW mv2 RENAME TO mv3; + +statement ok +ALTER TABLE t_as RENAME TO t_as_1; + +# alter view rename +statement ok +ALTER VIEW v1 RENAME TO v5; + +query TT +SHOW CREATE VIEW v5; +---- +public.v5 CREATE VIEW v5 AS (SELECT * FROM t_as_1 AS t_as WHERE id = 1) + +statement ok +ALTER INDEX idx RENAME TO idx1; + +statement ok +INSERT INTO t2 VALUES(1,(1,(1,2))); + +statement ok +INSERT INTO t2 VALUES(2,(2,(2,4))); + +query II rowsort +SELECT * from mv3 +---- +1 1 +2 2 + +query I +SELECT * from v2 +---- +2 + +query I +SELECT * from v3 +---- +2 + +query IIII rowsort +SELECT * from v4 +---- +1 (1,(1,2)) 1 (1,(1,2)) +2 (2,(2,4)) 2 (2,(2,4)) + +statement ok +CREATE MATERIALIZED VIEW mv4 AS SELECT * FROM src; + +statement ok +ALTER SOURCE src RENAME TO src1; + +query TT +SHOW CREATE MATERIALIZED VIEW mv4; +---- +public.mv4 CREATE MATERIALIZED VIEW mv4 AS SELECT * FROM src1 AS src + +statement ok +DROP SINK sink1; + +statement ok +DROP VIEW v5; + +statement ok +DROP VIEW v4; + +statement ok +DROP VIEW v3; + +statement ok +DROP VIEW v2; + +statement ok +DROP MATERIALIZED VIEW mv4; + +statement ok +DROP SOURCE src1; + +statement ok +DROP MATERIALIZED VIEW mv3; + +statement ok +DROP TABLE t2; + +statement ok +DROP TABLE t_as_1; diff --git a/e2e_test/ddl/alter_table_column.slt b/e2e_test/ddl/alter_table_column.slt index 7cad432aa3197..fc142e1510191 100644 --- a/e2e_test/ddl/alter_table_column.slt +++ b/e2e_test/ddl/alter_table_column.slt @@ -209,3 +209,35 @@ drop materialized view mv; statement ok drop table t; + +# Test the consistency of tables and indexes #https://github.com/risingwavelabs/risingwave/issues/8649 +statement ok +create table t(id int primary key, a int, b varchar); + +statement ok +create index idx on t(a); + +statement ok +alter table t add column c int; + +query IITI rowsort +select * from t; +---- + +statement ok +drop table t; + +statement ok +create table t(id int primary key, a int, b varchar); + +statement ok +create index idx on t(b) include(b); + +statement ok +alter table t drop column a; + +query II rowsort +select * from t where b = '1'; + +statement ok +drop table t; \ No newline at end of file diff --git a/e2e_test/ddl/show.slt b/e2e_test/ddl/show.slt index 5c1a69d2c9930..0b6b17f63a5c6 100644 --- a/e2e_test/ddl/show.slt +++ b/e2e_test/ddl/show.slt @@ -10,17 +10,17 @@ create view v3 as select sum(v2) as sum_v2 from t3; query TT describe t3; ---- -v1 Int32 -v2 Int32 -v3 Int32 +v1 integer +v2 integer +v3 integer primary key _row_id query TT show columns from t3; ---- -v1 Int32 -v2 Int32 -v3 Int32 +v1 integer +v2 integer +v3 integer statement ok create index idx1 on t3 (v1,v2);; @@ -28,11 +28,11 @@ create index idx1 on t3 (v1,v2);; query TT describe t3; ---- -v1 Int32 -v2 Int32 -v3 Int32 +v1 integer +v2 integer +v3 integer primary key _row_id -idx1 index(v1, v2) include(v3) distributed by(v1, v2) +idx1 index(v1 ASC, v2 ASC) include(v3) distributed by(v1, v2) statement ok drop index idx1; @@ -120,22 +120,22 @@ drop table t3; query TT describe pg_matviews; ---- -schemaname Varchar -matviewname Varchar -matviewowner Int32 -definition Varchar -matviewid Int32 -matviewtimezone Varchar -matviewgraph Varchar +schemaname varchar +matviewname varchar +matviewowner integer +definition varchar +matviewid integer +matviewtimezone varchar +matviewgraph varchar primary key schemaname query TT show columns from pg_catalog.pg_matviews; ---- -schemaname Varchar -matviewname Varchar -matviewowner Int32 -definition Varchar -matviewid Int32 -matviewtimezone Varchar -matviewgraph Varchar +schemaname varchar +matviewname varchar +matviewowner integer +definition varchar +matviewid integer +matviewtimezone varchar +matviewgraph varchar diff --git a/e2e_test/ddl/table.slt b/e2e_test/ddl/table.slt index 9a3c83a60e11d..4c076b979fc25 100644 --- a/e2e_test/ddl/table.slt +++ b/e2e_test/ddl/table.slt @@ -1,261 +1 @@ -# Create a table. -statement ok -create table ddl_t (v1 int); - -statement ok -explain select v1 from ddl_t; - -# Create another table with duplicated name. -statement error -create table ddl_t (v2 int); - -# Create a table using a empty string. -statement error -create table ""(v2 int); - -statement ok -create table if not exists ddl_t (v2 int); - -# Drop the table. -statement ok -drop table ddl_t; - -# Drop it again. -statement error -drop table ddl_t; - -# Create another table with the same name. -statement ok -create table ddl_t (v2 int); - -statement ok -explain select v2 from ddl_t; - -# Create a mview on top of it. -statement ok -create materialized view ddl_mv as select v2 from ddl_t; - -statement ok -explain select v2 from ddl_t; - -statement ok -explain create sink sink_t from ddl_t with ( connector = 'kafka', format = 'append_only', force_append_only = 'true' ); - -statement ok -explain create sink sink_as as select sum(v2) as sum from ddl_t with ( connector = 'kafka', format = 'append_only', force_append_only = 'true' ); - -# Create a mview with duplicated name. -statement error -create materialized view ddl_mv as select v2 from ddl_t; - -# Drop the table before dropping the mview. -statement error -drop table ddl_t; - -# We're not allowed to drop the mview using `DROP TABLE`. -statement error -drop table ddl_mv; - -# Drop the mview. -statement ok -drop materialized view ddl_mv; - -# Drop it again. -statement error -drop materialized view ddl_mv; - -# We're not allowed to drop the table using `DROP MATERIALIZED VIEW`. -statement error -drop materialized view ddl_t; - -# Now, we can drop the base table. -statement ok -drop table ddl_t; - -# Create table concludes struct column. -statement ok -create table st (v1 int, v2 struct>); - -statement ok -drop table st - -# We test the case sensitivity of table name and column name. -statement ok -create table t1 (v1 int); - -statement ok -drop table T1; - -statement ok -create table T1 (v1 int); - -statement ok -drop table t1; - -statement ok -create table "T1" (v1 int); - -# Since we have not really bound the columns in the insert statement -# this test case cannot be enabled. -# statement error -# insert into "T1" ("V1") values (1); - -statement error -drop table t1; - -statement error -drop table T1; - -statement ok -drop table "T1"; - -statement ok -create table "T2" ("V1" int); - -# Since we have not really bound the columns in the insert statement -# this test case cannot be enabled. -# statement error -# insert into "T2" (V1) values (1); - -statement ok -insert into "T2" ("V1") values (1); - -statement ok -drop table "T2" - -statement error -create table C1 (c1 varchar(5)); - -statement error -create table t (v1 int not null); - -statement error -create table t (v1 varchar collate "en_US"); - -# Test create-table-as -statement ok -create table t as select 1; - -statement ok -drop table t; - -statement error -create table t as select 1,2; - -statement ok -create table t as select 1 as a, 2 as b; - -statement ok -drop table t; - -statement ok -create table t(v1) as select 1; - -statement ok -drop table t; - -statement ok -create table t (v1 int,v2 int); - -statement ok -insert into t values (1,1); - -statement ok -insert into t values (1,1); - -statement ok -insert into t values (1,1); - -statement ok -flush - -statement ok -create table t1 as select * from t; - -statement ok -flush; - -query I -select * from t1; ----- -1 1 -1 1 -1 1 - -statement ok -drop table t1; - -statement ok -drop table t; - -statement ok -create table t AS SELECT * FROM generate_series(0, 5,1) tbl(i); - -statement ok -flush; - -query I -select * from t order by i; ----- -0 -1 -2 -3 -4 -5 - -statement ok -drop table t; - -statement ok -create table t (v1 int); - -statement ok -insert into t values (1); - -statement ok -insert into t values (2); - -statement ok -create table n1 as select sum(v1) from t; - -statement ok -flush; - -query I -select * from n1; ----- -3 - -statement error -create table n1 (v2 int); - -statement error -create table n1 as select * from t; - -statement ok -create table if not exists n1 (v2 int); - -statement ok -drop table n1; - -statement ok -drop table t; - -statement ok -create table t (v1 int,v2 int); - -statement ok -create table t1(a,b) as select v1,v2 from t; - -statement ok -create table t2(a) as select v1,v2 from t; - -statement ok -drop table t; - -statement ok -drop table t1; - -statement ok -drop table t2; +include ./table/*.slt.part diff --git a/e2e_test/ddl/table/generated_columns.slt.part b/e2e_test/ddl/table/generated_columns.slt.part new file mode 100644 index 0000000000000..ccc52d8efceec --- /dev/null +++ b/e2e_test/ddl/table/generated_columns.slt.part @@ -0,0 +1,41 @@ +# Create a table with generated columns. +statement ok +create table t1 (v1 int as v2-1, v2 int, v3 int as v2+1.02, v4 double as v2 + 1.02); + +statement ok +insert into t1 (v2) values (1), (2); + +statement ok +flush; + +query IIIR +select * from t1; +---- +0 1 2 2.02 +1 2 3 3.02 + +statement ok +drop table t1; + +# Create a table with generated columns. +statement ok +create table t2 (v1 int, v2 int as v1+1); + +statement ok +insert into t2 values (1), (2); + +statement ok +flush; + +query II +select * from t2; +---- +1 2 +2 3 + +statement ok +drop table t2; + +# Generated column reference another generated column +statement error +create table t2 (v1 int as v2+1, v2 int, v3 int as v1-1); diff --git a/e2e_test/ddl/table/table.slt.part b/e2e_test/ddl/table/table.slt.part new file mode 100644 index 0000000000000..525982f2c579d --- /dev/null +++ b/e2e_test/ddl/table/table.slt.part @@ -0,0 +1,261 @@ +# Create a table. +statement ok +create table ddl_t (v1 int); + +statement ok +explain select v1 from ddl_t; + +# Create another table with duplicated name. +statement error +create table ddl_t (v2 int); + +# Create a table using a empty string. +statement error +create table ""(v2 int); + +statement ok +create table if not exists ddl_t (v2 int); + +# Drop the table. +statement ok +drop table ddl_t; + +# Drop it again. +statement error +drop table ddl_t; + +# Create another table with the same name. +statement ok +create table ddl_t (v2 int); + +statement ok +explain select v2 from ddl_t; + +# Create a mview on top of it. +statement ok +create materialized view ddl_mv as select v2 from ddl_t; + +statement ok +explain select v2 from ddl_t; + +statement ok +explain create sink sink_t from ddl_t with ( connector = 'kafka', type = 'append-only', force_append_only = 'true' ); + +statement ok +explain create sink sink_as as select sum(v2) as sum from ddl_t with ( connector = 'kafka', type = 'append-only', force_append_only = 'true' ); + +# Create a mview with duplicated name. +statement error +create materialized view ddl_mv as select v2 from ddl_t; + +# Drop the table before dropping the mview. +statement error +drop table ddl_t; + +# We're not allowed to drop the mview using `DROP TABLE`. +statement error +drop table ddl_mv; + +# Drop the mview. +statement ok +drop materialized view ddl_mv; + +# Drop it again. +statement error +drop materialized view ddl_mv; + +# We're not allowed to drop the table using `DROP MATERIALIZED VIEW`. +statement error +drop materialized view ddl_t; + +# Now, we can drop the base table. +statement ok +drop table ddl_t; + +# Create table concludes struct column. +statement ok +create table st (v1 int, v2 struct>); + +statement ok +drop table st + +# We test the case sensitivity of table name and column name. +statement ok +create table t1 (v1 int); + +statement ok +drop table T1; + +statement ok +create table T1 (v1 int); + +statement ok +drop table t1; + +statement ok +create table "T1" (v1 int); + +# Since we have not really bound the columns in the insert statement +# this test case cannot be enabled. +# statement error +# insert into "T1" ("V1") values (1); + +statement error +drop table t1; + +statement error +drop table T1; + +statement ok +drop table "T1"; + +statement ok +create table "T2" ("V1" int); + +# Since we have not really bound the columns in the insert statement +# this test case cannot be enabled. +# statement error +# insert into "T2" (V1) values (1); + +statement ok +insert into "T2" ("V1") values (1); + +statement ok +drop table "T2" + +statement error +create table C1 (c1 varchar(5)); + +statement error +create table t (v1 int not null); + +statement error +create table t (v1 varchar collate "en_US"); + +# Test create-table-as +statement ok +create table t as select 1; + +statement ok +drop table t; + +statement error +create table t as select 1,2; + +statement ok +create table t as select 1 as a, 2 as b; + +statement ok +drop table t; + +statement ok +create table t(v1) as select 1; + +statement ok +drop table t; + +statement ok +create table t (v1 int,v2 int); + +statement ok +insert into t values (1,1); + +statement ok +insert into t values (1,1); + +statement ok +insert into t values (1,1); + +statement ok +flush + +statement ok +create table t1 as select * from t; + +statement ok +flush; + +query I +select * from t1; +---- +1 1 +1 1 +1 1 + +statement ok +drop table t1; + +statement ok +drop table t; + +statement ok +create table t AS SELECT * FROM generate_series(0, 5,1) tbl(i); + +statement ok +flush; + +query I +select * from t order by i; +---- +0 +1 +2 +3 +4 +5 + +statement ok +drop table t; + +statement ok +create table t (v1 int); + +statement ok +insert into t values (1); + +statement ok +insert into t values (2); + +statement ok +create table n1 as select sum(v1) from t; + +statement ok +flush; + +query I +select * from n1; +---- +3 + +statement error +create table n1 (v2 int); + +statement error +create table n1 as select * from t; + +statement ok +create table if not exists n1 (v2 int); + +statement ok +drop table n1; + +statement ok +drop table t; + +statement ok +create table t (v1 int,v2 int); + +statement ok +create table t1(a,b) as select v1,v2 from t; + +statement ok +create table t2(a) as select v1,v2 from t; + +statement ok +drop table t; + +statement ok +drop table t1; + +statement ok +drop table t2; diff --git a/e2e_test/extended_query/basic.slt b/e2e_test/extended_mode/basic.slt similarity index 50% rename from e2e_test/extended_query/basic.slt rename to e2e_test/extended_mode/basic.slt index c2cf66d73295d..51513a444ec79 100644 --- a/e2e_test/extended_query/basic.slt +++ b/e2e_test/extended_mode/basic.slt @@ -1,14 +1,4 @@ -# The basic.slt is to cover the path of pgwire. -# -# There are two kinds of statement, they run different path of pgwire: -# 1. un-query statement: SET,CREATE,INSERT,FLUSH,EXPLAIN,DROP.. -# 2. query statement: SELECT,WITH,VALUES,SHOW,DESCRIBE.. -# -# We also need to test different type in extended query mode: -# smallint,int,bigint -# real,double precision,numeric -# time,date,timestamp - +# Test different statements(DDL,DQL,DML) in extended mode. statement ok SET RW_IMPLICIT_FLUSH TO true; @@ -52,17 +42,17 @@ create table t3 (v1 int, v2 int, v3 int); query TT describe t3; ---- -v1 Int32 -v2 Int32 -v3 Int32 +v1 integer +v2 integer +v3 integer primary key _row_id query TT show columns from t3; ---- -v1 Int32 -v2 Int32 -v3 Int32 +v1 integer +v2 integer +v3 integer statement ok drop table t3; @@ -78,18 +68,3 @@ with t as (select generate_series(1,3,1)) select * from t; 1 2 3 - -query III -select 42::smallint, 42::int, 42::bigint; ----- -42 42 42 - -query III -select 42::real,42::double precision,42::decimal; ----- -42 42 42 - -query TTT -select '20:55:12'::time,'2022-07-12'::date,'2022-07-12 20:55:12'::timestamp; ----- -20:55:12 2022-07-12 2022-07-12 20:55:12 diff --git a/e2e_test/extended_mode/type.slt b/e2e_test/extended_mode/type.slt new file mode 100644 index 0000000000000..2271ecb51c5c9 --- /dev/null +++ b/e2e_test/extended_mode/type.slt @@ -0,0 +1,28 @@ +# Test binary format of different type. (sqllogitest return binary format in extended mode) + +statement ok +SET RW_IMPLICIT_FLUSH TO true; + +# RisingWave can't support list and struct now so we skip them. +# include ../batch/types/array.slt.part +# include ../batch/types/struct.slt.part +# include ../batch/types/list.slt.part + +# Sqllogitest can't support binary format bytea type so we skip it. +# include ../batch/types/bytea.slt.part + +# Can't support inf,-inf binary format now so we skip it. +# include ../batch/types/decimal.slt.part + +# Sqllogitest can't support binary format jsonb type so we skip it. +# include ../batch/types/jsonb_ord.slt.part +# include ../batch/types/jsonb.slt.part + +include ../batch/types/boolean.slt.part +include ../batch/types/cast.slt.part +include ../batch/types/date.slt +include ../batch/types/intercal.slt.part +include ../batch/types/number_arithmetic.slt.part +include ../batch/types/temporal_arithmetic.slt.part +include ../batch/types/time.slt.part +include ../batch/types/timestamptz_utc.slt.part diff --git a/e2e_test/sink/append_only_sink.slt b/e2e_test/sink/append_only_sink.slt index cf4e185d1b28f..57f194f033f4f 100644 --- a/e2e_test/sink/append_only_sink.slt +++ b/e2e_test/sink/append_only_sink.slt @@ -1,35 +1,20 @@ statement ok -create table t1 (v1 int, v2 int); - -statement error No primary key for the upsert sink -create sink s1 from t1 with (connector = 'console'); - -statement ok -create sink s1 as select v1, v2, _row_id from t1 with (connector = 'console'); - -statement ok -create table t2 (v1 int, v2 int primary key); - -statement ok -create sink s2 from t2 with (connector = 'console'); - -statement error No primary key for the upsert sink -create sink s3 as select avg(v1) from t2 with (connector = 'console'); +create table t (v1 int, v2 int); statement ok -create sink s3 as select avg(v1) from t2 with (connector = 'console', format = 'append_only', force_append_only = 'true'); +create sink s1 from t with (connector = 'console'); statement ok -create sink s4 as select avg(v1), v2 from t2 group by v2 with (connector = 'console'); +create sink s2 as select avg(v1), v2 from t group by v2 with (connector = 'console'); statement error The sink cannot be append-only -create sink s5 from t2 with (connector = 'console', format = 'append_only'); +create sink s3 from t with (connector = 'console', type = 'append-only'); statement ok -create sink s5 from t2 with (connector = 'console', format = 'append_only', force_append_only = 'true'); +create sink s3 from t with (connector = 'console', type = 'append-only', force_append_only = 'true'); statement error Cannot force the sink to be append-only -create sink s6 from t2 with (connector = 'console', format = 'upsert', force_append_only = 'true'); +create sink s4 from t with (connector = 'console', type = 'upsert', force_append_only = 'true'); statement ok drop sink s1 @@ -41,13 +26,4 @@ statement ok drop sink s3 statement ok -drop sink s4 - -statement ok -drop sink s5 - -statement ok -drop table t1 - -statement ok -drop table t2 +drop table t diff --git a/e2e_test/sink/iceberg_sink.slt b/e2e_test/sink/iceberg_sink.slt index ecb91b96fd0f7..2a214c0710ddd 100644 --- a/e2e_test/sink/iceberg_sink.slt +++ b/e2e_test/sink/iceberg_sink.slt @@ -7,7 +7,8 @@ CREATE MATERIALIZED VIEW mv6 AS SELECT * FROM t6; statement ok CREATE SINK s6 AS select mv6.v1 as v1, mv6.v2 as v2, mv6.v3 as v3 from mv6 WITH ( connector = 'iceberg', - sink.mode='append-only', + type = 'upsert', + primary_key = 'v1', warehouse.path = 's3://iceberg', s3.endpoint = 'http://127.0.0.1:9301', s3.access.key = 'hummockadmin', @@ -22,6 +23,12 @@ INSERT INTO t6 VALUES (1, 2, '1-2'), (2, 2, '2-2'), (3, 2, '3-2'), (5, 2, '5-2') statement ok FLUSH; +statement ok +INSERT INTO t6 VALUES (1, 50, '1-50'); + +statement ok +FLUSH; + statement ok DROP SINK s6; diff --git a/e2e_test/sink/remote/jdbc.check.pg.slt b/e2e_test/sink/remote/jdbc.check.pg.slt index 601a0b29e57b7..bd00a7938a898 100644 --- a/e2e_test/sink/remote/jdbc.check.pg.slt +++ b/e2e_test/sink/remote/jdbc.check.pg.slt @@ -3,8 +3,8 @@ query I select * from t_remote order by id; ---- -1 Alex -3 Carl -4 Doris -5 Eve -6 Frank \ No newline at end of file +1 Alex 28208 281620391 4986480304337356800 28162.0391 2.03 28162.0391 2023-03-20 10:18:30 +3 Carl 18300 1702307129 7878292368468104192 17023.07129 23.07 17023.07129 2023-03-20 10:18:32 +4 Doris 17250 151951802 3946135584462581760 1519518.02 18.02 1519518.02 2023-03-21 10:18:30 +5 Eve 9725 698160808 524334216698825600 69.8160808 69.81 69.8160808 2023-03-21 10:18:31 +6 Frank 28131 1233587627 8492820454814063616 123358.7627 58.76 123358.7627 2023-03-21 10:18:32 diff --git a/e2e_test/sink/remote/jdbc.load.slt b/e2e_test/sink/remote/jdbc.load.slt index 88bec6048187a..9adbb40a1b972 100644 --- a/e2e_test/sink/remote/jdbc.load.slt +++ b/e2e_test/sink/remote/jdbc.load.slt @@ -1,5 +1,15 @@ statement ok -create table t_remote (id integer primary key, name varchar); +create table t_remote ( + id integer primary key, + v_varchar varchar, + v_smallint smallint, + v_integer integer, + v_bigint bigint, + v_decimal decimal, + v_float float, + v_double double, + v_timestamp timestamp +); statement ok create materialized view mv_remote as select * from t_remote; @@ -19,16 +29,22 @@ CREATE SINK s_mysql FROM mv_remote WITH ( ); statement ok -INSERT INTO t_remote VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Carl'); +INSERT INTO t_remote VALUES + (1, 'Alice', 28208, 281620391, 4986480304337356659, 28162.0391, 2.03, 28162.0391, '2023-03-20 10:18:30'), + (2, 'Bob', 10580, 2131030003, 3074255027698877876, 21310.30003, 10.3, 21310.30003, '2023-03-20 10:18:31'), + (3, 'Carl', 18300, 1702307129, 7878292368468104216, 17023.07129, 23.07, 17023.07129, '2023-03-20 10:18:32'); statement ok -INSERT INTO t_remote VALUES (4, 'Doris'), (5, 'Eve'), (6, 'Frank'); +INSERT INTO t_remote VALUES + (4, 'Doris', 17250, 151951802, 3946135584462581863, 1519518.02, 18.02, 1519518.02, '2023-03-21 10:18:30'), + (5, 'Eve', 9725, 698160808, 524334216698825611, 69.8160808, 69.81, 69.8160808, '2023-03-21 10:18:31'), + (6, 'Frank', 28131, 1233587627, 8492820454814063326, 123358.7627, 58.76, 123358.7627, '2023-03-21 10:18:32'); statement ok FLUSH; statement ok -UPDATE t_remote SET name = 'Alex' WHERE id = 1; +UPDATE t_remote SET v_varchar = 'Alex' WHERE id = 1; statement ok DELETE FROM t_remote WHERE id = 2; diff --git a/e2e_test/sink/remote/mysql_create_table.sql b/e2e_test/sink/remote/mysql_create_table.sql new file mode 100644 index 0000000000000..491072eb59d63 --- /dev/null +++ b/e2e_test/sink/remote/mysql_create_table.sql @@ -0,0 +1,11 @@ +CREATE TABLE t_remote ( + id integer PRIMARY KEY, + v_varchar varchar(100), + v_smallint smallint, + v_integer integer, + v_bigint bigint, + v_decimal decimal, + v_float float, + v_double double, + v_timestamp timestamp +); \ No newline at end of file diff --git a/e2e_test/sink/remote/mysql_expected_result.tsv b/e2e_test/sink/remote/mysql_expected_result.tsv new file mode 100644 index 0000000000000..8e738579032d2 --- /dev/null +++ b/e2e_test/sink/remote/mysql_expected_result.tsv @@ -0,0 +1,5 @@ +1 Alex 28208 281620391 4986480304337356800 28162 2.03 28162.0391 2023-03-20 10:18:30 +3 Carl 18300 1702307129 7878292368468104192 17023 23.07 17023.07129 2023-03-20 10:18:32 +4 Doris 17250 151951802 3946135584462581760 1519518 18.02 1519518.02 2023-03-21 10:18:30 +5 Eve 9725 698160808 524334216698825600 70 69.81 69.8160808 2023-03-21 10:18:31 +6 Frank 28131 1233587627 8492820454814063616 123359 58.76 123358.7627 2023-03-21 10:18:32 diff --git a/e2e_test/sink/remote/pg_create_table.sql b/e2e_test/sink/remote/pg_create_table.sql new file mode 100644 index 0000000000000..c20e3386e8d06 --- /dev/null +++ b/e2e_test/sink/remote/pg_create_table.sql @@ -0,0 +1,11 @@ +CREATE TABLE t_remote ( + id integer PRIMARY KEY, + v_varchar varchar(100), + v_smallint smallint, + v_integer integer, + v_bigint bigint, + v_decimal decimal, + v_float real, + v_double double precision, + v_timestamp timestamp +); \ No newline at end of file diff --git a/e2e_test/source/basic/kafka.slt b/e2e_test/source/basic/kafka.slt index 0e6f7e6bca00b..5563e01dd15b9 100644 --- a/e2e_test/source/basic/kafka.slt +++ b/e2e_test/source/basic/kafka.slt @@ -79,7 +79,7 @@ from s5 with ( properties.bootstrap.server = '127.0.0.1:29092', topic = 'sink_target', - format = 'append_only', + type = 'append-only', connector = 'kafka' ) @@ -384,7 +384,7 @@ select id, first_name, last_name, email from s8; query IITFFBTT select id, sequence_id, name, score, avg_score, is_lasted, entrance_date, birthday, passed from s9; ---- -32 64 str_value 32 64 t 1970-01-01 1970-01-01 00:00:00 1 mon 1 day 00:00:01 +32 64 str_value 32 64 t 1970-01-01 1970-01-01 00:00:00+00:00 1 mon 1 day 00:00:01 query ITITT select id, code, timestamp, xfas, contacts, sex from s10; diff --git a/e2e_test/streaming/array_agg.slt b/e2e_test/streaming/array_agg.slt index 42c02a05c47ab..cf76386e3866e 100644 --- a/e2e_test/streaming/array_agg.slt +++ b/e2e_test/streaming/array_agg.slt @@ -13,9 +13,6 @@ create materialized view mv1 as select array_agg(c) as res from t; statement ok create materialized view mv2 as select array_agg(a order by b asc, a desc) as res from t; -statement ok -flush; - query T select u from (select unnest(res) from mv1) p(u) order by u; ---- @@ -47,11 +44,25 @@ select * from mv2; ---- {ccc,bbb,x,ddd,aaa,y} +statement ok +create materialized view mv3 as select array_agg(a order by b nulls first, a nulls last) as res from t; + +statement ok +insert into t values (NULL, NULL, 2), ('z', NULL, 6); + +query T +select * from mv3; +---- +{z,NULL,bbb,ccc,aaa,ddd,x,y} + statement ok drop materialized view mv1; statement ok drop materialized view mv2; +statement ok +drop materialized view mv3; + statement ok drop table t; diff --git a/e2e_test/streaming/bug_fixes/issue_8570.slt b/e2e_test/streaming/bug_fixes/issue_8570.slt new file mode 100644 index 0000000000000..5a61fdc322c95 --- /dev/null +++ b/e2e_test/streaming/bug_fixes/issue_8570.slt @@ -0,0 +1,54 @@ +# https://github.com/risingwavelabs/risingwave/issues/8570 +# TopN cache invalidation issue + +statement ok +SET RW_IMPLICIT_FLUSH TO true; + +statement ok +create table t(x int); + +statement ok +create materialized view t_singleton as select * from t order by x limit 100; + +statement ok +create materialized view mv as select * from t_singleton order by x limit 1; + +statement ok +insert into t values (1), (2), (3), (4); + +statement ok +delete from t where x = 2; + +statement ok +insert into t values (5); + +statement ok +delete from t where x = 1; + +statement ok +insert into t values (6); + +statement ok +delete from t where x = 3; + +# Shouldn't be 5 +query I +select * from mv; +---- +4 + +statement ok +delete from t where x = 4; + +# Shouldn't panic +statement ok +insert into t values (1); + +statement ok +drop materialized view mv; + +statement ok +drop materialized view t_singleton; + +statement ok +drop table t; diff --git a/e2e_test/streaming/order_by.slt b/e2e_test/streaming/order_by.slt index 4a6e44c9a8191..c87b937b3d718 100644 --- a/e2e_test/streaming/order_by.slt +++ b/e2e_test/streaming/order_by.slt @@ -16,9 +16,6 @@ create materialized view mv2 as select * from t1 order by v1 limit 3; statement ok create materialized view mv3 as select * from t1 order by v1 limit 3 offset 1; -statement ok -flush; - query III rowsort select v1, v2, v3 from mv1; ---- @@ -43,13 +40,60 @@ select v1, v2, v3 from mv3; 5 1 4 statement ok -drop materialized view mv1 +insert into t1 values (NULL,0,0); + +statement ok +create materialized view mv4 as select * from t1 order by v1 desc limit 1; + +statement ok +create materialized view mv5 as select * from t1 order by v1 nulls first limit 1; + +statement ok +create materialized view mv6 as select * from t1 order by v1 nulls last limit 1; + +statement ok +create materialized view mv7 as select * from t1 order by v1 desc nulls last limit 1; + +query III +select v1, v2, v3 from mv4; +---- +NULL 0 0 + +query III +select v1, v2, v3 from mv5; +---- +NULL 0 0 + +query III +select v1, v2, v3 from mv6; +---- +0 2 3 + +query III +select v1, v2, v3 from mv7; +---- +9 8 1 + +statement ok +drop materialized view mv1; + +statement ok +drop materialized view mv2; + +statement ok +drop materialized view mv3; + +statement ok +drop materialized view mv4; + +statement ok +drop materialized view mv5; statement ok -drop materialized view mv2 +drop materialized view mv6; statement ok -drop materialized view mv3 +drop materialized view mv7; statement ok -drop table t1 +drop table t1; diff --git a/e2e_test/udf/python.slt b/e2e_test/udf/python.slt index 560116e2e05fd..71654ac8ad64f 100644 --- a/e2e_test/udf/python.slt +++ b/e2e_test/udf/python.slt @@ -24,12 +24,18 @@ create function gcd(int, int, int) returns int language python as gcd3 using lin statement error exists create function gcd(int, int) returns int language python as gcd using link 'http://localhost:8815'; +# Create a function that returns multiple columns. +statement ok +create function extract_tcp_info(bytea) returns struct +language python as extract_tcp_info using link 'http://localhost:8815'; + # Create a table function. statement ok create function series(int) returns table (x int) language python as series using link 'http://localhost:8815'; +# Create a table function that returns multiple columns. statement ok -create function series2(int) returns table (x int, s varchar) language python as series2 using link 'http://localhost:8815'; +create function series2(int) returns table (x int, y varchar) language python as series2 using link 'http://localhost:8815'; query I select int_42(); @@ -55,16 +61,32 @@ select series(5); 3 4 -# FIXME: support table function with multiple columns -# query IT -# select series2(5); -# ---- -# (0,0) -# (1,1) -# (2,2) -# (3,3) -# (4,4) +query IT +select * from series2(3); +---- +0 #0 +1 #1 +2 #2 + +query T +select series2(3); +---- +(0,#0) +(1,#1) +(2,#2) +# TODO: support argument implicit cast for UDF +# e.g. extract_tcp_info(E'\\x45'); + +query T +select extract_tcp_info(E'\\x45000034a8a8400040065b8ac0a8000ec0a80001035d20b6d971b900000000080020200493310000020405b4' :: bytea); +---- +(192.168.0.14,192.168.0.1,861,8374) + +query TTII +select (extract_tcp_info(E'\\x45000034a8a8400040065b8ac0a8000ec0a80001035d20b6d971b900000000080020200493310000020405b4' :: BYTEA)).*; +---- +192.168.0.14 192.168.0.1 861 8374 # TODO: drop function without arguments diff --git a/e2e_test/udf/test.py b/e2e_test/udf/test.py index eabc10ad9290a..3d9cba52d36bd 100644 --- a/e2e_test/udf/test.py +++ b/e2e_test/udf/test.py @@ -1,3 +1,5 @@ +import socket +import struct import sys from typing import Iterator sys.path.append('src/udf/python') # noqa @@ -22,16 +24,25 @@ def gcd3(x: int, y: int, z: int) -> int: return gcd(gcd(x, y), z) +@udf(input_types=['BINARY'], result_type='STRUCT') +def extract_tcp_info(tcp_packet: bytes): + src_addr, dst_addr = struct.unpack('!4s4s', tcp_packet[12:20]) + src_port, dst_port = struct.unpack('!HH', tcp_packet[20:24]) + src_addr = socket.inet_ntoa(src_addr) + dst_addr = socket.inet_ntoa(dst_addr) + return src_addr, dst_addr, src_port, dst_port + + @udtf(input_types='INT', result_types='INT') def series(n: int) -> Iterator[int]: for i in range(n): yield i -@udtf(input_types=['INT'], result_types=['INT', 'VARCHAR']) +@udtf(input_types='INT', result_types=['INT', 'VARCHAR']) def series2(n: int) -> Iterator[tuple[int, str]]: for i in range(n): - yield i, str(i) + yield i, f'#{i}' if __name__ == '__main__': @@ -41,4 +52,5 @@ def series2(n: int) -> Iterator[tuple[int, str]]: server.add_function(gcd3) server.add_function(series) server.add_function(series2) + server.add_function(extract_tcp_info) server.serve() diff --git a/grafana/risingwave-dashboard.dashboard.py b/grafana/risingwave-dashboard.dashboard.py index 609a263dcb73b..f5bcaac3ce803 100644 --- a/grafana/risingwave-dashboard.dashboard.py +++ b/grafana/risingwave-dashboard.dashboard.py @@ -520,10 +520,16 @@ def section_cluster_node(panels): [ panels.target( f"sum(rate({metric('process_cpu_seconds_total')}[$__rate_interval])) by (job,instance)", - "{{job}} @ {{instance}}", - ) + "cpu - {{job}} @ {{instance}}", + ), + + panels.target( + f"sum(rate({metric('process_cpu_seconds_total')}[$__rate_interval])) by (job,instance) / avg({metric('process_cpu_core_num')}) by (job,instance)", + "cpu usage -{{job}} @ {{instance}}", + ), ], ), + panels.timeseries_count( "Meta Cluster", "", @@ -562,6 +568,16 @@ def section_compaction(outer_panels): ), ], ), + panels.timeseries_count( + "scale compactor core count", + "compactor core resource need to scale out", + [ + panels.target( + f"sum({metric('storage_compactor_suggest_core_count')})", + "suggest-core-count" + ), + ], + ), panels.timeseries_count( "Compaction Success & Failure Count", "num of compactions from each level to next level", @@ -1362,11 +1378,7 @@ def section_streaming_actors(outer_panels): ), panels.target( f"rate({metric('stream_join_insert_cache_miss_count')}[$__rate_interval])", - "cache miss when insert {{actor_id}} {{side}}", - ), - panels.target( - f"rate({metric('stream_join_may_exist_true_count')}[$__rate_interval])", - "may_exist true when insert {{actor_id}} {{side}}", + "cache miss when insert{{actor_id}} {{side}}", ), ], ), @@ -1564,7 +1576,6 @@ def section_batch_exchange(outer_panels): ), ] - def section_frontend(outer_panels): panels = outer_panels.sub_panel() return [ @@ -2598,6 +2609,26 @@ def section_memory_manager(outer_panels): ), ] +def section_connector_node(outer_panels): + panels = outer_panels.sub_panel() + return [ + outer_panels.row_collapsed( + "Connector Node", + [ + panels.timeseries_rowsps( + "Connector Source Throughput(rows)", + "", + [ + panels.target( + f"rate({metric('connector_source_rows_received')}[$__interval])", + "{{source_type}} @ {{source_id}}", + ), + ], + ), + ], + ) + ] + templating = Templating() if namespace_filter_enabled: templating = Templating( @@ -2655,5 +2686,6 @@ def section_memory_manager(outer_panels): *section_grpc_hummock_meta_client(panels), *section_frontend(panels), *section_memory_manager(panels), + *section_connector_node(panels), ], ).auto_panel_ids() diff --git a/grafana/risingwave-dashboard.json b/grafana/risingwave-dashboard.json index 67fe94a8198be..17d558245452d 100644 --- a/grafana/risingwave-dashboard.json +++ b/grafana/risingwave-dashboard.json @@ -1 +1 @@ -{"__inputs":[],"annotations":{"list":[]},"description":"RisingWave Dashboard","editable":true,"gnetId":null,"hideControls":false,"id":null,"links":[],"panels":[{"cacheTimeout":null,"collapsed":false,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":1,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Cluster Node","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":1},"height":null,"hideTimeOverride":false,"id":2,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(worker_num) by (worker_type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{worker_type}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Node Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":1},"height":null,"hideTimeOverride":false,"id":3,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(process_resident_memory_bytes) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Node Memory","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":9},"height":null,"hideTimeOverride":false,"id":4,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(process_cpu_seconds_total[$__rate_interval])) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Node CPU","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":9},"height":null,"hideTimeOverride":false,"id":5,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(meta_num) by (worker_addr,role)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{worker_addr}} @ {{role}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Meta Cluster","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"collapsed":false,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":17},"height":null,"hideTimeOverride":false,"id":6,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Streaming","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":18},"height":null,"hideTimeOverride":false,"id":7,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_source_output_rows_counts[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"source={{source_name}} {{source_id}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(rows)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":18},"height":null,"hideTimeOverride":false,"id":8,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(partition_input_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"actor={{actor_id}} source={{source_id}} partition={{partition}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(rows) Per Partition","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"MB/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":26},"height":null,"hideTimeOverride":false,"id":9,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum by (source_id)(rate(partition_input_bytes[$__rate_interval])))/(1000*1000)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"source={{source_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(bytes)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"MB/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":26},"height":null,"hideTimeOverride":false,"id":10,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(rate(partition_input_bytes[$__rate_interval]))/(1000*1000)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"actor={{actor_id}} source={{source_id}} partition={{partition}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(bytes) Per Partition","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":34},"height":null,"hideTimeOverride":false,"id":11,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_source_rows_per_barrier_counts[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"actor={{actor_id}} source={{source_id}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(rows) per barrier","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":34},"height":null,"hideTimeOverride":false,"id":12,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"all_barrier_nums","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"all_barrier","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"in_flight_barrier_nums","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"in_flight_barrier","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Number","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":42},"height":null,"hideTimeOverride":false,"id":13,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p999","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_pmax","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(meta_barrier_send_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_send_duration_seconds_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Send Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":42},"height":null,"hideTimeOverride":false,"id":14,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p999","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_pmax","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(meta_barrier_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_duration_seconds_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":50},"height":null,"hideTimeOverride":false,"id":15,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p999","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_pmax","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"max(sum by(le, instance)(rate(stream_barrier_inflight_duration_seconds_sum[$__rate_interval])) / sum by(le, instance)(rate(stream_barrier_inflight_duration_seconds_count[$__rate_interval])))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier In-Flight Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":50},"height":null,"hideTimeOverride":false,"id":16,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p50 - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p90 - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p99 - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p999 - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_pmax - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, instance)(rate(stream_barrier_sync_storage_duration_seconds_sum[$__rate_interval])) / sum by(le, instance)(rate(stream_barrier_sync_storage_duration_seconds_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_avg - {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Sync Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":58},"height":null,"hideTimeOverride":false,"id":17,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p999","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_pmax","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(meta_barrier_wait_commit_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_wait_commit_duration_seconds_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Wait Commit Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":66},"height":null,"hideTimeOverride":false,"id":18,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":19,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_executor_row_count[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}->{{executor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Executor Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":20,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_output_buffer_blocking_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Backpressure","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":21,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(actor_memory_usage[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Memory Usage","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":22,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_input_buffer_blocking_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}->{{upstream_fragment_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Input Blocking Time Ratio","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":23,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_barrier_time[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Barrier Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":24,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_processing_time[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Processing Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":25,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_actor_execution_time[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Execution Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":24},"height":null,"hideTimeOverride":false,"id":26,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_in_record_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Input Row","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":32},"height":null,"hideTimeOverride":false,"id":27,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_out_record_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Output Row","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":12,"y":32},"height":null,"hideTimeOverride":false,"id":28,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_fast_poll_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Fast Poll Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":40},"height":null,"hideTimeOverride":false,"id":29,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_fast_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Fast Poll Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":40},"height":null,"hideTimeOverride":false,"id":30,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_fast_poll_duration[$__rate_interval]) / rate(stream_actor_fast_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Fast Poll Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":40},"height":null,"hideTimeOverride":false,"id":31,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_slow_poll_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Slow Poll Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":48},"height":null,"hideTimeOverride":false,"id":32,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_slow_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Slow Poll Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":48},"height":null,"hideTimeOverride":false,"id":33,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_slow_poll_duration[$__rate_interval]) / rate(stream_actor_slow_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Slow Poll Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":48},"height":null,"hideTimeOverride":false,"id":34,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_poll_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Poll Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":56},"height":null,"hideTimeOverride":false,"id":35,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Poll Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":56},"height":null,"hideTimeOverride":false,"id":36,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_poll_duration[$__rate_interval]) / rate(stream_actor_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Poll Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":56},"height":null,"hideTimeOverride":false,"id":37,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_idle_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Idle Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":64},"height":null,"hideTimeOverride":false,"id":38,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_idle_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Idle Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":64},"height":null,"hideTimeOverride":false,"id":39,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_idle_duration[$__rate_interval]) / rate(stream_actor_idle_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Idle Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":64},"height":null,"hideTimeOverride":false,"id":40,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_scheduled_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Scheduled Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":72},"height":null,"hideTimeOverride":false,"id":41,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_scheduled_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Scheduled Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":72},"height":null,"hideTimeOverride":false,"id":42,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_scheduled_duration[$__rate_interval]) / rate(stream_actor_scheduled_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Scheduled Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":80},"height":null,"hideTimeOverride":false,"id":43,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_lookup_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cache miss {{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_lookup_total_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"total lookups {{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_insert_cache_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cache miss when insert {{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_may_exist_true_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"may_exist true when insert {{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Executor Cache","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":80},"height":null,"hideTimeOverride":false,"id":44,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, actor_id, wait_side, job, instance)(rate(stream_join_barrier_align_duration_sum[$__rate_interval])) / sum by(le,actor_id,wait_side,job,instance) (rate(stream_join_barrier_align_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Executor Barrier Align","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":88},"height":null,"hideTimeOverride":false,"id":45,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_actor_input_waiting_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Actor Input Blocking Time Ratio","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":88},"height":null,"hideTimeOverride":false,"id":46,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_match_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}.{{side}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Actor Match Duration Per Second","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":96},"height":null,"hideTimeOverride":false,"id":47,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_join_cached_entries","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Cached Entries","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":96},"height":null,"hideTimeOverride":false,"id":48,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_join_cached_rows","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Cached Rows","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":104},"height":null,"hideTimeOverride":false,"id":49,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_join_cached_estimated_size","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}} {{side}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Cached Estimated Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":104},"height":null,"hideTimeOverride":false,"id":50,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_lookup_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cache miss {{actor_id}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_lookup_total_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"total lookups {{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Aggregation Executor Cache Statistics For Each Key/State","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":112},"height":null,"hideTimeOverride":false,"id":51,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_chunk_lookup_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"chunk-level cache miss {{actor_id}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_chunk_lookup_total_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"chunk-level total lookups {{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Aggregation Executor Cache Statistics For Each StreamChunk","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":112},"height":null,"hideTimeOverride":false,"id":52,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_agg_cached_keys","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Aggregation Cached Keys","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Streaming Actors","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":67},"height":null,"hideTimeOverride":false,"id":53,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":54,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_exchange_frag_send_size[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{up_fragment_id}}->{{down_fragment_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Fragment-level Remote Exchange Send Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":55,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_exchange_frag_recv_size[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{up_fragment_id}}->{{down_fragment_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Fragment-level Remote Exchange Recv Throughput","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Streaming Exchange","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":68},"height":null,"hideTimeOverride":false,"id":56,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":57,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(user_compute_error_count) by (error_type, error_msg, fragment_id, executor_name)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{error_type}}: {{error_msg}} ({{executor_name}}: fragment_id={{fragment_id}})","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compute Errors by Type","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":58,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(user_source_error_count) by (error_type, error_msg, fragment_id, table_id, executor_name)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{error_type}}: {{error_msg}} ({{executor_name}}: table_id={{table_id}}, fragment_id={{fragment_id}})","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Errors by Type","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"User Streaming Errors","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":69},"height":null,"hideTimeOverride":false,"id":59,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":60,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"batch_task_exchange_recv_row_number","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{query_id}} : {{source_stage_id}}.{{source_task_id}} -> {{target_stage_id}}.{{target_task_id}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Exchange Recv Row Number","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":61,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"batch_task_num","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Batch Mpp Task Number","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Batch Metrics","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":false,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":70},"height":null,"hideTimeOverride":false,"id":62,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Hummock","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":71},"height":null,"hideTimeOverride":false,"id":63,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance) (rate(state_store_sync_duration_sum[$__rate_interval])) / sum by(le, job, instance) (rate(state_store_sync_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Build and Sync Sstable Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":71},"height":null,"hideTimeOverride":false,"id":64,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_sst_store_block_request_counts[$__rate_interval])) by (job, instance, table_id, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{table_id}} @ {{type}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_latency_count[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_miss[$__rate_interval])) by (instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache miss @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Cache Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":79},"height":null,"hideTimeOverride":false,"id":65,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_get_duration_count[$__rate_interval])) by (job,instanc,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_range_reverse_scan_duration_count[$__rate_interval])) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"backward scan - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_get_shared_buffer_hit_counts[$__rate_interval])) by (job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"shared_buffer hit - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_iter_in_process_counts[$__rate_interval])) by(job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"iter - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":79},"height":null,"hideTimeOverride":false,"id":66,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_get_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_get_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{table_id}} {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Duration - Get","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":87},"height":null,"hideTimeOverride":false,"id":67,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(state_store_iter_duration_sum[$__rate_interval])) / sum by(le, job,instance) (rate(state_store_iter_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time avg - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(state_store_scan_iter_duration_sum[$__rate_interval])) / sum by(le, job,instance) (rate(state_store_iter_scan_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time avg - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Duration - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":87},"height":null,"hideTimeOverride":false,"id":68,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.9, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.99, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.999, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 - {{table_id}} {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(1.0, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Item Size - Get","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":95},"height":null,"hideTimeOverride":false,"id":69,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Item Size - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":95},"height":null,"hideTimeOverride":false,"id":70,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Item Count - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":103},"height":null,"hideTimeOverride":false,"id":71,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_get_key_size_sum[$__rate_interval])) by(job, instance) + sum(rate(state_store_get_value_size_sum[$__rate_interval])) by(job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Throughput - Get","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":103},"height":null,"hideTimeOverride":false,"id":72,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_iter_size_sum[$__rate_interval])) by(job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Throughput - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":111},"height":null,"hideTimeOverride":false,"id":73,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_may_exist_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_may_exist_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{table_id}} {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Duration - MayExist","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":111},"height":null,"hideTimeOverride":false,"id":74,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_bloom_filter_true_negative_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"bloom filter true negative - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_read_req_positive_but_non_exist_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"bloom filter false positive count - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read_req bloom filter positive - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_read_req_check_bloom_filter_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read_req check bloom filter - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Bloom Filter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":119},"height":null,"hideTimeOverride":false,"id":75,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_iter_scan_key_counts[$__rate_interval])) by (instance, type, table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"iter keys flow - {{table_id}} @ {{type}} @ {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Iter keys flow","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":119},"height":null,"hideTimeOverride":false,"id":76,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"1 - (sum(rate(state_store_bloom_filter_true_negative_counts[$__rate_interval])) by (job,instance,table_id,type)) / (sum(rate(state_bloom_filter_check_counts[$__rate_interval])) by (job,instance,table_id,type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"bloom filter miss rate - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum(rate(state_store_sst_store_block_request_counts{type='meta_miss'}[$__rate_interval])) by (job,instance,table_id)) / (sum(rate(state_store_sst_store_block_request_counts{type='meta_total'}[$__rate_interval])) by (job,instance,table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"meta cache miss rate - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum(rate(state_store_sst_store_block_request_counts{type='data_miss'}[$__rate_interval])) by (job,instance,table_id)) / (sum(rate(state_store_sst_store_block_request_counts{type='data_total'}[$__rate_interval])) by (job,instance,table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"block cache miss rate - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum(rate(file_cache_miss[$__rate_interval])) by (instance)) / (sum(rate(file_cache_latency_count{op='get'}[$__rate_interval])) by (instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache miss rate @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"1 - (((sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type))) / (sum(rate(state_store_read_req_check_bloom_filter_counts[$__rate_interval])) by (job,instance,table_id,type)))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read req bloom filter filter rate - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"1 - (((sum(rate(state_store_read_req_positive_but_non_exist_counts[$__rate_interval])) by (job,instance,table_id,type))) / (sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type)))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read req bloom filter false positive rate - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":" Filter/Cache Miss Rate","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":127},"height":null,"hideTimeOverride":false,"id":77,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts p90 - {{table_id}} @ {{job}} @ {{type}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts p99 - {{table_id}} @ {{job}} @ {{type}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts pmax - {{table_id}} @ {{job}} @ {{type}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_iter_merge_sstable_counts_sum[$__rate_interval])) / sum by(le, job, instance, table_id)(rate(state_store_iter_merge_sstable_counts_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts avg - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Merged SSTs","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":127},"height":null,"hideTimeOverride":false,"id":78,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_write_batch_duration_count[$__rate_interval])) by (job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write batch - {{table_id}} @ {{job}} @ {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_sync_duration_count[$__rate_interval])) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"l0 - {{job}} @ {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":135},"height":null,"hideTimeOverride":false,"id":79,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_write_batch_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id)(rate(state_store_write_batch_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer avg - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(state_store_write_shared_buffer_sync_time_sum[$__rate_interval])) / sum by(le, job, instance)(rate(state_store_write_shared_buffer_sync_time_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":135},"height":null,"hideTimeOverride":false,"id":80,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_write_batch_tuple_counts[$__rate_interval])) by (job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write_batch_kv_pair_count - {{table_id}} @ {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Item Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":143},"height":null,"hideTimeOverride":false,"id":81,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_write_batch_size_sum[$__rate_interval]))by(job,instance) / sum(rate(state_store_write_batch_size_count[$__rate_interval]))by(job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"shared_buffer - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(compactor_shared_buffer_to_sstable_size[$__rate_interval]))by(job,instance) / sum(rate(state_store_shared_buffer_to_sstable_size_count[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"sync - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":143},"height":null,"hideTimeOverride":false,"id":82,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance) (rate(state_store_sync_size_sum[$__rate_interval])) / sum by(le, job, instance) (rate(state_store_sync_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Checkpoint Sync Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":151},"height":null,"hideTimeOverride":false,"id":83,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(state_store_meta_cache_size) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"meta cache - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(state_store_block_cache_size) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"data cache - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(state_store_limit_memory_size) by (job)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"uploading memory - {{job}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Cache Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":151},"height":null,"hideTimeOverride":false,"id":84,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance) (rate(batch_row_seq_scan_next_duration_sum[$__rate_interval])) / sum by(le, job, instance) (rate(batch_row_seq_scan_next_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next avg - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Row SeqScan Next Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":159},"height":null,"hideTimeOverride":false,"id":85,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id) (rate(state_store_iter_fetch_meta_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_iter_fetch_meta_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration avg - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Fetch Meta Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":167},"height":null,"hideTimeOverride":false,"id":86,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"num of SSTs in each level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":87,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_sst_num) by (instance, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"SST Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"KBs total file bytes in each level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"kbytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":88,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_total_file_size) by (instance, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs level sst","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of compactions from each level to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":89,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_compact_frequency) by (compactor, group, task_type, result)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{task_type}} - {{result}} - group-{{group}} @ {{compactor}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Success & Failure Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of compaction task which does not trigger","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":90,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_skip_compact_frequency[$__rate_interval])) by (level, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{level}}-{{type}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Skip Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of compactions from each level to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":91,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(storage_compact_task_pending_num) by(job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compactor_task_split_count - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compactor Running Task Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total time of compact that have been issued to state store","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":92,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_compact_sst_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-key-range p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_compact_sst_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-key-range pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_get_table_id_total_time_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get-table-id p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_get_table_id_total_time_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get-table-id pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le)(rate(compactor_compact_task_duration_sum[$__rate_interval])) / sum by(le)(rate(compactor_compact_task_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task avg","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le)(rate(state_store_compact_sst_duration_sum[$__rate_interval])) / sum by(le)(rate(state_store_compact_sst_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-key-range avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"KBs read from next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":93,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_next[$__rate_interval])) by(job,instance) + sum(rate(storage_level_compact_read_curr[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_write[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(compactor_write_build_l0_bytes[$__rate_interval]))by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"flush - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs written into next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":24},"height":null,"hideTimeOverride":false,"id":94,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_compact_write) by (job)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write - {{job}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(compactor_write_build_l0_bytes) by (job)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"flush - {{job}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Write Bytes","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs written into next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":32},"height":null,"hideTimeOverride":false,"id":95,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_compact_write) / sum(state_store_write_build_l0_bytes)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write amplification","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Write Amplification","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs to be merged to next level in each level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":32},"height":null,"hideTimeOverride":false,"id":96,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_level_compact_cnt","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compacting SST Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":40},"height":null,"hideTimeOverride":false,"id":97,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_next[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs Read from Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":40},"height":null,"hideTimeOverride":false,"id":98,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_curr[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs Read from Current Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":48},"height":null,"hideTimeOverride":false,"id":99,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_sstn_curr[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Count of SSTs Read from Current Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":48},"height":null,"hideTimeOverride":false,"id":100,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_write[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} write","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs Written to Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":56},"height":null,"hideTimeOverride":false,"id":101,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_write_sstn[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} write","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Count of SSTs Written to Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs read from next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":56},"height":null,"hideTimeOverride":false,"id":102,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_sstn_next[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Count of SSTs Read from Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total bytes gotten from sstable_bloom_filter, for observing bloom_filter size","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":64},"height":null,"hideTimeOverride":false,"id":103,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_bloom_filter_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_bloom_filter_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_meta - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_file_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_file_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_file - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Sstable Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total bytes gotten from sstable_avg_key_size, for observing sstable_avg_key_size","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":64},"height":null,"hideTimeOverride":false,"id":104,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_avg_key_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_avg_key_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_key_size - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_avg_value_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_avg_value_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_value_size - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Sstable Item Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Avg count gotten from sstable_distinct_epoch_count, for observing sstable_distinct_epoch_count","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":72},"height":null,"hideTimeOverride":false,"id":105,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_distinct_epoch_count_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_distinct_epoch_count_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_epoch_count - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Sstable Stat","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total time of operations which read from remote storage when enable prefetch","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":72},"height":null,"hideTimeOverride":false,"id":106,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Remote Read Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":80},"height":null,"hideTimeOverride":false,"id":107,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(compactor_iter_scan_key_counts[$__rate_interval])) by (instance, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"iter keys flow - {{type}} @ {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compactor Iter keys","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"bytes of Lsm tree needed to reach balance","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":80},"height":null,"hideTimeOverride":false,"id":108,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_compact_pending_bytes) by (instance, group)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact pending bytes - {{group}} @ {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Lsm Compact Pending Bytes","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"compression ratio of each level of the lsm tree","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":88},"height":null,"hideTimeOverride":false,"id":109,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_compact_level_compression_ratio) by (instance, group, level, algorithm)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"lsm compression ratio - cg{{group}} @ L{{level}} - {{algorithm}} {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Lsm Level Compression Ratio","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Compaction","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":168},"height":null,"hideTimeOverride":false,"id":110,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":111,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_read_bytes[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_write_bytes[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":112,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, type, job, instance)(rate(object_store_operation_latency_sum[$__rate_interval])) / sum by(le, type, job, instance) (rate(object_store_operation_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} avg - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":113,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_operation_latency_count[$__rate_interval])) by (le, type, job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_operation_latency_count{type=~'upload|delete'}[$__rate_interval])) by (le, media_type, job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{media_type}}-write - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_operation_latency_count{type=~'read|readv|list|metadata'}[$__rate_interval])) by (le, media_type, job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{media_type}}-read - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Rate","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":114,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} pmax - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":115,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_failure_count[$__rate_interval])) by (instance, job, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Failure Rate","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"$"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":116,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(object_store_read_bytes) * 0.01 / 1000 / 1000 / 1000","format":"time_series","hide":true,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"(Cross Region) Data Transfer Cost","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(object_store_operation_latency_count{type=~'read|streaming_read_start|delete'}) * 0.0004 / 1000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GET, SELECT, and all other Requests Cost","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(object_store_operation_latency_count{type=~'upload|streaming_upload_start|s3_upload_part|streaming_upload_finish|delete_objects|list'}) * 0.005 / 1000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"PUT, COPY, POST, LIST Requests Cost","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Estimated S3 Cost (Realtime)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"$"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":117,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_total_file_size) by (instance) * 0.023 / 1000 / 1000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Monthly Storage Cost","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Estimated S3 Cost (Monthly)","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Object Storage","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":169},"height":null,"hideTimeOverride":false,"id":118,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":119,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_latency_count[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_miss[$__rate_interval])) by (instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache miss @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_disk_latency_count[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache disk {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":120,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":121,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_disk_bytes[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"disk {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":122,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache disk - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache disk read entry - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache disk read entry - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache disk read entry - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache disk read entry - {{op}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Disk IO Size","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Hummock Tiered Cache","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":170},"height":null,"hideTimeOverride":false,"id":123,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":124,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time p50 - {{lock_type}} @ {{lock_name}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time p99 - {{lock_type}} @ {{lock_name}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time p999 - {{lock_type}} @ {{lock_name}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time pmax - {{lock_type}} @ {{lock_name}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Lock Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":125,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time p50 - {{method}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time p99 - {{method}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time p999 - {{method}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time pmax - {{method}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Real Process Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":126,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_size","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"version size","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Version Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":127,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_current_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"current version id","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_checkpoint_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"checkpoint version id","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_min_pinned_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"min pinned version id","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_min_safepoint_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"min safepoint version id","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Version Id","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":128,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_max_committed_epoch","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"max committed epoch","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_safe_epoch","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"safe epoch","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_min_pinned_epoch","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"min pinned epoch","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Epoch","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"kbytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":129,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_stats{metric='total_key_size'}/1024","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"table{{table_id}} {{metric}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_stats{metric='total_value_size'}/1024","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"table{{table_id}} {{metric}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Table KV Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":130,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_stats{metric='total_key_count'}","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"table{{table_id}} {{metric}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Table KV Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"total number of SSTs that is no longer referenced by versions but is not yet deleted from storage","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":24},"height":null,"hideTimeOverride":false,"id":131,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_stale_ssts_count","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"stale SST total number","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Stale SST Total Number","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Hummock Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":171},"height":null,"hideTimeOverride":false,"id":132,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":133,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"backup_job_count","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"job count","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Job Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":134,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time p50 - {{state}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time p99 - {{state}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time p999 - {{state}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time pmax - {{state}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Job Process Time","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Backup Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":172},"height":null,"hideTimeOverride":false,"id":135,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":136,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/Create'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/Create'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Create latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":137,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/Drop'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/Drop'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Drop latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":0},"height":null,"hideTimeOverride":false,"id":138,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/GetCatalog'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"GetCatalog latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Catalog Service","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":173},"height":null,"hideTimeOverride":false,"id":139,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":140,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"AddWorkerNode latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":141,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"ListAllNodes latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Cluster Service","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":174},"height":null,"hideTimeOverride":false,"id":142,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":143,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"CreateMaterializedView latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":144,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"DropMaterializedView latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":0},"height":null,"hideTimeOverride":false,"id":145,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/Flush'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Flush latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Stream Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":175},"height":null,"hideTimeOverride":false,"id":146,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":147,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"UnpinVersionBefore latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":148,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"UnpinSnapshotBefore latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":0},"height":null,"hideTimeOverride":false,"id":149,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"ReportCompactionTasks latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":150,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_p50","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_p90","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_p99","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_avg","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"GetNewSstIds latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Hummock Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":176},"height":null,"hideTimeOverride":false,"id":151,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":152,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_report_compaction_task_counts[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_counts - {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"compaction_count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":153,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_p50 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_p99 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_unpin_version_before_latency_sum[$__rate_interval])) / sum(irate(state_store_unpin_version_before_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_avg","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_p90 - {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"version_latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":154,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latency_p50 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latency_p99 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latencyp90 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_pin_snapshot_latency_sum[$__rate_interval])) / sum(irate(state_store_pin_snapshot_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latency_avg","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_unpin_version_snapshot_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_p50 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_unpin_version_snapshot_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_p99 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_unpin_snapshot_latency_sum[$__rate_interval])) / sum(irate(state_store_unpin_snapshot_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_avg","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_unpin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_p90 - {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"snapshot_latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":155,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_pin_snapshot_counts[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_counts - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_unpin_snapshot_counts[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_counts - {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"snapshot_count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":156,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_p50 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_p99 - {{instance}} ","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_get_new_sst_ids_latency_sum[$__rate_interval])) / sum(irate(state_store_get_new_sst_ids_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_avg","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_p90 - {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"table_latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":157,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_get_new_sst_ids_latency_counts[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_counts - {{instance}} ","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"table_count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":158,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_p50 - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_p99 - {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_report_compaction_task_latency_sum[$__rate_interval])) / sum(irate(state_store_report_compaction_task_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_avg","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_p90 - {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"compaction_latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC: Hummock Meta Client","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":177},"height":null,"hideTimeOverride":false,"id":159,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Qps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":160,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(frontend_query_counter_local_execution[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Per second in Loacl Execution Mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Qps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":161,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(distributed_completed_query_counter[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Per second in Distributed Execution Mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":162,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"distributed_running_query_num","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"The number of running query in distributed execution mode","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Running query in distributed execution mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":163,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"distributed_rejected_query_counter","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"The number of rejected query in distributed execution mode","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Rejected query in distributed execution mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":164,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"distributed_completed_query_counter","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"The number of completed query in distributed execution mode","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Completed query in distributed execution mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":165,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.95, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Latency in Distributed Execution Mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":166,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.95, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Latency in Local Execution Mode","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Frontend","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":178},"height":null,"hideTimeOverride":false,"id":167,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":168,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(lru_runtime_loop_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"LRU manager loop count per sec","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":169,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"lru_watermark_step","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"LRU manager watermark steps","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"watermark_time is the current lower watermark of cached data. physical_now is the current time of the machine. The diff (physical_now - watermark_time) shows how much data is cached.","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":170,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"lru_physical_now_ms - lru_current_watermark_time_ms","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"LRU manager diff between watermark_time and now (ms)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":171,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"jemalloc_allocated_bytes","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"The memory allocated by jemalloc","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":172,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_total_mem_usage","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"The memory allocated by streaming","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":173,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"batch_total_mem_usage","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"The memory allocated by batch","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Memory manager","transformations":[],"transparent":false,"type":"row"}],"refresh":"10s","rows":[],"schemaVersion":12,"sharedCrosshair":true,"style":"dark","tags":["risingwave"],"templating":{"list":[]},"time":{"from":"now-30m","to":"now"},"timepicker":{"hidden":false,"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone":"browser","title":"risingwave_dashboard","uid":"Ecy3uV1nz","version":0} +{"__inputs":[],"annotations":{"list":[]},"description":"RisingWave Dashboard","editable":true,"gnetId":null,"graphTooltip":0,"hideControls":false,"id":null,"links":[],"panels":[{"cacheTimeout":null,"collapsed":false,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":1,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Cluster Node","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":1},"height":null,"hideTimeOverride":false,"id":2,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(worker_num) by (worker_type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{worker_type}}","metric":"","query":"sum(worker_num) by (worker_type)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Node Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":1},"height":null,"hideTimeOverride":false,"id":3,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(process_resident_memory_bytes) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","query":"avg(process_resident_memory_bytes) by (job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Node Memory","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":9},"height":null,"hideTimeOverride":false,"id":4,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(process_cpu_seconds_total[$__rate_interval])) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cpu - {{job}} @ {{instance}}","metric":"","query":"sum(rate(process_cpu_seconds_total[$__rate_interval])) by (job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(process_cpu_seconds_total[$__rate_interval])) by (job,instance) / avg(process_cpu_core_num) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cpu usage -{{job}} @ {{instance}}","metric":"","query":"sum(rate(process_cpu_seconds_total[$__rate_interval])) by (job,instance) / avg(process_cpu_core_num) by (job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Node CPU","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":9},"height":null,"hideTimeOverride":false,"id":5,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(meta_num) by (worker_addr,role)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{worker_addr}} @ {{role}}","metric":"","query":"sum(meta_num) by (worker_addr,role)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Meta Cluster","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"collapsed":false,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":17},"height":null,"hideTimeOverride":false,"id":6,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Streaming","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":18},"height":null,"hideTimeOverride":false,"id":7,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_source_output_rows_counts[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"source={{source_name}} {{source_id}} @ {{instance}}","metric":"","query":"rate(stream_source_output_rows_counts[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(rows)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":18},"height":null,"hideTimeOverride":false,"id":8,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(partition_input_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"actor={{actor_id}} source={{source_id}} partition={{partition}}","metric":"","query":"rate(partition_input_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(rows) Per Partition","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"MB/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":26},"height":null,"hideTimeOverride":false,"id":9,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum by (source_id)(rate(partition_input_bytes[$__rate_interval])))/(1000*1000)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"source={{source_id}}","metric":"","query":"(sum by (source_id)(rate(partition_input_bytes[$__rate_interval])))/(1000*1000)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(bytes)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"MB/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":26},"height":null,"hideTimeOverride":false,"id":10,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(rate(partition_input_bytes[$__rate_interval]))/(1000*1000)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"actor={{actor_id}} source={{source_id}} partition={{partition}}","metric":"","query":"(rate(partition_input_bytes[$__rate_interval]))/(1000*1000)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(bytes) Per Partition","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":34},"height":null,"hideTimeOverride":false,"id":11,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_source_rows_per_barrier_counts[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"actor={{actor_id}} source={{source_id}} @ {{instance}}","metric":"","query":"rate(stream_source_rows_per_barrier_counts[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Throughput(rows) per barrier","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":34},"height":null,"hideTimeOverride":false,"id":12,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"all_barrier_nums","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"all_barrier","metric":"","query":"all_barrier_nums","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"in_flight_barrier_nums","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"in_flight_barrier","metric":"","query":"in_flight_barrier_nums","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Number","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":42},"height":null,"hideTimeOverride":false,"id":13,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p50","metric":"","query":"histogram_quantile(0.5, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p90","metric":"","query":"histogram_quantile(0.9, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p99","metric":"","query":"histogram_quantile(0.99, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_p999","metric":"","query":"histogram_quantile(0.999, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_pmax","metric":"","query":"histogram_quantile(1.0, sum(rate(meta_barrier_send_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(meta_barrier_send_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_send_duration_seconds_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_send_latency_avg","metric":"","query":"rate(meta_barrier_send_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_send_duration_seconds_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Send Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":42},"height":null,"hideTimeOverride":false,"id":14,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p50","metric":"","query":"histogram_quantile(0.5, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p90","metric":"","query":"histogram_quantile(0.9, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p99","metric":"","query":"histogram_quantile(0.99, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_p999","metric":"","query":"histogram_quantile(0.999, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_pmax","metric":"","query":"histogram_quantile(1.0, sum(rate(meta_barrier_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(meta_barrier_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_duration_seconds_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_latency_avg","metric":"","query":"rate(meta_barrier_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_duration_seconds_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":50},"height":null,"hideTimeOverride":false,"id":15,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p50","metric":"","query":"histogram_quantile(0.5, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p90","metric":"","query":"histogram_quantile(0.9, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p99","metric":"","query":"histogram_quantile(0.99, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_p999","metric":"","query":"histogram_quantile(0.999, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_pmax","metric":"","query":"histogram_quantile(1.0, sum(rate(stream_barrier_inflight_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"max(sum by(le, instance)(rate(stream_barrier_inflight_duration_seconds_sum[$__rate_interval])) / sum by(le, instance)(rate(stream_barrier_inflight_duration_seconds_count[$__rate_interval])))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_inflight_latency_avg","metric":"","query":"max(sum by(le, instance)(rate(stream_barrier_inflight_duration_seconds_sum[$__rate_interval])) / sum by(le, instance)(rate(stream_barrier_inflight_duration_seconds_count[$__rate_interval])))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier In-Flight Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":50},"height":null,"hideTimeOverride":false,"id":16,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p50 - {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p90 - {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p99 - {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_p999 - {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_pmax - {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(stream_barrier_sync_storage_duration_seconds_bucket[$__rate_interval])) by (le,instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, instance)(rate(stream_barrier_sync_storage_duration_seconds_sum[$__rate_interval])) / sum by(le, instance)(rate(stream_barrier_sync_storage_duration_seconds_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_sync_latency_avg - {{instance}}","metric":"","query":"sum by(le, instance)(rate(stream_barrier_sync_storage_duration_seconds_sum[$__rate_interval])) / sum by(le, instance)(rate(stream_barrier_sync_storage_duration_seconds_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Sync Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":58},"height":null,"hideTimeOverride":false,"id":17,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p50","metric":"","query":"histogram_quantile(0.5, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p90","metric":"","query":"histogram_quantile(0.9, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p99","metric":"","query":"histogram_quantile(0.99, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_p999","metric":"","query":"histogram_quantile(0.999, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_latency_pmax","metric":"","query":"histogram_quantile(1.0, sum(rate(meta_barrier_wait_commit_duration_seconds_bucket[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(meta_barrier_wait_commit_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_wait_commit_duration_seconds_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"barrier_wait_commit_avg","metric":"","query":"rate(meta_barrier_wait_commit_duration_seconds_sum[$__rate_interval]) / rate(meta_barrier_wait_commit_duration_seconds_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Barrier Wait Commit Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":66},"height":null,"hideTimeOverride":false,"id":18,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":19,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_executor_row_count[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}->{{executor_id}}","metric":"","query":"rate(stream_executor_row_count[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Executor Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":20,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_output_buffer_blocking_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_output_buffer_blocking_duration_ns[$__rate_interval]) / 1000000000","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Backpressure","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":21,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(actor_memory_usage[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(actor_memory_usage[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Memory Usage","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":22,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_input_buffer_blocking_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}->{{upstream_fragment_id}}","metric":"","query":"rate(stream_actor_input_buffer_blocking_duration_ns[$__rate_interval]) / 1000000000","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Input Blocking Time Ratio","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":23,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_barrier_time[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_barrier_time[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Barrier Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":24,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_processing_time[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_processing_time[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Processing Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":25,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_actor_execution_time[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_actor_execution_time[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Execution Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":24},"height":null,"hideTimeOverride":false,"id":26,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_in_record_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_in_record_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Input Row","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":32},"height":null,"hideTimeOverride":false,"id":27,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_out_record_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_out_record_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Actor Output Row","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":12,"y":32},"height":null,"hideTimeOverride":false,"id":28,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_fast_poll_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_fast_poll_duration[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Fast Poll Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":40},"height":null,"hideTimeOverride":false,"id":29,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_fast_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_fast_poll_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Fast Poll Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":40},"height":null,"hideTimeOverride":false,"id":30,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_fast_poll_duration[$__rate_interval]) / rate(stream_actor_fast_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_fast_poll_duration[$__rate_interval]) / rate(stream_actor_fast_poll_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Fast Poll Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":40},"height":null,"hideTimeOverride":false,"id":31,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_slow_poll_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_slow_poll_duration[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Slow Poll Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":48},"height":null,"hideTimeOverride":false,"id":32,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_slow_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_slow_poll_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Slow Poll Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":48},"height":null,"hideTimeOverride":false,"id":33,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_slow_poll_duration[$__rate_interval]) / rate(stream_actor_slow_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_slow_poll_duration[$__rate_interval]) / rate(stream_actor_slow_poll_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Slow Poll Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":48},"height":null,"hideTimeOverride":false,"id":34,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_poll_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_poll_duration[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Poll Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":56},"height":null,"hideTimeOverride":false,"id":35,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_poll_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Poll Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":56},"height":null,"hideTimeOverride":false,"id":36,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_poll_duration[$__rate_interval]) / rate(stream_actor_poll_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_poll_duration[$__rate_interval]) / rate(stream_actor_poll_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Poll Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":56},"height":null,"hideTimeOverride":false,"id":37,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_idle_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_idle_duration[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Idle Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":64},"height":null,"hideTimeOverride":false,"id":38,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_idle_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_idle_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Idle Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":64},"height":null,"hideTimeOverride":false,"id":39,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_idle_duration[$__rate_interval]) / rate(stream_actor_idle_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_idle_duration[$__rate_interval]) / rate(stream_actor_idle_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Idle Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":64},"height":null,"hideTimeOverride":false,"id":40,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_scheduled_duration[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_scheduled_duration[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Scheduled Total Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":72},"height":null,"hideTimeOverride":false,"id":41,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_scheduled_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_scheduled_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Scheduled Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":72},"height":null,"hideTimeOverride":false,"id":42,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_actor_scheduled_duration[$__rate_interval]) / rate(stream_actor_scheduled_cnt[$__rate_interval]) > 0","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_actor_scheduled_duration[$__rate_interval]) / rate(stream_actor_scheduled_cnt[$__rate_interval]) > 0","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Tokio: Actor Scheduled Avg Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":80},"height":null,"hideTimeOverride":false,"id":43,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_lookup_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cache miss {{actor_id}} {{side}}","metric":"","query":"rate(stream_join_lookup_miss_count[$__rate_interval])","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_lookup_total_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"total lookups {{actor_id}} {{side}}","metric":"","query":"rate(stream_join_lookup_total_count[$__rate_interval])","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_insert_cache_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cache miss when insert{{actor_id}} {{side}}","metric":"","query":"rate(stream_join_insert_cache_miss_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Executor Cache","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":80},"height":null,"hideTimeOverride":false,"id":44,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(stream_join_barrier_align_duration_bucket[$__rate_interval])) by (le, actor_id, wait_side, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, actor_id, wait_side, job, instance)(rate(stream_join_barrier_align_duration_sum[$__rate_interval])) / sum by(le,actor_id,wait_side,job,instance) (rate(stream_join_barrier_align_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg {{actor_id}}.{{wait_side}} - {{job}} @ {{instance}}","metric":"","query":"sum by(le, actor_id, wait_side, job, instance)(rate(stream_join_barrier_align_duration_sum[$__rate_interval])) / sum by(le,actor_id,wait_side,job,instance) (rate(stream_join_barrier_align_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Executor Barrier Align","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":88},"height":null,"hideTimeOverride":false,"id":45,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_actor_input_waiting_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"rate(stream_join_actor_input_waiting_duration_ns[$__rate_interval]) / 1000000000","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Actor Input Blocking Time Ratio","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":88},"height":null,"hideTimeOverride":false,"id":46,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_join_match_duration_ns[$__rate_interval]) / 1000000000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}.{{side}}","metric":"","query":"rate(stream_join_match_duration_ns[$__rate_interval]) / 1000000000","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Actor Match Duration Per Second","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":96},"height":null,"hideTimeOverride":false,"id":47,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_join_cached_entries","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}} {{side}}","metric":"","query":"stream_join_cached_entries","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Cached Entries","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":96},"height":null,"hideTimeOverride":false,"id":48,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_join_cached_rows","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}} {{side}}","metric":"","query":"stream_join_cached_rows","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Cached Rows","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":104},"height":null,"hideTimeOverride":false,"id":49,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_join_cached_estimated_size","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}} {{side}}","metric":"","query":"stream_join_cached_estimated_size","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Join Cached Estimated Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":104},"height":null,"hideTimeOverride":false,"id":50,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_lookup_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"cache miss {{actor_id}}","metric":"","query":"rate(stream_agg_lookup_miss_count[$__rate_interval])","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_lookup_total_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"total lookups {{actor_id}}","metric":"","query":"rate(stream_agg_lookup_total_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Aggregation Executor Cache Statistics For Each Key/State","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":0,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":112},"height":null,"hideTimeOverride":false,"id":51,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_chunk_lookup_miss_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"chunk-level cache miss {{actor_id}}","metric":"","query":"rate(stream_agg_chunk_lookup_miss_count[$__rate_interval])","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_agg_chunk_lookup_total_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"chunk-level total lookups {{actor_id}}","metric":"","query":"rate(stream_agg_chunk_lookup_total_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Aggregation Executor Cache Statistics For Each StreamChunk","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":112},"height":null,"hideTimeOverride":false,"id":52,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_agg_cached_keys","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{actor_id}}","metric":"","query":"stream_agg_cached_keys","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Aggregation Cached Keys","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Streaming Actors","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":67},"height":null,"hideTimeOverride":false,"id":53,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":54,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_exchange_frag_send_size[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{up_fragment_id}}->{{down_fragment_id}}","metric":"","query":"rate(stream_exchange_frag_send_size[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Fragment-level Remote Exchange Send Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":55,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(stream_exchange_frag_recv_size[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{up_fragment_id}}->{{down_fragment_id}}","metric":"","query":"rate(stream_exchange_frag_recv_size[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Fragment-level Remote Exchange Recv Throughput","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Streaming Exchange","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":68},"height":null,"hideTimeOverride":false,"id":56,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":57,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(user_compute_error_count) by (error_type, error_msg, fragment_id, executor_name)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{error_type}}: {{error_msg}} ({{executor_name}}: fragment_id={{fragment_id}})","metric":"","query":"sum(user_compute_error_count) by (error_type, error_msg, fragment_id, executor_name)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compute Errors by Type","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":58,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(user_source_error_count) by (error_type, error_msg, fragment_id, table_id, executor_name)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{error_type}}: {{error_msg}} ({{executor_name}}: table_id={{table_id}}, fragment_id={{fragment_id}})","metric":"","query":"sum(user_source_error_count) by (error_type, error_msg, fragment_id, table_id, executor_name)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Source Errors by Type","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"User Streaming Errors","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":69},"height":null,"hideTimeOverride":false,"id":59,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":60,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"batch_task_exchange_recv_row_number","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{query_id}} : {{source_stage_id}}.{{source_task_id}} -> {{target_stage_id}}.{{target_task_id}}","metric":"","query":"batch_task_exchange_recv_row_number","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Exchange Recv Row Number","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"row"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":61,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"batch_task_num","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"batch_task_num","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Batch Mpp Task Number","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Batch Metrics","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":false,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":70},"height":null,"hideTimeOverride":false,"id":62,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Hummock","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":71},"height":null,"hideTimeOverride":false,"id":63,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_sync_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance) (rate(state_store_sync_duration_sum[$__rate_interval])) / sum by(le, job, instance) (rate(state_store_sync_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance) (rate(state_store_sync_duration_sum[$__rate_interval])) / sum by(le, job, instance) (rate(state_store_sync_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Build and Sync Sstable Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":71},"height":null,"hideTimeOverride":false,"id":64,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_sst_store_block_request_counts[$__rate_interval])) by (job, instance, table_id, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{table_id}} @ {{type}} - {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_sst_store_block_request_counts[$__rate_interval])) by (job, instance, table_id, type)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_latency_count[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache {{op}} @ {{instance}}","metric":"","query":"sum(rate(file_cache_latency_count[$__rate_interval])) by (op, instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_miss[$__rate_interval])) by (instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache miss @ {{instance}}","metric":"","query":"sum(rate(file_cache_miss[$__rate_interval])) by (instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Cache Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":79},"height":null,"hideTimeOverride":false,"id":65,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_get_duration_count[$__rate_interval])) by (job,instanc,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_get_duration_count[$__rate_interval])) by (job,instanc,table_id)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_range_reverse_scan_duration_count[$__rate_interval])) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"backward scan - {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_range_reverse_scan_duration_count[$__rate_interval])) by (job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_get_shared_buffer_hit_counts[$__rate_interval])) by (job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"shared_buffer hit - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_get_shared_buffer_hit_counts[$__rate_interval])) by (job,instance,table_id)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_iter_in_process_counts[$__rate_interval])) by(job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"iter - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_iter_in_process_counts[$__rate_interval])) by(job,instance,table_id)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":79},"height":null,"hideTimeOverride":false,"id":66,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_get_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_get_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_get_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{table_id}} {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance, table_id)(rate(state_store_get_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_get_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Duration - Get","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":87},"height":null,"hideTimeOverride":false,"id":67,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_iter_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(state_store_iter_duration_sum[$__rate_interval])) / sum by(le, job,instance) (rate(state_store_iter_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"create_iter_time avg - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(state_store_iter_duration_sum[$__rate_interval])) / sum by(le, job,instance) (rate(state_store_iter_duration_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_iter_scan_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(state_store_scan_iter_duration_sum[$__rate_interval])) / sum by(le, job,instance) (rate(state_store_iter_scan_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pure_scan_time avg - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(state_store_scan_iter_duration_sum[$__rate_interval])) / sum by(le, job,instance) (rate(state_store_iter_scan_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Duration - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":87},"height":null,"hideTimeOverride":false,"id":68,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.9, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.9, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.99, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.99, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.999, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 - {{table_id}} {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(0.999, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(1.0, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_get_key_size_bucket[$__rate_interval])) by (le, job, instance, table_id)) + histogram_quantile(1.0, sum(rate(state_store_get_value_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Item Size - Get","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":95},"height":null,"hideTimeOverride":false,"id":69,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_iter_size_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Item Size - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":95},"height":null,"hideTimeOverride":false,"id":70,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p999 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.999, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_iter_item_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Item Count - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":103},"height":null,"hideTimeOverride":false,"id":71,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_get_key_size_sum[$__rate_interval])) by(job, instance) + sum(rate(state_store_get_value_size_sum[$__rate_interval])) by(job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_get_key_size_sum[$__rate_interval])) by(job, instance) + sum(rate(state_store_get_value_size_sum[$__rate_interval])) by(job, instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Throughput - Get","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":103},"height":null,"hideTimeOverride":false,"id":72,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_iter_size_sum[$__rate_interval])) by(job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_iter_size_sum[$__rate_interval])) by(job, instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Throughput - Iter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":111},"height":null,"hideTimeOverride":false,"id":73,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_may_exist_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_may_exist_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_may_exist_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{table_id}} {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance, table_id)(rate(state_store_may_exist_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_may_exist_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Duration - MayExist","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":111},"height":null,"hideTimeOverride":false,"id":74,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_bloom_filter_true_negative_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"bloom filter true negative - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_bloom_filter_true_negative_counts[$__rate_interval])) by (job,instance,table_id,type)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_read_req_positive_but_non_exist_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"bloom filter false positive count - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_read_req_positive_but_non_exist_counts[$__rate_interval])) by (job,instance,table_id,type)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read_req bloom filter positive - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_read_req_check_bloom_filter_counts[$__rate_interval])) by (job,instance,table_id,type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read_req check bloom filter - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_read_req_check_bloom_filter_counts[$__rate_interval])) by (job,instance,table_id,type)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Bloom Filter","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":119},"height":null,"hideTimeOverride":false,"id":75,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_iter_scan_key_counts[$__rate_interval])) by (instance, type, table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"iter keys flow - {{table_id}} @ {{type}} @ {{instance}} ","metric":"","query":"sum(rate(state_store_iter_scan_key_counts[$__rate_interval])) by (instance, type, table_id)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Iter keys flow","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":119},"height":null,"hideTimeOverride":false,"id":76,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"1 - (sum(rate(state_store_bloom_filter_true_negative_counts[$__rate_interval])) by (job,instance,table_id,type)) / (sum(rate(state_bloom_filter_check_counts[$__rate_interval])) by (job,instance,table_id,type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"bloom filter miss rate - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"1 - (sum(rate(state_store_bloom_filter_true_negative_counts[$__rate_interval])) by (job,instance,table_id,type)) / (sum(rate(state_bloom_filter_check_counts[$__rate_interval])) by (job,instance,table_id,type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum(rate(state_store_sst_store_block_request_counts{type='meta_miss'}[$__rate_interval])) by (job,instance,table_id)) / (sum(rate(state_store_sst_store_block_request_counts{type='meta_total'}[$__rate_interval])) by (job,instance,table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"meta cache miss rate - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"(sum(rate(state_store_sst_store_block_request_counts{type='meta_miss'}[$__rate_interval])) by (job,instance,table_id)) / (sum(rate(state_store_sst_store_block_request_counts{type='meta_total'}[$__rate_interval])) by (job,instance,table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum(rate(state_store_sst_store_block_request_counts{type='data_miss'}[$__rate_interval])) by (job,instance,table_id)) / (sum(rate(state_store_sst_store_block_request_counts{type='data_total'}[$__rate_interval])) by (job,instance,table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"block cache miss rate - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"(sum(rate(state_store_sst_store_block_request_counts{type='data_miss'}[$__rate_interval])) by (job,instance,table_id)) / (sum(rate(state_store_sst_store_block_request_counts{type='data_total'}[$__rate_interval])) by (job,instance,table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"(sum(rate(file_cache_miss[$__rate_interval])) by (instance)) / (sum(rate(file_cache_latency_count{op='get'}[$__rate_interval])) by (instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache miss rate @ {{instance}}","metric":"","query":"(sum(rate(file_cache_miss[$__rate_interval])) by (instance)) / (sum(rate(file_cache_latency_count{op='get'}[$__rate_interval])) by (instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"1 - (((sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type))) / (sum(rate(state_store_read_req_check_bloom_filter_counts[$__rate_interval])) by (job,instance,table_id,type)))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read req bloom filter filter rate - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"1 - (((sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type))) / (sum(rate(state_store_read_req_check_bloom_filter_counts[$__rate_interval])) by (job,instance,table_id,type)))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"1 - (((sum(rate(state_store_read_req_positive_but_non_exist_counts[$__rate_interval])) by (job,instance,table_id,type))) / (sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type)))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read req bloom filter false positive rate - {{table_id}} - {{type}} @ {{job}} @ {{instance}}","metric":"","query":"1 - (((sum(rate(state_store_read_req_positive_but_non_exist_counts[$__rate_interval])) by (job,instance,table_id,type))) / (sum(rate(state_store_read_req_bloom_filter_positive_counts[$__rate_interval])) by (job,instance,table_id,type)))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":" Filter/Cache Miss Rate","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":127},"height":null,"hideTimeOverride":false,"id":77,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts p90 - {{table_id}} @ {{job}} @ {{type}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts p99 - {{table_id}} @ {{job}} @ {{type}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts pmax - {{table_id}} @ {{job}} @ {{type}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_iter_merge_sstable_counts_bucket[$__rate_interval])) by (le, job, table_id, type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_iter_merge_sstable_counts_sum[$__rate_interval])) / sum by(le, job, instance, table_id)(rate(state_store_iter_merge_sstable_counts_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"# merged ssts avg - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance, table_id)(rate(state_store_iter_merge_sstable_counts_sum[$__rate_interval])) / sum by(le, job, instance, table_id)(rate(state_store_iter_merge_sstable_counts_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Read Merged SSTs","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":127},"height":null,"hideTimeOverride":false,"id":78,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_write_batch_duration_count[$__rate_interval])) by (job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write batch - {{table_id}} @ {{job}} @ {{instance}} ","metric":"","query":"sum(rate(state_store_write_batch_duration_count[$__rate_interval])) by (job,instance,table_id)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_sync_duration_count[$__rate_interval])) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"l0 - {{job}} @ {{instance}} ","metric":"","query":"sum(rate(state_store_sync_duration_count[$__rate_interval])) by (job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":135},"height":null,"hideTimeOverride":false,"id":79,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_write_batch_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id)(rate(state_store_write_batch_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id)(rate(state_store_write_batch_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to shared_buffer avg - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance, table_id)(rate(state_store_write_batch_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id)(rate(state_store_write_batch_duration_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_write_shared_buffer_sync_time_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(state_store_write_shared_buffer_sync_time_sum[$__rate_interval])) / sum by(le, job, instance)(rate(state_store_write_shared_buffer_sync_time_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write to object_store - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(state_store_write_shared_buffer_sync_time_sum[$__rate_interval])) / sum by(le, job, instance)(rate(state_store_write_shared_buffer_sync_time_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":135},"height":null,"hideTimeOverride":false,"id":80,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_write_batch_tuple_counts[$__rate_interval])) by (job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write_batch_kv_pair_count - {{table_id}} @ {{instance}} ","metric":"","query":"sum(rate(state_store_write_batch_tuple_counts[$__rate_interval])) by (job,instance,table_id)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Item Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":143},"height":null,"hideTimeOverride":false,"id":81,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(state_store_write_batch_size_sum[$__rate_interval]))by(job,instance) / sum(rate(state_store_write_batch_size_count[$__rate_interval]))by(job,instance,table_id)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"shared_buffer - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum(rate(state_store_write_batch_size_sum[$__rate_interval]))by(job,instance) / sum(rate(state_store_write_batch_size_count[$__rate_interval]))by(job,instance,table_id)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(compactor_shared_buffer_to_sstable_size[$__rate_interval]))by(job,instance) / sum(rate(state_store_shared_buffer_to_sstable_size_count[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"sync - {{job}} @ {{instance}}","metric":"","query":"sum(rate(compactor_shared_buffer_to_sstable_size[$__rate_interval]))by(job,instance) / sum(rate(state_store_shared_buffer_to_sstable_size_count[$__rate_interval]))by(job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Write Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":143},"height":null,"hideTimeOverride":false,"id":82,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_sync_size_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance) (rate(state_store_sync_size_sum[$__rate_interval])) / sum by(le, job, instance) (rate(state_store_sync_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance) (rate(state_store_sync_size_sum[$__rate_interval])) / sum by(le, job, instance) (rate(state_store_sync_size_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Checkpoint Sync Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":151},"height":null,"hideTimeOverride":false,"id":83,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(state_store_meta_cache_size) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"meta cache - {{job}} @ {{instance}}","metric":"","query":"avg(state_store_meta_cache_size) by (job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(state_store_block_cache_size) by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"data cache - {{job}} @ {{instance}}","metric":"","query":"avg(state_store_block_cache_size) by (job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(state_store_limit_memory_size) by (job)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"uploading memory - {{job}}","metric":"","query":"sum(state_store_limit_memory_size) by (job)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Cache Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":151},"height":null,"hideTimeOverride":false,"id":84,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(batch_row_seq_scan_next_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance) (rate(batch_row_seq_scan_next_duration_sum[$__rate_interval])) / sum by(le, job, instance) (rate(batch_row_seq_scan_next_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"row_seq_scan next avg - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance) (rate(batch_row_seq_scan_next_duration_sum[$__rate_interval])) / sum by(le, job, instance) (rate(batch_row_seq_scan_next_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Row SeqScan Next Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":159},"height":null,"hideTimeOverride":false,"id":85,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration p50 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration p99 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_iter_fetch_meta_duration_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance, table_id) (rate(state_store_iter_fetch_meta_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_iter_fetch_meta_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"fetch_meta_duration avg - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance, table_id) (rate(state_store_iter_fetch_meta_duration_sum[$__rate_interval])) / sum by(le, job, instance, table_id) (rate(state_store_iter_fetch_meta_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Fetch Meta Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":167},"height":null,"hideTimeOverride":false,"id":86,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"num of SSTs in each level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":87,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_sst_num) by (instance, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}}","metric":"","query":"sum(storage_level_sst_num) by (instance, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"SST Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"KBs total file bytes in each level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"kbytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":88,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_total_file_size) by (instance, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}}","metric":"","query":"sum(storage_level_total_file_size) by (instance, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs level sst","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"compactor core resource need to scale out","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":89,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_compactor_suggest_core_count)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"suggest-core-count","metric":"","query":"sum(storage_compactor_suggest_core_count)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"scale compactor core count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of compactions from each level to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":90,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_compact_frequency) by (compactor, group, task_type, result)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{task_type}} - {{result}} - group-{{group}} @ {{compactor}}","metric":"","query":"sum(storage_level_compact_frequency) by (compactor, group, task_type, result)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Success & Failure Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of compaction task which does not trigger","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":91,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_skip_compact_frequency[$__rate_interval])) by (level, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{level}}-{{type}}","metric":"","query":"sum(rate(storage_skip_compact_frequency[$__rate_interval])) by (level, type)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Skip Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of compactions from each level to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":92,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"avg(storage_compact_task_pending_num) by(job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compactor_task_split_count - {{job}} @ {{instance}}","metric":"","query":"avg(storage_compact_task_pending_num) by(job, instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compactor Running Task Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total time of compact that have been issued to state store","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":93,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(compactor_compact_task_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_compact_sst_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-key-range p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(compactor_compact_sst_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_compact_sst_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-key-range pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(compactor_compact_sst_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_get_table_id_total_time_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get-table-id p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(compactor_get_table_id_total_time_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_get_table_id_total_time_duration_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get-table-id pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(compactor_get_table_id_total_time_duration_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(compactor_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(compactor_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(compactor_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(compactor_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le)(rate(compactor_compact_task_duration_sum[$__rate_interval])) / sum by(le)(rate(compactor_compact_task_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-task avg","metric":"","query":"sum by(le)(rate(compactor_compact_task_duration_sum[$__rate_interval])) / sum by(le)(rate(compactor_compact_task_duration_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le)(rate(state_store_compact_sst_duration_sum[$__rate_interval])) / sum by(le)(rate(state_store_compact_sst_duration_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact-key-range avg","metric":"","query":"sum by(le)(rate(state_store_compact_sst_duration_sum[$__rate_interval])) / sum by(le)(rate(state_store_compact_sst_duration_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"KBs read from next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":24},"height":null,"hideTimeOverride":false,"id":94,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_next[$__rate_interval])) by(job,instance) + sum(rate(storage_level_compact_read_curr[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read - {{job}} @ {{instance}}","metric":"","query":"sum(rate(storage_level_compact_read_next[$__rate_interval])) by(job,instance) + sum(rate(storage_level_compact_read_curr[$__rate_interval])) by(job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_write[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write - {{job}} @ {{instance}}","metric":"","query":"sum(rate(storage_level_compact_write[$__rate_interval])) by(job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(compactor_write_build_l0_bytes[$__rate_interval]))by (job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"flush - {{job}} @ {{instance}}","metric":"","query":"sum(rate(compactor_write_build_l0_bytes[$__rate_interval]))by (job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs written into next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":32},"height":null,"hideTimeOverride":false,"id":95,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_compact_write) by (job)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write - {{job}}","metric":"","query":"sum(storage_level_compact_write) by (job)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(compactor_write_build_l0_bytes) by (job)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"flush - {{job}}","metric":"","query":"sum(compactor_write_build_l0_bytes) by (job)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Write Bytes","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs written into next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":32},"height":null,"hideTimeOverride":false,"id":96,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_compact_write) / sum(state_store_write_build_l0_bytes)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write amplification","metric":"","query":"sum(storage_level_compact_write) / sum(state_store_write_build_l0_bytes)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compaction Write Amplification","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs to be merged to next level in each level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":40},"height":null,"hideTimeOverride":false,"id":97,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_level_compact_cnt","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}}","metric":"","query":"storage_level_compact_cnt","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compacting SST Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":40},"height":null,"hideTimeOverride":false,"id":98,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_next[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","query":"sum(rate(storage_level_compact_read_next[$__rate_interval])) by (le, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs Read from Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":48},"height":null,"hideTimeOverride":false,"id":99,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_curr[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","query":"sum(rate(storage_level_compact_read_curr[$__rate_interval])) by (le, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs Read from Current Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":48},"height":null,"hideTimeOverride":false,"id":100,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_sstn_curr[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","query":"sum(rate(storage_level_compact_read_sstn_curr[$__rate_interval])) by (le, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Count of SSTs Read from Current Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":56},"height":null,"hideTimeOverride":false,"id":101,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_write[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} write","metric":"","query":"sum(rate(storage_level_compact_write[$__rate_interval])) by (le, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"KBs Written to Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":56},"height":null,"hideTimeOverride":false,"id":102,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_write_sstn[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} write","metric":"","query":"sum(rate(storage_level_compact_write_sstn[$__rate_interval])) by (le, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Count of SSTs Written to Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"num of SSTs read from next level during history compactions to next level","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":64},"height":null,"hideTimeOverride":false,"id":103,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(storage_level_compact_read_sstn_next[$__rate_interval])) by (le, level_index)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"L{{level_index}} read","metric":"","query":"sum(rate(storage_level_compact_read_sstn_next[$__rate_interval])) by (le, level_index)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Count of SSTs Read from Next Level","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total bytes gotten from sstable_bloom_filter, for observing bloom_filter size","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":64},"height":null,"hideTimeOverride":false,"id":104,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_bloom_filter_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_bloom_filter_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_meta - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(compactor_sstable_bloom_filter_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_bloom_filter_size_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_file_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_file_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_file - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(compactor_sstable_file_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_file_size_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Sstable Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total bytes gotten from sstable_avg_key_size, for observing sstable_avg_key_size","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":72},"height":null,"hideTimeOverride":false,"id":105,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_avg_key_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_avg_key_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_key_size - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(compactor_sstable_avg_key_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_avg_key_size_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_avg_value_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_avg_value_size_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_value_size - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(compactor_sstable_avg_value_size_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_avg_value_size_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Sstable Item Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Avg count gotten from sstable_distinct_epoch_count, for observing sstable_distinct_epoch_count","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":72},"height":null,"hideTimeOverride":false,"id":106,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, job, instance)(rate(compactor_sstable_distinct_epoch_count_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_distinct_epoch_count_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"avg_epoch_count - {{job}} @ {{instance}}","metric":"","query":"sum by(le, job, instance)(rate(compactor_sstable_distinct_epoch_count_sum[$__rate_interval])) / sum by(le, job, instance)(rate(compactor_sstable_distinct_epoch_count_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Sstable Stat","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"Total time of operations which read from remote storage when enable prefetch","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":80},"height":null,"hideTimeOverride":false,"id":107,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(state_store_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io p90 - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(state_store_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(state_store_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance, table_id))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"remote-io pmax - {{table_id}} @ {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(state_store_remote_read_time_per_task_bucket[$__rate_interval])) by (le, job, instance, table_id))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Hummock Remote Read Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":80},"height":null,"hideTimeOverride":false,"id":108,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(compactor_iter_scan_key_counts[$__rate_interval])) by (instance, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"iter keys flow - {{type}} @ {{instance}} ","metric":"","query":"sum(rate(compactor_iter_scan_key_counts[$__rate_interval])) by (instance, type)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Compactor Iter keys","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"bytes of Lsm tree needed to reach balance","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":88},"height":null,"hideTimeOverride":false,"id":109,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_compact_pending_bytes) by (instance, group)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"compact pending bytes - {{group}} @ {{instance}} ","metric":"","query":"sum(storage_compact_pending_bytes) by (instance, group)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Lsm Compact Pending Bytes","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"compression ratio of each level of the lsm tree","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"percentunit"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":88},"height":null,"hideTimeOverride":false,"id":110,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_compact_level_compression_ratio) by (instance, group, level, algorithm)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"lsm compression ratio - cg{{group}} @ L{{level}} - {{algorithm}} {{instance}} ","metric":"","query":"sum(storage_compact_level_compression_ratio) by (instance, group, level, algorithm)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Lsm Level Compression Ratio","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Compaction","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":168},"height":null,"hideTimeOverride":false,"id":111,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":112,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_read_bytes[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"read - {{job}} @ {{instance}}","metric":"","query":"sum(rate(object_store_read_bytes[$__rate_interval]))by(job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_write_bytes[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"write - {{job}} @ {{instance}}","metric":"","query":"sum(rate(object_store_write_bytes[$__rate_interval]))by(job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":113,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(object_store_operation_latency_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum by(le, type, job, instance)(rate(object_store_operation_latency_sum[$__rate_interval])) / sum by(le, type, job, instance) (rate(object_store_operation_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} avg - {{job}} @ {{instance}}","metric":"","query":"sum by(le, type, job, instance)(rate(object_store_operation_latency_sum[$__rate_interval])) / sum by(le, type, job, instance) (rate(object_store_operation_latency_count[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Duration","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":114,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_operation_latency_count[$__rate_interval])) by (le, type, job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} - {{job}} @ {{instance}}","metric":"","query":"sum(rate(object_store_operation_latency_count[$__rate_interval])) by (le, type, job, instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_operation_latency_count{type=~'upload|delete'}[$__rate_interval])) by (le, media_type, job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{media_type}}-write - {{job}} @ {{instance}}","metric":"","query":"sum(rate(object_store_operation_latency_count{type=~'upload|delete'}[$__rate_interval])) by (le, media_type, job, instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_operation_latency_count{type=~'read|readv|list|metadata'}[$__rate_interval])) by (le, media_type, job, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{media_type}}-read - {{job}} @ {{instance}}","metric":"","query":"sum(rate(object_store_operation_latency_count{type=~'read|readv|list|metadata'}[$__rate_interval])) by (le, media_type, job, instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Rate","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":115,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} pmax - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(object_store_operation_bytes_bucket[$__rate_interval])) by (le, type, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":116,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(object_store_failure_count[$__rate_interval])) by (instance, job, type)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{type}} - {{job}} @ {{instance}}","metric":"","query":"sum(rate(object_store_failure_count[$__rate_interval])) by (instance, job, type)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Operation Failure Rate","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"$"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":117,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(object_store_read_bytes) * 0.01 / 1000 / 1000 / 1000","format":"time_series","hide":true,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"(Cross Region) Data Transfer Cost","metric":"","query":"sum(object_store_read_bytes) * 0.01 / 1000 / 1000 / 1000","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(object_store_operation_latency_count{type=~'read|streaming_read_start|delete'}) * 0.0004 / 1000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GET, SELECT, and all other Requests Cost","metric":"","query":"sum(object_store_operation_latency_count{type=~'read|streaming_read_start|delete'}) * 0.0004 / 1000","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(object_store_operation_latency_count{type=~'upload|streaming_upload_start|s3_upload_part|streaming_upload_finish|delete_objects|list'}) * 0.005 / 1000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"PUT, COPY, POST, LIST Requests Cost","metric":"","query":"sum(object_store_operation_latency_count{type=~'upload|streaming_upload_start|s3_upload_part|streaming_upload_finish|delete_objects|list'}) * 0.005 / 1000","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Estimated S3 Cost (Realtime)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"$"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":118,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(storage_level_total_file_size) by (instance) * 0.023 / 1000 / 1000","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Monthly Storage Cost","metric":"","query":"sum(storage_level_total_file_size) by (instance) * 0.023 / 1000 / 1000","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Estimated S3 Cost (Monthly)","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Object Storage","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":169},"height":null,"hideTimeOverride":false,"id":119,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"ops"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":120,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_latency_count[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache {{op}} @ {{instance}}","metric":"","query":"sum(rate(file_cache_latency_count[$__rate_interval])) by (op, instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_miss[$__rate_interval])) by (instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache miss @ {{instance}}","metric":"","query":"sum(rate(file_cache_miss[$__rate_interval])) by (instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_disk_latency_count[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"file cache disk {{op}} @ {{instance}}","metric":"","query":"sum(rate(file_cache_disk_latency_count[$__rate_interval])) by (op, instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Ops","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":121,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(file_cache_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(file_cache_disk_latency_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Bps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":122,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(rate(file_cache_disk_bytes[$__rate_interval])) by (op, instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"disk {{op}} @ {{instance}}","metric":"","query":"sum(rate(file_cache_disk_bytes[$__rate_interval])) by (op, instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Throughput","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":123,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache disk - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(file_cache_disk_io_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - file cache disk read entry - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - file cache disk read entry - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - file cache disk read entry - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pmax - file cache disk read entry - {{op}} @ {{instance}}","metric":"","query":"histogram_quantile(1.0, sum(rate(file_cache_disk_read_entry_size_bucket[$__rate_interval])) by (le, op, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Disk IO Size","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Hummock Tiered Cache","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":170},"height":null,"hideTimeOverride":false,"id":124,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":125,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time p50 - {{lock_type}} @ {{lock_name}}","metric":"","query":"histogram_quantile(0.5, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time p99 - {{lock_type}} @ {{lock_name}}","metric":"","query":"histogram_quantile(0.99, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time p999 - {{lock_type}} @ {{lock_name}}","metric":"","query":"histogram_quantile(0.999, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Lock Time pmax - {{lock_type}} @ {{lock_name}}","metric":"","query":"histogram_quantile(1.0, sum(rate(hummock_manager_lock_time_bucket[$__rate_interval])) by (le, lock_name, lock_type))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Lock Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":126,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time p50 - {{method}}","metric":"","query":"histogram_quantile(0.5, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time p99 - {{method}}","metric":"","query":"histogram_quantile(0.99, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time p999 - {{method}}","metric":"","query":"histogram_quantile(0.999, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Real Process Time pmax - {{method}}","metric":"","query":"histogram_quantile(1.0, sum(rate(meta_hummock_manager_real_process_time_bucket[$__rate_interval])) by (le, method))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Real Process Time","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":127,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_size","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"version size","metric":"","query":"storage_version_size","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Version Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":128,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_current_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"current version id","metric":"","query":"storage_current_version_id","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_checkpoint_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"checkpoint version id","metric":"","query":"storage_checkpoint_version_id","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_min_pinned_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"min pinned version id","metric":"","query":"storage_min_pinned_version_id","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_min_safepoint_version_id","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"min safepoint version id","metric":"","query":"storage_min_safepoint_version_id","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Version Id","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":129,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_max_committed_epoch","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"max committed epoch","metric":"","query":"storage_max_committed_epoch","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_safe_epoch","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"safe epoch","metric":"","query":"storage_safe_epoch","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_min_pinned_epoch","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"min pinned epoch","metric":"","query":"storage_min_pinned_epoch","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Epoch","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"kbytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":130,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_stats{metric='total_key_size'}/1024","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"table{{table_id}} {{metric}}","metric":"","query":"storage_version_stats{metric='total_key_size'}/1024","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_stats{metric='total_value_size'}/1024","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"table{{table_id}} {{metric}}","metric":"","query":"storage_version_stats{metric='total_value_size'}/1024","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Table KV Size","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":131,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_version_stats{metric='total_key_count'}","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"table{{table_id}} {{metric}}","metric":"","query":"storage_version_stats{metric='total_key_count'}","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Table KV Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"total number of SSTs that is no longer referenced by versions but is not yet deleted from storage","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":24},"height":null,"hideTimeOverride":false,"id":132,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"storage_stale_ssts_count","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"stale SST total number","metric":"","query":"storage_stale_ssts_count","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Stale SST Total Number","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Hummock Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":171},"height":null,"hideTimeOverride":false,"id":133,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":134,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"backup_job_count","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"job count","metric":"","query":"backup_job_count","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Job Count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":135,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time p50 - {{state}}","metric":"","query":"histogram_quantile(0.5, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time p99 - {{state}}","metric":"","query":"histogram_quantile(0.99, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.999, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time p999 - {{state}}","metric":"","query":"histogram_quantile(0.999, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(1.0, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Job Process Time pmax - {{state}}","metric":"","query":"histogram_quantile(1.0, sum(rate(backup_job_latency_bucket[$__rate_interval])) by (le, state))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Job Process Time","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Backup Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":172},"height":null,"hideTimeOverride":false,"id":136,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":137,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Create'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/Create'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/Create'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Create_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/Create'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/Create'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Create latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":138,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/Drop'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/Drop'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/Drop'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Drop_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/Drop'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/Drop'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Drop latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":0},"height":null,"hideTimeOverride":false,"id":139,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/GetCatalog'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetCatalog_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.CatalogService/GetCatalog'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.CatalogService/GetCatalog'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"GetCatalog latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Catalog Service","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":173},"height":null,"hideTimeOverride":false,"id":140,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":141,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"AddWorkerNode_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.ClusterService/AddWorkerNode'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"AddWorkerNode latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":142,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ListAllNodes_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.ClusterService/ListAllNodes'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"ListAllNodes latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Cluster Service","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":174},"height":null,"hideTimeOverride":false,"id":143,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":144,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"CreateMaterializedView_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/CreateMaterializedView'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"CreateMaterializedView latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":145,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"DropMaterializedView_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/DropMaterializedView'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"DropMaterializedView latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":0},"height":null,"hideTimeOverride":false,"id":146,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/Flush'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"Flush_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.StreamManagerService/Flush'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.StreamManagerService/Flush'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Flush latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Stream Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":175},"height":null,"hideTimeOverride":false,"id":147,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":148,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinVersionBefore_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/UnpinVersionBefore'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"UnpinVersionBefore latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":8,"y":0},"height":null,"hideTimeOverride":false,"id":149,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"UnpinSnapshotBefore_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/UnpinSnapshotBefore'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"UnpinSnapshotBefore latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":16,"y":0},"height":null,"hideTimeOverride":false,"id":150,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"ReportCompactionTasks_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/ReportCompactionTasks'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"ReportCompactionTasks latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":8,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":151,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_p50","metric":"","query":"histogram_quantile(0.5, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_p90","metric":"","query":"histogram_quantile(0.9, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_p99","metric":"","query":"histogram_quantile(0.99, sum(irate(meta_grpc_duration_seconds_bucket{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) by (le))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"GetNewSstIds_avg","metric":"","query":"sum(irate(meta_grpc_duration_seconds_sum{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval])) / sum(irate(meta_grpc_duration_seconds_count{path='/meta.HummockManagerService/GetNewSstIds'}[$__rate_interval]))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"GetNewSstIds latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC Meta: Hummock Manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":176},"height":null,"hideTimeOverride":false,"id":152,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":153,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_report_compaction_task_counts[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_counts - {{instance}} ","metric":"","query":"sum(irate(state_store_report_compaction_task_counts[$__rate_interval])) by(job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"compaction_count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":154,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_p50 - {{instance}} ","metric":"","query":"histogram_quantile(0.5, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_p99 - {{instance}} ","metric":"","query":"histogram_quantile(0.99, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_unpin_version_before_latency_sum[$__rate_interval])) / sum(irate(state_store_unpin_version_before_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_avg","metric":"","query":"sum(irate(state_store_unpin_version_before_latency_sum[$__rate_interval])) / sum(irate(state_store_unpin_version_before_latency_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_version_before_latency_p90 - {{instance}} ","metric":"","query":"histogram_quantile(0.90, sum(irate(state_store_unpin_version_before_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"version_latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":155,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latency_p50 - {{instance}} ","metric":"","query":"histogram_quantile(0.5, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latency_p99 - {{instance}} ","metric":"","query":"histogram_quantile(0.99, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latencyp90 - {{instance}} ","metric":"","query":"histogram_quantile(0.9, sum(irate(state_store_pin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_pin_snapshot_latency_sum[$__rate_interval])) / sum(irate(state_store_pin_snapshot_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_latency_avg","metric":"","query":"sum(irate(state_store_pin_snapshot_latency_sum[$__rate_interval])) / sum(irate(state_store_pin_snapshot_latency_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_unpin_version_snapshot_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_p50 - {{instance}} ","metric":"","query":"histogram_quantile(0.5, sum(irate(state_store_unpin_version_snapshot_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_unpin_version_snapshot_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_p99 - {{instance}} ","metric":"","query":"histogram_quantile(0.99, sum(irate(state_store_unpin_version_snapshot_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_unpin_snapshot_latency_sum[$__rate_interval])) / sum(irate(state_store_unpin_snapshot_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_avg","metric":"","query":"sum(irate(state_store_unpin_snapshot_latency_sum[$__rate_interval])) / sum(irate(state_store_unpin_snapshot_latency_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_unpin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_latency_p90 - {{instance}} ","metric":"","query":"histogram_quantile(0.90, sum(irate(state_store_unpin_snapshot_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"snapshot_latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":156,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_pin_snapshot_counts[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"pin_snapshot_counts - {{instance}} ","metric":"","query":"sum(irate(state_store_pin_snapshot_counts[$__rate_interval])) by(job,instance)","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_unpin_snapshot_counts[$__rate_interval])) by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"unpin_snapshot_counts - {{instance}} ","metric":"","query":"sum(irate(state_store_unpin_snapshot_counts[$__rate_interval])) by(job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"snapshot_count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":157,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_p50 - {{instance}} ","metric":"","query":"histogram_quantile(0.5, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_p99 - {{instance}} ","metric":"","query":"histogram_quantile(0.99, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_get_new_sst_ids_latency_sum[$__rate_interval])) / sum(irate(state_store_get_new_sst_ids_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_avg","metric":"","query":"sum(irate(state_store_get_new_sst_ids_latency_sum[$__rate_interval])) / sum(irate(state_store_get_new_sst_ids_latency_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_latency_p90 - {{instance}} ","metric":"","query":"histogram_quantile(0.90, sum(irate(state_store_get_new_sst_ids_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"table_latency","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":158,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_get_new_sst_ids_latency_counts[$__rate_interval]))by(job,instance)","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"get_new_sst_ids_latency_counts - {{instance}} ","metric":"","query":"sum(irate(state_store_get_new_sst_ids_latency_counts[$__rate_interval]))by(job,instance)","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"table_count","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":159,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_p50 - {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.99, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_p99 - {{instance}}","metric":"","query":"histogram_quantile(0.99, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"sum(irate(state_store_report_compaction_task_latency_sum[$__rate_interval])) / sum(irate(state_store_report_compaction_task_latency_count[$__rate_interval]))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_avg","metric":"","query":"sum(irate(state_store_report_compaction_task_latency_sum[$__rate_interval])) / sum(irate(state_store_report_compaction_task_latency_count[$__rate_interval]))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.90, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"report_compaction_task_latency_p90 - {{instance}}","metric":"","query":"histogram_quantile(0.90, sum(irate(state_store_report_compaction_task_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"compaction_latency","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"gRPC: Hummock Meta Client","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":177},"height":null,"hideTimeOverride":false,"id":160,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Qps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":161,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(frontend_query_counter_local_execution[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"rate(frontend_query_counter_local_execution[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Per second in Loacl Execution Mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"Qps"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":162,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(distributed_completed_query_counter[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"rate(distributed_completed_query_counter[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Per second in Distributed Execution Mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":163,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"distributed_running_query_num","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"The number of running query in distributed execution mode","metric":"","query":"distributed_running_query_num","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Running query in distributed execution mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":164,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"distributed_rejected_query_counter","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"The number of rejected query in distributed execution mode","metric":"","query":"distributed_rejected_query_counter","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Rejected query in distributed execution mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":165,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["last"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"distributed_completed_query_counter","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"The number of completed query in distributed execution mode","metric":"","query":"distributed_completed_query_counter","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Completed query in distributed execution mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":166,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.95, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.95, sum(rate(distributed_query_latency_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Latency in Distributed Execution Mode","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":24},"height":null,"hideTimeOverride":false,"id":167,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.5, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p50 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.5, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.9, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p90 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.9, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""},{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"histogram_quantile(0.95, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"p99 - {{job}} @ {{instance}}","metric":"","query":"histogram_quantile(0.95, sum(rate(frontend_latency_local_execution_bucket[$__rate_interval])) by (le, job, instance))","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Query Latency in Local Execution Mode","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Frontend","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":178},"height":null,"hideTimeOverride":false,"id":168,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":169,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(lru_runtime_loop_count[$__rate_interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"rate(lru_runtime_loop_count[$__rate_interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"LRU manager loop count per sec","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":0},"height":null,"hideTimeOverride":false,"id":170,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"lru_watermark_step","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"lru_watermark_step","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"LRU manager watermark steps","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"watermark_time is the current lower watermark of cached data. physical_now is the current time of the machine. The diff (physical_now - watermark_time) shows how much data is cached.","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":""},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":8},"height":null,"hideTimeOverride":false,"id":171,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"lru_physical_now_ms - lru_current_watermark_time_ms","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"lru_physical_now_ms - lru_current_watermark_time_ms","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"LRU manager diff between watermark_time and now (ms)","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":8},"height":null,"hideTimeOverride":false,"id":172,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"jemalloc_allocated_bytes","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"jemalloc_allocated_bytes","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"The memory allocated by jemalloc","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":16},"height":null,"hideTimeOverride":false,"id":173,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"stream_total_mem_usage","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"stream_total_mem_usage","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"The memory allocated by streaming","transformations":[],"transparent":false,"type":"timeseries"},{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"bytes"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":12,"y":16},"height":null,"hideTimeOverride":false,"id":174,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":[],"displayMode":"list","placement":"bottom"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"batch_total_mem_usage","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"","metric":"","query":"batch_total_mem_usage","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"The memory allocated by batch","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Memory manager","transformations":[],"transparent":false,"type":"row"},{"cacheTimeout":null,"collapsed":true,"datasource":null,"description":null,"editable":true,"error":false,"fieldConfig":{"defaults":{"thresholds":{"mode":"absolute","steps":[]}}},"gridPos":{"h":1,"w":24,"x":0,"y":179},"height":null,"hideTimeOverride":false,"id":175,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"panels":[{"cacheTimeout":null,"datasource":null,"description":"","editable":true,"error":false,"fieldConfig":{"defaults":{"color":{"mode":"palette-classic"},"custom":{"axisLabel":"","axisPlacement":"auto","barAlignment":0,"drawStyle":"line","fillOpacity":10,"gradientMode":"none","hideFrom":{"legend":false,"tooltip":false,"viz":false},"lineInterpolation":"linear","lineWidth":1,"pointSize":5,"scaleDistribution":{"log":2,"type":"linear"},"showPoints":"auto","spanNulls":false,"stacking":{},"thresholdsStyle":{"mode":"off"}},"mappings":[],"thresholds":{"mode":"absolute","steps":[]},"unit":"rows/s"},"overrides":[]},"gridPos":{"h":8,"w":12,"x":0,"y":0},"height":null,"hideTimeOverride":false,"id":176,"interval":null,"links":[],"maxDataPoints":100,"maxPerRow":null,"minSpan":null,"options":{"legend":{"calcs":["mean"],"displayMode":"table","placement":"right"},"tooltip":{"mode":"single"}},"repeat":null,"repeatDirection":null,"span":null,"targets":[{"datasource":{"type":"prometheus","uid":"risedev-prometheus"},"expr":"rate(connector_source_rows_received[$__interval])","format":"time_series","hide":false,"instant":false,"interval":"","intervalFactor":2,"legendFormat":"{{source_type}} @ {{source_id}}","metric":"","query":"rate(connector_source_rows_received[$__interval])","refId":"","step":10,"target":""}],"timeFrom":null,"timeShift":null,"title":"Connector Source Throughput(rows)","transformations":[],"transparent":false,"type":"timeseries"}],"repeat":null,"repeatDirection":null,"span":null,"targets":[],"timeFrom":null,"timeShift":null,"title":"Connector Node","transformations":[],"transparent":false,"type":"row"}],"refresh":"10s","rows":[],"schemaVersion":12,"sharedCrosshair":true,"style":"dark","tags":["risingwave"],"templating":{"list":[]},"time":{"from":"now-30m","to":"now"},"timepicker":{"hidden":false,"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone":"browser","title":"risingwave_dashboard","uid":"Ecy3uV1nz","version":0} diff --git a/integration_tests/datagen/sink/mysql/mysql.go b/integration_tests/datagen/sink/mysql/mysql.go index 5d1370b245970..0831af85b4857 100644 --- a/integration_tests/datagen/sink/mysql/mysql.go +++ b/integration_tests/datagen/sink/mysql/mysql.go @@ -24,7 +24,7 @@ type MysqlSink struct { func OpenMysqlSink(cfg MysqlConfig) (*MysqlSink, error) { fmt.Printf("Opening MySQL sink: %+v\n", cfg) - db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", + db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?multiStatements=true", cfg.DbUser, cfg.DbPassword, cfg.DbHost, cfg.DbPort, cfg.Database)) if err != nil { return nil, err diff --git a/integration_tests/datagen/twitter/twitter.go b/integration_tests/datagen/twitter/twitter.go index 5a4aefb152b5f..97731dc3aed2b 100644 --- a/integration_tests/datagen/twitter/twitter.go +++ b/integration_tests/datagen/twitter/twitter.go @@ -37,16 +37,10 @@ type twitterUser struct { } func (r *twitterEvent) ToPostgresSql() string { - return fmt.Sprintf("INSERT INTO %s (data, author) values (%s, %s);", - "twitter", r.Data.objectString(), r.Author.objectString()) -} - -func (r *twitterUser) objectString() string { - return fmt.Sprintf("('%s'::TIMESTAMP, '%s', '%s', '%s')", r.CreatedAt, r.Id, r.Name, r.UserName) -} - -func (r *tweetData) objectString() string { - return fmt.Sprintf("('%s'::TIMESTAMP, '%s', '%s', '%s')", r.CreatedAt, r.Id, r.Text, r.Lang) + return fmt.Sprintf("INSERT INTO tweet (created_at, id, text, lang, author_id) values ('%s', '%s', '%s', '%s', '%s'); INSERT INTO user (created_at, id, name, username, followers) values ('%s', '%s', '%s', '%s', %d);", + r.Data.CreatedAt, r.Data.Id, r.Data.Text, r.Data.Lang, r.Author.Id, + r.Author.CreatedAt, r.Author.Id, r.Author.Name, r.Author.UserName, r.Author.Followers, + ) } func (r *twitterEvent) ToJson() (topic string, key string, data []byte) { diff --git a/integration_tests/iceberg-sink/create_sink.sql b/integration_tests/iceberg-sink/create_sink.sql index 8913dbb05525b..9306b836f7744 100644 --- a/integration_tests/iceberg-sink/create_sink.sql +++ b/integration_tests/iceberg-sink/create_sink.sql @@ -2,7 +2,8 @@ CREATE SINK bhv_iceberg_sink FROM bhv_mv WITH ( connector = 'iceberg', - sink.mode='upsert', + type = 'upsert', + primary_key = 'user_id, target_id, event_timestamp', warehouse.path = 's3://hummock001/iceberg-data', s3.endpoint = 'http://minio-0:9301', s3.access.key = 'hummockadmin', diff --git a/integration_tests/postgres-sink/postgres_prepare.sql b/integration_tests/postgres-sink/postgres_prepare.sql index cac57c699a154..ded9b4cec97cd 100644 --- a/integration_tests/postgres-sink/postgres_prepare.sql +++ b/integration_tests/postgres-sink/postgres_prepare.sql @@ -1,4 +1,4 @@ CREATE TABLE target_count ( - target_id VARCHAR(128), + target_id VARCHAR(128) primary key, target_count BIGINT ); \ No newline at end of file diff --git a/integration_tests/scripts/run_demos.py b/integration_tests/scripts/run_demos.py index 330ebee1065b7..fc2bea0d837c3 100644 --- a/integration_tests/scripts/run_demos.py +++ b/integration_tests/scripts/run_demos.py @@ -25,8 +25,7 @@ def run_demo(demo: str, format: str): demo_dir = os.path.join(project_dir, demo) print("Running demo: {}".format(demo)) - subprocess.run(["docker", "compose", "up", "-d"], - cwd=demo_dir, check=True) + subprocess.run(["docker", "compose", "up", "-d"], cwd=demo_dir, check=True) sleep(40) sql_files = ['create_source.sql', 'create_mv.sql', 'query.sql'] @@ -43,6 +42,7 @@ def run_demo(demo: str, format: str): run_sql_file(sql_file, demo_dir) sleep(10) + def run_iceberg_demo(): demo = "iceberg-sink" file_dir = dirname(abspath(__file__)) @@ -50,8 +50,7 @@ def run_iceberg_demo(): demo_dir = os.path.join(project_dir, demo) print("Running demo: iceberg-sink") - subprocess.run(["docker", "compose", "up", "-d"], - cwd=demo_dir, check=True) + subprocess.run(["docker", "compose", "up", "-d"], cwd=demo_dir, check=True) sleep(40) subprocess.run(["docker", "compose", "exec", "spark", "bash", "/spark-script/run-sql-file.sh", "create-table"], @@ -71,7 +70,7 @@ def run_iceberg_demo(): query_sql = open(os.path.join(demo_dir, "iceberg-query.sql")).read() - print("querying iceberg with presto sql: %s"%query_sql) + print("querying iceberg with presto sql: %s" % query_sql) query_output_file_name = "query_outout.txt" @@ -88,8 +87,6 @@ def run_iceberg_demo(): assert len(output_content.strip()) > 0 - - arg_parser = argparse.ArgumentParser(description='Run the demo') arg_parser.add_argument('--format', metavar='format', @@ -102,6 +99,9 @@ def run_iceberg_demo(): help='the test case') args = arg_parser.parse_args() +# disable telemetry in env +os.environ['ENABLE_TELEMETRY'] = "false" + if args.case == "iceberg-sink": if args.format == "protobuf": print("skip protobuf test for iceberg-sink") diff --git a/integration_tests/tidb-cdc-sink/config/changefeed.toml b/integration_tests/tidb-cdc-sink/config/changefeed.toml new file mode 100644 index 0000000000000..b84615c14e3df --- /dev/null +++ b/integration_tests/tidb-cdc-sink/config/changefeed.toml @@ -0,0 +1,4 @@ +[sink] +dispatchers = [ + {matcher = ['*.*'], topic = "ticdc_{schema}_{table}"}, +] diff --git a/integration_tests/tidb-cdc-sink/config/pd.toml b/integration_tests/tidb-cdc-sink/config/pd.toml new file mode 100644 index 0000000000000..19f8a1119f99c --- /dev/null +++ b/integration_tests/tidb-cdc-sink/config/pd.toml @@ -0,0 +1,86 @@ +# PD Configuration. + +name = "pd" +data-dir = "default.pd" + +client-urls = "http://127.0.0.1:2379" +# if not set, use ${client-urls} +advertise-client-urls = "" + +peer-urls = "http://127.0.0.1:2380" +# if not set, use ${peer-urls} +advertise-peer-urls = "" + +initial-cluster = "pd=http://127.0.0.1:2380" +initial-cluster-state = "new" + +lease = 3 +tso-save-interval = "3s" + +[security] +# Path of file that contains list of trusted SSL CAs. if set, following four settings shouldn't be empty +cacert-path = "" +# Path of file that contains X509 certificate in PEM format. +cert-path = "" +# Path of file that contains X509 key in PEM format. +key-path = "" + +[log] +level = "error" + +# log format, one of json, text, console +#format = "text" + +# disable automatic timestamps in output +#disable-timestamp = false + +# file logging +[log.file] +#filename = "" +# max log file size in MB +#max-size = 300 +# max log file keep days +#max-days = 28 +# maximum number of old log files to retain +#max-backups = 7 +# rotate log by day +#log-rotate = true + +[metric] +# prometheus client push interval, set "0s" to disable prometheus. +interval = "15s" +# prometheus pushgateway address, leaves it empty will disable prometheus. +address = "prometheus-0:9091" + +[schedule] +max-merge-region-size = 0 +split-merge-interval = "1h" +max-snapshot-count = 3 +max-pending-peer-count = 16 +max-store-down-time = "30m" +leader-schedule-limit = 4 +region-schedule-limit = 4 +replica-schedule-limit = 8 +merge-schedule-limit = 8 +tolerant-size-ratio = 5.0 + +# customized schedulers, the format is as below +# if empty, it will use balance-leader, balance-region, hot-region as default +# [[schedule.schedulers]] +# type = "evict-leader" +# args = ["1"] + +[replication] +# The number of replicas for each region. +max-replicas = 3 +# The label keys specified the location of a store. +# The placement priorities is implied by the order of label keys. +# For example, ["zone", "rack"] means that we should place replicas to +# different zones first, then to different racks if we don't have enough zones. +location-labels = [] + +[label-property] +# Do not assign region leaders to stores that have these tags. +# [[label-property.reject-leader]] +# key = "zone" +# value = "cn1 diff --git a/integration_tests/tidb-cdc-sink/config/tidb.toml b/integration_tests/tidb-cdc-sink/config/tidb.toml new file mode 100644 index 0000000000000..c58a052b6e6a3 --- /dev/null +++ b/integration_tests/tidb-cdc-sink/config/tidb.toml @@ -0,0 +1,239 @@ +# TiDB Configuration. + +# TiDB server host. +host = "0.0.0.0" + +# TiDB server port. +port = 4000 + +# Registered store name, [tikv, mocktikv] +store = "mocktikv" + +# TiDB storage path. +path = "/tmp/tidb" + +# The socket file to use for connection. +socket = "" + +# Run ddl worker on this tidb-server. +run-ddl = true + +# Schema lease duration, very dangerous to change only if you know what you do. +lease = "0" + +# When create table, split a separated region for it. It is recommended to +# turn off this option if there will be a large number of tables created. +split-table = true + +# The limit of concurrent executed sessions. +token-limit = 1000 + +# Only print a log when out of memory quota. +# Valid options: ["log", "cancel"] +oom-action = "log" + +# Set the memory quota for a query in bytes. Default: 32GB +mem-quota-query = 34359738368 + +# Enable coprocessor streaming. +enable-streaming = false + +# Set system variable 'lower_case_table_names' +lower-case-table-names = 2 + +[log] +# Log level: debug, info, warn, error, fatal. +level = "error" + +# Log format, one of json, text, console. +format = "text" + +# Disable automatic timestamp in output +disable-timestamp = false + +# Stores slow query log into separated files. +slow-query-file = "" + +# Queries with execution time greater than this value will be logged. (Milliseconds) +slow-threshold = 300 + +# Queries with internal result greater than this value will be logged. +expensive-threshold = 10000 + +# Maximum query length recorded in log. +query-log-max-len = 2048 + +# File logging. +[log.file] +# Log file name. +filename = "" + +# Max log file size in MB (upper limit to 4096MB). +max-size = 300 + +# Max log file keep days. No clean up by default. +max-days = 0 + +# Maximum number of old log files to retain. No clean up by default. +max-backups = 0 + +# Rotate log by day +log-rotate = true + +[security] +# Path of file that contains list of trusted SSL CAs for connection with mysql client. +ssl-ca = "" + +# Path of file that contains X509 certificate in PEM format for connection with mysql client. +ssl-cert = "" + +# Path of file that contains X509 key in PEM format for connection with mysql client. +ssl-key = "" + +# Path of file that contains list of trusted SSL CAs for connection with cluster components. +cluster-ssl-ca = "" + +# Path of file that contains X509 certificate in PEM format for connection with cluster components. +cluster-ssl-cert = "" + +# Path of file that contains X509 key in PEM format for connection with cluster components. +cluster-ssl-key = "" + +[status] +# If enable status report HTTP service. +report-status = true + +# TiDB status port. +status-port = 10080 + +# Prometheus pushgateway address, leaves it empty will disable prometheus push. +metrics-addr = "prometheus-0:9091" + +# Prometheus client push interval in second, set \"0\" to disable prometheus push. +metrics-interval = 15 + +[performance] +# Max CPUs to use, 0 use number of CPUs in the machine. +max-procs = 0 +# StmtCountLimit limits the max count of statement inside a transaction. +stmt-count-limit = 5000 + +# Set keep alive option for tcp connection. +tcp-keep-alive = true + +# The maximum number of retries when commit a transaction. +retry-limit = 10 + +# Whether support cartesian product. +cross-join = true + +# Stats lease duration, which influences the time of analyze and stats load. +stats-lease = "3s" + +# Run auto analyze worker on this tidb-server. +run-auto-analyze = true + +# Probability to use the query feedback to update stats, 0 or 1 for always false/true. +feedback-probability = 0.0 + +# The max number of query feedback that cache in memory. +query-feedback-limit = 1024 + +# Pseudo stats will be used if the ratio between the modify count and +# row count in statistics of a table is greater than it. +pseudo-estimate-ratio = 0.7 + +[proxy-protocol] +# PROXY protocol acceptable client networks. +# Empty string means disable PROXY protocol, * means all networks. +networks = "" + +# PROXY protocol header read timeout, unit is second +header-timeout = 5 + +[plan-cache] +enabled = false +capacity = 2560 +shards = 256 + +[prepared-plan-cache] +enabled = false +capacity = 100 + +[opentracing] +# Enable opentracing. +enable = false + +# Whether to enable the rpc metrics. +rpc-metrics = false + +[opentracing.sampler] +# Type specifies the type of the sampler: const, probabilistic, rateLimiting, or remote +type = "const" + +# Param is a value passed to the sampler. +# Valid values for Param field are: +# - for "const" sampler, 0 or 1 for always false/true respectively +# - for "probabilistic" sampler, a probability between 0 and 1 +# - for "rateLimiting" sampler, the number of spans per second +# - for "remote" sampler, param is the same as for "probabilistic" +# and indicates the initial sampling rate before the actual one +# is received from the mothership +param = 1.0 + +# SamplingServerURL is the address of jaeger-agent's HTTP sampling server +sampling-server-url = "" + +# MaxOperations is the maximum number of operations that the sampler +# will keep track of. If an operation is not tracked, a default probabilistic +# sampler will be used rather than the per operation specific sampler. +max-operations = 0 + +# SamplingRefreshInterval controls how often the remotely controlled sampler will poll +# jaeger-agent for the appropriate sampling strategy. +sampling-refresh-interval = 0 + +[opentracing.reporter] +# QueueSize controls how many spans the reporter can keep in memory before it starts dropping +# new spans. The queue is continuously drained by a background go-routine, as fast as spans +# can be sent out of process. +queue-size = 0 + +# BufferFlushInterval controls how often the buffer is force-flushed, even if it's not full. +# It is generally not useful, as it only matters for very low traffic services. +buffer-flush-interval = 0 + +# LogSpans, when true, enables LoggingReporter that runs in parallel with the main reporter +# and logs all submitted spans. Main Configuration.Logger must be initialized in the code +# for this option to have any effect. +log-spans = false + +# LocalAgentHostPort instructs reporter to send spans to jaeger-agent at this address +local-agent-host-port = "" + +[tikv-client] +# Max gRPC connections that will be established with each tikv-server. +grpc-connection-count = 16 + +# After a duration of this time in seconds if the client doesn't see any activity it pings +# the server to see if the transport is still alive. +grpc-keepalive-time = 10 + +# After having pinged for keepalive check, the client waits for a duration of Timeout in seconds +# and if no activity is seen even after that the connection is closed. +grpc-keepalive-timeout = 3 + +# max time for commit command, must be twice bigger than raft election timeout. +commit-timeout = "41s" + +[binlog] + +# Socket file to write binlog. +binlog-socket = "" + +# WriteTimeout specifies how long it will wait for writing binlog to pump. +write-timeout = "15s" + +# If IgnoreError is true, when writing binlog meets error, TiDB would stop writing binlog, +# but still provide service. +ignore-error = false diff --git a/integration_tests/tidb-cdc-sink/config/tikv.toml b/integration_tests/tidb-cdc-sink/config/tikv.toml new file mode 100644 index 0000000000000..0757990597098 --- /dev/null +++ b/integration_tests/tidb-cdc-sink/config/tikv.toml @@ -0,0 +1,497 @@ +# TiKV config template +# Human-readable big numbers: +# File size(based on byte): KB, MB, GB, TB, PB +# e.g.: 1_048_576 = "1MB" +# Time(based on ms): ms, s, m, h +# e.g.: 78_000 = "1.3m" + +# log level: trace, debug, info, warn, error, off. +log-level = "error" +# file to store log, write to stderr if it's empty. +# log-file = "" + +[readpool.storage] +# size of thread pool for high-priority operations +# high-concurrency = 4 +# size of thread pool for normal-priority operations +# normal-concurrency = 4 +# size of thread pool for low-priority operations +# low-concurrency = 4 +# max running high-priority operations, reject if exceed +# max-tasks-high = 8000 +# max running normal-priority operations, reject if exceed +# max-tasks-normal = 8000 +# max running low-priority operations, reject if exceed +# max-tasks-low = 8000 +# size of stack size for each thread pool +# stack-size = "10MB" + +[readpool.coprocessor] +# Notice: if CPU_NUM > 8, default thread pool size for coprocessors +# will be set to CPU_NUM * 0.8. + +# high-concurrency = 8 +# normal-concurrency = 8 +# low-concurrency = 8 +# max-tasks-high = 16000 +# max-tasks-normal = 16000 +# max-tasks-low = 16000 +# stack-size = "10MB" + +[server] +# set listening address. +# addr = "127.0.0.1:20160" +# set advertise listening address for client communication, if not set, use addr instead. +# advertise-addr = "" +# notify capacity, 40960 is suitable for about 7000 regions. +# notify-capacity = 40960 +# maximum number of messages can be processed in one tick. +# messages-per-tick = 4096 + +# compression type for grpc channel, available values are no, deflate and gzip. +# grpc-compression-type = "no" +# size of thread pool for grpc server. +# grpc-concurrency = 4 +# The number of max concurrent streams/requests on a client connection. +# grpc-concurrent-stream = 1024 +# The number of connections with each tikv server to send raft messages. +# grpc-raft-conn-num = 10 +# Amount to read ahead on individual grpc streams. +# grpc-stream-initial-window-size = "2MB" + +# How many snapshots can be sent concurrently. +# concurrent-send-snap-limit = 32 +# How many snapshots can be recv concurrently. +# concurrent-recv-snap-limit = 32 + +# max count of tasks being handled, new tasks will be rejected. +# end-point-max-tasks = 2000 + +# max recursion level allowed when decoding dag expression +# end-point-recursion-limit = 1000 + +# max time to handle coprocessor request before timeout +# end-point-request-max-handle-duration = "60s" + +# the max bytes that snapshot can be written to disk in one second, +# should be set based on your disk performance +# snap-max-write-bytes-per-sec = "100MB" + +# set attributes about this server, e.g. { zone = "us-west-1", disk = "ssd" }. +# labels = {} + +[storage] +# set the path to rocksdb directory. +# data-dir = "/tmp/tikv/store" + +# notify capacity of scheduler's channel +# scheduler-notify-capacity = 10240 + +# maximum number of messages can be processed in one tick +# scheduler-messages-per-tick = 1024 + +# the number of slots in scheduler latches, concurrency control for write. +# scheduler-concurrency = 2048000 + +# scheduler's worker pool size, should increase it in heavy write cases, +# also should less than total cpu cores. +# scheduler-worker-pool-size = 4 + +# When the pending write bytes exceeds this threshold, +# the "scheduler too busy" error is displayed. +# scheduler-pending-write-threshold = "100MB" + +[pd] +# pd endpoints +# endpoints = [] + +[metric] +# the Prometheus client push interval. Setting the value to 0s stops Prometheus client from pushing. +# interval = "15s" +# the Prometheus pushgateway address. Leaving it empty stops Prometheus client from pushing. +address = "prometheus-0:9091" +# the Prometheus client push job name. Note: A node id will automatically append, e.g., "tikv_1". +# job = "tikv" + +[raftstore] +# true (default value) for high reliability, this can prevent data loss when power failure. +# sync-log = true + +# set the path to raftdb directory, default value is data-dir/raft +# raftdb-path = "" + +# set store capacity, if no set, use disk capacity. +# capacity = 0 + +# notify capacity, 40960 is suitable for about 7000 regions. +# notify-capacity = 40960 + +# maximum number of messages can be processed in one tick. +# messages-per-tick = 4096 + +# Region heartbeat tick interval for reporting to pd. +# pd-heartbeat-tick-interval = "60s" +# Store heartbeat tick interval for reporting to pd. +# pd-store-heartbeat-tick-interval = "10s" + +# When region size changes exceeds region-split-check-diff, we should check +# whether the region should be split or not. +# region-split-check-diff = "6MB" + +# Interval to check region whether need to be split or not. +# split-region-check-tick-interval = "10s" + +# When raft entry exceed the max size, reject to propose the entry. +# raft-entry-max-size = "8MB" + +# Interval to gc unnecessary raft log. +# raft-log-gc-tick-interval = "10s" +# A threshold to gc stale raft log, must >= 1. +# raft-log-gc-threshold = 50 +# When entry count exceed this value, gc will be forced trigger. +# raft-log-gc-count-limit = 72000 +# When the approximate size of raft log entries exceed this value, gc will be forced trigger. +# It's recommended to set it to 3/4 of region-split-size. +# raft-log-gc-size-limit = "72MB" + +# When a peer hasn't been active for max-peer-down-duration, +# we will consider this peer to be down and report it to pd. +# max-peer-down-duration = "5m" + +# Interval to check whether start manual compaction for a region, +# region-compact-check-interval = "5m" +# Number of regions for each time to check. +# region-compact-check-step = 100 +# The minimum number of delete tombstones to trigger manual compaction. +# region-compact-min-tombstones = 10000 +# Interval to check whether should start a manual compaction for lock column family, +# if written bytes reach lock-cf-compact-threshold for lock column family, will fire +# a manual compaction for lock column family. +# lock-cf-compact-interval = "10m" +# lock-cf-compact-bytes-threshold = "256MB" + +# Interval (s) to check region whether the data are consistent. +# consistency-check-interval = 0 + +# Use delete range to drop a large number of continuous keys. +# use-delete-range = false + +# delay time before deleting a stale peer +# clean-stale-peer-delay = "10m" + +# Interval to cleanup import sst files. +# cleanup-import-sst-interval = "10m" + +[coprocessor] +# When it is true, it will try to split a region with table prefix if +# that region crosses tables. It is recommended to turn off this option +# if there will be a large number of tables created. +# split-region-on-table = true +# When the region's size exceeds region-max-size, we will split the region +# into two which the left region's size will be region-split-size or a little +# bit smaller. +# region-max-size = "144MB" +# region-split-size = "96MB" + +[rocksdb] +# Maximum number of concurrent background jobs (compactions and flushes) +# max-background-jobs = 8 + +# This value represents the maximum number of threads that will concurrently perform a +# compaction job by breaking it into multiple, smaller ones that are run simultaneously. +# Default: 1 (i.e. no subcompactions) +# max-sub-compactions = 1 + +# Number of open files that can be used by the DB. You may need to +# increase this if your database has a large working set. Value -1 means +# files opened are always kept open. You can estimate number of files based +# on target_file_size_base and target_file_size_multiplier for level-based +# compaction. +# If max-open-files = -1, RocksDB will prefetch index and filter blocks into +# block cache at startup, so if your database has a large working set, it will +# take several minutes to open the db. +max-open-files = 1024 + +# Max size of rocksdb's MANIFEST file. +# For detailed explanation please refer to https://github.com/facebook/rocksdb/wiki/MANIFEST +# max-manifest-file-size = "20MB" + +# If true, the database will be created if it is missing. +# create-if-missing = true + +# rocksdb wal recovery mode +# 0 : TolerateCorruptedTailRecords, tolerate incomplete record in trailing data on all logs; +# 1 : AbsoluteConsistency, We don't expect to find any corruption in the WAL; +# 2 : PointInTimeRecovery, Recover to point-in-time consistency; +# 3 : SkipAnyCorruptedRecords, Recovery after a disaster; +# wal-recovery-mode = 2 + +# rocksdb write-ahead logs dir path +# This specifies the absolute dir path for write-ahead logs (WAL). +# If it is empty, the log files will be in the same dir as data. +# When you set the path to rocksdb directory in memory like in /dev/shm, you may want to set +# wal-dir to a directory on a persistent storage. +# See https://github.com/facebook/rocksdb/wiki/How-to-persist-in-memory-RocksDB-database +# wal-dir = "/tmp/tikv/store" + +# The following two fields affect how archived write-ahead logs will be deleted. +# 1. If both set to 0, logs will be deleted asap and will not get into the archive. +# 2. If wal-ttl-seconds is 0 and wal-size-limit is not 0, +# WAL files will be checked every 10 min and if total size is greater +# then wal-size-limit, they will be deleted starting with the +# earliest until size_limit is met. All empty files will be deleted. +# 3. If wal-ttl-seconds is not 0 and wal-size-limit is 0, then +# WAL files will be checked every wal-ttl-seconds / 2 and those that +# are older than wal-ttl-seconds will be deleted. +# 4. If both are not 0, WAL files will be checked every 10 min and both +# checks will be performed with ttl being first. +# When you set the path to rocksdb directory in memory like in /dev/shm, you may want to set +# wal-ttl-seconds to a value greater than 0 (like 86400) and backup your db on a regular basis. +# See https://github.com/facebook/rocksdb/wiki/How-to-persist-in-memory-RocksDB-database +# wal-ttl-seconds = 0 +# wal-size-limit = 0 + +# rocksdb max total wal size +# max-total-wal-size = "4GB" + +# Rocksdb Statistics provides cumulative stats over time. +# Turn statistics on will introduce about 5%-10% overhead for RocksDB, +# but it is worthy to know the internal status of RocksDB. +# enable-statistics = true + +# Dump statistics periodically in information logs. +# Same as rocksdb's default value (10 min). +# stats-dump-period = "10m" + +# Due to Rocksdb FAQ: https://github.com/facebook/rocksdb/wiki/RocksDB-FAQ, +# If you want to use rocksdb on multi disks or spinning disks, you should set value at +# least 2MB; +# compaction-readahead-size = 0 + +# This is the maximum buffer size that is used by WritableFileWrite +# writable-file-max-buffer-size = "1MB" + +# Use O_DIRECT for both reads and writes in background flush and compactions +# use-direct-io-for-flush-and-compaction = false + +# Limit the disk IO of compaction and flush. Compaction and flush can cause +# terrible spikes if they exceed a certain threshold. Consider setting this to +# 50% ~ 80% of the disk throughput for a more stable result. However, in heavy +# write workload, limiting compaction and flush speed can cause write stalls too. +# rate-bytes-per-sec = 0 + +# Enable or disable the pipelined write +# enable-pipelined-write = true + +# Allows OS to incrementally sync files to disk while they are being +# written, asynchronously, in the background. +# bytes-per-sync = "0MB" + +# Allows OS to incrementally sync WAL to disk while it is being written. +# wal-bytes-per-sync = "0KB" + +# Specify the maximal size of the Rocksdb info log file. If the log file +# is larger than `max_log_file_size`, a new info log file will be created. +# If max_log_file_size == 0, all logs will be written to one log file. +# Default: 1GB +# info-log-max-size = "1GB" + +# Time for the Rocksdb info log file to roll (in seconds). +# If specified with non-zero value, log file will be rolled +# if it has been active longer than `log_file_time_to_roll`. +# Default: 0 (disabled) +# info-log-roll-time = "0" + +# Maximal Rocksdb info log files to be kept. +# Default: 10 +# info-log-keep-log-file-num = 10 + +# This specifies the Rocksdb info LOG dir. +# If it is empty, the log files will be in the same dir as data. +# If it is non empty, the log files will be in the specified dir, +# and the db data dir's absolute path will be used as the log file +# name's prefix. +# Default: empty +# info-log-dir = "" + +# Column Family default used to store actual data of the database. +[rocksdb.defaultcf] +# compression method (if any) is used to compress a block. +# no: kNoCompression +# snappy: kSnappyCompression +# zlib: kZlibCompression +# bzip2: kBZip2Compression +# lz4: kLZ4Compression +# lz4hc: kLZ4HCCompression +# zstd: kZSTD + +# per level compression +# compression-per-level = ["no", "no", "lz4", "lz4", "lz4", "zstd", "zstd"] + +# Approximate size of user data packed per block. Note that the +# block size specified here corresponds to uncompressed data. +# block-size = "64KB" + +# If you're doing point lookups you definitely want to turn bloom filters on, We use +# bloom filters to avoid unnecessary disk reads. Default bits_per_key is 10, which +# yields ~1% false positive rate. Larger bits_per_key values will reduce false positive +# rate, but increase memory usage and space amplification. +# bloom-filter-bits-per-key = 10 + +# false means one sst file one bloom filter, true means every block has a corresponding bloom filter +# block-based-bloom-filter = false + +# level0-file-num-compaction-trigger = 4 + +# Soft limit on number of level-0 files. We start slowing down writes at this point. +# level0-slowdown-writes-trigger = 20 + +# Maximum number of level-0 files. We stop writes at this point. +# level0-stop-writes-trigger = 36 + +# Amount of data to build up in memory (backed by an unsorted log +# on disk) before converting to a sorted on-disk file. +# write-buffer-size = "128MB" + +# The maximum number of write buffers that are built up in memory. +# max-write-buffer-number = 5 + +# The minimum number of write buffers that will be merged together +# before writing to storage. +# min-write-buffer-number-to-merge = 1 + +# Control maximum total data size for base level (level 1). +# max-bytes-for-level-base = "512MB" + +# Target file size for compaction. +# target-file-size-base = "8MB" + +# Max bytes for compaction.max_compaction_bytes +# max-compaction-bytes = "2GB" + +# There are four different algorithms to pick files to compact. +# 0 : ByCompensatedSize +# 1 : OldestLargestSeqFirst +# 2 : OldestSmallestSeqFirst +# 3 : MinOverlappingRatio +# compaction-pri = 3 + +# block-cache used to cache uncompressed blocks, big block-cache can speed up read. +# in normal cases should tune to 30%-50% system's total memory. +# block-cache-size = "1GB" + +# Indicating if we'd put index/filter blocks to the block cache. +# If not specified, each "table reader" object will pre-load index/filter block +# during table initialization. +# cache-index-and-filter-blocks = true + +# Pin level0 filter and index blocks in cache. +# pin-l0-filter-and-index-blocks = true + +# Enable read amplication statistics. +# value => memory usage (percentage of loaded blocks memory) +# 1 => 12.50 % +# 2 => 06.25 % +# 4 => 03.12 % +# 8 => 01.56 % +# 16 => 00.78 % +# read-amp-bytes-per-bit = 0 + +# Pick target size of each level dynamically. +# dynamic-level-bytes = true + +# Options for Column Family write +# Column Family write used to store commit information in MVCC model +[rocksdb.writecf] +# compression-per-level = ["no", "no", "lz4", "lz4", "lz4", "zstd", "zstd"] +# block-size = "64KB" +# write-buffer-size = "128MB" +# max-write-buffer-number = 5 +# min-write-buffer-number-to-merge = 1 +# max-bytes-for-level-base = "512MB" +# target-file-size-base = "8MB" + +# in normal cases should tune to 10%-30% system's total memory. +# block-cache-size = "256MB" +# level0-file-num-compaction-trigger = 4 +# level0-slowdown-writes-trigger = 20 +# level0-stop-writes-trigger = 36 +# cache-index-and-filter-blocks = true +# pin-l0-filter-and-index-blocks = true +# compaction-pri = 3 +# read-amp-bytes-per-bit = 0 +# dynamic-level-bytes = true + +[rocksdb.lockcf] +# compression-per-level = ["no", "no", "no", "no", "no", "no", "no"] +# block-size = "16KB" +# write-buffer-size = "128MB" +# max-write-buffer-number = 5 +# min-write-buffer-number-to-merge = 1 +# max-bytes-for-level-base = "128MB" +# target-file-size-base = "8MB" +# block-cache-size = "256MB" +# level0-file-num-compaction-trigger = 1 +# level0-slowdown-writes-trigger = 20 +# level0-stop-writes-trigger = 36 +# cache-index-and-filter-blocks = true +# pin-l0-filter-and-index-blocks = true +# compaction-pri = 0 +# read-amp-bytes-per-bit = 0 +# dynamic-level-bytes = true + +[raftdb] +# max-sub-compactions = 1 +max-open-files = 1024 +# max-manifest-file-size = "20MB" +# create-if-missing = true + +# enable-statistics = true +# stats-dump-period = "10m" + +# compaction-readahead-size = 0 +# writable-file-max-buffer-size = "1MB" +# use-direct-io-for-flush-and-compaction = false +# enable-pipelined-write = true +# allow-concurrent-memtable-write = false +# bytes-per-sync = "0MB" +# wal-bytes-per-sync = "0KB" + +# info-log-max-size = "1GB" +# info-log-roll-time = "0" +# info-log-keep-log-file-num = 10 +# info-log-dir = "" + +[raftdb.defaultcf] +# compression-per-level = ["no", "no", "lz4", "lz4", "lz4", "zstd", "zstd"] +# block-size = "64KB" +# write-buffer-size = "128MB" +# max-write-buffer-number = 5 +# min-write-buffer-number-to-merge = 1 +# max-bytes-for-level-base = "512MB" +# target-file-size-base = "8MB" + +# should tune to 256MB~2GB. +# block-cache-size = "256MB" +# level0-file-num-compaction-trigger = 4 +# level0-slowdown-writes-trigger = 20 +# level0-stop-writes-trigger = 36 +# cache-index-and-filter-blocks = true +# pin-l0-filter-and-index-blocks = true +# compaction-pri = 0 +# read-amp-bytes-per-bit = 0 +# dynamic-level-bytes = true + +[security] +# set the path for certificates. Empty string means disabling secure connectoins. +# ca-path = "" +# cert-path = "" +# key-path = "" + +[import] +# the directory to store importing kv data. +# import-dir = "/tmp/tikv/import" +# number of threads to handle RPC requests. +# num-threads = 8 +# stream channel window size, stream will be blocked on channel full. +# stream-channel-window = 128 diff --git a/integration_tests/tidb-cdc-sink/create_mv.sql b/integration_tests/tidb-cdc-sink/create_mv.sql new file mode 100644 index 0000000000000..042da6cf585b3 --- /dev/null +++ b/integration_tests/tidb-cdc-sink/create_mv.sql @@ -0,0 +1,31 @@ +-- +-- Find the top10 hotest hashtags. +-- +CREATE MATERIALIZED VIEW hot_hashtags AS WITH tags AS ( + SELECT + unnest(regexp_matches(tweet.text, '#\w+', 'g')) AS hashtag, + tweet.created_at AS created_at + FROM + tweet JOIN user + ON + tweet.author_id = user.id +) +SELECT + hashtag, + COUNT(*) AS hashtag_occurrences, + window_start +FROM + TUMBLE(tags, created_at, INTERVAL '5 minute') +GROUP BY + hashtag, + window_start +ORDER BY + hashtag_occurrences; + + +CREATE SINK hot_hashtags_sink FROM hot_hashtags +WITH ( + connector='jdbc', + jdbc.url='jdbc:mysql://tidb:4000/test?user=root&password=', + table.name='hot_hashtags' +); diff --git a/integration_tests/tidb-cdc-sink/create_source.sql b/integration_tests/tidb-cdc-sink/create_source.sql new file mode 100644 index 0000000000000..d58996f799d7d --- /dev/null +++ b/integration_tests/tidb-cdc-sink/create_source.sql @@ -0,0 +1,27 @@ +CREATE TABLE tweet ( + id varchar, + text varchar, + lang varchar, + created_at timestamp, + author_id varchar, + PRIMARY KEY (id) +) WITH ( + connector='kafka', + topic='ticdc_test_tweet', + properties.bootstrap.server='kafka:9092', + scan.startup.mode='earliest' +) ROW FORMAT CANAL_JSON; + +create table user ( + id varchar, + name varchar, + username varchar, + followers bigint, + created_at timestamp, + PRIMARY KEY (id) +) WITH ( + connector='kafka', + topic='ticdc_test_user', + properties.bootstrap.server='kafka:9092', + scan.startup.mode='earliest' +) ROW FORMAT CANAL_JSON; diff --git a/integration_tests/tidb-cdc-sink/data_check b/integration_tests/tidb-cdc-sink/data_check new file mode 100644 index 0000000000000..2f946d9fc6ae8 --- /dev/null +++ b/integration_tests/tidb-cdc-sink/data_check @@ -0,0 +1 @@ +tweet,user \ No newline at end of file diff --git a/integration_tests/tidb-cdc-sink/docker-compose.yml b/integration_tests/tidb-cdc-sink/docker-compose.yml new file mode 100644 index 0000000000000..e1b45c81a6bbf --- /dev/null +++ b/integration_tests/tidb-cdc-sink/docker-compose.yml @@ -0,0 +1,232 @@ +--- +version: '3' +services: + compactor-0: + extends: + file: ../../docker/docker-compose.yml + service: compactor-0 + compute-node-0: + extends: + file: ../../docker/docker-compose.yml + service: compute-node-0 + etcd-0: + extends: + file: ../../docker/docker-compose.yml + service: etcd-0 + frontend-node-0: + extends: + file: ../../docker/docker-compose.yml + service: frontend-node-0 + grafana-0: + extends: + file: ../../docker/docker-compose.yml + service: grafana-0 + meta-node-0: + extends: + file: ../../docker/docker-compose.yml + service: meta-node-0 + minio-0: + extends: + file: ../../docker/docker-compose.yml + service: minio-0 + prometheus-0: + extends: + file: ../../docker/docker-compose.yml + service: prometheus-0 + connector-node: + extends: + file: ../../docker/docker-compose.yml + service: connector-node + + #=================== TiDB & TiCDC components ================== + ticdc-controller: + image: pingcap/ticdc:v6.6.0 + entrypoint: "/cdc cli" + command: + - changefeed + - create + - --server + - http://ticdc-capturer0:8300 + - --sink-uri + - "kafka://kafka:9092/ticdc_default?protocol=canal-json&kafka-version=2.4.0&partition-num=3&max-message-bytes=67108864&replication-factor=1" + - --changefeed-id + - "ticdc-replication-task" + - --config + - "/changefeed.toml" + volumes: + - ./config/changefeed.toml:/changefeed.toml:ro + depends_on: + - "pd" + - "kafka" + - "ticdc-capturer0" + restart: on-failure + + ticdc-capturer0: + image: pingcap/ticdc:v6.6.0 + entrypoint: "/cdc server" + ports: + - "8300:8300" + command: + - --addr=0.0.0.0:8300 + - --pd=http://pd:2379 + - --advertise-addr=ticdc-capturer0:8300 + depends_on: + - pd + - "tidb" + - "kafka" + restart: on-failure + + pd: + image: pingcap/pd:v6.6.0 + ports: + - "2379:2379" + volumes: + - ./config/pd.toml:/pd.toml:ro + command: + - --name=pd + - --client-urls=http://0.0.0.0:2379 + - --peer-urls=http://0.0.0.0:2380 + - --advertise-client-urls=http://pd:2379 + - --advertise-peer-urls=http://pd:2380 + - --initial-cluster=pd=http://pd:2380 + - --data-dir=/data/pd + - --config=/pd.toml + restart: on-failure + + tikv0: + image: pingcap/tikv:v6.6.0 + volumes: + - ./config/tikv.toml:/tikv.toml:ro + - /data + command: + - --addr=0.0.0.0:20160 + - --advertise-addr=tikv0:20160 + - --data-dir=/data/tikv0 + - --pd=pd:2379 + - --config=/tikv.toml + depends_on: + - "pd" + restart: on-failure + + tikv1: + image: pingcap/tikv:v6.6.0 + volumes: + - ./config/tikv.toml:/tikv.toml:ro + - /data + command: + - --addr=0.0.0.0:20160 + - --advertise-addr=tikv1:20160 + - --data-dir=/data/tikv1 + - --pd=pd:2379 + - --config=/tikv.toml + depends_on: + - "pd" + restart: on-failure + + tikv2: + image: pingcap/tikv:v6.6.0 + volumes: + - ./config/tikv.toml:/tikv.toml:ro + - /data + command: + - --addr=0.0.0.0:20160 + - --advertise-addr=tikv2:20160 + - --data-dir=/data/tikv2 + - --pd=pd:2379 + - --config=/tikv.toml + depends_on: + - "pd" + restart: on-failure + + tidb: + image: pingcap/tidb:v6.6.0 + ports: + - "4000:4000" + - "10080:10080" + volumes: + - ./config/tidb.toml:/tidb.toml:ro + command: + - --store=tikv + - --path=pd:2379 + - --config=/tidb.toml + - --advertise-address=tidb + depends_on: + - "tikv0" + - "tikv1" + - "tikv2" + restart: on-failure + + #=================== Kakfa ================== + + # Adapted from https://github.com/confluentinc/demo-scene/blob/master/connect-jdbc/docker-compose.yml + zookeeper: + image: confluentinc/cp-zookeeper:5.5.1 + container_name: zookeeper + environment: + ZOOKEEPER_CLIENT_PORT: 2181 + ZOOKEEPER_TICK_TIME: 2000 + + kafka: + image: confluentinc/cp-enterprise-kafka:5.5.1 + container_name: kafka + depends_on: + - "zookeeper" + ports: + # Exposes 9092 for external connections to the broker + # Use kafka:29092 for connections internal on the docker network + # See https://rmoff.net/2018/08/02/kafka-listeners-explained/ for details + - 9092:9092 + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://kafka:9092 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" + KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100 + CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka:29092 + CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181 + CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1 + CONFLUENT_METRICS_ENABLE: 'true' + CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous' + + #===================== Others =================== + datagen: + build: ../datagen + depends_on: + - tidb + command: + - /bin/sh + - -c + - /datagen --mode twitter --qps 2 mysql --host tidb --db test --port 4000 --user root --password "" + restart: always + container_name: datagen + + init_tidb: + image: mysql:8.0 + depends_on: + - tidb + command: + - /bin/sh + - -c + - "mysql --password= -h tidb --port 4000 -u root test < tidb_create_tables.sql" + volumes: + - "./tidb_create_tables.sql:/tidb_create_tables.sql" + container_name: init_tidb + restart: on-failure + +volumes: + compute-node-0: + external: false + etcd-0: + external: false + grafana-0: + external: false + minio-0: + external: false + prometheus-0: + external: false + message_queue: + external: false \ No newline at end of file diff --git a/integration_tests/tidb-cdc-sink/query.sql b/integration_tests/tidb-cdc-sink/query.sql new file mode 100644 index 0000000000000..3e64784a04aa7 --- /dev/null +++ b/integration_tests/tidb-cdc-sink/query.sql @@ -0,0 +1,8 @@ +SELECT + * +FROM + hot_hashtags +ORDER BY + hashtag_occurrences DESC +LIMIT + 10; \ No newline at end of file diff --git a/integration_tests/tidb-cdc-sink/tidb_create_tables.sql b/integration_tests/tidb-cdc-sink/tidb_create_tables.sql new file mode 100644 index 0000000000000..3a7e4d448bf6f --- /dev/null +++ b/integration_tests/tidb-cdc-sink/tidb_create_tables.sql @@ -0,0 +1,25 @@ +CREATE TABLE `tweet` ( + `id` varchar(20) NOT NULL, + `text` varchar(1024) DEFAULT NULL, + `lang` varchar(20) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `author_id` varchar(20) NOT NULL, + PRIMARY KEY (`id`) +); + +create table user ( + `id` varchar(20) NOT NULL, + `name` varchar(100) DEFAULT NULL, + `username` varchar(100) DEFAULT NULL, + `followers` bigint not null, + `created_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`) +); + + +create table hot_hashtags ( + `window_start` timestamp not null, + `hashtag` varchar(100) not null, + `hashtag_occurrences` bigint not null, + PRIMARY KEY (window_start, hashtag) +); diff --git a/java/connector-node/assembly/scripts/start-service.sh b/java/connector-node/assembly/scripts/start-service.sh index 483c950570329..86b59386c43a3 100755 --- a/java/connector-node/assembly/scripts/start-service.sh +++ b/java/connector-node/assembly/scripts/start-service.sh @@ -15,6 +15,7 @@ while getopts ":h:p:" o; do done shift $((OPTIND-1)) + DIR="$( cd "$( dirname "$0" )" && pwd )" MAIN='com.risingwave.connector.ConnectorService' PORT=50051 @@ -24,4 +25,4 @@ if [ -z "${port}" ]; then port=$PORT fi -java -classpath "${DIR}/libs/*" $MAIN --port ${port} +java -classpath "${DIR}/libs/*" -Djava.library.path="${RW_JAVA_BINDING_LIB_PATH}" $MAIN --port ${port} diff --git a/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/TableSchema.java b/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/TableSchema.java index 5d1016c95ea49..053ba1e329920 100644 --- a/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/TableSchema.java +++ b/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/TableSchema.java @@ -102,8 +102,6 @@ public static TableSchema fromProto(ConnectorServiceProto.TableSchema tableSchem .collect(Collectors.toList())); } - /** @deprecated pk here is from Risingwave, it may not match the pk in the database */ - @Deprecated public List getPrimaryKeys() { return primaryKeys; } diff --git a/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/ConnectorConfig.java b/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/ConnectorConfig.java deleted file mode 100644 index 8f5c3c854a480..0000000000000 --- a/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/ConnectorConfig.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 RisingWave Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.risingwave.connector.api.source; - -import java.util.HashMap; -import java.util.Map; - -public class ConnectorConfig extends HashMap { - - public ConnectorConfig() {} - - public ConnectorConfig(Map m) { - super(m); - } - - public String getNonNull(String key) { - String value = super.get(key); - if (value == null) { - throw new RuntimeException(key + "cannot be null"); - } - return value; - } - - /* Common configs */ - public static final String HOST = "hostname"; - public static final String PORT = "port"; - public static final String USER = "username"; - public static final String PASSWORD = "password"; - - public static final String DB_NAME = "database.name"; - public static final String TABLE_NAME = "table.name"; - - /* MySQL specified configs */ - public static final String MYSQL_SERVER_ID = "server.id"; - - /* Postgres specified configs */ - public static final String PG_SLOT_NAME = "slot.name"; - public static final String PG_SCHEMA_NAME = "schema.name"; - - public static Map extractDebeziumProperties(Map properties) { - // retain only debezium properties if any - var userProps = new HashMap<>(properties); - userProps.remove(ConnectorConfig.HOST); - userProps.remove(ConnectorConfig.PORT); - userProps.remove(ConnectorConfig.USER); - userProps.remove(ConnectorConfig.PASSWORD); - userProps.remove(ConnectorConfig.DB_NAME); - userProps.remove(ConnectorConfig.TABLE_NAME); - userProps.remove(ConnectorConfig.MYSQL_SERVER_ID); - userProps.remove(ConnectorConfig.PG_SLOT_NAME); - userProps.remove(ConnectorConfig.PG_SCHEMA_NAME); - return userProps; - } -} diff --git a/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/SourceHandler.java b/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/SourceHandler.java index 1c3f0d1e91d66..d37730635a60b 100644 --- a/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/SourceHandler.java +++ b/java/connector-node/connector-api/src/main/java/com/risingwave/connector/api/source/SourceHandler.java @@ -19,7 +19,7 @@ /** Handler for RPC request */ public interface SourceHandler { - void handle( + void startSource( ServerCallStreamObserver responseObserver); } diff --git a/java/connector-node/python-client/integration_tests.py b/java/connector-node/python-client/integration_tests.py index 61aacb6414dce..7480902519e61 100644 --- a/java/connector-node/python-client/integration_tests.py +++ b/java/connector-node/python-client/integration_tests.py @@ -162,7 +162,7 @@ def test_print_sink(input_file): def test_iceberg_sink(input_file): test_sink("iceberg", - {"sink.mode":"append-only", + {"type":"append-only", "warehouse.path":"s3a://bucket", "s3.endpoint": "http://127.0.0.1:9000", "s3.access.key": "minioadmin", @@ -173,7 +173,7 @@ def test_iceberg_sink(input_file): def test_upsert_iceberg_sink(input_file): test_upsert_sink("iceberg", - {"sink.mode":"upsert", + {"type":"upsert", "warehouse.path":"s3a://bucket", "s3.endpoint": "http://127.0.0.1:9000", "s3.access.key": "minioadmin", diff --git a/java/connector-node/risingwave-connector-service/pom.xml b/java/connector-node/risingwave-connector-service/pom.xml index ff38088c4221f..581085f43b30a 100644 --- a/java/connector-node/risingwave-connector-service/pom.xml +++ b/java/connector-node/risingwave-connector-service/pom.xml @@ -25,6 +25,10 @@ com.risingwave.java proto + + com.risingwave.java + java-binding + com.risingwave.java connector-api @@ -47,7 +51,14 @@ com.google.code.gson gson - + + org.apache.commons + commons-text + + + commons-io + commons-io + commons-cli commons-cli diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/JsonDeserializer.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/JsonDeserializer.java index 097872dcef757..837989120eab3 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/JsonDeserializer.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/JsonDeserializer.java @@ -22,6 +22,8 @@ import com.risingwave.proto.ConnectorServiceProto; import com.risingwave.proto.ConnectorServiceProto.SinkStreamRequest.WriteBatch.JsonPayload; import com.risingwave.proto.Data; +import java.math.BigDecimal; +import java.sql.Timestamp; import java.util.Map; public class JsonDeserializer implements Deserializer { @@ -31,6 +33,8 @@ public JsonDeserializer(TableSchema tableSchema) { this.tableSchema = tableSchema; } + // Encoding here should be consistent with `datum_to_json_object()` in + // src/connector/src/sink/mod.rs @Override public CloseableIterator deserialize( ConnectorServiceProto.SinkStreamRequest.WriteBatch writeBatch) { @@ -113,6 +117,19 @@ private static Double castDouble(Object value) { } } + private static BigDecimal castDecimal(Object value) { + if (value instanceof String) { + // FIXME(eric): See `datum_to_json_object()` in src/connector/src/sink/mod.rs + return new BigDecimal((String) value); + } else if (value instanceof BigDecimal) { + return (BigDecimal) value; + } else { + throw io.grpc.Status.INVALID_ARGUMENT + .withDescription("unable to cast into double from " + value.getClass()) + .asRuntimeException(); + } + } + private static Object validateJsonDataTypes(Data.DataType.TypeName typeName, Object value) { switch (typeName) { case INT16: @@ -132,6 +149,8 @@ private static Object validateJsonDataTypes(Data.DataType.TypeName typeName, Obj return castDouble(value); case FLOAT: return castDouble(value).floatValue(); + case DECIMAL: + return castDecimal(value); case BOOLEAN: if (!(value instanceof Boolean)) { throw io.grpc.Status.INVALID_ARGUMENT @@ -139,6 +158,15 @@ private static Object validateJsonDataTypes(Data.DataType.TypeName typeName, Obj .asRuntimeException(); } return value; + case TIMESTAMP: + case TIMESTAMPTZ: + if (!(value instanceof String)) { + throw io.grpc.Status.INVALID_ARGUMENT + .withDescription( + "Expected timestamp in string, got " + value.getClass()) + .asRuntimeException(); + } + return Timestamp.valueOf((String) value); default: throw io.grpc.Status.INVALID_ARGUMENT .withDescription("unsupported type " + typeName) diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/SinkStreamObserver.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/SinkStreamObserver.java index eb5d6514cb53c..036db70aae9b8 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/SinkStreamObserver.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/SinkStreamObserver.java @@ -18,6 +18,7 @@ import com.risingwave.connector.api.TableSchema; import com.risingwave.connector.api.sink.*; +import com.risingwave.connector.deserializer.StreamChunkDeserializer; import com.risingwave.metrics.ConnectorNodeMetrics; import com.risingwave.metrics.MonitoredRowIterator; import com.risingwave.proto.ConnectorServiceProto; @@ -202,7 +203,10 @@ private void bindSink(SinkConfig sinkConfig, ConnectorServiceProto.SinkPayloadFo case JSON: deserializer = new JsonDeserializer(tableSchema); break; + case STREAM_CHUNK: + deserializer = new StreamChunkDeserializer(tableSchema); + break; } - ConnectorNodeMetrics.incActiveConnections(sinkConfig.getConnectorType(), "node1"); + ConnectorNodeMetrics.incActiveSinkConnections(sinkConfig.getConnectorType(), "node1"); } } diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/deserializer/StreamChunkDeserializer.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/deserializer/StreamChunkDeserializer.java new file mode 100644 index 0000000000000..b6be0af1d9394 --- /dev/null +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/deserializer/StreamChunkDeserializer.java @@ -0,0 +1,215 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.risingwave.connector.deserializer; + +import static io.grpc.Status.INVALID_ARGUMENT; + +import com.risingwave.connector.api.TableSchema; +import com.risingwave.connector.api.sink.CloseableIterator; +import com.risingwave.connector.api.sink.Deserializer; +import com.risingwave.connector.api.sink.SinkRow; +import com.risingwave.java.binding.StreamChunkIterator; +import com.risingwave.java.binding.StreamChunkRow; +import com.risingwave.proto.ConnectorServiceProto; +import com.risingwave.proto.ConnectorServiceProto.SinkStreamRequest.WriteBatch.StreamChunkPayload; +import com.risingwave.proto.Data; + +public class StreamChunkDeserializer implements Deserializer { + interface ValueGetter { + Object get(StreamChunkRow row); + } + + private final ValueGetter[] valueGetters; + + public StreamChunkDeserializer(TableSchema tableSchema) { + this.valueGetters = buildValueGetter(tableSchema); + } + + static ValueGetter[] buildValueGetter(TableSchema tableSchema) { + String[] colNames = tableSchema.getColumnNames(); + ValueGetter[] ret = new ValueGetter[colNames.length]; + for (int i = 0; i < colNames.length; i++) { + int index = i; + Data.DataType.TypeName typeName = tableSchema.getColumnType(colNames[i]); + switch (typeName) { + case INT16: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getShort(index); + }; + break; + case INT32: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getInt(index); + }; + break; + case INT64: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getLong(index); + }; + break; + case FLOAT: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getFloat(index); + }; + break; + case DOUBLE: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getDouble(index); + }; + break; + case BOOLEAN: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getBoolean(index); + }; + break; + case VARCHAR: + ret[i] = + row -> { + if (row.isNull(index)) { + return null; + } + return row.getString(index); + }; + break; + default: + throw io.grpc.Status.INVALID_ARGUMENT + .withDescription("unsupported type " + typeName) + .asRuntimeException(); + } + } + return ret; + } + + @Override + public CloseableIterator deserialize( + ConnectorServiceProto.SinkStreamRequest.WriteBatch writeBatch) { + if (!writeBatch.hasStreamChunkPayload()) { + throw INVALID_ARGUMENT + .withDescription( + "expected StreamChunkPayload, got " + writeBatch.getPayloadCase()) + .asRuntimeException(); + } + StreamChunkPayload streamChunkPayload = writeBatch.getStreamChunkPayload(); + return new StreamChunkIteratorWrapper( + new StreamChunkIterator(streamChunkPayload.getBinaryData().toByteArray()), + valueGetters); + } + + static class StreamChunkRowWrapper implements SinkRow { + + private boolean isClosed; + private final StreamChunkRow inner; + private final ValueGetter[] valueGetters; + + StreamChunkRowWrapper(StreamChunkRow inner, ValueGetter[] valueGetters) { + this.inner = inner; + this.valueGetters = valueGetters; + this.isClosed = false; + } + + @Override + public Object get(int index) { + return valueGetters[index].get(inner); + } + + @Override + public Data.Op getOp() { + return inner.getOp(); + } + + @Override + public int size() { + return valueGetters.length; + } + + @Override + public void close() { + if (!isClosed) { + this.isClosed = true; + inner.close(); + } + } + } + + static class StreamChunkIteratorWrapper implements CloseableIterator { + private final StreamChunkIterator iter; + private final ValueGetter[] valueGetters; + private StreamChunkRowWrapper row; + + public StreamChunkIteratorWrapper(StreamChunkIterator iter, ValueGetter[] valueGetters) { + this.iter = iter; + this.valueGetters = valueGetters; + this.row = null; + } + + @Override + public void close() { + iter.close(); + try { + if (row != null) { + row.close(); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public boolean hasNext() { + if (this.row != null) { + throw new RuntimeException( + "cannot call hasNext again when there is row not consumed by next"); + } + StreamChunkRow row = iter.next(); + if (row == null) { + return false; + } + this.row = new StreamChunkRowWrapper(row, valueGetters); + return true; + } + + @Override + public SinkRow next() { + // Move the sink row outside + SinkRow ret = this.row; + this.row = null; + return ret; + } + } +} diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/metrics/ConnectorNodeMetrics.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/metrics/ConnectorNodeMetrics.java index 51009c356b505..90fa04c538784 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/metrics/ConnectorNodeMetrics.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/metrics/ConnectorNodeMetrics.java @@ -16,42 +16,55 @@ import static io.grpc.Status.INTERNAL; +import com.sun.management.OperatingSystemMXBean; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.Counter; import io.prometheus.client.Gauge; import io.prometheus.client.exporter.HTTPServer; import java.io.IOException; import java.lang.management.ManagementFactory; -import java.lang.management.OperatingSystemMXBean; import java.net.InetSocketAddress; public class ConnectorNodeMetrics { - private static final Counter activeConnections = + private static final Counter activeSourceConnections = Counter.build() - .name("active_connections") + .name("active_source_connections") + .labelNames("source_type", "ip") + .help("Number of active source connections") + .register(); + + private static final Counter activeSinkConnections = + Counter.build() + .name("active_sink_connections") .labelNames("sink_type", "ip") - .help("Number of active connections") + .help("Number of active sink connections") .register(); - private static final Counter totalConnections = + private static final Counter totalSinkConnections = Counter.build() - .name("total_connections") + .name("total_sink_connections") .labelNames("sink_type", "ip") .help("Number of total connections") .register(); - private static final Gauge cpuUsage = - Gauge.build() - .name("cpu_usage") - .labelNames("node_id") - .help("CPU usage in percentage") + private static final Counter cpuUsage = + Counter.build() + .name("process_cpu_seconds_total") + .labelNames("job") + .help("Total user and system CPU time spent in seconds.") .register(); private static final Gauge ramUsage = Gauge.build() - .name("ram_usage") - .labelNames("node_id") + .name("process_resident_memory_bytes") + .labelNames("job") .help("RAM usage in bytes") .register(); + private static final Counter sourceRowsReceived = + Counter.build() + .name("connector_source_rows_received") + .labelNames("source_type", "source_id") + .help("Number of rows received by source") + .register(); private static final Counter sinkRowsReceived = Counter.build() .name("sink_rows_received") @@ -68,14 +81,15 @@ public class ConnectorNodeMetrics { static class PeriodicMetricsCollector extends Thread { private final int interval; private final OperatingSystemMXBean osBean; - private final String nodeId; + private final String job; - public PeriodicMetricsCollector(int intervalMillis, String nodeId) { + public PeriodicMetricsCollector(int intervalMillis, String job) { this.interval = intervalMillis; - this.nodeId = nodeId; - this.osBean = ManagementFactory.getOperatingSystemMXBean(); + this.job = job; + this.osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean(); } + @SuppressWarnings({"InfiniteLoopStatement", "BusyWait"}) @Override public void run() { while (true) { @@ -89,24 +103,26 @@ public void run() { } private void collect() { - double cpuUsage = osBean.getSystemLoadAverage(); - ConnectorNodeMetrics.cpuUsage.labels(nodeId).set(cpuUsage); + double cpuTotal = osBean.getProcessCpuTime() / 1000000000.0; + double cpuPast = ConnectorNodeMetrics.cpuUsage.labels(job).get(); + ConnectorNodeMetrics.cpuUsage.labels(job).inc(cpuTotal - cpuPast); long ramUsageBytes = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); - ConnectorNodeMetrics.ramUsage.labels(nodeId).set(ramUsageBytes); + ConnectorNodeMetrics.ramUsage.labels(job).set(ramUsageBytes); } } public static void startHTTPServer(int port) { CollectorRegistry registry = new CollectorRegistry(); - registry.register(activeConnections); + registry.register(activeSourceConnections); + registry.register(activeSinkConnections); + registry.register(sourceRowsReceived); registry.register(cpuUsage); registry.register(ramUsage); - PeriodicMetricsCollector collector = new PeriodicMetricsCollector(1000, "node1"); + PeriodicMetricsCollector collector = new PeriodicMetricsCollector(1000, "connector"); collector.start(); - try { - HTTPServer server = new HTTPServer(new InetSocketAddress("localhost", port), registry); + new HTTPServer(new InetSocketAddress("localhost", port), registry); } catch (IOException e) { throw INTERNAL.withDescription("Failed to start HTTP server") .withCause(e) @@ -114,12 +130,24 @@ public static void startHTTPServer(int port) { } } - public static void incActiveConnections(String sinkType, String ip) { - activeConnections.labels(sinkType, ip).inc(); + public static void incActiveSourceConnections(String sourceType, String ip) { + activeSourceConnections.labels(sourceType, ip).inc(); + } + + public static void decActiveSourceConnections(String sourceType, String ip) { + activeSourceConnections.remove(sourceType, ip); + } + + public static void incActiveSinkConnections(String sinkType, String ip) { + activeSinkConnections.labels(sinkType, ip).inc(); } public static void decActiveConnections(String sinkType, String ip) { - activeConnections.remove(sinkType, ip); + activeSinkConnections.remove(sinkType, ip); + } + + public static void incSourceRowsReceived(String sourceType, String sourceId, double amt) { + sourceRowsReceived.labels(sourceType, sourceId).inc(amt); } public static void incSinkRowsReceived() { @@ -127,17 +155,13 @@ public static void incSinkRowsReceived() { } public static void incTotalConnections(String sinkType, String ip) { - totalConnections.labels(sinkType, ip).inc(); + totalSinkConnections.labels(sinkType, ip).inc(); } public static void incErrorCount(String sinkType, String ip) { errorCount.labels(sinkType, ip).inc(); } - public static void setCpuUsage(String ip, double cpuUsagePercentage) { - cpuUsage.labels(ip).set(cpuUsagePercentage); - } - public static void setRamUsage(String ip, long usedRamInBytes) { ramUsage.labels(ip).set(usedRamInBytes); } diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/SourceRequestHandler.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/SourceRequestHandler.java index 8dcb973307c06..dd54b86803889 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/SourceRequestHandler.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/SourceRequestHandler.java @@ -14,10 +14,11 @@ package com.risingwave.sourcenode; -import com.risingwave.connector.api.source.ConnectorConfig; import com.risingwave.connector.api.source.SourceTypeE; +import com.risingwave.metrics.ConnectorNodeMetrics; import com.risingwave.proto.ConnectorServiceProto; import com.risingwave.proto.Data.DataType; +import com.risingwave.sourcenode.common.DbzConnectorConfig; import com.risingwave.sourcenode.core.SourceHandlerFactory; import io.grpc.Status; import io.grpc.StatusException; @@ -46,19 +47,25 @@ public void handle(ConnectorServiceProto.GetEventStreamRequest request) { break; case START: var startRequest = request.getStart(); - var handler = - SourceHandlerFactory.createSourceHandler( - SourceTypeE.valueOf(startRequest.getSourceType()), - startRequest.getSourceId(), - startRequest.getStartOffset(), - new ConnectorConfig(startRequest.getPropertiesMap())); - if (handler == null) { - LOG.error("failed to create source handler"); - responseObserver.onCompleted(); - } else { - handler.handle( + try { + var handler = + SourceHandlerFactory.createSourceHandler( + SourceTypeE.valueOf(startRequest.getSourceType()), + startRequest.getSourceId(), + startRequest.getStartOffset(), + startRequest.getPropertiesMap()); + ConnectorNodeMetrics.incActiveSourceConnections( + startRequest.getSourceType().toString(), + startRequest.getPropertiesMap().get(DbzConnectorConfig.HOST)); + handler.startSource( (ServerCallStreamObserver) responseObserver); + ConnectorNodeMetrics.decActiveSourceConnections( + startRequest.getSourceType().toString(), + startRequest.getPropertiesMap().get(DbzConnectorConfig.HOST)); + } catch (Throwable t) { + LOG.error("failed to start source", t); + responseObserver.onError(t); } break; case REQUEST_NOT_SET: @@ -75,11 +82,11 @@ private void validateDbProperties( String jdbcUrl = toJdbcPrefix(validate.getSourceType()) + "://" - + props.get(ConnectorConfig.HOST) + + props.get(DbzConnectorConfig.HOST) + ":" - + props.get(ConnectorConfig.PORT) + + props.get(DbzConnectorConfig.PORT) + "/" - + props.get(ConnectorConfig.DB_NAME); + + props.get(DbzConnectorConfig.DB_NAME); LOG.debug("validate jdbc url: {}", jdbcUrl); var sqlStmts = new Properties(); @@ -93,8 +100,8 @@ private void validateDbProperties( try (var conn = DriverManager.getConnection( jdbcUrl, - props.get(ConnectorConfig.USER), - props.get(ConnectorConfig.PASSWORD))) { + props.get(DbzConnectorConfig.USER), + props.get(DbzConnectorConfig.PASSWORD))) { // usernamed and password are correct var dbMeta = conn.getMetaData(); @@ -138,8 +145,8 @@ private void validateDbProperties( } // check whether table exist try (var stmt = conn.prepareStatement(sqlStmts.getProperty("mysql.table"))) { - stmt.setString(1, props.get(ConnectorConfig.DB_NAME)); - stmt.setString(2, props.get(ConnectorConfig.TABLE_NAME)); + stmt.setString(1, props.get(DbzConnectorConfig.DB_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); var res = stmt.executeQuery(); while (res.next()) { var ret = res.getInt(1); @@ -152,8 +159,8 @@ private void validateDbProperties( try (var stmt = conn.prepareStatement(sqlStmts.getProperty("mysql.table_schema"))) { var sourceSchema = validate.getTableSchema(); - stmt.setString(1, props.get(ConnectorConfig.DB_NAME)); - stmt.setString(2, props.get(ConnectorConfig.TABLE_NAME)); + stmt.setString(1, props.get(DbzConnectorConfig.DB_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); var res = stmt.executeQuery(); var pkFields = new HashSet(); int index = 0; @@ -203,8 +210,8 @@ private void validateDbProperties( } // check schema name and table name try (var stmt = conn.prepareStatement(sqlStmts.getProperty("postgres.table"))) { - stmt.setString(1, props.get(ConnectorConfig.PG_SCHEMA_NAME)); - stmt.setString(2, props.get(ConnectorConfig.TABLE_NAME)); + stmt.setString(1, props.get(DbzConnectorConfig.PG_SCHEMA_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); var res = stmt.executeQuery(); while (res.next()) { var ret = res.getString(1); @@ -219,9 +226,9 @@ private void validateDbProperties( try (var stmt = conn.prepareStatement(sqlStmts.getProperty("postgres.pk"))) { stmt.setString( 1, - props.get(ConnectorConfig.PG_SCHEMA_NAME) + props.get(DbzConnectorConfig.PG_SCHEMA_NAME) + "." - + props.get(ConnectorConfig.TABLE_NAME)); + + props.get(DbzConnectorConfig.TABLE_NAME)); var res = stmt.executeQuery(); var pkFields = new HashSet(); @@ -237,8 +244,8 @@ private void validateDbProperties( // check whether source schema match table schema on upstream try (var stmt = conn.prepareStatement(sqlStmts.getProperty("postgres.table_schema"))) { - stmt.setString(1, props.get(ConnectorConfig.PG_SCHEMA_NAME)); - stmt.setString(2, props.get(ConnectorConfig.TABLE_NAME)); + stmt.setString(1, props.get(DbzConnectorConfig.PG_SCHEMA_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); var res = stmt.executeQuery(); var sourceSchema = validate.getTableSchema(); int index = 0; @@ -263,6 +270,159 @@ private void validateDbProperties( } } } + // check whether user is superuser or replication role + try (var stmt = + conn.prepareStatement(sqlStmts.getProperty("postgres.role.check"))) { + stmt.setString(1, props.get(DbzConnectorConfig.USER)); + var res = stmt.executeQuery(); + while (res.next()) { + if (!res.getBoolean(1)) { + throw new StatusException( + Status.INTERNAL.withDescription( + "Postgres user must be superuser or replication role to start walsender.")); + } + } + } + // check whether user has select privilege on table for initial snapshot + try (var stmt = + conn.prepareStatement( + sqlStmts.getProperty("postgres.table_privilege.check"))) { + stmt.setString(1, props.get(DbzConnectorConfig.TABLE_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.USER)); + var res = stmt.executeQuery(); + while (res.next()) { + if (!res.getBoolean(1)) { + throw new StatusException( + Status.INTERNAL.withDescription( + "Postgres user must have select privilege on table " + + props.get( + DbzConnectorConfig.TABLE_NAME))); + } + } + } + // check whether publication exists + boolean publicationExists = false; + boolean partialPublication = false; + try (var stmt = conn.createStatement()) { + var res = + stmt.executeQuery( + sqlStmts.getProperty("postgres.publication_att_exists")); + while (res.next()) { + partialPublication = res.getBoolean(1); + } + } + // pg 15 and up supports partial publication of table + // check whether publication covers all columns + if (partialPublication) { + try (var stmt = + conn.prepareStatement( + sqlStmts.getProperty("postgres.publication_att"))) { + stmt.setString(1, props.get(DbzConnectorConfig.PG_SCHEMA_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); + var res = stmt.executeQuery(); + while (res.next()) { + String[] columnsPub = + (String[]) res.getArray("attnames").getArray(); + var sourceSchema = validate.getTableSchema(); + for (int i = 0; i < sourceSchema.getColumnsCount(); i++) { + String columnName = sourceSchema.getColumns(i).getName(); + if (Arrays.stream(columnsPub).noneMatch(columnName::equals)) { + throw new StatusException( + Status.INTERNAL.withDescription( + "The publication 'dbz_publication' does not cover all necessary columns in table " + + props.get( + DbzConnectorConfig + .TABLE_NAME))); + } + if (i == sourceSchema.getColumnsCount() - 1) { + publicationExists = true; + } + } + if (publicationExists) { + LOG.info("publication exists"); + break; + } + } + } + } else { // check directly whether publication exists + try (var stmt = + conn.prepareStatement( + sqlStmts.getProperty("postgres.publication_cnt"))) { + stmt.setString(1, props.get(DbzConnectorConfig.PG_SCHEMA_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); + var res = stmt.executeQuery(); + while (res.next()) { + if (res.getInt("count") > 0) { + publicationExists = true; + LOG.info("publication exists"); + break; + } + } + } + } + // if publication does not exist, check permission to create publication + if (!publicationExists) { + // check create privilege on database + try (var stmt = + conn.prepareStatement( + sqlStmts.getProperty( + "postgres.database_privilege.check"))) { + stmt.setString(1, props.get(DbzConnectorConfig.USER)); + stmt.setString(2, props.get(DbzConnectorConfig.DB_NAME)); + stmt.setString(3, props.get(DbzConnectorConfig.USER)); + var res = stmt.executeQuery(); + while (res.next()) { + if (!res.getBoolean(1)) { + throw new StatusException( + Status.INTERNAL.withDescription( + "Postgres user must have create privilege on database" + + props.get( + DbzConnectorConfig.DB_NAME))); + } + } + } + // check ownership on table + boolean isTableOwner = false; + String owner = null; + // check if user is owner + try (var stmt = + conn.prepareStatement( + sqlStmts.getProperty("postgres.table_owner"))) { + stmt.setString(1, props.get(DbzConnectorConfig.PG_SCHEMA_NAME)); + stmt.setString(2, props.get(DbzConnectorConfig.TABLE_NAME)); + var res = stmt.executeQuery(); + while (res.next()) { + owner = res.getString("tableowner"); + if (owner.equals(props.get(DbzConnectorConfig.USER))) { + isTableOwner = true; + break; + } + } + } + // if user is not owner, check if user belongs to owner group + if (!isTableOwner && !owner.isEmpty()) { + try (var stmt = + conn.prepareStatement( + sqlStmts.getProperty("postgres.users_of_group"))) { + stmt.setString(1, owner); + var res = stmt.executeQuery(); + while (res.next()) { + String[] users = (String[]) res.getArray("members").getArray(); + if (Arrays.stream(users) + .anyMatch(props.get(DbzConnectorConfig.USER)::equals)) { + isTableOwner = true; + break; + } + } + } + } + if (!isTableOwner) { + throw new StatusException( + Status.INTERNAL.withDescription( + "Postgres user must be owner of table " + + props.get(DbzConnectorConfig.TABLE_NAME))); + } + } break; default: break; diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/common/DbzConnectorConfig.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/common/DbzConnectorConfig.java new file mode 100644 index 0000000000000..cff7e0dc2940d --- /dev/null +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/common/DbzConnectorConfig.java @@ -0,0 +1,141 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.risingwave.sourcenode.common; + +import com.risingwave.connector.api.source.SourceTypeE; +import com.risingwave.connector.cdc.debezium.internal.ConfigurableOffsetBackingStore; +import java.io.IOException; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import org.apache.commons.io.IOUtils; +import org.apache.commons.text.StringSubstitutor; + +public class DbzConnectorConfig { + + /* Common configs */ + public static final String HOST = "hostname"; + public static final String PORT = "port"; + public static final String USER = "username"; + public static final String PASSWORD = "password"; + + public static final String DB_NAME = "database.name"; + public static final String TABLE_NAME = "table.name"; + + /* MySQL specified configs */ + public static final String MYSQL_SERVER_ID = "server.id"; + + /* Postgres specified configs */ + public static final String PG_SLOT_NAME = "slot.name"; + public static final String PG_SCHEMA_NAME = "schema.name"; + + private static final String MYSQL_CONFIG_FILE = "mysql.properties"; + private static final String POSTGRES_CONFIG_FILE = "postgres.properties"; + + public static Map extractDebeziumProperties(Map properties) { + // retain only debezium properties if any + var userProps = new HashMap<>(properties); + userProps.remove(DbzConnectorConfig.HOST); + userProps.remove(DbzConnectorConfig.PORT); + userProps.remove(DbzConnectorConfig.USER); + userProps.remove(DbzConnectorConfig.PASSWORD); + userProps.remove(DbzConnectorConfig.DB_NAME); + userProps.remove(DbzConnectorConfig.TABLE_NAME); + userProps.remove(DbzConnectorConfig.MYSQL_SERVER_ID); + userProps.remove(DbzConnectorConfig.PG_SLOT_NAME); + userProps.remove(DbzConnectorConfig.PG_SCHEMA_NAME); + return userProps; + } + + private final long sourceId; + + private final SourceTypeE sourceType; + + private final Properties resolvedDbzProps; + + public long getSourceId() { + return sourceId; + } + + public SourceTypeE getSourceType() { + return sourceType; + } + + public Properties getResolvedDebeziumProps() { + return resolvedDbzProps; + } + + public DbzConnectorConfig( + SourceTypeE source, long sourceId, String startOffset, Map userProps) { + var dbzProps = new Properties(); + try (var input = getClass().getClassLoader().getResourceAsStream("debezium.properties")) { + assert input != null; + dbzProps.load(input); + } catch (IOException e) { + throw new RuntimeException("failed to load debezium.properties", e); + } + + StringSubstitutor substitutor = new StringSubstitutor(userProps); + if (source == SourceTypeE.MYSQL) { + var mysqlProps = initiateDbConfig(MYSQL_CONFIG_FILE, substitutor); + // if offset is specified, we will continue binlog reading from the specified offset + if (null != startOffset && !startOffset.isBlank()) { + // 'snapshot.mode=schema_only_recovery' must be configured if binlog offset is + // specified. + // It only snapshots the schemas, not the data, and continue binlog reading from the + // specified offset + mysqlProps.setProperty("snapshot.mode", "schema_only_recovery"); + mysqlProps.setProperty( + ConfigurableOffsetBackingStore.OFFSET_STATE_VALUE, startOffset); + } + + dbzProps.putAll(mysqlProps); + } else if (source == SourceTypeE.POSTGRES) { + var postgresProps = initiateDbConfig(POSTGRES_CONFIG_FILE, substitutor); + + // if offset is specified, we will continue reading changes from the specified offset + if (null != startOffset && !startOffset.isBlank()) { + postgresProps.setProperty("snapshot.mode", "never"); + postgresProps.setProperty( + ConfigurableOffsetBackingStore.OFFSET_STATE_VALUE, startOffset); + } + dbzProps.putAll(postgresProps); + } else { + throw new RuntimeException("unsupported source type: " + source); + } + + var otherProps = extractDebeziumProperties(userProps); + dbzProps.putAll(otherProps); + + this.sourceId = sourceId; + this.sourceType = source; + this.resolvedDbzProps = dbzProps; + } + + private Properties initiateDbConfig(String fileName, StringSubstitutor substitutor) { + var dbProps = new Properties(); + try (var input = getClass().getClassLoader().getResourceAsStream(fileName)) { + assert input != null; + var inputStr = IOUtils.toString(input, StandardCharsets.UTF_8); + var resolvedStr = substitutor.replace(inputStr); + dbProps.load(new StringReader(resolvedStr)); + } catch (IOException e) { + throw new RuntimeException("failed to load " + fileName, e); + } + return dbProps; + } +} diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/common/DebeziumCdcUtils.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/common/DebeziumCdcUtils.java deleted file mode 100644 index d4ecc4fe7c132..0000000000000 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/common/DebeziumCdcUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2023 RisingWave Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.risingwave.sourcenode.common; - -import java.util.Properties; - -public class DebeziumCdcUtils { - - /** Common config properties for Debeizum CDC connectors */ - public static Properties createCommonConfig() { - var props = new Properties(); - // capture decimal type in doule values, which may result in a loss of precision but is - // easier to use - // https://debezium.io/documentation/reference/stable/connectors/mysql.html#mysql-property-decimal-handling-mode - props.setProperty("decimal.handling.mode", "double"); - - // Add a converter for `Date` data type, which convert `Date` into a string - props.setProperty("converters", "datetime"); - props.setProperty( - "datetime.type", - "com.risingwave.connector.cdc.debezium.converters.DatetimeTypeConverter"); - props.setProperty("max.batch.size", "1024"); - props.setProperty("max.queue.size", "8192"); - return props; - } -} diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultCdcEngine.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEngine.java similarity index 71% rename from java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultCdcEngine.java rename to java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEngine.java index 1a18ac7f4a731..b9f85ec33b1b2 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultCdcEngine.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEngine.java @@ -15,37 +15,34 @@ package com.risingwave.sourcenode.core; import com.risingwave.connector.api.source.CdcEngine; -import com.risingwave.connector.api.source.SourceConfig; import com.risingwave.proto.ConnectorServiceProto; import io.debezium.embedded.Connect; import io.debezium.engine.DebeziumEngine; import io.debezium.heartbeat.Heartbeat; +import java.util.Properties; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; -public class DefaultCdcEngine implements CdcEngine { +public class DbzCdcEngine implements CdcEngine { static final int DEFAULT_QUEUE_CAPACITY = 16; private final DebeziumEngine engine; - private final CdcEventConsumer consumer; - private final SourceConfig config; + private final DbzCdcEventConsumer consumer; + private final long id; /** If config is not valid will throw exceptions */ - public DefaultCdcEngine(SourceConfig config, DebeziumEngine.CompletionCallback callback) { - var dbzHeartbeatPrefix = - config.getProperties().getProperty(Heartbeat.HEARTBEAT_TOPICS_PREFIX.name()); + public DbzCdcEngine(long id, Properties config, DebeziumEngine.CompletionCallback callback) { + var dbzHeartbeatPrefix = config.getProperty(Heartbeat.HEARTBEAT_TOPICS_PREFIX.name()); var consumer = - new CdcEventConsumer( - config.getId(), - dbzHeartbeatPrefix, - new ArrayBlockingQueue<>(DEFAULT_QUEUE_CAPACITY)); + new DbzCdcEventConsumer( + id, dbzHeartbeatPrefix, new ArrayBlockingQueue<>(DEFAULT_QUEUE_CAPACITY)); // Builds a debezium engine but not start it - this.config = config; + this.id = id; this.consumer = consumer; this.engine = DebeziumEngine.create(Connect.class) - .using(config.getProperties()) + .using(config) .using(callback) .notifying(consumer) .build(); @@ -59,7 +56,7 @@ public void run() { @Override public long getId() { - return config.getId(); + return id; } public void stop() throws Exception { diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultCdcEngineRunner.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEngineRunner.java similarity index 65% rename from java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultCdcEngineRunner.java rename to java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEngineRunner.java index eebe3e30b3373..68104c226924d 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultCdcEngineRunner.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEngineRunner.java @@ -16,7 +16,7 @@ import com.risingwave.connector.api.source.*; import com.risingwave.proto.ConnectorServiceProto; -import io.debezium.engine.DebeziumEngine; +import com.risingwave.sourcenode.common.DbzConnectorConfig; import io.grpc.stub.StreamObserver; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -25,44 +25,40 @@ import org.slf4j.LoggerFactory; /** Single-thread engine runner */ -public class DefaultCdcEngineRunner implements CdcEngineRunner { - static final Logger LOG = LoggerFactory.getLogger(DefaultCdcEngineRunner.class); +public class DbzCdcEngineRunner implements CdcEngineRunner { + static final Logger LOG = LoggerFactory.getLogger(DbzCdcEngineRunner.class); private final ExecutorService executor; private final AtomicBoolean running = new AtomicBoolean(false); private final CdcEngine engine; - public DefaultCdcEngineRunner(CdcEngine engine) { + public DbzCdcEngineRunner(CdcEngine engine) { this.executor = Executors.newSingleThreadExecutor(); this.engine = engine; } public static CdcEngineRunner newCdcEngineRunner( - long sourceId, - SourceConfig config, + DbzConnectorConfig config, StreamObserver responseObserver) { - DefaultCdcEngineRunner runner = null; + DbzCdcEngineRunner runner = null; try { var engine = - new DefaultCdcEngine( - config, - new DebeziumEngine.CompletionCallback() { - @Override - public void handle( - boolean success, String message, Throwable error) { - if (!success) { - responseObserver.onError(error); - LOG.error( - "failed to run the engine. message: {}", - message, - error); - } else { - responseObserver.onCompleted(); - } + new DbzCdcEngine( + config.getSourceId(), + config.getResolvedDebeziumProps(), + (success, message, error) -> { + if (!success) { + responseObserver.onError(error); + LOG.error( + "the engine terminated with error. message: {}", + message, + error); + } else { + responseObserver.onCompleted(); } }); - runner = new DefaultCdcEngineRunner(engine); + runner = new DbzCdcEngineRunner(engine); } catch (Exception e) { LOG.error("failed to create the CDC engine", e); } diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/CdcEventConsumer.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEventConsumer.java similarity index 97% rename from java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/CdcEventConsumer.java rename to java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEventConsumer.java index 5324bd92827e3..499e97b48b704 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/CdcEventConsumer.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzCdcEventConsumer.java @@ -33,16 +33,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CdcEventConsumer +public class DbzCdcEventConsumer implements DebeziumEngine.ChangeConsumer> { - static final Logger LOG = LoggerFactory.getLogger(CdcEventConsumer.class); + static final Logger LOG = LoggerFactory.getLogger(DbzCdcEventConsumer.class); private final BlockingQueue outputChannel; private final long sourceId; private final JsonConverter converter; private final String heartbeatTopicPrefix; - CdcEventConsumer( + DbzCdcEventConsumer( long sourceId, String heartbeatTopicPrefix, BlockingQueue store) { diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultSourceHandler.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzSourceHandler.java similarity index 70% rename from java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultSourceHandler.java rename to java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzSourceHandler.java index 82e0af3e4c446..ee7c2aea839cf 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DefaultSourceHandler.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/DbzSourceHandler.java @@ -14,33 +14,29 @@ package com.risingwave.sourcenode.core; -import com.risingwave.connector.api.source.SourceConfig; import com.risingwave.connector.api.source.SourceHandler; +import com.risingwave.metrics.ConnectorNodeMetrics; import com.risingwave.proto.ConnectorServiceProto.GetEventStreamResponse; +import com.risingwave.sourcenode.common.DbzConnectorConfig; import io.grpc.Context; import io.grpc.stub.ServerCallStreamObserver; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** Default handler for RPC request */ -public class DefaultSourceHandler implements SourceHandler { - static final Logger LOG = LoggerFactory.getLogger(DefaultSourceHandler.class); +/** * handler for starting a debezium source connectors */ +public class DbzSourceHandler implements SourceHandler { + static final Logger LOG = LoggerFactory.getLogger(DbzSourceHandler.class); - private final SourceConfig config; + private final DbzConnectorConfig config; - private DefaultSourceHandler(SourceConfig config) { + public DbzSourceHandler(DbzConnectorConfig config) { this.config = config; } - public static DefaultSourceHandler newWithConfig(SourceConfig config) { - return new DefaultSourceHandler(config); - } - @Override - public void handle(ServerCallStreamObserver responseObserver) { - var runner = - DefaultCdcEngineRunner.newCdcEngineRunner(config.getId(), config, responseObserver); + public void startSource(ServerCallStreamObserver responseObserver) { + var runner = DbzCdcEngineRunner.newCdcEngineRunner(config, responseObserver); if (runner == null) { responseObserver.onCompleted(); return; @@ -49,7 +45,7 @@ public void handle(ServerCallStreamObserver responseObse try { // Start the engine runner.start(); - LOG.info("Start consuming events of table {}", config.getId()); + LOG.info("Start consuming events of table {}", config.getSourceId()); while (runner.isRunning()) { try { // Thread will block on the channel to get output from engine @@ -62,10 +58,13 @@ public void handle(ServerCallStreamObserver responseObse // wait a bit to avoid OOM Thread.sleep(500); } - + ConnectorNodeMetrics.incSourceRowsReceived( + config.getSourceType().toString(), + String.valueOf(config.getSourceId()), + resp.getEventsCount()); LOG.debug( "Engine#{}: emit one chunk {} events to network ", - config.getId(), + config.getSourceId(), resp.getEventsCount()); responseObserver.onNext(resp); } @@ -73,7 +72,7 @@ public void handle(ServerCallStreamObserver responseObse if (Context.current().isCancelled()) { LOG.info( "Engine#{}: Connection broken detected, stop the engine", - config.getId()); + config.getSourceId()); runner.stop(); } } catch (InterruptedException e) { @@ -85,9 +84,9 @@ public void handle(ServerCallStreamObserver responseObse try { runner.stop(); } catch (Exception e) { - LOG.warn("Failed to stop Engine#{}", config.getId(), e); + LOG.warn("Failed to stop Engine#{}", config.getSourceId(), e); } } - LOG.info("End consuming events of table {}", config.getId()); + LOG.info("End consuming events of table {}", config.getSourceId()); } } diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/SourceHandlerFactory.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/SourceHandlerFactory.java index 51877adba7a3e..8692f25da25dd 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/SourceHandlerFactory.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/core/SourceHandlerFactory.java @@ -14,11 +14,10 @@ package com.risingwave.sourcenode.core; -import com.risingwave.connector.api.source.ConnectorConfig; import com.risingwave.connector.api.source.SourceHandler; import com.risingwave.connector.api.source.SourceTypeE; -import com.risingwave.sourcenode.mysql.MySqlSourceConfig; -import com.risingwave.sourcenode.postgres.PostgresSourceConfig; +import com.risingwave.sourcenode.common.DbzConnectorConfig; +import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,17 +25,9 @@ public abstract class SourceHandlerFactory { static final Logger LOG = LoggerFactory.getLogger(SourceHandlerFactory.class); public static SourceHandler createSourceHandler( - SourceTypeE type, long sourceId, String startOffset, ConnectorConfig userProps) { - switch (type) { - case MYSQL: - return DefaultSourceHandler.newWithConfig( - new MySqlSourceConfig(sourceId, startOffset, userProps)); - case POSTGRES: - return DefaultSourceHandler.newWithConfig( - new PostgresSourceConfig(sourceId, startOffset, userProps)); - default: - LOG.warn("unknown source type: {}", type); - return null; - } + SourceTypeE source, long sourceId, String startOffset, Map userProps) { + var config = new DbzConnectorConfig(source, sourceId, startOffset, userProps); + LOG.info("resolved config for source#{}: {}", sourceId, config.getResolvedDebeziumProps()); + return new DbzSourceHandler(config); } } diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/mysql/MySqlSourceConfig.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/mysql/MySqlSourceConfig.java deleted file mode 100644 index 78f36e8bcf7f9..0000000000000 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/mysql/MySqlSourceConfig.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2023 RisingWave Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.risingwave.sourcenode.mysql; - -import com.risingwave.connector.api.source.ConnectorConfig; -import com.risingwave.connector.api.source.SourceConfig; -import com.risingwave.connector.api.source.SourceTypeE; -import com.risingwave.connector.cdc.debezium.internal.ConfigurableOffsetBackingStore; -import com.risingwave.sourcenode.common.DebeziumCdcUtils; -import java.util.Properties; - -/** MySQL Source Config */ -public class MySqlSourceConfig implements SourceConfig { - static final String DB_SERVER_NAME_PREFIX = "RW_CDC_"; - private final Properties props = DebeziumCdcUtils.createCommonConfig(); - private final long id; - private final String sourceName; - - public MySqlSourceConfig(long sourceId, String startOffset, ConnectorConfig userProps) { - id = sourceId; - props.setProperty("connector.class", "io.debezium.connector.mysql.MySqlConnector"); - props.setProperty( - "offset.storage", ConfigurableOffsetBackingStore.class.getCanonicalName()); - - props.setProperty( - "database.history", "io.debezium.relational.history.MemoryDatabaseHistory"); - // if offset is specified, we will continue binlog reading from the specified offset - if (null != startOffset && !startOffset.isBlank()) { - // 'snapshot.mode=schema_only_recovery' must be configured if binlog offset is - // specified. - // It only snapshots the schemas, not the data, and continue binlog reading from the - // specified offset - props.setProperty("snapshot.mode", "schema_only_recovery"); - props.setProperty(ConfigurableOffsetBackingStore.OFFSET_STATE_VALUE, startOffset); - } - - // Begin of connector configs - props.setProperty("database.hostname", userProps.get(ConnectorConfig.HOST)); - props.setProperty("database.port", userProps.get(ConnectorConfig.PORT)); - props.setProperty("database.user", userProps.get(ConnectorConfig.USER)); - props.setProperty("database.password", userProps.get(ConnectorConfig.PASSWORD)); - - props.setProperty("database.include.list", userProps.get(ConnectorConfig.DB_NAME)); - // only captures data of the specified table - String tableFilter = - userProps.getNonNull(ConnectorConfig.DB_NAME) - + "." - + userProps.getNonNull(ConnectorConfig.TABLE_NAME); - props.setProperty("table.include.list", tableFilter); - - // disable schema change events for current stage - props.setProperty("include.schema.changes", "false"); - - // ServerId must be unique since the connector will join the mysql cluster as a client. - // By default, we generate serverId by adding a fixed number to the sourceId generated by - // Meta. We may allow user to specify the ID in the future. - props.setProperty("database.server.id", userProps.get(ConnectorConfig.MYSQL_SERVER_ID)); - props.setProperty("database.server.name", DB_SERVER_NAME_PREFIX + tableFilter); - - // host:port:database.table - sourceName = - userProps.get(ConnectorConfig.HOST) - + ":" - + userProps.get(ConnectorConfig.PORT) - + ":" - + userProps.get(ConnectorConfig.DB_NAME) - + "." - + userProps.get(ConnectorConfig.TABLE_NAME); - - props.setProperty("name", sourceName); - - // pass through debezium properties if any - var dbzProperties = ConnectorConfig.extractDebeziumProperties(userProps); - props.putAll(dbzProperties); - } - - @Override - public long getId() { - return id; - } - - @Override - public String getSourceName() { - return sourceName; - } - - @Override - public SourceTypeE getSourceType() { - return SourceTypeE.MYSQL; - } - - @Override - public Properties getProperties() { - return props; - } -} diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/postgres/PostgresSourceConfig.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/postgres/PostgresSourceConfig.java deleted file mode 100644 index 6b492397dcb90..0000000000000 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/sourcenode/postgres/PostgresSourceConfig.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2023 RisingWave Labs -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.risingwave.sourcenode.postgres; - -import com.risingwave.connector.api.source.ConnectorConfig; -import com.risingwave.connector.api.source.SourceConfig; -import com.risingwave.connector.api.source.SourceTypeE; -import com.risingwave.connector.cdc.debezium.internal.ConfigurableOffsetBackingStore; -import com.risingwave.sourcenode.common.DebeziumCdcUtils; -import io.debezium.heartbeat.Heartbeat; -import java.time.Duration; -import java.util.Properties; - -/** Postgres Source Config */ -public class PostgresSourceConfig implements SourceConfig { - static final String DB_SERVER_NAME_PREFIX = "RW_CDC_"; - private final Properties props = DebeziumCdcUtils.createCommonConfig(); - private final long id; - private final String sourceName; - private static final long DEFAULT_HEARTBEAT_MS = Duration.ofMinutes(5).toMillis(); - - public PostgresSourceConfig(long sourceId, String startOffset, ConnectorConfig userProps) { - id = sourceId; - props.setProperty("connector.class", "io.debezium.connector.postgresql.PostgresConnector"); - props.setProperty( - "offset.storage", ConfigurableOffsetBackingStore.class.getCanonicalName()); - props.setProperty( - "database.history", "io.debezium.relational.history.MemoryDatabaseHistory"); - - // if offset is specified, we will continue reading changes from the specified offset - if (null != startOffset && !startOffset.isBlank()) { - props.setProperty("snapshot.mode", "never"); - props.setProperty(ConfigurableOffsetBackingStore.OFFSET_STATE_VALUE, startOffset); - } - - String dbName = userProps.getNonNull(ConnectorConfig.DB_NAME); - String schema = userProps.getNonNull(ConnectorConfig.PG_SCHEMA_NAME); - String table = userProps.getNonNull(ConnectorConfig.TABLE_NAME); - - // Begin of connector configs - props.setProperty("database.hostname", userProps.get(ConnectorConfig.HOST)); - props.setProperty("database.port", userProps.get(ConnectorConfig.PORT)); - props.setProperty("database.user", userProps.get(ConnectorConfig.USER)); - props.setProperty("database.password", userProps.get(ConnectorConfig.PASSWORD)); - props.setProperty("database.dbname", dbName); - // The name of the PostgreSQL logical decoding plug-in installed on the PostgreSQL server. - // Supported values are decoderbufs, and pgoutput. - // The wal2json plug-in is deprecated and scheduled for removal. - // see - // https://debezium.io/documentation/reference/1.9/connectors/postgresql.html#postgresql-property-plugin-name - props.setProperty("plugin.name", "pgoutput"); - - // The name of the PostgreSQL logical decoding slot that was created for streaming changes - // from a particular plug-in for a particular database/schema. The server uses this slot to - // stream events - // to the Debezium connector that you are configuring. - // Slot names must conform to PostgreSQL replication slot naming rules, - // which state: "Each replication slot has a name, which can contain lower-case letters, - // numbers, and the underscore character." - props.setProperty("slot.name", userProps.get(ConnectorConfig.PG_SLOT_NAME)); - - // Sending heartbeat messages enables the connector to send the latest retrieved LSN to the - // database, which allows the database to reclaim disk space being - // used by no longer needed WAL files. - // https://debezium.io/documentation/reference/1.9/connectors/postgresql.html#postgresql-property-heartbeat-interval-ms - props.setProperty("heartbeat.interval.ms", String.valueOf(DEFAULT_HEARTBEAT_MS)); - props.setProperty( - Heartbeat.HEARTBEAT_TOPICS_PREFIX.name(), - Heartbeat.HEARTBEAT_TOPICS_PREFIX.defaultValueAsString()); - - String tableFilter = schema + "." + table; - props.setProperty("table.include.list", tableFilter); - props.setProperty("database.server.name", DB_SERVER_NAME_PREFIX + tableFilter); - - // host:port:database.schema.table - sourceName = - userProps.getNonNull(ConnectorConfig.HOST) - + ":" - + userProps.getNonNull(ConnectorConfig.PORT) - + ":" - + dbName - + "." - + schema - + "." - + table; - props.setProperty("name", sourceName); - - // pass through debezium properties if any - var dbzProperties = ConnectorConfig.extractDebeziumProperties(userProps); - props.putAll(dbzProperties); - } - - @Override - public long getId() { - return id; - } - - @Override - public String getSourceName() { - return sourceName; - } - - @Override - public SourceTypeE getSourceType() { - return SourceTypeE.POSTGRES; - } - - @Override - public Properties getProperties() { - return props; - } -} diff --git a/java/connector-node/risingwave-connector-service/src/main/resources/debezium.properties b/java/connector-node/risingwave-connector-service/src/main/resources/debezium.properties new file mode 100644 index 0000000000000..666e547188d9a --- /dev/null +++ b/java/connector-node/risingwave-connector-service/src/main/resources/debezium.properties @@ -0,0 +1,8 @@ +# Store common debezium configs shared by all connectors +decimal.handling.mode=double +converters=datetime +datetime.type=com.risingwave.connector.cdc.debezium.converters.DatetimeTypeConverter +max.batch.size=1024 +max.queue.size=8192 + +time.precision.mode=adaptive_time_microseconds diff --git a/java/connector-node/risingwave-connector-service/src/main/resources/mysql.properties b/java/connector-node/risingwave-connector-service/src/main/resources/mysql.properties new file mode 100644 index 0000000000000..d7b9b384ca4b1 --- /dev/null +++ b/java/connector-node/risingwave-connector-service/src/main/resources/mysql.properties @@ -0,0 +1,21 @@ +# configs for mysql connector +connector.class=io.debezium.connector.mysql.MySqlConnector +offset.storage=com.risingwave.connector.cdc.debezium.internal.ConfigurableOffsetBackingStore +database.history=io.debezium.relational.history.MemoryDatabaseHistory +# default snapshot mode to initial +snapshot.mode=${debezium.snapshot.mode:-initial} + +database.hostname=${hostname} +database.port=${port} +database.user=${username} +database.password=${password} + +database.include.list=${database.name} +table.include.list=${database.name}.${table.name} + +# default to disable schema change events +include.schema.changes=${debezium.include.schema.changes:-false} +database.server.id=${server.id} +database.server.name=RW_CDC_${database.name}.${table.name} + +name=${hostname}:${port}:${database.name}.${table.name} diff --git a/java/connector-node/risingwave-connector-service/src/main/resources/postgres.properties b/java/connector-node/risingwave-connector-service/src/main/resources/postgres.properties new file mode 100644 index 0000000000000..05e10d44f0eb9 --- /dev/null +++ b/java/connector-node/risingwave-connector-service/src/main/resources/postgres.properties @@ -0,0 +1,30 @@ +# configs for postgres conneoctor +connector.class=io.debezium.connector.postgresql.PostgresConnector +offset.storage=com.risingwave.connector.cdc.debezium.internal.ConfigurableOffsetBackingStore +database.history=io.debezium.relational.history.MemoryDatabaseHistory +# default snapshot mode to initial +snapshot.mode=${debezium.snapshot.mode:-initial} + +database.hostname=${hostname} +database.port=${port} +database.user=${username} +database.password=${password} + +database.dbname=${database.name} +table.include.list=${schema.name}.${table.name} + +# The name of the PostgreSQL replication slot +slot.name=${slot.name} + +# default plugin name is 'pgoutput' +plugin.name=${debezium.plugin.name:-pgoutput} + +# allow to auto create publication for given tables +publication.autocreate.mode=${debezium.publication.autocreate.mode:-filtered} + +# default heartbeat interval 5 mins +heartbeat.interval.ms=${debezium.heartbeat.interval.ms:-300000} +heartbeat.topics.prefix=${debezium.heartbeat.topics.prefix:-RW_CDC_HeartBeat_} + +database.server.name=RW_CDC_${database.name}.${table.name} +name=${hostname}:${port}:${database.name}.${schema.name}.${table.name} diff --git a/java/connector-node/risingwave-connector-service/src/main/resources/validate_sql.properties b/java/connector-node/risingwave-connector-service/src/main/resources/validate_sql.properties index 0f84c4401baa9..bff8753a85d06 100644 --- a/java/connector-node/risingwave-connector-service/src/main/resources/validate_sql.properties +++ b/java/connector-node/risingwave-connector-service/src/main/resources/validate_sql.properties @@ -8,3 +8,28 @@ postgres.table=SELECT EXISTS ( SELECT FROM pg_tables WHERE schemaname = ? AND ta postgres.pk=SELECT a.attname, format_type(a.atttypid, a.atttypmod) AS data_type FROM pg_index i JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) WHERE i.indrelid = ?::regclass AND i.indisprimary postgres.table_schema=SELECT column_name, data_type FROM information_schema.columns WHERE table_schema = ? AND table_name = ? ORDER BY ordinal_position postgres.slot.check=SELECT slot_name FROM pg_replication_slots WHERE slot_name = ? +postgres.role.check=SELECT rolreplication OR rolsuper FROM pg_roles WHERE rolname = ? +postgres.database_privilege.check=SELECT has_database_privilege(?, ?, 'create') FROM pg_roles WHERE rolname = ? +postgres.table_privilege.check=SELECT (COUNT(*) = 1) FROM information_schema.role_table_grants WHERE table_name = ? AND grantee = ? and privilege_type = 'SELECT' +postgres.table_owner=SELECT tableowner FROM pg_tables WHERE schemaname = ? and tablename = ? +postgres.publication_att_exists=SELECT count(*) > 0 FROM information_schema.columns WHERE table_name = 'pg_publication_tables' AND column_name = 'attnames' +postgres.publication_att=SELECT attnames FROM pg_publication_tables WHERE schemaname = ? AND tablename = ? AND pubname = 'dbz_publication' +postgres.publication_cnt=SELECT COUNT(*) AS count FROM pg_publication_tables WHERE schemaname = ? AND tablename = ? AND pubname = 'dbz_publication' +postgres.users_of_group=WITH RECURSIVE base (g, m) AS (( \ +SELECT r1.rolname as group, ARRAY_AGG(DISTINCT(r2.rolname)) as members FROM pg_auth_members am \ +INNER JOIN pg_roles r1 ON r1.oid = am.roleid \ +INNER JOIN pg_roles r2 ON r2.oid = am.member \ +WHERE r1.rolname = ? \ +GROUP BY r1.rolname \ +) \ +UNION ALL ( \ +WITH groups AS (SELECT DISTINCT(UNNEST(m)) AS g FROM base) \ +SELECT r1.rolname as group, ARRAY_AGG(DISTINCT(r2.rolname)) as members FROM pg_auth_members am \ +INNER JOIN pg_roles r1 ON r1.oid = am.roleid \ +INNER JOIN pg_roles r2 ON r2.oid = am.member \ +INNER JOIN groups ON r1.rolname = groups.g \ +GROUP BY r1.rolname \ +) \ +), \ +tmp AS (SELECT DISTINCT(UNNEST(m)) AS members FROM base) \ +SELECT ARRAY_AGG(members) AS members FROM tmp diff --git a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/IcebergSinkFactory.java b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/IcebergSinkFactory.java index 424f7e415d58f..1cdb1edf0e468 100644 --- a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/IcebergSinkFactory.java +++ b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/IcebergSinkFactory.java @@ -39,7 +39,7 @@ public class IcebergSinkFactory implements SinkFactory { private static final Logger LOG = LoggerFactory.getLogger(IcebergSinkFactory.class); - public static final String SINK_MODE_PROP = "sink.mode"; + public static final String SINK_TYPE_PROP = "type"; public static final String WAREHOUSE_PATH_PROP = "warehouse.path"; public static final String DATABASE_NAME_PROP = "database.name"; public static final String TABLE_NAME_PROP = "table.name"; @@ -58,7 +58,7 @@ public class IcebergSinkFactory implements SinkFactory { @Override public SinkBase create(TableSchema tableSchema, Map tableProperties) { - String mode = tableProperties.get(SINK_MODE_PROP); + String mode = tableProperties.get(SINK_TYPE_PROP); String warehousePath = getWarehousePath(tableProperties); String databaseName = tableProperties.get(DATABASE_NAME_PROP); String tableName = tableProperties.get(TABLE_NAME_PROP); @@ -93,7 +93,7 @@ public SinkBase create(TableSchema tableSchema, Map tablePropert @Override public void validate( TableSchema tableSchema, Map tableProperties, SinkType sinkType) { - if (!tableProperties.containsKey(SINK_MODE_PROP) // only append-only, upsert + if (!tableProperties.containsKey(SINK_TYPE_PROP) // only append-only, upsert || !tableProperties.containsKey(WAREHOUSE_PATH_PROP) || !tableProperties.containsKey(DATABASE_NAME_PROP) || !tableProperties.containsKey(TABLE_NAME_PROP)) { @@ -101,14 +101,14 @@ public void validate( .withDescription( String.format( "%s, %s, %s or %s is not specified", - SINK_MODE_PROP, + SINK_TYPE_PROP, WAREHOUSE_PATH_PROP, DATABASE_NAME_PROP, TABLE_NAME_PROP)) .asRuntimeException(); } - String mode = tableProperties.get(SINK_MODE_PROP); + String mode = tableProperties.get(SINK_TYPE_PROP); String databaseName = tableProperties.get(DATABASE_NAME_PROP); String tableName = tableProperties.get(TABLE_NAME_PROP); String warehousePath = getWarehousePath(tableProperties); diff --git a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowMap.java b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowMap.java index 7bad8abea65ef..a817e715a45d3 100644 --- a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowMap.java +++ b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowMap.java @@ -19,6 +19,7 @@ import io.grpc.Status; import java.util.List; import java.util.TreeMap; +import org.apache.iceberg.data.Record; public class SinkRowMap { TreeMap>, SinkRowOp> map = new TreeMap<>(new PkComparator()); @@ -27,7 +28,7 @@ public void clear() { map.clear(); } - public void insert(List> key, SinkRow row) { + public void insert(List> key, Record row) { if (!map.containsKey(key)) { map.put(key, SinkRowOp.insertOp(row)); } else { @@ -42,19 +43,20 @@ public void insert(List> key, SinkRow row) { } } - public void delete(List> key, SinkRow row) { + public void delete(List> key, Record row) { if (!map.containsKey(key)) { map.put(key, SinkRowOp.deleteOp(row)); } else { SinkRowOp sinkRowOp = map.get(key); - SinkRow insert = sinkRowOp.getInsert(); + Record insert = sinkRowOp.getInsert(); if (insert == null) { throw Status.FAILED_PRECONDITION .withDescription("try to double delete a primary key") .asRuntimeException(); } - assertRowValuesEqual(insert, row); - SinkRow delete = sinkRowOp.getDelete(); + // TODO: may enable it again + // assertRowValuesEqual(insert, row); + Record delete = sinkRowOp.getDelete(); if (delete != null) { map.put(key, SinkRowOp.deleteOp(delete)); } else { diff --git a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowOp.java b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowOp.java index 1ac28644a75b2..67b42b078914a 100644 --- a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowOp.java +++ b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/SinkRowOp.java @@ -14,14 +14,14 @@ package com.risingwave.connector; -import com.risingwave.connector.api.sink.SinkRow; import io.grpc.Status; +import org.apache.iceberg.data.Record; public class SinkRowOp { - private final SinkRow delete; - private final SinkRow insert; + private final Record delete; + private final Record insert; - public static SinkRowOp insertOp(SinkRow row) { + public static SinkRowOp insertOp(Record row) { if (row == null) { throw Status.FAILED_PRECONDITION .withDescription("row op must not be null to initialize insertOp") @@ -30,7 +30,7 @@ public static SinkRowOp insertOp(SinkRow row) { return new SinkRowOp(null, row); } - public static SinkRowOp deleteOp(SinkRow row) { + public static SinkRowOp deleteOp(Record row) { if (row == null) { throw Status.FAILED_PRECONDITION .withDescription("row op must not be null to initialize deleteOp") @@ -39,7 +39,7 @@ public static SinkRowOp deleteOp(SinkRow row) { return new SinkRowOp(row, null); } - public static SinkRowOp updateOp(SinkRow delete, SinkRow insert) { + public static SinkRowOp updateOp(Record delete, Record insert) { if (delete == null || insert == null) { throw Status.FAILED_PRECONDITION .withDescription("row ops must not be null initialize updateOp") @@ -48,7 +48,7 @@ public static SinkRowOp updateOp(SinkRow delete, SinkRow insert) { return new SinkRowOp(delete, insert); } - private SinkRowOp(SinkRow delete, SinkRow insert) { + private SinkRowOp(Record delete, Record insert) { this.delete = delete; this.insert = insert; } @@ -57,11 +57,11 @@ public boolean isDelete() { return insert == null && delete != null; } - public SinkRow getDelete() { + public Record getDelete() { return delete; } - public SinkRow getInsert() { + public Record getInsert() { return insert; } } diff --git a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/UpsertIcebergSink.java b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/UpsertIcebergSink.java index a0522602a4c32..8c26f7b3659e2 100644 --- a/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/UpsertIcebergSink.java +++ b/java/connector-node/risingwave-sink-iceberg/src/main/java/com/risingwave/connector/UpsertIcebergSink.java @@ -75,7 +75,7 @@ public UpsertIcebergSink( .collect(Collectors.toList()); } - private Record newRecord(Schema schema, SinkRow row) { + private static Record newRecord(Schema schema, SinkRow row) { Record record = GenericRecord.create(schema); for (int i = 0; i < schema.columns().size(); i++) { record.set(i, row.get(i)); @@ -174,10 +174,10 @@ public void write(Iterator rows) { } switch (row.getOp()) { case INSERT: - sinkRowMap.insert(getKeyFromRow(row), row); + sinkRowMap.insert(getKeyFromRow(row), newRecord(rowSchema, row)); break; case DELETE: - sinkRowMap.delete(getKeyFromRow(row), row); + sinkRowMap.delete(getKeyFromRow(row), newRecord(deleteRowSchema, row)); break; case UPDATE_DELETE: if (updateBufferExists) { @@ -186,7 +186,7 @@ public void write(Iterator rows) { "an UPDATE_INSERT should precede an UPDATE_DELETE") .asRuntimeException(); } - sinkRowMap.delete(getKeyFromRow(row), row); + sinkRowMap.delete(getKeyFromRow(row), newRecord(deleteRowSchema, row)); updateBufferExists = true; break; case UPDATE_INSERT: @@ -196,7 +196,7 @@ public void write(Iterator rows) { "an UPDATE_INSERT should precede an UPDATE_DELETE") .asRuntimeException(); } - sinkRowMap.insert(getKeyFromRow(row), row); + sinkRowMap.insert(getKeyFromRow(row), newRecord(rowSchema, row)); updateBufferExists = false; break; default: @@ -217,13 +217,13 @@ public void sync() { newEqualityDeleteWriter(entry.getKey()); DataWriter dataWriter = newDataWriter(entry.getKey()); for (SinkRowOp sinkRowOp : entry.getValue().map.values()) { - SinkRow insert = sinkRowOp.getInsert(); - SinkRow delete = sinkRowOp.getDelete(); + Record insert = sinkRowOp.getInsert(); + Record delete = sinkRowOp.getDelete(); if (insert != null) { - dataWriter.write(newRecord(rowSchema, insert)); + dataWriter.write(insert); } if (delete != null) { - equalityDeleteWriter.write(newRecord(deleteRowSchema, delete)); + equalityDeleteWriter.write(delete); } } try { diff --git a/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/IcebergSinkFactoryTest.java b/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/IcebergSinkFactoryTest.java index 6ff0ce99e38a8..832ac2746f973 100644 --- a/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/IcebergSinkFactoryTest.java +++ b/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/IcebergSinkFactoryTest.java @@ -64,7 +64,7 @@ public void testCreate() throws IOException { sinkFactory.create( TableSchema.getMockTableSchema(), Map.of( - IcebergSinkFactory.SINK_MODE_PROP, + IcebergSinkFactory.SINK_TYPE_PROP, sinkMode, IcebergSinkFactory.WAREHOUSE_PATH_PROP, warehousePath, diff --git a/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/SinkRowMapTest.java b/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/SinkRowMapTest.java index f4cdd8d988c71..c5048aca40762 100644 --- a/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/SinkRowMapTest.java +++ b/java/connector-node/risingwave-sink-iceberg/src/test/java/com/risingwave/connector/SinkRowMapTest.java @@ -21,6 +21,10 @@ import com.risingwave.proto.Data; import java.util.ArrayList; import java.util.List; +import org.apache.iceberg.Schema; +import org.apache.iceberg.data.GenericRecord; +import org.apache.iceberg.data.Record; +import org.apache.iceberg.types.Types; import org.junit.Assert; import org.junit.Test; @@ -31,29 +35,42 @@ public void testInsert() { SinkRow row = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1); List> key = new ArrayList<>(); key.add((Comparable) row.get(0)); + Schema schema = new Schema(Types.NestedField.optional(0, "id", Types.IntegerType.get())); + Record r = GenericRecord.create(schema); + r.set(0, row.get(0)); - sinkRowMap.insert(key, row); + sinkRowMap.insert(key, r); assertEquals(1, sinkRowMap.map.size()); assertEquals(null, sinkRowMap.map.get(key).getDelete()); - assertEquals(row, sinkRowMap.map.get(key).getInsert()); + assertEquals(r, sinkRowMap.map.get(key).getInsert()); } @Test public void testInsertAfterDelete() { SinkRowMap sinkRowMap = new SinkRowMap(); + Schema schema = + new Schema( + Types.NestedField.optional(0, "id", Types.IntegerType.get()), + Types.NestedField.optional(1, "name", Types.StringType.get())); SinkRow row1 = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1, "Alice"); List> key1 = new ArrayList<>(); key1.add((Comparable) row1.get(0)); + Record r1 = GenericRecord.create(schema); + r1.set(0, row1.get(0)); + r1.set(1, row1.get(1)); SinkRow row2 = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1, "Bob"); List> key2 = new ArrayList<>(); key2.add((Comparable) row2.get(0)); + Record r2 = GenericRecord.create(schema); + r2.set(0, row2.get(0)); + r2.set(1, row2.get(1)); - sinkRowMap.delete(key1, row1); - sinkRowMap.insert(key1, row2); + sinkRowMap.delete(key1, r1); + sinkRowMap.insert(key1, r2); assertEquals(1, sinkRowMap.map.size()); - assertEquals(row1, sinkRowMap.map.get(key1).getDelete()); - assertEquals(row2, sinkRowMap.map.get(key1).getInsert()); + assertEquals(r1, sinkRowMap.map.get(key1).getDelete()); + assertEquals(r2, sinkRowMap.map.get(key1).getInsert()); } @Test @@ -62,11 +79,14 @@ public void testInsertAfterInsert() { SinkRow row = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1); List> key = new ArrayList<>(); key.add((Comparable) row.get(0)); + Schema schema = new Schema(Types.NestedField.optional(0, "id", Types.IntegerType.get())); + Record r = GenericRecord.create(schema); + r.set(0, row.get(0)); - sinkRowMap.insert(key, row); + sinkRowMap.insert(key, r); boolean exceptionThrown = false; try { - sinkRowMap.insert(key, row); + sinkRowMap.insert(key, r); } catch (RuntimeException e) { exceptionThrown = true; Assert.assertTrue( @@ -87,10 +107,14 @@ public void testDelete() { List> key = new ArrayList<>(); key.add((Comparable) row.get(0)); - sinkRowMap.delete(key, row); + Schema schema = new Schema(Types.NestedField.optional(0, "id", Types.IntegerType.get())); + Record r = GenericRecord.create(schema); + r.set(0, row.get(0)); + + sinkRowMap.delete(key, r); assertEquals(1, sinkRowMap.map.size()); assertEquals(null, sinkRowMap.map.get(key).getInsert()); - assertEquals(row, sinkRowMap.map.get(key).getDelete()); + assertEquals(r, sinkRowMap.map.get(key).getDelete()); } @Test @@ -100,10 +124,14 @@ public void testDeleteAfterDelete() { List> key = new ArrayList<>(); key.add((Comparable) row.get(0)); - sinkRowMap.delete(key, row); + Schema schema = new Schema(Types.NestedField.optional(0, "id", Types.IntegerType.get())); + Record r = GenericRecord.create(schema); + r.set(0, row.get(0)); + + sinkRowMap.delete(key, r); boolean exceptionThrown = false; try { - sinkRowMap.delete(key, row); + sinkRowMap.delete(key, r); } catch (RuntimeException e) { exceptionThrown = true; Assert.assertTrue( @@ -122,8 +150,12 @@ public void testDeleteAfterInsert() { List> key = new ArrayList<>(); key.add((Comparable) row.get(0)); - sinkRowMap.insert(key, row); - sinkRowMap.delete(key, row); + Schema schema = new Schema(Types.NestedField.optional(0, "id", Types.IntegerType.get())); + Record r = GenericRecord.create(schema); + r.set(0, row.get(0)); + + sinkRowMap.insert(key, r); + sinkRowMap.delete(key, r); assertEquals(0, sinkRowMap.map.size()); } @@ -131,19 +163,31 @@ public void testDeleteAfterInsert() { public void testDeleteAfterUpdate() { SinkRowMap sinkRowMap = new SinkRowMap(); + Schema schema = + new Schema( + Types.NestedField.optional(0, "id", Types.IntegerType.get()), + Types.NestedField.optional(1, "name", Types.StringType.get())); + SinkRow row1 = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1, "Alice"); List> key1 = new ArrayList<>(); key1.add((Comparable) row1.get(0)); + Record r1 = GenericRecord.create(schema); + r1.set(0, row1.get(0)); + r1.set(1, row1.get(1)); + SinkRow row2 = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1, "Clare"); List> key2 = new ArrayList<>(); key2.add((Comparable) row2.get(0)); + Record r2 = GenericRecord.create(schema); + r2.set(0, row2.get(0)); + r2.set(1, row2.get(1)); - sinkRowMap.delete(key1, row1); - sinkRowMap.insert(key2, row2); - sinkRowMap.delete(key2, row2); + sinkRowMap.delete(key1, r1); + sinkRowMap.insert(key2, r2); + sinkRowMap.delete(key2, r2); assertEquals(1, sinkRowMap.map.size()); assertEquals(null, sinkRowMap.map.get(key1).getInsert()); - assertEquals(row1, sinkRowMap.map.get(key1).getDelete()); + assertEquals(r1, sinkRowMap.map.get(key1).getDelete()); } @Test @@ -153,7 +197,10 @@ public void testClear() { SinkRow row = new ArraySinkRow(Data.Op.OP_UNSPECIFIED, 1); List> key = new ArrayList<>(); key.add((Comparable) row.get(0)); - sinkRowMap.insert(key, row); + Schema schema = new Schema(Types.NestedField.optional(0, "id", Types.IntegerType.get())); + Record r = GenericRecord.create(schema); + r.set(0, row.get(0)); + sinkRowMap.insert(key, r); sinkRowMap.clear(); assertEquals(0, sinkRowMap.map.size()); diff --git a/java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSinkFactory.java b/java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSinkFactory.java index 2f3c6d420087d..8e03db0032432 100644 --- a/java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSinkFactory.java +++ b/java/connector-node/risingwave-sink-jdbc/src/main/java/com/risingwave/connector/JDBCSinkFactory.java @@ -56,12 +56,18 @@ public void validate( String tableName = tableProperties.get(TABLE_NAME_PROP); Set jdbcColumns = new HashSet<>(); Set jdbcPk = new HashSet<>(); + Set jdbcTableNames = new HashSet<>(); try (Connection conn = DriverManager.getConnection(jdbcUrl); + ResultSet tableNamesResultSet = + conn.getMetaData().getTables(null, null, "%", null); ResultSet columnResultSet = conn.getMetaData().getColumns(null, null, tableName, null); ResultSet pkResultSet = conn.getMetaData().getPrimaryKeys(null, null, tableName); ) { + while (tableNamesResultSet.next()) { + jdbcTableNames.add(tableNamesResultSet.getString("TABLE_NAME")); + } while (columnResultSet.next()) { jdbcColumns.add(columnResultSet.getString("COLUMN_NAME")); } @@ -69,7 +75,15 @@ public void validate( jdbcPk.add(pkResultSet.getString("COLUMN_NAME")); } } catch (SQLException e) { - throw Status.INTERNAL.withCause(e).asRuntimeException(); + throw Status.INVALID_ARGUMENT + .withDescription("failed to connect to target database: " + e.getSQLState()) + .asRuntimeException(); + } + + if (!jdbcTableNames.contains(tableName)) { + throw Status.INVALID_ARGUMENT + .withDescription("table not found: " + tableName) + .asRuntimeException(); } // Check that all columns in tableSchema exist in the JDBC table. diff --git a/java/connector-node/risingwave-source-test/pom.xml b/java/connector-node/risingwave-source-test/pom.xml index 6da046213366b..8959ebb39467a 100644 --- a/java/connector-node/risingwave-source-test/pom.xml +++ b/java/connector-node/risingwave-source-test/pom.xml @@ -17,6 +17,18 @@ + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-slf4j-impl + + + org.apache.logging.log4j + log4j-core + junit junit diff --git a/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/PostgresSourceTest.java b/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/PostgresSourceTest.java index fe0b35a15b048..e1ed443c67fc6 100644 --- a/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/PostgresSourceTest.java +++ b/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/PostgresSourceTest.java @@ -17,12 +17,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import com.risingwave.proto.ConnectorServiceProto; -import io.grpc.Grpc; -import io.grpc.InsecureChannelCredentials; -import io.grpc.Server; -import io.grpc.ServerBuilder; +import com.risingwave.proto.Data; +import io.grpc.*; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; @@ -41,7 +40,7 @@ public class PostgresSourceTest { private static final Logger LOG = LoggerFactory.getLogger(PostgresSourceTest.class.getName()); private static final PostgreSQLContainer pg = - new PostgreSQLContainer<>("postgres:12.3-alpine") + new PostgreSQLContainer<>("postgres:15-alpine") .withDatabaseName("test") .withUsername("postgres") .withCommand("postgres -c wal_level=logical -c max_wal_senders=10"); @@ -145,6 +144,69 @@ public void testLines() throws InterruptedException, SQLException { connection.close(); } + // test whether validation catches permission errors + @Test + public void testPermissionCheck() { + Connection connection = SourceTestClient.connect(pgDataSource); + String query = + "CREATE TABLE IF NOT EXISTS orders (o_key BIGINT NOT NULL, o_val INT, PRIMARY KEY (o_key))"; + SourceTestClient.performQuery(connection, query); + // create a partial publication, check whether error is reported + query = "CREATE PUBLICATION dbz_publication FOR TABLE orders (o_key)"; + SourceTestClient.performQuery(connection, query); + ConnectorServiceProto.TableSchema tableSchema = + ConnectorServiceProto.TableSchema.newBuilder() + .addColumns( + ConnectorServiceProto.TableSchema.Column.newBuilder() + .setName("o_key") + .setDataType(Data.DataType.TypeName.INT64) + .build()) + .addColumns( + ConnectorServiceProto.TableSchema.Column.newBuilder() + .setName("o_val") + .setDataType(Data.DataType.TypeName.INT32) + .build()) + .addPkIndices(0) + .build(); + Iterator eventStream1 = + testClient.getEventStreamValidate( + pg, + ConnectorServiceProto.SourceType.POSTGRES, + tableSchema, + "test", + "orders"); + StatusRuntimeException exception1 = + assertThrows( + StatusRuntimeException.class, + () -> { + eventStream1.hasNext(); + }); + assertEquals( + exception1.getMessage(), + "INVALID_ARGUMENT: INTERNAL: The publication 'dbz_publication' does not cover all necessary columns in table orders"); + query = "DROP PUBLICATION dbz_publication"; + SourceTestClient.performQuery(connection, query); + // revoke superuser and replication, check if reports error + query = "ALTER USER " + pg.getUsername() + " nosuperuser noreplication"; + SourceTestClient.performQuery(connection, query); + Iterator eventStream2 = + testClient.getEventStreamValidate( + pg, + ConnectorServiceProto.SourceType.POSTGRES, + tableSchema, + "test", + "orders"); + StatusRuntimeException exception2 = + assertThrows( + StatusRuntimeException.class, + () -> { + eventStream2.hasNext(); + }); + assertEquals( + exception2.getMessage(), + "INVALID_ARGUMENT: INTERNAL: Postgres user must be superuser or replication role to start walsender."); + } + // generates test cases for the risingwave debezium parser @Ignore @Test diff --git a/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/SourceTestClient.java b/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/SourceTestClient.java index ea0a601fbf699..950e847f6d65e 100644 --- a/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/SourceTestClient.java +++ b/java/connector-node/risingwave-source-test/src/test/java/com/risingwave/connector/SourceTestClient.java @@ -88,6 +88,40 @@ protected static DataSource getDataSource(JdbcDatabaseContainer container) { return new HikariDataSource(hikariConfig); } + protected Iterator getEventStreamValidate( + JdbcDatabaseContainer container, + ConnectorServiceProto.SourceType sourceType, + ConnectorServiceProto.TableSchema tableSchema, + String databaseName, + String tableName) { + String port = String.valueOf(URI.create(container.getJdbcUrl().substring(5)).getPort()); + ConnectorServiceProto.GetEventStreamRequest req = + ConnectorServiceProto.GetEventStreamRequest.newBuilder() + .setValidate( + ConnectorServiceProto.GetEventStreamRequest.ValidateProperties + .newBuilder() + .setSourceId(0) + .setSourceType(sourceType) + .setTableSchema(tableSchema) + .putProperties("hostname", container.getHost()) + .putProperties("port", port) + .putProperties("username", container.getUsername()) + .putProperties("password", container.getPassword()) + .putProperties("database.name", databaseName) + .putProperties("table.name", tableName) + .putProperties("schema.name", "public") // pg only + .putProperties("slot.name", "orders") // pg only + .putProperties("server.id", "1")) // mysql only + .build(); + Iterator responses = null; + try { + responses = blockingStub.getEventStream(req); + } catch (StatusRuntimeException e) { + fail("RPC failed: {}", e.getStatus()); + } + return responses; + } + protected Iterator getEventStreamStart( JdbcDatabaseContainer container, ConnectorServiceProto.SourceType sourceType, diff --git a/java/pom.xml b/java/pom.xml index fe24bacc97bf1..88b87e7ae9efb 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -33,6 +33,8 @@ 2.27.1 2.20.0 1.5.0 + 2.11.0 + 1.10.0 1.9.7.Final 2.13.5 3.3.1 @@ -60,6 +62,16 @@ commons-cli ${commons.cli.version} + + org.apache.commons + commons-text + ${commons.text.version} + + + commons-io + commons-io + ${commons.io.version} + com.fasterxml.jackson.core jackson-databind diff --git a/java/tools/maven/checkstyle.xml b/java/tools/maven/checkstyle.xml index 33649434a3266..4bd0d510e0fad 100644 --- a/java/tools/maven/checkstyle.xml +++ b/java/tools/maven/checkstyle.xml @@ -165,11 +165,6 @@ This file is based on the checkstyle file of Apache Beam. - - - - - index_chain --NoShuffle--> lookup) which will break current - // `NoShuffle` scaling assumption. Currently we detect this case and forbid it to scale. if no_shuffle_source_fragment_ids.contains(fragment_id) { let mut queue: VecDeque<_> = fragment_dispatcher_map .get(fragment_id) @@ -451,21 +447,12 @@ where if let Some(downstream_fragments) = fragment_dispatcher_map.get(&downstream_id) { - // If `NoShuffle` used by other fragment type rather than `ChainNode`, bail. - for downstream_fragment_id in downstream_fragments.keys() { - let downstream_fragment = fragment_map - .get(downstream_fragment_id) - .ok_or_else(|| anyhow!("fragment {fragment_id} does not exist"))?; - if (downstream_fragment.get_fragment_type_mask() - & (FragmentTypeFlag::ChainNode as u32 - | FragmentTypeFlag::Mview as u32)) - == 0 - { - bail!("Rescheduling NoShuffle edge only supports ChainNode and Mview. Other usage for e.g. delta join is forbidden currently."); - } - } + let no_shuffle_downstreams = downstream_fragments + .iter() + .filter(|(_, ty)| **ty == DispatcherType::NoShuffle) + .map(|(fragment_id, _)| fragment_id); - queue.extend(downstream_fragments.keys().cloned()); + queue.extend(no_shuffle_downstreams.copied()); } no_shuffle_reschedule.insert( @@ -743,7 +730,12 @@ where .unwrap(); if let Some(downstream_fragments) = ctx.fragment_dispatcher_map.get(fragment_id) { - for downstream_fragment_id in downstream_fragments.keys() { + let no_shuffle_downstreams = downstream_fragments + .iter() + .filter(|(_, ty)| **ty == DispatcherType::NoShuffle) + .map(|(fragment_id, _)| fragment_id); + + for downstream_fragment_id in no_shuffle_downstreams { arrange_no_shuffle_relation( ctx, downstream_fragment_id, @@ -1014,20 +1006,19 @@ where } } - let downstream_fragment_ids = - if let Some(downstream_fragments) = ctx.fragment_dispatcher_map.get(&fragment_id) { - // Skip NoShuffle fragments' downstream - if ctx - .no_shuffle_source_fragment_ids - .contains(&fragment.fragment_id) - { - vec![] - } else { - downstream_fragments.keys().copied().collect_vec() - } - } else { - vec![] - }; + let downstream_fragment_ids = if let Some(downstream_fragments) = + ctx.fragment_dispatcher_map.get(&fragment_id) + { + // Skip fragments' no-shuffle downstream, as there's no need to update the merger + // (receiver) of a no-shuffle downstream + downstream_fragments + .iter() + .filter(|(_, dispatcher_type)| *dispatcher_type != &DispatcherType::NoShuffle) + .map(|(fragment_id, _)| *fragment_id) + .collect_vec() + } else { + vec![] + }; let vnode_bitmap_updates = match fragment.distribution_type() { FragmentDistributionType::Hash => { @@ -1123,7 +1114,7 @@ where let _source_pause_guard = self.source_manager.paused.lock().await; - tracing::trace!("reschedule plan: {:#?}", reschedule_fragment); + tracing::debug!("reschedule plan: {:#?}", reschedule_fragment); self.barrier_scheduler .run_command_with_paused(Command::RescheduleFragment(reschedule_fragment)) diff --git a/src/meta/src/stream/sink.rs b/src/meta/src/stream/sink.rs index d4ad160c7e0ab..5fd707941e277 100644 --- a/src/meta/src/stream/sink.rs +++ b/src/meta/src/stream/sink.rs @@ -15,12 +15,12 @@ use anyhow::anyhow; use risingwave_connector::sink::catalog::SinkCatalog; use risingwave_connector::sink::{SinkConfig, SinkImpl}; -use risingwave_pb::catalog::Sink as ProstSinkCatalog; +use risingwave_pb::catalog::PbSink; use crate::{MetaError, MetaResult}; pub async fn validate_sink( - prost_sink_catalog: &ProstSinkCatalog, + prost_sink_catalog: &PbSink, connector_rpc_endpoint: Option, ) -> MetaResult<()> { let sink_catalog = SinkCatalog::from(prost_sink_catalog); diff --git a/src/meta/src/stream/stream_manager.rs b/src/meta/src/stream/stream_manager.rs index 7db0d0119359d..70283c94c3193 100644 --- a/src/meta/src/stream/stream_manager.rs +++ b/src/meta/src/stream/stream_manager.rs @@ -726,6 +726,7 @@ mod tests { let (barrier_scheduler, scheduled_barriers) = BarrierScheduler::new_pair( hummock_manager.clone(), + meta_metrics.clone(), system_params.checkpoint_frequency() as usize, ); diff --git a/src/meta/src/stream/test_fragmenter.rs b/src/meta/src/stream/test_fragmenter.rs index 43f5e991b9f1c..3daa812dcfb01 100644 --- a/src/meta/src/stream/test_fragmenter.rs +++ b/src/meta/src/stream/test_fragmenter.rs @@ -18,14 +18,16 @@ use std::vec; use itertools::Itertools; use risingwave_common::catalog::{DatabaseId, SchemaId, TableId}; -use risingwave_pb::catalog::Table as ProstTable; -use risingwave_pb::common::{ParallelUnit, PbColumnOrder, PbDirection, PbOrderType, WorkerNode}; +use risingwave_pb::catalog::PbTable; +use risingwave_pb::common::{ + ParallelUnit, PbColumnOrder, PbDirection, PbNullsAre, PbOrderType, WorkerNode, +}; use risingwave_pb::data::data_type::TypeName; use risingwave_pb::data::DataType; use risingwave_pb::expr::agg_call::Type; use risingwave_pb::expr::expr_node::RexNode; use risingwave_pb::expr::expr_node::Type::{Add, GreaterThan, InputRef}; -use risingwave_pb::expr::{AggCall, ExprNode, FunctionCall, InputRef as ProstInputRef}; +use risingwave_pb::expr::{AggCall, ExprNode, FunctionCall, PbInputRef}; use risingwave_pb::plan_common::{ColumnCatalog, ColumnDesc, Field}; use risingwave_pb::stream_plan::stream_fragment_graph::{StreamFragment, StreamFragmentEdge}; use risingwave_pb::stream_plan::stream_node::NodeBody; @@ -56,7 +58,7 @@ fn make_inputref(idx: u32) -> ExprNode { fn make_sum_aggcall(idx: u32) -> AggCall { AggCall { r#type: Type::Sum as i32, - args: vec![ProstInputRef { + args: vec![PbInputRef { index: idx, r#type: Some(DataType { type_name: TypeName::Int64 as i32, @@ -96,6 +98,7 @@ fn make_column_order(column_index: u32) -> PbColumnOrder { column_index, order_type: Some(PbOrderType { direction: PbDirection::Ascending as _, + nulls_are: PbNullsAre::Largest as _, }), } } @@ -114,12 +117,12 @@ fn make_column(column_type: TypeName, column_id: i32) -> ColumnCatalog { } } -fn make_source_internal_table(id: u32) -> ProstTable { +fn make_source_internal_table(id: u32) -> PbTable { let columns = vec![ make_column(TypeName::Varchar, 0), make_column(TypeName::Varchar, 1), ]; - ProstTable { + PbTable { id, schema_id: SchemaId::placeholder().schema_id, database_id: DatabaseId::placeholder().database_id, @@ -129,18 +132,19 @@ fn make_source_internal_table(id: u32) -> ProstTable { column_index: 0, order_type: Some(PbOrderType { direction: PbDirection::Descending as _, + nulls_are: PbNullsAre::Largest as _, }), }], ..Default::default() } } -fn make_internal_table(id: u32, is_agg_value: bool) -> ProstTable { +fn make_internal_table(id: u32, is_agg_value: bool) -> PbTable { let mut columns = vec![make_column(TypeName::Int64, 0)]; if !is_agg_value { columns.push(make_column(TypeName::Int32, 1)); } - ProstTable { + PbTable { id, schema_id: SchemaId::placeholder().schema_id, database_id: DatabaseId::placeholder().database_id, @@ -150,6 +154,7 @@ fn make_internal_table(id: u32, is_agg_value: bool) -> ProstTable { column_index: 0, order_type: Some(PbOrderType { direction: PbDirection::Descending as _, + nulls_are: PbNullsAre::Largest as _, }), }], stream_key: vec![2], @@ -157,8 +162,8 @@ fn make_internal_table(id: u32, is_agg_value: bool) -> ProstTable { } } -fn make_empty_table(id: u32) -> ProstTable { - ProstTable { +fn make_empty_table(id: u32) -> PbTable { + PbTable { id, schema_id: SchemaId::placeholder().schema_id, database_id: DatabaseId::placeholder().database_id, @@ -170,7 +175,7 @@ fn make_empty_table(id: u32) -> ProstTable { } } -fn make_materialize_table(id: u32) -> ProstTable { +fn make_materialize_table(id: u32) -> PbTable { make_internal_table(id, true) } @@ -356,7 +361,6 @@ fn make_stream_fragments() -> Vec { table_id: 1, table: Some(make_materialize_table(888)), column_orders: vec![make_column_order(1), make_column_order(2)], - handle_pk_conflict_behavior: 0, })), fields: vec![], // TODO: fill this later operator_id: 7, diff --git a/src/meta/src/stream/test_scale.rs b/src/meta/src/stream/test_scale.rs index d3a42a3c2432c..0ad2f51268db0 100644 --- a/src/meta/src/stream/test_scale.rs +++ b/src/meta/src/stream/test_scale.rs @@ -143,7 +143,7 @@ mod tests { for parallel_unit_num in simulated_parallel_unit_nums(None, None) { let (actor_mapping, _) = generate_actor_mapping(parallel_unit_num); - let actor_to_parallel_unit_map = (0..parallel_unit_num) + let actor_to_parallel_unit_map: HashMap<_, _> = (0..parallel_unit_num) .map(|i| (i as ActorId, i as ParallelUnitId)) .collect(); let parallel_unit_mapping = actor_mapping.to_parallel_unit(&actor_to_parallel_unit_map); diff --git a/src/meta/src/telemetry.rs b/src/meta/src/telemetry.rs new file mode 100644 index 0000000000000..a2b69ad4cf844 --- /dev/null +++ b/src/meta/src/telemetry.rs @@ -0,0 +1,160 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::sync::Arc; + +use anyhow::anyhow; +use risingwave_common::telemetry::report::{TelemetryInfoFetcher, TelemetryReportCreator}; +use risingwave_common::telemetry::{ + current_timestamp, SystemData, TelemetryNodeType, TelemetryReport, TelemetryReportBase, +}; +use serde::{Deserialize, Serialize}; +use uuid::Uuid; + +use crate::storage::MetaStore; + +/// Column in meta store +pub const TELEMETRY_CF: &str = "cf/telemetry"; +/// `telemetry` in bytes +pub const TELEMETRY_KEY: &[u8] = &[74, 65, 0x6c, 65, 0x6d, 65, 74, 72, 79]; + +#[derive(Debug, Serialize, Deserialize)] +pub(crate) struct MetaTelemetryReport { + #[serde(flatten)] + base: TelemetryReportBase, +} + +impl MetaTelemetryReport { + pub(crate) fn new(tracking_id: String, session_id: String, up_time: u64) -> Self { + Self { + base: TelemetryReportBase { + tracking_id, + session_id, + system_data: SystemData::new(), + up_time, + time_stamp: current_timestamp(), + node_type: TelemetryNodeType::Meta, + }, + } + } +} + +impl TelemetryReport for MetaTelemetryReport { + fn to_json(&self) -> anyhow::Result { + let json = serde_json::to_string(self)?; + Ok(json) + } +} + +pub(crate) struct MetaTelemetryInfoFetcher { + meta_store: Arc, +} + +impl MetaTelemetryInfoFetcher { + pub(crate) fn new(meta_store: Arc) -> Self { + Self { meta_store } + } +} + +#[async_trait::async_trait] +impl TelemetryInfoFetcher for MetaTelemetryInfoFetcher { + async fn fetch_telemetry_info(&self) -> anyhow::Result { + let tracking_id = get_or_create_tracking_id(self.meta_store.clone()).await?; + + Ok(tracking_id) + } +} + +/// fetch or create a `tracking_id` from etcd +async fn get_or_create_tracking_id( + meta_store: Arc, +) -> Result { + match meta_store.get_cf(TELEMETRY_CF, TELEMETRY_KEY).await { + Ok(bytes) => String::from_utf8(bytes).map_err(|e| anyhow!("failed to parse uuid, {}", e)), + Err(_) => { + let uuid = Uuid::new_v4().to_string(); + // put new uuid in meta store + match meta_store + .put_cf( + TELEMETRY_CF, + TELEMETRY_KEY.to_vec(), + uuid.clone().into_bytes(), + ) + .await + { + Err(e) => Err(anyhow!("failed to create uuid, {}", e)), + Ok(_) => Ok(uuid), + } + } + } +} + +#[derive(Copy, Clone)] +pub(crate) struct MetaReportCreator {} + +impl MetaReportCreator { + pub(crate) fn new() -> Self { + Self {} + } +} + +impl TelemetryReportCreator for MetaReportCreator { + fn create_report( + &self, + tracking_id: String, + session_id: String, + up_time: u64, + ) -> anyhow::Result { + Ok(MetaTelemetryReport::new(tracking_id, session_id, up_time)) + } + + fn report_type(&self) -> &str { + "meta" + } +} + +#[cfg(test)] +mod tests { + use std::sync::Arc; + + use super::*; + use crate::storage::MemStore; + + #[tokio::test] + async fn test_get_or_create_tracking_id_existing_id() { + let meta_store = Arc::new(MemStore::new()); + let uuid = Uuid::new_v4().to_string(); + meta_store + .put_cf( + TELEMETRY_CF, + TELEMETRY_KEY.to_vec(), + uuid.clone().into_bytes(), + ) + .await + .unwrap(); + let result = get_or_create_tracking_id(Arc::clone(&meta_store)) + .await + .unwrap(); + assert_eq!(result, uuid); + } + + #[tokio::test] + async fn test_get_or_create_tracking_id_new_id() { + let meta_store = Arc::new(MemStore::new()); + let result = get_or_create_tracking_id(Arc::clone(&meta_store)) + .await + .unwrap(); + assert!(String::from_utf8(result.into_bytes()).is_ok()); + } +} diff --git a/src/object_store/src/object/disk.rs b/src/object_store/src/object/disk.rs index 3cf4f3895babd..67cd42505a0e5 100644 --- a/src/object_store/src/object/disk.rs +++ b/src/object_store/src/object/disk.rs @@ -22,7 +22,7 @@ use std::sync::Arc; use bytes::Bytes; use futures::future::try_join_all; -use risingwave_common::cache::{CacheableEntry, LruCache}; +use risingwave_common::cache::{CachePriority, CacheableEntry, LruCache}; use tokio::io::{AsyncRead, AsyncWriteExt}; use super::{ @@ -123,6 +123,7 @@ impl DiskObjectStore { opened_read_file_cache: Arc::new(LruCache::new( OPENED_FILE_CACHE_DEFAULT_NUM_SHARD_BITS, OPENED_FILE_CACHE_DEFAULT_CAPACITY, + 0, )), } } @@ -151,6 +152,7 @@ impl DiskObjectStore { .lookup_with_request_dedup::<_, ObjectError, _>( hash, path.clone(), + CachePriority::High, move || async move { let file = utils::open_file(&path, true, false, false) .await? diff --git a/src/object_store/src/object/mod.rs b/src/object_store/src/object/mod.rs index 8390693a53f1d..26efba364f8a6 100644 --- a/src/object_store/src/object/mod.rs +++ b/src/object_store/src/object/mod.rs @@ -857,6 +857,15 @@ pub async fn parse_remote_object_store( .monitored(metrics), ) } + azblob if azblob.starts_with("azblob://") => { + let azblob = azblob.strip_prefix("azblob://").unwrap(); + let (container_name, root) = azblob.split_once('@').unwrap(); + ObjectStoreImpl::Opendal( + OpendalObjectStore::new_azblob_engine(container_name.to_string(), root.to_string()) + .unwrap() + .monitored(metrics), + ) + } fs if fs.starts_with("fs://") => { let fs = fs.strip_prefix("fs://").unwrap(); let (_, root) = fs.split_once('@').unwrap(); diff --git a/src/object_store/src/object/opendal_engine/azblob.rs b/src/object_store/src/object/opendal_engine/azblob.rs new file mode 100644 index 0000000000000..f13075648d109 --- /dev/null +++ b/src/object_store/src/object/opendal_engine/azblob.rs @@ -0,0 +1,44 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use opendal::services::Azblob; +use opendal::Operator; + +use super::{EngineType, OpendalObjectStore}; +use crate::object::ObjectResult; +impl OpendalObjectStore { + /// create opendal azblob engine. + pub fn new_azblob_engine(container_name: String, root: String) -> ObjectResult { + // Create azblob backend builder. + let mut builder = Azblob::default(); + builder.root(&root); + builder.container(&container_name); + + let endpoint = std::env::var("AZBLOB_ENDPOINT") + .unwrap_or_else(|_| panic!("AZBLOB_ENDPOINT not found from environment variables")); + let account_name = std::env::var("AZBLOB_ACCOUNT_NAME") + .unwrap_or_else(|_| panic!("AZBLOB_ACCOUNT_NAME not found from environment variables")); + let account_key = std::env::var("AZBLOB_ACCOUNT_KEY") + .unwrap_or_else(|_| panic!("AZBLOB_ACCOUNT_KEY not found from environment variables")); + + builder.endpoint(&endpoint); + builder.account_name(&account_name); + builder.account_key(&account_key); + let op: Operator = Operator::new(builder)?.finish(); + Ok(Self { + op, + engine_type: EngineType::Azblob, + }) + } +} diff --git a/src/object_store/src/object/opendal_engine/mod.rs b/src/object_store/src/object/opendal_engine/mod.rs index 65f60c6c14727..1e93904eb73b2 100644 --- a/src/object_store/src/object/opendal_engine/mod.rs +++ b/src/object_store/src/object/opendal_engine/mod.rs @@ -26,5 +26,7 @@ pub mod gcs; pub use gcs::*; pub mod oss; pub use oss::*; +pub mod azblob; +pub use azblob::*; pub mod fs; pub use fs::*; 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 7b02aba061af5..b5f78d9ef9510 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 @@ -39,6 +39,7 @@ pub enum EngineType { Gcs, Oss, Webhdfs, + Azblob, Fs, } @@ -186,6 +187,7 @@ impl ObjectStore for OpendalObjectStore { EngineType::Gcs => "Gcs", EngineType::Oss => "Oss", EngineType::Webhdfs => "Webhdfs", + EngineType::Azblob => "Azblob", EngineType::Fs => "Fs", } } diff --git a/src/prost/build.rs b/src/prost/build.rs index 8e832846eee41..05f1d2c4e70f6 100644 --- a/src/prost/build.rs +++ b/src/prost/build.rs @@ -65,6 +65,7 @@ fn main() -> Result<(), Box> { .type_attribute("expr.FunctionCall", "#[derive(Eq, Hash)]") .type_attribute("expr.UserDefinedFunction", "#[derive(Eq, Hash)]") .type_attribute("catalog.StreamSourceInfo", "#[derive(Eq, Hash)]") + .type_attribute("plan_common.GeneratedColumnDesc", "#[derive(Eq, Hash)]") .out_dir(out_dir.as_path()) .compile(&protos, &[proto_dir.to_string()]) .expect("Failed to compile grpc!"); diff --git a/src/prost/helpers/src/generate.rs b/src/prost/helpers/src/generate.rs index 7fe949131ca6f..a689f7e00a0ff 100644 --- a/src/prost/helpers/src/generate.rs +++ b/src/prost/helpers/src/generate.rs @@ -93,11 +93,11 @@ pub fn implement(field: &Field) -> TokenStream2 { if let Some(enum_type) = extract_enum_type_from_field(field) { return quote! { #[inline(always)] - pub fn #getter_fn_name(&self) -> std::result::Result<#enum_type, crate::ProstFieldNotFound> { + pub fn #getter_fn_name(&self) -> std::result::Result<#enum_type, crate::PbFieldNotFound> { if self.#field_name.eq(&0) { - return Err(crate::ProstFieldNotFound(stringify!(#field_name))); + return Err(crate::PbFieldNotFound(stringify!(#field_name))); } - #enum_type::from_i32(self.#field_name).ok_or_else(|| crate::ProstFieldNotFound(stringify!(#field_name))) + #enum_type::from_i32(self.#field_name).ok_or_else(|| crate::PbFieldNotFound(stringify!(#field_name))) } }; }; @@ -110,8 +110,8 @@ pub fn implement(field: &Field) -> TokenStream2 { let ty = extract_type_from_option(data_type); return quote! { #[inline(always)] - pub fn #getter_fn_name(&self) -> std::result::Result<&#ty, crate::ProstFieldNotFound> { - self.#field_name.as_ref().ok_or_else(|| crate::ProstFieldNotFound(stringify!(#field_name))) + pub fn #getter_fn_name(&self) -> std::result::Result<&#ty, crate::PbFieldNotFound> { + self.#field_name.as_ref().ok_or_else(|| crate::PbFieldNotFound(stringify!(#field_name))) } }; } else if ["u32", "u64", "f32", "f64", "i32", "i64", "bool"] diff --git a/src/prost/src/lib.rs b/src/prost/src/lib.rs index e8ad3c7f770d7..a6669186cd3f9 100644 --- a/src/prost/src/lib.rs +++ b/src/prost/src/lib.rs @@ -142,10 +142,10 @@ pub mod backup_service_serde; pub mod java_binding_serde; #[derive(Clone, PartialEq, Eq, Debug)] -pub struct ProstFieldNotFound(pub &'static str); +pub struct PbFieldNotFound(pub &'static str); -impl From for tonic::Status { - fn from(e: ProstFieldNotFound) -> Self { +impl From for tonic::Status { + fn from(e: PbFieldNotFound) -> Self { tonic::Status::new(tonic::Code::Internal, e.0) } } diff --git a/src/risedevtool/connector.toml b/src/risedevtool/connector.toml index 55b485412dde1..adb430a159676 100644 --- a/src/risedevtool/connector.toml +++ b/src/risedevtool/connector.toml @@ -1,50 +1,13 @@ extend = "common.toml" [env] -RW_CONNECTOR_VERSION = "0.1.17" -RW_CONNECTOR_DOWNLOAD_PATH = "${PREFIX_TMP}/risingwave-connector-${RW_CONNECTOR_VERSION}.tar.gz" -RW_CONNECTOR_RELEASE = "risingwave-connector-${RW_CONNECTOR_VERSION}.tar.gz" -RW_CONNECTOR_BIN_PREFIX = "${PREFIX_BIN}/connector-node" - -RW_CONNECTOR_DOWNLOAD_URL = "https://github.com/risingwavelabs/risingwave-connector-release/raw/main/risingwave-connector-${RW_CONNECTOR_VERSION}.tar.gz" - MAVEN_VERSION = "3.9.0" MAVEN_DOWNLOAD_PATH = "${PREFIX_TMP}/maven.tar.gz" -[tasks.download-connector] -category = "RiseDev - Components" -dependencies = ["prepare"] -condition = { env_set = [ "ENABLE_RW_CONNECTOR" ] } -description = "Download RisingWave Connector" -script = ''' -#!/usr/bin/env bash -set -e -if [ -f "${RW_CONNECTOR_BIN_PREFIX}/start-service.sh" ]; then - exit 0 -fi - -if [ -n "${ENABLE_BUILD_RW_CONNECTOR+x}" ]; then - echo "ENABLE_BUILD_RW_CONNECTOR is set, will build RisingWave Connector from source instead" - exit 0 -fi - -if [ -f "${RW_CONNECTOR_DOWNLOAD_PATH}" ]; then - mkdir -p "${PREFIX_BIN}/connector-node" - tar xf "${RW_CONNECTOR_DOWNLOAD_PATH}" -C "${PREFIX_BIN}/connector-node" - rm "${RW_CONNECTOR_DOWNLOAD_PATH}" -else - echo "RisingWave Connector not found, download ${RW_CONNECTOR_RELEASE}" - curl -fL -o "${RW_CONNECTOR_DOWNLOAD_PATH}" "${RW_CONNECTOR_DOWNLOAD_URL}" - mkdir -p "${PREFIX_BIN}/connector-node" - tar xf "${RW_CONNECTOR_DOWNLOAD_PATH}" -C "${PREFIX_BIN}/connector-node" - rm "${RW_CONNECTOR_DOWNLOAD_PATH}" -fi -''' - [tasks.download-maven] category = "RiseDev - Components" dependencies = ["prepare"] -condition = { env_set = [ "ENABLE_RW_CONNECTOR", "ENABLE_BUILD_RW_CONNECTOR" ] } +condition = { env_set = [ "ENABLE_BUILD_RW_CONNECTOR" ] } description = "Download Maven" script = ''' #!/usr/bin/env bash @@ -54,7 +17,7 @@ if !(command -v javac &> /dev/null && [[ "$(javac -version 2>&1 | awk '{print $2 exit 1 fi -if command -v mvn &> /dev/null; then +if (command -v mvn &> /dev/null) || [ -d "${PREFIX_BIN}/maven" ]; then exit 0 else echo "Maven is not installed. Downloading now..." diff --git a/src/risedevtool/src/bin/risedev-config.rs b/src/risedevtool/src/bin/risedev-config.rs index 37f2333e9b531..29549541b6893 100644 --- a/src/risedevtool/src/bin/risedev-config.rs +++ b/src/risedevtool/src/bin/risedev-config.rs @@ -65,10 +65,9 @@ pub enum Components { Kafka, Pubsub, Redis, - ConnectorNode, - BuildConnectorNode, Tracing, RustComponents, + BuildConnectorNode, Dashboard, Release, AllInOne, @@ -85,8 +84,7 @@ impl Components { Self::Kafka => "[Component] Kafka", Self::Pubsub => "[Component] Google Pubsub", Self::Redis => "[Component] Redis", - Self::ConnectorNode => "[Component] RisingWave Connector", - Self::BuildConnectorNode => "[Build] Build RisingWave Connector from source", + Self::BuildConnectorNode => "[Build] Build RisingWave Connector (Java)", Self::RustComponents => "[Build] Rust components", Self::Dashboard => "[Build] Dashboard v2", Self::Tracing => "[Component] Tracing: Jaeger", @@ -165,11 +163,6 @@ a dev cluster. Required if you want to sink data to redis. " } - Self::ConnectorNode => { - " -Required if you want to create CDC source from external Databases. - " - } Self::BuildConnectorNode => { " Required if you want to build Connector Node from source locally. @@ -194,7 +187,6 @@ Required if you want to build Connector Node from source locally. "ENABLE_ALL_IN_ONE" => Some(Self::AllInOne), "ENABLE_SANITIZER" => Some(Self::Sanitizer), "ENABLE_REDIS" => Some(Self::Redis), - "ENABLE_RW_CONNECTOR" => Some(Self::ConnectorNode), "ENABLE_BUILD_RW_CONNECTOR" => Some(Self::BuildConnectorNode), _ => None, } @@ -215,7 +207,6 @@ Required if you want to build Connector Node from source locally. Self::Release => "ENABLE_RELEASE_PROFILE", Self::AllInOne => "ENABLE_ALL_IN_ONE", Self::Sanitizer => "ENABLE_SANITIZER", - Self::ConnectorNode => "ENABLE_RW_CONNECTOR", Self::BuildConnectorNode => "ENABLE_BUILD_RW_CONNECTOR", } .into() diff --git a/src/risedevtool/src/compose.rs b/src/risedevtool/src/compose.rs index 73271c9c34718..afeb67d1b4b76 100644 --- a/src/risedevtool/src/compose.rs +++ b/src/risedevtool/src/compose.rs @@ -154,11 +154,7 @@ fn health_check_port(port: u16) -> HealthCheck { impl Compose for ComputeNodeConfig { fn compose(&self, config: &ComposeConfig) -> Result { let mut command = Command::new("compute-node"); - ComputeNodeService::apply_command_args( - &mut command, - self, - HummockInMemoryStrategy::Disallowed, - )?; + ComputeNodeService::apply_command_args(&mut command, self)?; if self.enable_tiered_cache { command.arg("--file-cache-dir").arg("/filecache"); } @@ -201,7 +197,11 @@ impl Compose for ComputeNodeConfig { impl Compose for MetaNodeConfig { fn compose(&self, config: &ComposeConfig) -> Result { let mut command = Command::new("meta-node"); - MetaNodeService::apply_command_args(&mut command, self)?; + MetaNodeService::apply_command_args( + &mut command, + self, + HummockInMemoryStrategy::Disallowed, + )?; if let Some(c) = &config.rw_config_path { let target = Path::new(&config.config_directory).join("risingwave.toml"); @@ -264,11 +264,7 @@ impl Compose for FrontendConfig { impl Compose for CompactorConfig { fn compose(&self, config: &ComposeConfig) -> Result { let mut command = Command::new("compactor-node"); - CompactorService::apply_command_args( - &mut command, - self, - HummockInMemoryStrategy::Disallowed, - )?; + CompactorService::apply_command_args(&mut command, self)?; if let Some(c) = &config.rw_config_path { let target = Path::new(&config.config_directory).join("risingwave.toml"); diff --git a/src/risedevtool/src/config_gen/prometheus_gen.rs b/src/risedevtool/src/config_gen/prometheus_gen.rs index 6172ffcf1accb..01caa0ca1aa34 100644 --- a/src/risedevtool/src/config_gen/prometheus_gen.rs +++ b/src/risedevtool/src/config_gen/prometheus_gen.rs @@ -79,6 +79,14 @@ impl PrometheusGen { .map(|node| format!("\"{}:{}\"", node.address, 9644)) .join(","); + let connector_node_targets = config + .provide_connector_node + .as_ref() + .unwrap() + .iter() + .map(|node| format!("\"{}:{}\"", node.address, node.exporter_port)) + .join(","); + let now = Local::now().format("%Y%m%d-%H%M%S"); let remote_write = if config.remote_write { @@ -143,6 +151,10 @@ scrape_configs: - job_name: redpanda static_configs: - targets: [{redpanda_targets}] + + - job_name: connector-node + static_configs: + - targets: [{connector_node_targets}] "#, ) } diff --git a/src/risedevtool/src/service_config.rs b/src/risedevtool/src/service_config.rs index 1095558919d8d..bcb8c012b7e84 100644 --- a/src/risedevtool/src/service_config.rs +++ b/src/risedevtool/src/service_config.rs @@ -36,9 +36,7 @@ pub struct ComputeNodeConfig { pub provide_opendal: Option>, pub provide_aws_s3: Option>, pub provide_jaeger: Option>, - pub provide_compactor: Option>, pub user_managed: bool, - pub enable_in_memory_kv_state_backend: bool, pub connector_rpc_endpoint: String, pub total_memory_bytes: usize, @@ -67,6 +65,14 @@ pub struct MetaNodeConfig { pub connector_rpc_endpoint: String, pub provide_etcd_backend: Option>, pub provide_prometheus: Option>, + + pub provide_compute_node: Option>, + pub provide_compactor: Option>, + + pub provide_aws_s3: Option>, + pub provide_minio: Option>, + pub provide_opendal: Option>, + pub enable_in_memory_kv_state_backend: bool, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -103,8 +109,6 @@ pub struct CompactorConfig { pub exporter_port: u16, pub provide_minio: Option>, - pub provide_opendal: Option>, - pub provide_aws_s3: Option>, pub provide_meta_node: Option>, pub user_managed: bool, @@ -182,6 +186,7 @@ pub struct PrometheusConfig { pub provide_etcd: Option>, pub provide_redpanda: Option>, pub provide_frontend: Option>, + pub provide_connector_node: Option>, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] @@ -316,6 +321,7 @@ pub struct ConnectorNodeConfig { phantom_use: Option, pub id: String, pub port: u16, + pub exporter_port: u16, pub address: String, } diff --git a/src/risedevtool/src/task/compactor_service.rs b/src/risedevtool/src/task/compactor_service.rs index 8d11854416f33..76a2b205e6283 100644 --- a/src/risedevtool/src/task/compactor_service.rs +++ b/src/risedevtool/src/task/compactor_service.rs @@ -17,13 +17,10 @@ use std::io::Write; use std::path::Path; use std::process::Command; -use anyhow::{anyhow, Result}; +use anyhow::Result; use crate::util::{get_program_args, get_program_env_cmd, get_program_name}; -use crate::{ - add_meta_node, add_storage_backend, CompactorConfig, ExecuteContext, HummockInMemoryStrategy, - Task, -}; +use crate::{add_meta_node, CompactorConfig, ExecuteContext, Task}; pub struct CompactorService { config: CompactorConfig, @@ -45,19 +42,7 @@ impl CompactorService { } /// Apply command args according to config - pub fn apply_command_args( - cmd: &mut Command, - config: &CompactorConfig, - hummock_in_memory_strategy: HummockInMemoryStrategy, - ) -> Result<()> { - if matches!( - hummock_in_memory_strategy, - HummockInMemoryStrategy::Isolated - ) { - return Err(anyhow!( - "compactor cannot use in-memory hummock if remote object store is not provided" - )); - } + pub fn apply_command_args(cmd: &mut Command, config: &CompactorConfig) -> Result<()> { cmd.arg("--listen-addr") .arg(format!("{}:{}", config.listen_address, config.port)) .arg("--prometheus-listener-addr") @@ -78,18 +63,6 @@ impl CompactorService { .arg(format!("{}", compaction_worker_threads_number)); } - let provide_minio = config.provide_minio.as_ref().unwrap(); - let provide_aws_s3 = config.provide_aws_s3.as_ref().unwrap(); - let provide_opendal = config.provide_opendal.as_ref().unwrap(); - add_storage_backend( - &config.id, - provide_opendal, - provide_minio, - provide_aws_s3, - hummock_in_memory_strategy, - cmd, - )?; - let provide_meta_node = config.provide_meta_node.as_ref().unwrap(); add_meta_node(provide_meta_node, cmd)?; @@ -124,7 +97,7 @@ impl Task for CompactorService { cmd.arg("--config-path") .arg(Path::new(&prefix_config).join("risingwave.toml")); - Self::apply_command_args(&mut cmd, &self.config, HummockInMemoryStrategy::Disallowed)?; + Self::apply_command_args(&mut cmd, &self.config)?; if !self.config.user_managed { ctx.run_command(ctx.tmux_run(cmd)?)?; diff --git a/src/risedevtool/src/task/compute_node_service.rs b/src/risedevtool/src/task/compute_node_service.rs index 3d8e8b3dd3866..53db91e40e563 100644 --- a/src/risedevtool/src/task/compute_node_service.rs +++ b/src/risedevtool/src/task/compute_node_service.rs @@ -20,7 +20,7 @@ use anyhow::{anyhow, Result}; use super::{ExecuteContext, Task}; use crate::util::{get_program_args, get_program_env_cmd, get_program_name}; -use crate::{add_meta_node, add_storage_backend, ComputeNodeConfig, HummockInMemoryStrategy}; +use crate::{add_meta_node, ComputeNodeConfig}; pub struct ComputeNodeService { config: ComputeNodeConfig, @@ -42,11 +42,7 @@ impl ComputeNodeService { } /// Apply command args according to config - pub fn apply_command_args( - cmd: &mut Command, - config: &ComputeNodeConfig, - hummock_in_memory_strategy: HummockInMemoryStrategy, - ) -> Result<()> { + pub fn apply_command_args(cmd: &mut Command, config: &ComputeNodeConfig) -> Result<()> { cmd.arg("--listen-addr") .arg(format!("{}:{}", config.listen_address, config.port)) .arg("--prometheus-listener-addr") @@ -85,59 +81,9 @@ impl ComputeNodeService { } } - let provide_minio = config.provide_minio.as_ref().unwrap(); - let provide_opendal = config.provide_opendal.as_ref().unwrap(); - let provide_aws_s3 = config.provide_aws_s3.as_ref().unwrap(); - - let provide_compute_node = config.provide_compute_node.as_ref().unwrap(); - - let is_shared_backend = match ( - config.enable_in_memory_kv_state_backend, - provide_minio.as_slice(), - provide_aws_s3.as_slice(), - provide_opendal.as_slice(), - ) { - (true, [], [], []) => { - cmd.arg("--state-store").arg("in-memory"); - false - } - (true, _, _, _) => { - return Err(anyhow!( - "When `enable_in_memory_kv_state_backend` is enabled, no minio and aws-s3 should be provided.", - )); - } - (_, provide_minio, provide_aws_s3, provide_opendal) => add_storage_backend( - &config.id, - provide_opendal, - provide_minio, - provide_aws_s3, - hummock_in_memory_strategy, - cmd, - )?, - }; - - if provide_compute_node.len() > 1 && !is_shared_backend { - if config.enable_in_memory_kv_state_backend { - // Using a non-shared backend with multiple compute nodes will be problematic for - // state sharing like scaling. However, for distributed end-to-end tests with - // in-memory state store, this is acceptable. - } else { - return Err(anyhow!( - "Hummock storage may behave incorrectly with in-memory backend for multiple compute-node configuration. Should use a shared backend (e.g. MinIO) instead. Consider adding `use: minio` in risedev config." - )); - } - } - let provide_meta_node = config.provide_meta_node.as_ref().unwrap(); add_meta_node(provide_meta_node, cmd)?; - let provide_compactor = config.provide_compactor.as_ref().unwrap(); - if is_shared_backend && provide_compactor.is_empty() { - return Err(anyhow!( - "When using a shared backend (minio, aws-s3, or shared in-memory with `risedev playground`), at least one compactor is required. Consider adding `use: compactor` in risedev config." - )); - } - Ok(()) } } @@ -172,7 +118,7 @@ impl Task for ComputeNodeService { cmd.arg("--config-path") .arg(Path::new(&prefix_config).join("risingwave.toml")); - Self::apply_command_args(&mut cmd, &self.config, HummockInMemoryStrategy::Isolated)?; + Self::apply_command_args(&mut cmd, &self.config)?; if self.config.enable_tiered_cache { let prefix_data = env::var("PREFIX_DATA")?; cmd.arg("--file-cache-dir").arg( diff --git a/src/risedevtool/src/task/connector_service.rs b/src/risedevtool/src/task/connector_service.rs index 9cc589012a44b..05268db6a43ea 100644 --- a/src/risedevtool/src/task/connector_service.rs +++ b/src/risedevtool/src/task/connector_service.rs @@ -44,10 +44,10 @@ impl Task for ConnectorNodeService { ctx.pb.set_message("starting"); let path = self.connector_path()?; if !path.exists() { - return Err(anyhow!("RisingWave connector binary not found in {:?}\nDid you enable risingwave connector feature in `./risedev configure`?", path)); + return Err(anyhow!("RisingWave connector binary not found in {:?}\nPlease enable building RisingWave connector in `./risedev configure`?", path)); } - let mut cmd = Command::new("sh"); - cmd.arg(path).arg("-p").arg(self.config.port.to_string()); + let mut cmd = Command::new(path); + cmd.arg("-p").arg(self.config.port.to_string()); ctx.run_command(ctx.tmux_run(cmd)?)?; ctx.pb.set_message("started"); diff --git a/src/risedevtool/src/task/etcd_service.rs b/src/risedevtool/src/task/etcd_service.rs index d442a45beb542..1912ce58f5b1b 100644 --- a/src/risedevtool/src/task/etcd_service.rs +++ b/src/risedevtool/src/task/etcd_service.rs @@ -57,8 +57,6 @@ impl EtcdService { .arg(&advertise_peer_urls) .arg("--listen-metrics-urls") .arg(&exporter_urls) - .arg("--name") - .arg("risedev-meta") .arg("--max-txn-ops") .arg("999999") .arg("--max-request-bytes") diff --git a/src/risedevtool/src/task/meta_node_service.rs b/src/risedevtool/src/task/meta_node_service.rs index a01b917d109ea..535d42fe5b435 100644 --- a/src/risedevtool/src/task/meta_node_service.rs +++ b/src/risedevtool/src/task/meta_node_service.rs @@ -21,7 +21,7 @@ use itertools::Itertools; use super::{ExecuteContext, Task}; use crate::util::{get_program_args, get_program_env_cmd, get_program_name}; -use crate::MetaNodeConfig; +use crate::{add_storage_backend, HummockInMemoryStrategy, MetaNodeConfig}; pub struct MetaNodeService { config: MetaNodeConfig, @@ -43,7 +43,11 @@ impl MetaNodeService { } /// Apply command args according to config - pub fn apply_command_args(cmd: &mut Command, config: &MetaNodeConfig) -> Result<()> { + pub fn apply_command_args( + cmd: &mut Command, + config: &MetaNodeConfig, + hummock_in_memory_strategy: HummockInMemoryStrategy, + ) -> Result<()> { cmd.arg("--listen-addr") .arg(format!("{}:{}", config.listen_address, config.port)) .arg("--advertise-addr") @@ -93,6 +97,57 @@ impl MetaNodeService { } } + let provide_minio = config.provide_minio.as_ref().unwrap(); + let provide_opendal = config.provide_opendal.as_ref().unwrap(); + let provide_aws_s3 = config.provide_aws_s3.as_ref().unwrap(); + + let provide_compute_node = config.provide_compute_node.as_ref().unwrap(); + let provide_compactor = config.provide_compactor.as_ref().unwrap(); + + let is_shared_backend = match ( + config.enable_in_memory_kv_state_backend, + provide_minio.as_slice(), + provide_aws_s3.as_slice(), + provide_opendal.as_slice(), + ) { + (true, [], [], []) => { + cmd.arg("--state-store").arg("in-memory"); + false + } + (true, _, _, _) => { + return Err(anyhow!( + "When `enable_in_memory_kv_state_backend` is enabled, no minio and aws-s3 should be provided.", + )); + } + (_, provide_minio, provide_aws_s3, provide_opendal) => add_storage_backend( + &config.id, + provide_opendal, + provide_minio, + provide_aws_s3, + hummock_in_memory_strategy, + cmd, + )?, + }; + + if (provide_compute_node.len() > 1 || !provide_compactor.is_empty()) && !is_shared_backend { + if config.enable_in_memory_kv_state_backend { + // Using a non-shared backend with multiple compute nodes will be problematic for + // state sharing like scaling. However, for distributed end-to-end tests with + // in-memory state store, this is acceptable. + } else { + return Err(anyhow!( + "Hummock storage may behave incorrectly with in-memory backend for multiple compute-node or compactor-enabled configuration. Should use a shared backend (e.g. MinIO) instead. Consider adding `use: minio` in risedev config." + )); + } + } + + let provide_compactor = config.provide_compactor.as_ref().unwrap(); + if is_shared_backend && provide_compactor.is_empty() { + return Err(anyhow!( + "When using a shared backend (minio, aws-s3, or shared in-memory with `risedev playground`), at least one compactor is required. Consider adding `use: compactor` in risedev config." + )); + } + Ok(()) } } @@ -121,7 +176,7 @@ impl Task for MetaNodeService { ); } - Self::apply_command_args(&mut cmd, &self.config)?; + Self::apply_command_args(&mut cmd, &self.config, HummockInMemoryStrategy::Isolated)?; let prefix_config = env::var("PREFIX_CONFIG")?; cmd.arg("--config-path") diff --git a/src/risedevtool/src/task/utils.rs b/src/risedevtool/src/task/utils.rs index ad53b579f4d00..a758873044522 100644 --- a/src/risedevtool/src/task/utils.rs +++ b/src/risedevtool/src/task/utils.rs @@ -101,30 +101,31 @@ pub fn add_storage_backend( if opendal.engine == "hdfs"{ cmd.arg("--state-store") .arg(format!("hummock+hdfs://{}@{}", opendal.namenode, opendal.root)); - true } else if opendal.engine == "gcs"{ cmd.arg("--state-store") .arg(format!("hummock+gcs://{}@{}", opendal.bucket, opendal.root)); - true} + } else if opendal.engine == "oss"{ cmd.arg("--state-store") .arg(format!("hummock+oss://{}@{}", opendal.bucket, opendal.root)); - true } else if opendal.engine == "webhdfs"{ cmd.arg("--state-store") .arg(format!("hummock+webhdfs://{}@{}", opendal.namenode, opendal.root)); - true + } + else if opendal.engine == "azblob"{ + cmd.arg("--state-store") + .arg(format!("hummock+azblob://{}@{}", opendal.bucket, opendal.root)); } else if opendal.engine == "fs"{ cmd.arg("--state-store") .arg(format!("hummock+fs://{}@{}", opendal.namenode, opendal.root)); - true } else{ unimplemented!() } + true } (other_minio, other_s3, _) => { diff --git a/src/rpc_client/src/compute_client.rs b/src/rpc_client/src/compute_client.rs index d7cff5eb9bc93..a0ad224106290 100644 --- a/src/rpc_client/src/compute_client.rs +++ b/src/rpc_client/src/compute_client.rs @@ -30,7 +30,7 @@ use risingwave_pb::monitor_service::{ use risingwave_pb::task_service::exchange_service_client::ExchangeServiceClient; use risingwave_pb::task_service::task_service_client::TaskServiceClient; use risingwave_pb::task_service::{ - AbortTaskRequest, AbortTaskResponse, CreateTaskRequest, ExecuteRequest, GetDataRequest, + CancelTaskRequest, CancelTaskResponse, CreateTaskRequest, ExecuteRequest, GetDataRequest, GetDataResponse, GetStreamRequest, GetStreamResponse, TaskInfoResponse, }; use tokio::sync::mpsc; @@ -157,11 +157,11 @@ impl ComputeClient { Ok(self.task_client.to_owned().execute(req).await?.into_inner()) } - pub async fn abort(&self, req: AbortTaskRequest) -> Result { + pub async fn cancel(&self, req: CancelTaskRequest) -> Result { Ok(self .task_client .to_owned() - .abort_task(req) + .cancel_task(req) .await? .into_inner()) } diff --git a/src/rpc_client/src/connector_client.rs b/src/rpc_client/src/connector_client.rs index f05b756b41435..4192ee9d81c2f 100644 --- a/src/rpc_client/src/connector_client.rs +++ b/src/rpc_client/src/connector_client.rs @@ -120,6 +120,7 @@ impl ConnectorClient { connector_type: String, properties: HashMap, table_schema: Option, + sink_payload_format: SinkPayloadFormat, ) -> Result<(UnboundedSender, Streaming)> { let (request_sender, request_receiver) = unbounded_channel::(); @@ -127,7 +128,7 @@ impl ConnectorClient { request_sender .send(SinkStreamRequest { request: Some(SinkRequest::Start(StartSink { - format: SinkPayloadFormat::Json as i32, + format: sink_payload_format as i32, sink_config: Some(SinkConfig { connector_type, properties, diff --git a/src/rpc_client/src/hummock_meta_client.rs b/src/rpc_client/src/hummock_meta_client.rs index 5f1a181672fb8..827349213a559 100644 --- a/src/rpc_client/src/hummock_meta_client.rs +++ b/src/rpc_client/src/hummock_meta_client.rs @@ -19,7 +19,8 @@ use risingwave_hummock_sdk::{ HummockEpoch, HummockSstableObjectId, HummockVersionId, LocalSstableInfo, SstObjectIdRange, }; use risingwave_pb::hummock::{ - CompactTask, CompactTaskProgress, HummockSnapshot, HummockVersion, VacuumTask, + CompactTask, CompactTaskProgress, CompactorWorkload, HummockSnapshot, HummockVersion, + VacuumTask, }; use crate::error::Result; @@ -41,9 +42,10 @@ pub trait HummockMetaClient: Send + Sync + 'static { compact_task: CompactTask, table_stats_change: TableStatsMap, ) -> Result<()>; - async fn report_compaction_task_progress( + async fn compactor_heartbeat( &self, progress: Vec, + workload: CompactorWorkload, ) -> Result<()>; // We keep `commit_epoch` only for test/benchmark. async fn commit_epoch( @@ -56,6 +58,7 @@ pub trait HummockMetaClient: Send + Sync + 'static { async fn subscribe_compact_tasks( &self, max_concurrent_task_number: u64, + cpu_core_num: u32, ) -> Result>; async fn report_vacuum_task(&self, vacuum_task: VacuumTask) -> Result<()>; async fn trigger_manual_compaction( diff --git a/src/rpc_client/src/meta_client.rs b/src/rpc_client/src/meta_client.rs index 77cc767bccfe8..6638b43073601 100644 --- a/src/rpc_client/src/meta_client.rs +++ b/src/rpc_client/src/meta_client.rs @@ -27,6 +27,7 @@ use lru::LruCache; use risingwave_common::catalog::{CatalogVersion, FunctionId, IndexId, TableId}; use risingwave_common::config::MAX_CONNECTION_WINDOW_SIZE; use risingwave_common::system_param::reader::SystemParamsReader; +use risingwave_common::telemetry::report::TelemetryInfoFetcher; use risingwave_common::util::addr::HostAddr; use risingwave_common::util::column_index_mapping::ColIndexMapping; use risingwave_hummock_sdk::compact::CompactorRuntimeConfig; @@ -39,11 +40,10 @@ use risingwave_hummock_sdk::{ use risingwave_pb::backup_service::backup_service_client::BackupServiceClient; use risingwave_pb::backup_service::*; use risingwave_pb::catalog::{ - Connection, Database as ProstDatabase, Function as ProstFunction, Index as ProstIndex, - Schema as ProstSchema, Sink as ProstSink, Source as ProstSource, Table as ProstTable, - View as ProstView, + Connection, PbDatabase, PbFunction, PbIndex, PbSchema, PbSink, PbSource, PbTable, PbView, }; use risingwave_pb::common::{HostAddress, WorkerType}; +use risingwave_pb::ddl_service::alter_relation_name_request::Relation; use risingwave_pb::ddl_service::ddl_service_client::DdlServiceClient; use risingwave_pb::ddl_service::drop_table_request::SourceId; use risingwave_pb::ddl_service::*; @@ -56,10 +56,11 @@ use risingwave_pb::meta::heartbeat_service_client::HeartbeatServiceClient; use risingwave_pb::meta::list_table_fragments_response::TableFragmentInfo; use risingwave_pb::meta::meta_member_service_client::MetaMemberServiceClient; use risingwave_pb::meta::notification_service_client::NotificationServiceClient; -use risingwave_pb::meta::reschedule_request::Reschedule as ProstReschedule; +use risingwave_pb::meta::reschedule_request::PbReschedule; use risingwave_pb::meta::scale_service_client::ScaleServiceClient; use risingwave_pb::meta::stream_manager_service_client::StreamManagerServiceClient; use risingwave_pb::meta::system_params_service_client::SystemParamsServiceClient; +use risingwave_pb::meta::telemetry_info_service_client::TelemetryInfoServiceClient; use risingwave_pb::meta::*; use risingwave_pb::stream_plan::StreamFragmentGraph; use risingwave_pb::user::update_user_request::UpdateField; @@ -261,14 +262,14 @@ impl MetaClient { Ok(()) } - pub async fn create_database(&self, db: ProstDatabase) -> Result<(DatabaseId, CatalogVersion)> { + pub async fn create_database(&self, db: PbDatabase) -> Result<(DatabaseId, CatalogVersion)> { let request = CreateDatabaseRequest { db: Some(db) }; let resp = self.inner.create_database(request).await?; // TODO: handle error in `resp.status` here Ok((resp.database_id, resp.version)) } - pub async fn create_schema(&self, schema: ProstSchema) -> Result<(SchemaId, CatalogVersion)> { + pub async fn create_schema(&self, schema: PbSchema) -> Result<(SchemaId, CatalogVersion)> { let request = CreateSchemaRequest { schema: Some(schema), }; @@ -279,7 +280,7 @@ impl MetaClient { pub async fn create_materialized_view( &self, - table: ProstTable, + table: PbTable, graph: StreamFragmentGraph, ) -> Result<(TableId, CatalogVersion)> { let request = CreateMaterializedViewRequest { @@ -300,7 +301,7 @@ impl MetaClient { Ok(resp.version) } - pub async fn create_source(&self, source: ProstSource) -> Result<(u32, CatalogVersion)> { + pub async fn create_source(&self, source: PbSource) -> Result<(u32, CatalogVersion)> { let request = CreateSourceRequest { source: Some(source), }; @@ -311,7 +312,7 @@ impl MetaClient { pub async fn create_sink( &self, - sink: ProstSink, + sink: PbSink, graph: StreamFragmentGraph, ) -> Result<(u32, CatalogVersion)> { let request = CreateSinkRequest { @@ -325,7 +326,7 @@ impl MetaClient { pub async fn create_function( &self, - function: ProstFunction, + function: PbFunction, ) -> Result<(FunctionId, CatalogVersion)> { let request = CreateFunctionRequest { function: Some(function), @@ -336,8 +337,8 @@ impl MetaClient { pub async fn create_table( &self, - source: Option, - table: ProstTable, + source: Option, + table: PbTable, graph: StreamFragmentGraph, ) -> Result<(TableId, CatalogVersion)> { let request = CreateTableRequest { @@ -350,9 +351,22 @@ impl MetaClient { Ok((resp.table_id.into(), resp.version)) } + pub async fn alter_relation_name( + &self, + relation: Relation, + name: &str, + ) -> Result { + let request = AlterRelationNameRequest { + relation: Some(relation), + new_name: name.to_string(), + }; + let resp = self.inner.alter_relation_name(request).await?; + Ok(resp.version) + } + pub async fn replace_table( &self, - table: ProstTable, + table: PbTable, graph: StreamFragmentGraph, table_col_index_mapping: ColIndexMapping, ) -> Result { @@ -366,7 +380,7 @@ impl MetaClient { Ok(resp.version) } - pub async fn create_view(&self, view: ProstView) -> Result<(u32, CatalogVersion)> { + pub async fn create_view(&self, view: PbView) -> Result<(u32, CatalogVersion)> { let request = CreateViewRequest { view: Some(view) }; let resp = self.inner.create_view(request).await?; // TODO: handle error in `resp.status` here @@ -375,8 +389,8 @@ impl MetaClient { pub async fn create_index( &self, - index: ProstIndex, - table: ProstTable, + index: PbIndex, + table: PbTable, graph: StreamFragmentGraph, ) -> Result<(TableId, CatalogVersion)> { let request = CreateIndexRequest { @@ -588,7 +602,7 @@ impl MetaClient { (join_handle, shutdown_tx) } - pub async fn risectl_list_state_tables(&self) -> Result> { + pub async fn risectl_list_state_tables(&self) -> Result> { let request = RisectlListStateTablesRequest {}; let resp = self.inner.risectl_list_state_tables(request).await?; Ok(resp.tables) @@ -635,7 +649,7 @@ impl MetaClient { Ok(resp) } - pub async fn reschedule(&self, reschedules: HashMap) -> Result { + pub async fn reschedule(&self, reschedules: HashMap) -> Result { let request = RescheduleRequest { reschedules }; let resp = self.inner.reschedule(request).await?; Ok(resp.success) @@ -661,7 +675,7 @@ impl MetaClient { pub async fn init_metadata_for_replay( &self, - tables: Vec, + tables: Vec, compaction_groups: Vec, ) -> Result<()> { let req = InitMetadataForReplayRequest { @@ -801,6 +815,12 @@ impl MetaClient { Ok(resp.manifest.expect("should exist")) } + pub async fn get_telemetry_info(&self) -> Result { + let req = GetTelemetryInfoRequest {}; + let resp = self.inner.get_telemetry_info(req).await?; + Ok(resp) + } + pub async fn get_system_params(&self) -> Result { let req = GetSystemParamsRequest {}; let resp = self.inner.get_system_params(req).await?; @@ -926,24 +946,28 @@ impl HummockMetaClient for MetaClient { async fn subscribe_compact_tasks( &self, max_concurrent_task_number: u64, + cpu_core_num: u32, ) -> Result> { let req = SubscribeCompactTasksRequest { context_id: self.worker_id(), max_concurrent_task_number, + cpu_core_num, }; let stream = self.inner.subscribe_compact_tasks(req).await?; Ok(Box::pin(stream)) } - async fn report_compaction_task_progress( + async fn compactor_heartbeat( &self, progress: Vec, + workload: CompactorWorkload, ) -> Result<()> { - let req = ReportCompactionTaskProgressRequest { + let req = CompactorHeartbeatRequest { context_id: self.worker_id(), progress, + workload: Some(workload), }; - self.inner.report_compaction_task_progress(req).await?; + self.inner.compactor_heartbeat(req).await?; Ok(()) } @@ -991,6 +1015,17 @@ impl HummockMetaClient for MetaClient { } } +#[async_trait] +impl TelemetryInfoFetcher for MetaClient { + async fn fetch_telemetry_info(&self) -> anyhow::Result { + let resp = self.get_telemetry_info().await?; + let tracking_id = resp + .get_tracking_id() + .map_err(|e| anyhow::format_err!("failed to get tracking_id {:?}", e))?; + Ok(tracking_id.to_string()) + } +} + #[derive(Debug, Clone)] struct GrpcMetaClientCore { cluster_client: ClusterServiceClient, @@ -1003,6 +1038,7 @@ struct GrpcMetaClientCore { user_client: UserServiceClient, scale_client: ScaleServiceClient, backup_client: BackupServiceClient, + telemetry_client: TelemetryInfoServiceClient, system_params_client: SystemParamsServiceClient, } @@ -1018,7 +1054,9 @@ impl GrpcMetaClientCore { let user_client = UserServiceClient::new(channel.clone()); let scale_client = ScaleServiceClient::new(channel.clone()); let backup_client = BackupServiceClient::new(channel.clone()); + let telemetry_client = TelemetryInfoServiceClient::new(channel.clone()); let system_params_client = SystemParamsServiceClient::new(channel); + GrpcMetaClientCore { cluster_client, meta_member_client, @@ -1030,6 +1068,7 @@ impl GrpcMetaClientCore { user_client, scale_client, backup_client, + telemetry_client, system_params_client, } } @@ -1323,7 +1362,6 @@ impl GrpcMetaClient { ))) }) .await?; - Ok(channel) } @@ -1358,6 +1396,7 @@ macro_rules! for_all_meta_rpc { ,{ stream_client, cancel_creating_jobs, CancelCreatingJobsRequest, CancelCreatingJobsResponse } ,{ stream_client, list_table_fragments, ListTableFragmentsRequest, ListTableFragmentsResponse } ,{ ddl_client, create_table, CreateTableRequest, CreateTableResponse } + ,{ ddl_client, alter_relation_name, AlterRelationNameRequest, AlterRelationNameResponse } ,{ ddl_client, create_materialized_view, CreateMaterializedViewRequest, CreateMaterializedViewResponse } ,{ ddl_client, create_view, CreateViewRequest, CreateViewResponse } ,{ ddl_client, create_source, CreateSourceRequest, CreateSourceResponse } @@ -1396,7 +1435,7 @@ macro_rules! for_all_meta_rpc { ,{ hummock_client, report_compaction_tasks, ReportCompactionTasksRequest, ReportCompactionTasksResponse } ,{ hummock_client, get_new_sst_ids, GetNewSstIdsRequest, GetNewSstIdsResponse } ,{ hummock_client, subscribe_compact_tasks, SubscribeCompactTasksRequest, Streaming } - ,{ hummock_client, report_compaction_task_progress, ReportCompactionTaskProgressRequest, ReportCompactionTaskProgressResponse } + ,{ hummock_client, compactor_heartbeat, CompactorHeartbeatRequest, CompactorHeartbeatResponse } ,{ hummock_client, report_vacuum_task, ReportVacuumTaskRequest, ReportVacuumTaskResponse } ,{ hummock_client, trigger_manual_compaction, TriggerManualCompactionRequest, TriggerManualCompactionResponse } ,{ hummock_client, report_full_scan_task, ReportFullScanTaskRequest, ReportFullScanTaskResponse } @@ -1422,6 +1461,7 @@ macro_rules! for_all_meta_rpc { ,{ backup_client, get_backup_job_status, GetBackupJobStatusRequest, GetBackupJobStatusResponse } ,{ backup_client, delete_meta_snapshot, DeleteMetaSnapshotRequest, DeleteMetaSnapshotResponse} ,{ backup_client, get_meta_snapshot_manifest, GetMetaSnapshotManifestRequest, GetMetaSnapshotManifestResponse} + ,{ telemetry_client, get_telemetry_info, GetTelemetryInfoRequest, TelemetryInfoResponse} ,{ system_params_client, get_system_params, GetSystemParamsRequest, GetSystemParamsResponse } ,{ system_params_client, set_system_param, SetSystemParamRequest, SetSystemParamResponse } } diff --git a/src/source/benches/json_parser.rs b/src/source/benches/json_parser.rs index 22d4a1cb94e7f..e26bdbc686086 100644 --- a/src/source/benches/json_parser.rs +++ b/src/source/benches/json_parser.rs @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use criterion::{criterion_group, criterion_main, Criterion}; +use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; use rand::distributions::Alphanumeric; use rand::prelude::*; use risingwave_common::catalog::ColumnId; -use risingwave_common::types::{DataType, NaiveDateTimeWrapper, NaiveDateWrapper}; +use risingwave_common::types::{DataType, Date, Timestamp}; use risingwave_connector::parser::{JsonParser, SourceStreamChunkBuilder}; use risingwave_connector::source::SourceColumnDesc; @@ -34,9 +34,9 @@ fn generate_json(rng: &mut impl Rng) -> String { .take(7) .map(char::from) .collect::(), - NaiveDateWrapper::from_num_days_from_ce_uncheck((rng.gen::() % (1 << 20)) as i32).0, + Date::from_num_days_from_ce_uncheck((rng.gen::() % (1 << 20)) as i32).0, { - let datetime = NaiveDateTimeWrapper::from_timestamp_uncheck((rng.gen::() % (1u32 << 28)) as i64, 0).0; + let datetime = Timestamp::from_timestamp_uncheck((rng.gen::() % (1u32 << 28)) as i64, 0).0; format!("{:?} {:?}", datetime.date(), datetime.time()) } ) @@ -53,97 +53,39 @@ fn generate_all_json() -> Vec> { fn get_descs() -> Vec { vec![ - SourceColumnDesc { - name: "i32".to_string(), - data_type: DataType::Int32, - column_id: ColumnId::from(0), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "bool".to_string(), - data_type: DataType::Boolean, - column_id: ColumnId::from(2), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "i16".to_string(), - data_type: DataType::Int16, - column_id: ColumnId::from(3), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "i64".to_string(), - data_type: DataType::Int64, - column_id: ColumnId::from(4), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "f32".to_string(), - data_type: DataType::Float32, - column_id: ColumnId::from(5), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "f64".to_string(), - data_type: DataType::Float64, - column_id: ColumnId::from(6), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "varchar".to_string(), - data_type: DataType::Varchar, - column_id: ColumnId::from(7), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "date".to_string(), - data_type: DataType::Date, - column_id: ColumnId::from(8), - is_row_id: false, - is_meta: false, - fields: vec![], - }, - SourceColumnDesc { - name: "timestamp".to_string(), - data_type: DataType::Timestamp, - column_id: ColumnId::from(9), - is_row_id: false, - is_meta: false, - fields: vec![], - }, + SourceColumnDesc::simple("i32", DataType::Int32, ColumnId::from(0)), + SourceColumnDesc::simple("bool", DataType::Boolean, ColumnId::from(2)), + SourceColumnDesc::simple("i16", DataType::Int16, ColumnId::from(3)), + SourceColumnDesc::simple("i64", DataType::Int64, ColumnId::from(4)), + SourceColumnDesc::simple("f32", DataType::Float32, ColumnId::from(5)), + SourceColumnDesc::simple("f64", DataType::Float64, ColumnId::from(6)), + SourceColumnDesc::simple("varchar", DataType::Varchar, ColumnId::from(7)), + SourceColumnDesc::simple("date", DataType::Date, ColumnId::from(8)), + SourceColumnDesc::simple("timestamp", DataType::Timestamp, ColumnId::from(9)), ] } fn bench_json_parser(c: &mut Criterion) { let descs = get_descs(); let parser = JsonParser::new_for_test(descs.clone()).unwrap(); - let records = generate_all_json(); let rt = tokio::runtime::Builder::new_multi_thread() .enable_all() .build() .unwrap(); + let records = generate_all_json(); c.bench_function("json_parser", |b| { - b.to_async(&rt).iter(|| async { - let mut builder = SourceStreamChunkBuilder::with_capacity(descs.clone(), NUM_RECORDS); - for record in &records { - let writer = builder.row_writer(); - parser.parse_inner(record, writer).await.unwrap(); - } - }) + b.to_async(&rt).iter_batched( + || records.clone(), + |records| async { + let mut builder = + SourceStreamChunkBuilder::with_capacity(descs.clone(), NUM_RECORDS); + for record in records { + let writer = builder.row_writer(); + parser.parse_inner(record, writer).await.unwrap(); + } + }, + BatchSize::SmallInput, + ) }); } diff --git a/src/source/src/source_desc.rs b/src/source/src/source_desc.rs index d6c0036b6fb28..2bcc5bfec1ab8 100644 --- a/src/source/src/source_desc.rs +++ b/src/source/src/source_desc.rs @@ -22,10 +22,8 @@ use risingwave_connector::parser::SpecificParserConfig; use risingwave_connector::source::monitor::SourceMetrics; use risingwave_connector::source::{SourceColumnDesc, SourceFormat}; use risingwave_connector::ConnectorParams; -use risingwave_pb::catalog::StreamSourceInfo as ProstStreamSourceInfo; -use risingwave_pb::plan_common::{ - ColumnCatalog as ProstColumnCatalog, RowFormatType as ProstRowFormatType, -}; +use risingwave_pb::catalog::PbStreamSourceInfo; +use risingwave_pb::plan_common::{PbColumnCatalog, PbRowFormatType}; use crate::connector_source::ConnectorSource; use crate::fs_connector_source::FsConnectorSource; @@ -54,12 +52,12 @@ pub struct FsSourceDesc { #[derive(Clone)] pub struct SourceDescBuilder { - columns: Vec, + columns: Vec, metrics: Arc, pk_column_ids: Vec, row_id_index: Option, properties: HashMap, - source_info: ProstStreamSourceInfo, + source_info: PbStreamSourceInfo, connector_params: ConnectorParams, connector_message_buffer_size: usize, } @@ -67,12 +65,12 @@ pub struct SourceDescBuilder { impl SourceDescBuilder { #[allow(clippy::too_many_arguments)] pub fn new( - columns: Vec, + columns: Vec, metrics: Arc, pk_column_ids: Vec, row_id_index: Option, properties: HashMap, - source_info: ProstStreamSourceInfo, + source_info: PbStreamSourceInfo, connector_params: ConnectorParams, connector_message_buffer_size: usize, ) -> Self { @@ -90,16 +88,16 @@ impl SourceDescBuilder { pub async fn build(self) -> Result { let format = match self.source_info.get_row_format()? { - ProstRowFormatType::Json => SourceFormat::Json, - ProstRowFormatType::Protobuf => SourceFormat::Protobuf, - ProstRowFormatType::DebeziumJson => SourceFormat::DebeziumJson, - ProstRowFormatType::Avro => SourceFormat::Avro, - ProstRowFormatType::Maxwell => SourceFormat::Maxwell, - ProstRowFormatType::CanalJson => SourceFormat::CanalJson, - ProstRowFormatType::Native => SourceFormat::Native, - ProstRowFormatType::DebeziumAvro => SourceFormat::DebeziumAvro, - ProstRowFormatType::UpsertJson => SourceFormat::UpsertJson, - ProstRowFormatType::UpsertAvro => SourceFormat::UpsertAvro, + PbRowFormatType::Json => SourceFormat::Json, + PbRowFormatType::Protobuf => SourceFormat::Protobuf, + PbRowFormatType::DebeziumJson => SourceFormat::DebeziumJson, + PbRowFormatType::Avro => SourceFormat::Avro, + PbRowFormatType::Maxwell => SourceFormat::Maxwell, + PbRowFormatType::CanalJson => SourceFormat::CanalJson, + PbRowFormatType::Native => SourceFormat::Native, + PbRowFormatType::DebeziumAvro => SourceFormat::DebeziumAvro, + PbRowFormatType::UpsertJson => SourceFormat::UpsertJson, + PbRowFormatType::UpsertAvro => SourceFormat::UpsertAvro, _ => unreachable!(), }; @@ -146,8 +144,8 @@ impl SourceDescBuilder { pub async fn build_fs_source_desc(&self) -> Result { let format = match self.source_info.get_row_format()? { - ProstRowFormatType::Csv => SourceFormat::Csv, - ProstRowFormatType::Json => SourceFormat::Json, + PbRowFormatType::Csv => SourceFormat::Csv, + PbRowFormatType::Json => SourceFormat::Json, _ => unreachable!(), }; @@ -214,6 +212,7 @@ pub mod test_utils { name: f.name.clone(), field_descs: vec![], type_name: "".to_string(), + generated_column: None, } .to_protobuf(), ), diff --git a/src/source/src/table.rs b/src/source/src/table.rs index 1e1b9e16f5d70..778b33846d525 100644 --- a/src/source/src/table.rs +++ b/src/source/src/table.rs @@ -100,7 +100,9 @@ impl TableDmlHandle { #[cfg(debug_assertions)] risingwave_common::util::schema_check::schema_check( - self.column_descs.iter().map(|c| &c.data_type), + self.column_descs + .iter() + .filter_map(|c| (!c.is_generated_column()).then_some(&c.data_type)), chunk.columns(), ) .expect("table source write chunk schema check failed"); diff --git a/src/sqlparser/examples/parse.rs b/src/sqlparser/examples/parse.rs index 73587757de75f..40c9d52a1aeab 100644 --- a/src/sqlparser/examples/parse.rs +++ b/src/sqlparser/examples/parse.rs @@ -27,7 +27,7 @@ fn main() { continue; } - let tokens = Tokenizer::new(&sql).tokenize().unwrap(); + let tokens = Tokenizer::new(&sql).tokenize_with_location().unwrap(); println!("tokens: {:?}", tokens); let ast = Parser::parse_sql(&sql).unwrap(); println!("ast: {:?}", ast); diff --git a/src/sqlparser/src/ast/ddl.rs b/src/sqlparser/src/ast/ddl.rs index 21f24bb67e4cb..47ec88350d230 100644 --- a/src/sqlparser/src/ast/ddl.rs +++ b/src/sqlparser/src/ast/ddl.rs @@ -77,6 +77,34 @@ pub enum AlterTableOperation { }, } +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] +pub enum AlterIndexOperation { + RenameIndex { index_name: ObjectName }, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] +pub enum AlterViewOperation { + RenameView { view_name: ObjectName }, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] +pub enum AlterSinkOperation { + RenameSink { sink_name: ObjectName }, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] +pub enum AlterSourceOperation { + RenameSource { source_name: ObjectName }, +} + impl fmt::Display for AlterTableOperation { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -133,6 +161,46 @@ impl fmt::Display for AlterTableOperation { } } +impl fmt::Display for AlterIndexOperation { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AlterIndexOperation::RenameIndex { index_name } => { + write!(f, "RENAME TO {index_name}") + } + } + } +} + +impl fmt::Display for AlterViewOperation { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AlterViewOperation::RenameView { view_name } => { + write!(f, "RENAME TO {view_name}") + } + } + } +} + +impl fmt::Display for AlterSinkOperation { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AlterSinkOperation::RenameSink { sink_name } => { + write!(f, "RENAME TO {sink_name}") + } + } + } +} + +impl fmt::Display for AlterSourceOperation { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + AlterSourceOperation::RenameSource { source_name } => { + write!(f, "RENAME TO {source_name}") + } + } + } +} + /// An `ALTER COLUMN` (`Statement::AlterTable`) operation #[derive(Debug, Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] @@ -371,6 +439,8 @@ pub enum ColumnOption { /// - MySQL's `AUTO_INCREMENT` or SQLite's `AUTOINCREMENT` /// - ... DialectSpecific(Vec), + /// AS ( )` + GeneratedColumns(Expr), } impl fmt::Display for ColumnOption { @@ -403,6 +473,7 @@ impl fmt::Display for ColumnOption { } Check(expr) => write!(f, "CHECK ({})", expr), DialectSpecific(val) => write!(f, "{}", display_separated(val, " ")), + GeneratedColumns(expr) => write!(f, "AS {}", expr), } } } diff --git a/src/sqlparser/src/ast/mod.rs b/src/sqlparser/src/ast/mod.rs index 52f591afba58a..79af8fd138e33 100644 --- a/src/sqlparser/src/ast/mod.rs +++ b/src/sqlparser/src/ast/mod.rs @@ -43,6 +43,9 @@ pub use self::query::{ }; pub use self::statement::*; pub use self::value::{DateTimeField, DollarQuotedString, TrimWhereField, Value}; +pub use crate::ast::ddl::{ + AlterIndexOperation, AlterSinkOperation, AlterSourceOperation, AlterViewOperation, +}; use crate::keywords::Keyword; use crate::parser::{Parser, ParserError}; @@ -991,6 +994,31 @@ pub enum Statement { name: ObjectName, operation: AlterTableOperation, }, + /// ALTER INDEX + AlterIndex { + /// Index name + name: ObjectName, + operation: AlterIndexOperation, + }, + /// ALTER VIEW + AlterView { + /// View name + name: ObjectName, + materialized: bool, + operation: AlterViewOperation, + }, + /// ALTER SINK + AlterSink { + /// Sink name + name: ObjectName, + operation: AlterSinkOperation, + }, + /// ALTER SOURCE + AlterSource { + /// Source name + name: ObjectName, + operation: AlterSourceOperation, + }, /// DESCRIBE TABLE OR SOURCE Describe { /// Table or Source name @@ -1363,7 +1391,7 @@ impl fmt::Display for Statement { if_not_exists = if *if_not_exists { "IF NOT EXISTS " } else { "" }, name = name, table_name = table_name, - columns = display_separated(columns, ","), + columns = display_comma_separated(columns), include = if include.is_empty() { "".to_string() } else { @@ -1386,6 +1414,18 @@ impl fmt::Display for Statement { Statement::AlterTable { name, operation } => { write!(f, "ALTER TABLE {} {}", name, operation) } + Statement::AlterIndex { name, operation } => { + write!(f, "ALTER INDEX {} {}", name, operation) + } + Statement::AlterView { materialized, name, operation } => { + write!(f, "ALTER {}VIEW {} {}", if *materialized { "MATERIALIZED " } else { "" }, name, operation) + } + Statement::AlterSink { name, operation } => { + write!(f, "ALTER SINK {} {}", name, operation) + } + Statement::AlterSource { name, operation } => { + write!(f, "ALTER SOURCE {} {}", name, operation) + } Statement::Drop(stmt) => write!(f, "DROP {}", stmt), Statement::DropFunction { if_exists, diff --git a/src/sqlparser/src/ast/statement.rs b/src/sqlparser/src/ast/statement.rs index 830727495b50c..3494bd9db92e2 100644 --- a/src/sqlparser/src/ast/statement.rs +++ b/src/sqlparser/src/ast/statement.rs @@ -710,7 +710,7 @@ impl ParseTo for UserOptions { break; } - if let Token::Word(ref w) = token { + if let Token::Word(ref w) = token.token { parser.next_token(); let (item_mut_ref, user_option) = match w.keyword { Keyword::SUPERUSER => (&mut builder.super_user, UserOption::SuperUser), diff --git a/src/sqlparser/src/parser.rs b/src/sqlparser/src/parser.rs index cd6c7099a6e92..ff784093fb0a3 100644 --- a/src/sqlparser/src/parser.rs +++ b/src/sqlparser/src/parser.rs @@ -24,7 +24,9 @@ use core::fmt; use tracing::{debug, instrument}; -use crate::ast::ddl::SourceWatermark; +use crate::ast::ddl::{ + AlterIndexOperation, AlterSinkOperation, AlterViewOperation, SourceWatermark, +}; use crate::ast::{ParseTo, *}; use crate::keywords::{self, Keyword}; use crate::tokenizer::*; @@ -69,6 +71,7 @@ pub enum IsLateral { use IsLateral::*; +#[derive(Debug)] pub enum WildcardOrExpr { Expr(Expr), /// Expr is an arbitrary expression, returning either a table or a column. @@ -141,7 +144,7 @@ pub enum Precedence { } pub struct Parser { - tokens: Vec, + tokens: Vec, /// The index of the first unprocessed token in `self.tokens` index: usize, /// Since we cannot distinguish `>>` and double `>`, so use `angle_brackets_num` to store the @@ -157,7 +160,7 @@ pub struct Parser { impl Parser { /// Parse the specified tokens - pub fn new(tokens: Vec) -> Self { + pub fn new(tokens: Vec) -> Self { Parser { tokens, index: 0, @@ -171,7 +174,7 @@ impl Parser { #[instrument(level = "debug")] pub fn parse_sql(sql: &str) -> Result, ParserError> { let mut tokenizer = Tokenizer::new(sql); - let tokens = tokenizer.tokenize()?; + let tokens = tokenizer.tokenize_with_location()?; let mut parser = Parser::new(tokens); let mut stmts = Vec::new(); let mut expecting_statement_delimiter = false; @@ -199,7 +202,8 @@ impl Parser { /// Parse a single top-level statement (such as SELECT, INSERT, CREATE, etc.), /// stopping before the statement separator, if any. pub fn parse_statement(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => match w.keyword { Keyword::EXPLAIN => Ok(self.parse_explain()?), Keyword::ANALYZE => Ok(self.parse_analyze()?), @@ -243,13 +247,18 @@ impl Parser { Keyword::PREPARE => Ok(self.parse_prepare()?), Keyword::COMMENT => Ok(self.parse_comment()?), Keyword::FLUSH => Ok(Statement::Flush), - _ => self.expected("an SQL statement", Token::Word(w)), + _ => self.expected( + "an SQL statement", + Token::Word(w).with_location(token.location), + ), }, Token::LParen => { self.prev_token(); Ok(Statement::Query(Box::new(self.parse_query()?))) } - unexpected => self.expected("an SQL statement", unexpected), + unexpected => { + self.expected("an SQL statement", unexpected.with_location(token.location)) + } } } @@ -295,7 +304,7 @@ impl Parser { pub fn parse_wildcard_or_expr(&mut self) -> Result { let index = self.index; - match self.next_token() { + match self.next_token().token { Token::Word(w) if self.peek_token() == Token::Period => { // Since there's no parenthesis, `w` must be a column or a table // So what follows must be dot-delimited identifiers, e.g. `a.b.c.*` @@ -362,6 +371,8 @@ impl Parser { Expr::CompoundIdentifier(_) => expr, // expr is `((1,2,3)::foo)` Expr::Cast { .. } => expr, + // expr is `(func())` + Expr::Function(_) => expr, // expr is `((foo.v1).v2)` Expr::FieldIdentifier(expr, ids) => { // Put `ids` to the latter part! @@ -391,7 +402,8 @@ impl Parser { ) -> Result { let mut id_parts = vec![]; while self.consume_token(&Token::Period) { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => id_parts.push(w.to_ident()?), Token::Mul => { return if id_parts.is_empty() { @@ -401,7 +413,10 @@ impl Parser { } } unexpected => { - return self.expected("an identifier or a '*' after '.'", unexpected); + return self.expected( + "an identifier or a '*' after '.'", + unexpected.with_location(token.location), + ); } } } @@ -468,7 +483,8 @@ impl Parser { } })); - let expr = match self.next_token() { + let token = self.next_token(); + let expr = match token.token { Token::Word(w) => match w.keyword { Keyword::TRUE | Keyword::FALSE | Keyword::NULL => { self.prev_token(); @@ -497,15 +513,18 @@ impl Parser { } // Here `w` is a word, check if it's a part of a multi-part // identifier, a function call, or a simple identifier: - _ => match self.peek_token() { + _ => match self.peek_token().token { Token::LParen | Token::Period => { let mut id_parts: Vec = vec![w.to_ident()?]; while self.consume_token(&Token::Period) { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => id_parts.push(w.to_ident()?), unexpected => { - return self - .expected("an identifier or a '*' after '.'", unexpected); + return self.expected( + "an identifier or a '*' after '.'", + unexpected.with_location(token.location), + ); } } } @@ -591,7 +610,7 @@ impl Parser { Ok(expr) } } - unexpected => self.expected("an expression:", unexpected), + unexpected => self.expected("an expression:", unexpected.with_location(token.location)), }?; if self.parse_keyword(Keyword::COLLATE) { @@ -627,12 +646,16 @@ impl Parser { pub fn parse_fields(&mut self) -> Result, ParserError> { let mut idents = vec![]; while self.consume_token(&Token::Period) { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => { idents.push(w.to_ident()?); } unexpected => { - return self.expected("an identifier after '.'", unexpected); + return self.expected( + "an identifier after '.'", + unexpected.with_location(token.location), + ); } } } @@ -695,14 +718,21 @@ impl Parser { } pub fn parse_window_frame_units(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => match w.keyword { Keyword::ROWS => Ok(WindowFrameUnits::Rows), Keyword::RANGE => Ok(WindowFrameUnits::Range), Keyword::GROUPS => Ok(WindowFrameUnits::Groups), - _ => self.expected("ROWS, RANGE, GROUPS", Token::Word(w))?, + _ => self.expected( + "ROWS, RANGE, GROUPS", + Token::Word(w).with_location(token.location), + )?, }, - unexpected => self.expected("ROWS, RANGE, GROUPS", unexpected), + unexpected => self.expected( + "ROWS, RANGE, GROUPS", + unexpected.with_location(token.location), + ), } } @@ -930,7 +960,7 @@ impl Parser { pub fn parse_trim_expr(&mut self) -> Result { self.expect_token(&Token::LParen)?; let mut where_expr = None; - if let Token::Word(word) = self.peek_token() { + if let Token::Word(word) = self.peek_token().token { if [Keyword::BOTH, Keyword::LEADING, Keyword::TRAILING] .iter() .any(|d| word.keyword == *d) @@ -951,14 +981,20 @@ impl Parser { } pub fn parse_trim_where(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => match w.keyword { Keyword::BOTH => Ok(TrimWhereField::Both), Keyword::LEADING => Ok(TrimWhereField::Leading), Keyword::TRAILING => Ok(TrimWhereField::Trailing), - _ => self.expected("trim_where field", Token::Word(w))?, + _ => self.expected( + "trim_where field", + Token::Word(w).with_location(token.location), + )?, }, - unexpected => self.expected("trim_where field", unexpected), + unexpected => { + self.expected("trim_where field", unexpected.with_location(token.location)) + } } } @@ -1007,7 +1043,8 @@ impl Parser { // This function parses date/time fields for interval qualifiers. pub fn parse_date_time_field(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => match w.keyword { Keyword::YEAR => Ok(DateTimeField::Year), Keyword::MONTH => Ok(DateTimeField::Month), @@ -1015,9 +1052,14 @@ impl Parser { Keyword::HOUR => Ok(DateTimeField::Hour), Keyword::MINUTE => Ok(DateTimeField::Minute), Keyword::SECOND => Ok(DateTimeField::Second), - _ => self.expected("date/time field", Token::Word(w))?, + _ => self.expected( + "date/time field", + Token::Word(w).with_location(token.location), + )?, }, - unexpected => self.expected("date/time field", unexpected), + unexpected => { + self.expected("date/time field", unexpected.with_location(token.location)) + } } } @@ -1031,10 +1073,13 @@ impl Parser { // select extract('invaLId' from null::date); // ``` pub fn parse_date_time_field_in_extract(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => Ok(w.value.to_uppercase()), Token::SingleQuotedString(s) => Ok(s.to_uppercase()), - unexpected => self.expected("date/time field", unexpected), + unexpected => { + self.expected("date/time field", unexpected.with_location(token.location)) + } } } @@ -1065,7 +1110,7 @@ impl Parser { // // Note that PostgreSQL allows omitting the qualifier, so we provide // this more general implementation. - let leading_field = match self.peek_token() { + let leading_field = match self.peek_token().token { Token::Word(kw) if [ Keyword::YEAR, @@ -1120,7 +1165,7 @@ impl Parser { /// Parse an operator following an expression pub fn parse_infix(&mut self, expr: Expr, precedence: Precedence) -> Result { let tok = self.next_token(); - let regular_binary_operator = match &tok { + let regular_binary_operator = match &tok.token { Token::Spaceship => Some(BinaryOperator::Spaceship), Token::DoubleEq => Some(BinaryOperator::Eq), Token::Eq => Some(BinaryOperator::Eq), @@ -1204,7 +1249,7 @@ impl Parser { right: Box::new(self.parse_subexpr(precedence)?), }) } - } else if let Token::Word(w) = &tok { + } else if let Token::Word(w) = &tok.token { match w.keyword { Keyword::IS => { if self.parse_keyword(Keyword::TRUE) { @@ -1235,15 +1280,15 @@ impl Parser { } Keyword::AT => { if self.parse_keywords(&[Keyword::TIME, Keyword::ZONE]) { - let time_zone = self.next_token(); - match time_zone { + let token = self.next_token(); + match token.token { Token::SingleQuotedString(time_zone) => Ok(Expr::AtTimeZone { timestamp: Box::new(expr), time_zone, }), - tok => self.expected( + unexpected => self.expected( "Expected Token::SingleQuotedString after AT TIME ZONE", - tok, + unexpected.with_location(token.location), ), } } else { @@ -1348,7 +1393,7 @@ impl Parser { let token = self.peek_token(); debug!("get_next_precedence() {:?}", token); - match token { + match token.token { Token::Word(w) if w.keyword == Keyword::OR => Ok(P::LogicalOr), Token::Word(w) if w.keyword == Keyword::XOR => Ok(P::LogicalXor), Token::Word(w) if w.keyword == Keyword::AND => Ok(P::LogicalAnd), @@ -1363,7 +1408,7 @@ impl Parser { | Token::GtEq | Token::DoubleEq | Token::Spaceship => Ok(P::Cmp), - Token::Word(w) if w.keyword == Keyword::NOT => match self.peek_nth_token(1) { + Token::Word(w) if w.keyword == Keyword::NOT => match self.peek_nth_token(1).token { // The precedence of NOT varies depending on keyword that // follows it. If it is followed by IN, BETWEEN, or LIKE, // it takes on the precedence of those tokens. Otherwise it @@ -1391,7 +1436,7 @@ impl Parser { | Token::HashArrow | Token::HashLongArrow => Ok(P::Other), Token::Word(w) if w.keyword == Keyword::AT => { - match (self.peek_nth_token(1), self.peek_nth_token(2)) { + match (self.peek_nth_token(1).token, self.peek_nth_token(2).token) { (Token::Word(w), Token::Word(w2)) if w.keyword == Keyword::TIME && w2.keyword == Keyword::ZONE => { @@ -1419,20 +1464,23 @@ impl Parser { /// Return the first non-whitespace token that has not yet been processed /// (or None if reached end-of-file) - pub fn peek_token(&self) -> Token { + pub fn peek_token(&self) -> TokenWithLocation { self.peek_nth_token(0) } /// Return nth non-whitespace token that has not yet been processed - pub fn peek_nth_token(&self, mut n: usize) -> Token { + pub fn peek_nth_token(&self, mut n: usize) -> TokenWithLocation { let mut index = self.index; loop { index += 1; - match self.tokens.get(index - 1) { + let token = self.tokens.get(index - 1); + match token.map(|x| &x.token) { Some(Token::Whitespace(_)) => continue, - non_whitespace => { + _ => { if n == 0 { - return non_whitespace.cloned().unwrap_or(Token::EOF); + return token + .cloned() + .unwrap_or(TokenWithLocation::wrap(Token::EOF)); } n -= 1; } @@ -1443,18 +1491,23 @@ impl Parser { /// Return the first non-whitespace token that has not yet been processed /// (or None if reached end-of-file) and mark it as processed. OK to call /// repeatedly after reaching EOF. - pub fn next_token(&mut self) -> Token { + pub fn next_token(&mut self) -> TokenWithLocation { loop { self.index += 1; - match self.tokens.get(self.index - 1) { + let token = self.tokens.get(self.index - 1); + match token.map(|x| &x.token) { Some(Token::Whitespace(_)) => continue, - token => return token.cloned().unwrap_or(Token::EOF), + _ => { + return token + .cloned() + .unwrap_or(TokenWithLocation::wrap(Token::EOF)) + } } } } /// Return the first unprocessed token, possibly whitespace. - pub fn next_token_no_skip(&mut self) -> Option<&Token> { + pub fn next_token_no_skip(&mut self) -> Option<&TokenWithLocation> { self.index += 1; self.tokens.get(self.index - 1) } @@ -1466,7 +1519,7 @@ impl Parser { loop { assert!(self.index > 0); self.index -= 1; - if let Some(Token::Whitespace(_)) = self.tokens.get(self.index) { + if let Some(token) = self.tokens.get(self.index) && let Token::Whitespace(_) = token.token { continue; } return; @@ -1474,15 +1527,15 @@ impl Parser { } /// Report unexpected token - pub fn expected(&self, expected: &str, found: Token) -> Result { + pub fn expected(&self, expected: &str, found: TokenWithLocation) -> Result { let start_off = self.index.saturating_sub(10); let end_off = self.index.min(self.tokens.len()); let near_tokens = &self.tokens[start_off..end_off]; - struct TokensDisplay<'a>(&'a [Token]); + struct TokensDisplay<'a>(&'a [TokenWithLocation]); impl<'a> fmt::Display for TokensDisplay<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for token in self.0 { - write!(f, "{}", token)?; + write!(f, "{}", token.token)?; } Ok(()) } @@ -1498,7 +1551,7 @@ impl Parser { /// Look for an expected keyword and consume it if it exists #[must_use] pub fn parse_keyword(&mut self, expected: Keyword) -> bool { - match self.peek_token() { + match self.peek_token().token { Token::Word(w) if expected == w.keyword => { self.next_token(); true @@ -1525,7 +1578,7 @@ impl Parser { /// Look for one of the given keywords and return the one that matches. #[must_use] pub fn parse_one_of_keywords(&mut self, keywords: &[Keyword]) -> Option { - match self.peek_token() { + match self.peek_token().token { Token::Word(w) => { keywords .iter() @@ -1540,7 +1593,7 @@ impl Parser { } pub fn peek_nth_any_of_keywords(&mut self, n: usize, keywords: &[Keyword]) -> bool { - match self.peek_nth_token(n) { + match self.peek_nth_token(n).token { Token::Word(w) => keywords.iter().any(|keyword| *keyword == w.keyword), _ => false, } @@ -1906,7 +1959,7 @@ impl Parser { Keyword::LINK => Ok(CreateFunctionUsing::Link(uri)), _ => self.expected( "LINK, got {:?}", - Token::make_keyword(format!("{keyword:?}").as_str()), + TokenWithLocation::wrap(Token::make_keyword(format!("{keyword:?}").as_str())), ), } } @@ -2114,7 +2167,7 @@ impl Parser { "Only 1 watermark is allowed to be defined on source.".to_string(), )); } - } else if let Token::Word(_) = self.peek_token() { + } else if let Token::Word(_) = self.peek_token().token { columns.push(self.parse_column_def()?); } else { return self.expected("column name or constraint definition", self.peek_token()); @@ -2133,7 +2186,7 @@ impl Parser { fn parse_column_def(&mut self) -> Result { let name = self.parse_identifier_non_reserved()?; - let data_type = if let Token::Word(_) = self.peek_token() { + let data_type = if let Token::Word(_) = self.peek_token().token { Some(self.parse_data_type()?) } else { None @@ -2210,6 +2263,8 @@ impl Parser { let expr = self.parse_expr()?; self.expect_token(&Token::RParen)?; Ok(Some(ColumnOption::Check(expr))) + } else if self.parse_keyword(Keyword::AS) { + Ok(Some(ColumnOption::GeneratedColumns(self.parse_expr()?))) } else { Ok(None) } @@ -2254,7 +2309,8 @@ impl Parser { } else { None }; - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) if w.keyword == Keyword::PRIMARY || w.keyword == Keyword::UNIQUE => { let is_primary = w.keyword == Keyword::PRIMARY; if is_primary { @@ -2303,7 +2359,10 @@ impl Parser { } unexpected => { if name.is_some() { - self.expected("PRIMARY, UNIQUE, FOREIGN, or CHECK", unexpected) + self.expected( + "PRIMARY, UNIQUE, FOREIGN, or CHECK", + unexpected.with_location(token.location), + ) } else { self.prev_token(); Ok(None) @@ -2361,12 +2420,25 @@ impl Parser { pub fn parse_alter(&mut self) -> Result { if self.parse_keyword(Keyword::TABLE) { self.parse_alter_table() + } else if self.parse_keyword(Keyword::INDEX) { + self.parse_alter_index() + } else if self.parse_keyword(Keyword::VIEW) { + self.parse_alter_view(false) + } else if self.parse_keywords(&[Keyword::MATERIALIZED, Keyword::VIEW]) { + self.parse_alter_view(true) + } else if self.parse_keyword(Keyword::SINK) { + self.parse_alter_sink() + } else if self.parse_keyword(Keyword::SOURCE) { + self.parse_alter_source() } else if self.parse_keyword(Keyword::USER) { self.parse_alter_user() } else if self.parse_keyword(Keyword::SYSTEM) { self.parse_alter_system() } else { - self.expected("TABLE or USER after ALTER", self.peek_token()) + self.expected( + "TABLE, INDEX, MATERIALIZED, VIEW, SINK, SOURCE, USER or SYSTEM after ALTER", + self.peek_token(), + ) } } @@ -2461,6 +2533,89 @@ impl Parser { }) } + pub fn parse_alter_index(&mut self) -> Result { + let index_name = self.parse_object_name()?; + let operation = if self.parse_keyword(Keyword::RENAME) { + if self.parse_keyword(Keyword::TO) { + let index_name = self.parse_object_name()?; + AlterIndexOperation::RenameIndex { index_name } + } else { + return self.expected("TO after RENAME", self.peek_token()); + } + } else { + return self.expected("RENAME after ALTER INDEX", self.peek_token()); + }; + + Ok(Statement::AlterIndex { + name: index_name, + operation, + }) + } + + pub fn parse_alter_view(&mut self, materialized: bool) -> Result { + let view_name = self.parse_object_name()?; + let operation = if self.parse_keyword(Keyword::RENAME) { + if self.parse_keyword(Keyword::TO) { + let view_name = self.parse_object_name()?; + AlterViewOperation::RenameView { view_name } + } else { + return self.expected("TO after RENAME", self.peek_token()); + } + } else { + return self.expected( + &format!( + "RENAME after ALTER {}VIEW", + if materialized { "MATERIALIZED " } else { "" } + ), + self.peek_token(), + ); + }; + + Ok(Statement::AlterView { + materialized, + name: view_name, + operation, + }) + } + + pub fn parse_alter_sink(&mut self) -> Result { + let sink_name = self.parse_object_name()?; + let operation = if self.parse_keyword(Keyword::RENAME) { + if self.parse_keyword(Keyword::TO) { + let sink_name = self.parse_object_name()?; + AlterSinkOperation::RenameSink { sink_name } + } else { + return self.expected("TO after RENAME", self.peek_token()); + } + } else { + return self.expected("RENAME after ALTER SINK", self.peek_token()); + }; + + Ok(Statement::AlterSink { + name: sink_name, + operation, + }) + } + + pub fn parse_alter_source(&mut self) -> Result { + let source_name = self.parse_object_name()?; + let operation = if self.parse_keyword(Keyword::RENAME) { + if self.parse_keyword(Keyword::TO) { + let source_name = self.parse_object_name()?; + AlterSourceOperation::RenameSource { source_name } + } else { + return self.expected("TO after RENAME", self.peek_token()); + } + } else { + return self.expected("RENAME after ALTER SOURCE", self.peek_token()); + }; + + Ok(Statement::AlterSource { + name: source_name, + operation, + }) + } + pub fn parse_alter_system(&mut self) -> Result { self.expect_keyword(Keyword::SET)?; let param = self.parse_identifier()?; @@ -2495,7 +2650,7 @@ impl Parser { let mut values = vec![]; let mut content = String::from(""); while let Some(t) = self.next_token_no_skip() { - match t { + match t.token { Token::Whitespace(Whitespace::Tab) => { values.push(Some(content.to_string())); content.clear(); @@ -2508,7 +2663,7 @@ impl Parser { if self.consume_token(&Token::Period) { return values; } - if let Token::Word(w) = self.next_token() { + if let Token::Word(w) = self.next_token().token { if w.value == "N" { values.push(None); } @@ -2524,7 +2679,8 @@ impl Parser { /// Parse a literal value (numbers, strings, date/time, booleans) fn parse_value(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => match w.keyword { Keyword::TRUE => Ok(Value::Boolean(true)), Keyword::FALSE => Ok(Value::Boolean(false)), @@ -2532,9 +2688,12 @@ impl Parser { Keyword::NoKeyword if w.quote_style.is_some() => match w.quote_style { Some('"') => Ok(Value::DoubleQuotedString(w.value)), Some('\'') => Ok(Value::SingleQuotedString(w.value)), - _ => self.expected("A value?", Token::Word(w))?, + _ => self.expected("A value?", Token::Word(w).with_location(token.location))?, }, - _ => self.expected("a concrete value", Token::Word(w)), + _ => self.expected( + "a concrete value", + Token::Word(w).with_location(token.location), + ), }, Token::Number(ref n) => Ok(Value::Number(n.clone())), Token::SingleQuotedString(ref s) => Ok(Value::SingleQuotedString(s.to_string())), @@ -2542,13 +2701,13 @@ impl Parser { Token::CstyleEscapesString(ref s) => Ok(Value::CstyleEscapesString(s.to_string())), Token::NationalStringLiteral(ref s) => Ok(Value::NationalStringLiteral(s.to_string())), Token::HexStringLiteral(ref s) => Ok(Value::HexStringLiteral(s.to_string())), - unexpected => self.expected("a value", unexpected), + unexpected => self.expected("a value", unexpected.with_location(token.location)), } } fn parse_set_variable(&mut self) -> Result { let token = self.peek_token(); - match (self.parse_value(), token) { + match (self.parse_value(), token.token) { (Ok(value), _) => Ok(SetVariableValue::Literal(value)), (Err(_), Token::Word(w)) => { if w.keyword == Keyword::DEFAULT { @@ -2557,7 +2716,9 @@ impl Parser { Ok(SetVariableValue::Ident(w.to_ident()?)) } } - (Err(_), unexpected) => self.expected("variable value", unexpected), + (Err(_), unexpected) => { + self.expected("variable value", unexpected.with_location(token.location)) + } } } @@ -2573,17 +2734,18 @@ impl Parser { /// Parse an unsigned literal integer/long pub fn parse_literal_uint(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Number(s) => s.parse::().map_err(|e| { ParserError::ParserError(format!("Could not parse '{}' as u64: {}", s, e)) }), - unexpected => self.expected("literal int", unexpected), + unexpected => self.expected("literal int", unexpected.with_location(token.location)), } } pub fn parse_function_definition(&mut self) -> Result { let peek_token = self.peek_token(); - match peek_token { + match peek_token.token { Token::DollarQuotedString(value) => { self.next_token(); Ok(FunctionDefinition::DoubleDollarDef(value.value)) @@ -2596,16 +2758,18 @@ impl Parser { /// Parse a literal string pub fn parse_literal_string(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(Word { value, keyword, .. }) if keyword == Keyword::NoKeyword => Ok(value), Token::SingleQuotedString(s) => Ok(s), - unexpected => self.expected("literal string", unexpected), + unexpected => self.expected("literal string", unexpected.with_location(token.location)), } } /// Parse a map key string pub fn parse_map_key(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(Word { value, keyword, .. }) if keyword == Keyword::NoKeyword => { if self.peek_token() == Token::LParen { return self.parse_function(ObjectName(vec![Ident::new_unchecked(value)])); @@ -2614,7 +2778,10 @@ impl Parser { } Token::SingleQuotedString(s) => Ok(Expr::Value(Value::SingleQuotedString(s))), Token::Number(s) => Ok(Expr::Value(Value::Number(s))), - unexpected => self.expected("literal string, number or function", unexpected), + unexpected => self.expected( + "literal string, number or function", + unexpected.with_location(token.location), + ), } } @@ -2638,7 +2805,7 @@ impl Parser { self.angle_brackets_num += 1; loop { - if let Token::Word(_) = self.peek_token() { + if let Token::Word(_) = self.peek_token().token { let name = self.parse_identifier_non_reserved()?; let data_type = self.parse_data_type()?; columns.push(StructField { name, data_type }) @@ -2667,7 +2834,8 @@ impl Parser { /// Parse a SQL datatype pub fn parse_data_type_inner(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => match w.keyword { Keyword::BOOLEAN | Keyword::BOOL => Ok(DataType::Boolean), Keyword::FLOAT => { @@ -2740,7 +2908,9 @@ impl Parser { Ok(DataType::Custom(type_name)) } }, - unexpected => self.expected("a data type name", unexpected), + unexpected => { + self.expected("a data type name", unexpected.with_location(token.location)) + } } } @@ -2752,7 +2922,8 @@ impl Parser { reserved_kwds: &[Keyword], ) -> Result, ParserError> { let after_as = self.parse_keyword(Keyword::AS); - match self.next_token() { + let token = self.next_token(); + match token.token { // Accept any identifier after `AS` (though many dialects have restrictions on // keywords that may appear here). If there's no `AS`: don't parse keywords, // which may start a construct allowed in this position, to be parsed as aliases. @@ -2763,7 +2934,10 @@ impl Parser { } not_an_ident => { if after_as { - return self.expected("an identifier after AS", not_an_ident); + return self.expected( + "an identifier after AS", + not_an_ident.with_location(token.location), + ); } self.prev_token(); Ok(None) // no alias found @@ -2821,7 +2995,7 @@ impl Parser { pub fn parse_identifiers_non_keywords(&mut self) -> Result, ParserError> { let mut idents = vec![]; loop { - match self.peek_token() { + match self.peek_token().token { Token::Word(w) => { if w.keyword != Keyword::NoKeyword { break; @@ -2843,7 +3017,8 @@ impl Parser { pub fn parse_identifiers(&mut self) -> Result, ParserError> { let mut idents = vec![]; loop { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => { idents.push(w.to_ident()?); } @@ -2857,22 +3032,24 @@ impl Parser { /// Parse a simple one-word identifier (possibly quoted, possibly a keyword) pub fn parse_identifier(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => Ok(w.to_ident()?), - unexpected => self.expected("identifier", unexpected), + unexpected => self.expected("identifier", unexpected.with_location(token.location)), } } /// Parse a simple one-word identifier (possibly quoted, possibly a non-reserved keyword) pub fn parse_identifier_non_reserved(&mut self) -> Result { - match self.next_token() { + let token = self.next_token(); + match token.token { Token::Word(w) => { match keywords::RESERVED_FOR_COLUMN_OR_TABLE_NAME.contains(&w.keyword) { true => parser_err!(format!("syntax error at or near \"{w}\"")), false => Ok(w.to_ident()?), } } - unexpected => self.expected("identifier", unexpected), + unexpected => self.expected("identifier", unexpected.with_location(token.location)), } } @@ -3170,7 +3347,7 @@ impl Parser { loop { // The query can be optionally followed by a set operator: - let op = self.parse_set_operator(&self.peek_token()); + let op = self.parse_set_operator(&self.peek_token().token); let next_precedence = match op { // UNION and EXCEPT have the same binding power and evaluate left-to-right Some(SetOperator::Union) | Some(SetOperator::Except) => 10, @@ -3345,7 +3522,7 @@ impl Parser { /// otherwise, return `Statement::ShowVariable`. pub fn parse_show(&mut self) -> Result { let index = self.index; - if let Token::Word(w) = self.next_token() { + if let Token::Word(w) = self.next_token().token { match w.keyword { Keyword::TABLES => { return Ok(Statement::ShowObjects(ShowObject::Table { @@ -3418,7 +3595,7 @@ impl Parser { /// Parse object type and name after `show create`. pub fn parse_show_create(&mut self) -> Result { - if let Token::Word(w) = self.next_token() { + if let Token::Word(w) = self.next_token().token { let show_type = match w.keyword { Keyword::TABLE => ShowCreateType::Table, Keyword::MATERIALIZED => { @@ -3471,7 +3648,7 @@ impl Parser { } } else { let natural = self.parse_keyword(Keyword::NATURAL); - let peek_keyword = if let Token::Word(w) = self.peek_token() { + let peek_keyword = if let Token::Word(w) = self.peek_token().token { w.keyword } else { Keyword::NoKeyword @@ -3546,7 +3723,7 @@ impl Parser { // It can only be a subquery. We don't use `maybe_parse` so that a meaningful error can // be returned. - match self.peek_token() { + match self.peek_token().token { Token::Word(w) if [Keyword::SELECT, Keyword::WITH, Keyword::VALUES].contains(&w.keyword) => { @@ -4101,7 +4278,7 @@ impl Parser { self.expect_keyword(Keyword::ON)?; let token = self.next_token(); - let (object_type, object_name) = match token { + let (object_type, object_name) = match token.token { Token::Word(w) if w.keyword == Keyword::COLUMN => { let object_name = self.parse_object_name()?; (CommentObject::Column, object_name) diff --git a/src/sqlparser/src/test_utils.rs b/src/sqlparser/src/test_utils.rs index 92c79f1e256a4..00d454a2fc992 100644 --- a/src/sqlparser/src/test_utils.rs +++ b/src/sqlparser/src/test_utils.rs @@ -34,7 +34,7 @@ where F: Fn(&mut Parser) -> T, { let mut tokenizer = Tokenizer::new(sql); - let tokens = tokenizer.tokenize().unwrap(); + let tokens = tokenizer.tokenize_with_location().unwrap(); f(&mut Parser::new(tokens)) } diff --git a/src/sqlparser/src/tokenizer.rs b/src/sqlparser/src/tokenizer.rs index ed1e1ef4831d2..dbef78d14e98b 100644 --- a/src/sqlparser/src/tokenizer.rs +++ b/src/sqlparser/src/tokenizer.rs @@ -25,6 +25,7 @@ use alloc::{ vec::Vec, }; use core::fmt; +use core::fmt::Debug; use core::iter::Peekable; use core::str::Chars; @@ -237,6 +238,10 @@ impl Token { }, }) } + + pub fn with_location(self, location: Location) -> TokenWithLocation { + TokenWithLocation::new(self, location.line, location.column) + } } /// A keyword (like SELECT) or an optionally quoted SQL identifier @@ -300,6 +305,61 @@ impl fmt::Display for Whitespace { } } +/// Location in input string +#[derive(Debug, Eq, PartialEq, Clone)] +pub struct Location { + /// Line number, starting from 1 + pub line: u64, + /// Line column, starting from 1 + pub column: u64, +} + +/// A [Token] with [Location] attached to it +#[derive(Debug, Eq, PartialEq, Clone)] +pub struct TokenWithLocation { + pub token: Token, + pub location: Location, +} + +impl TokenWithLocation { + pub fn new(token: Token, line: u64, column: u64) -> TokenWithLocation { + TokenWithLocation { + token, + location: Location { line, column }, + } + } + + pub fn wrap(token: Token) -> TokenWithLocation { + TokenWithLocation::new(token, 0, 0) + } +} + +impl PartialEq for TokenWithLocation { + fn eq(&self, other: &Token) -> bool { + &self.token == other + } +} + +impl PartialEq for Token { + fn eq(&self, other: &TokenWithLocation) -> bool { + self == &other.token + } +} + +impl fmt::Display for TokenWithLocation { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + if self.token == Token::EOF { + write!(f, "EOF at the end") + } else { + write!( + f, + "{} at line:{}, column:{}", + self.token, self.location.line, self.location.column + ) + } + } +} + /// Tokenizer error #[derive(Debug, PartialEq)] pub struct TokenizerError { @@ -338,11 +398,11 @@ impl<'a> Tokenizer<'a> { } } - /// Tokenize the statement and produce a vector of tokens - pub fn tokenize(&mut self) -> Result, TokenizerError> { + /// Tokenize the statement and produce a vector of tokens with locations. + pub fn tokenize_with_location(&mut self) -> Result, TokenizerError> { let mut peekable = self.query.chars().peekable(); - let mut tokens: Vec = vec![]; + let mut tokens: Vec = vec![]; while let Some(token) = self.next_token(&mut peekable)? { match &token { @@ -359,11 +419,20 @@ impl<'a> Tokenizer<'a> { _ => self.col += 1, } - tokens.push(token); + let token_with_location = TokenWithLocation::new(token, self.line, self.col); + + tokens.push(token_with_location); } Ok(tokens) } + /// Tokenize the statement and produce a vector of tokens without locations. + #[allow(dead_code)] + fn tokenize(&mut self) -> Result, TokenizerError> { + self.tokenize_with_location() + .map(|v| v.into_iter().map(|t| t.token).collect()) + } + /// Get the next token or return None fn next_token(&self, chars: &mut Peekable>) -> Result, TokenizerError> { match chars.peek() { diff --git a/src/sqlparser/tests/sqlparser_common.rs b/src/sqlparser/tests/sqlparser_common.rs index 1d3d280d3e567..361940cc3d0b0 100644 --- a/src/sqlparser/tests/sqlparser_common.rs +++ b/src/sqlparser/tests/sqlparser_common.rs @@ -3514,7 +3514,7 @@ fn parse_rollback() { #[test] fn parse_create_index() { - let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test(name,age DESC) INCLUDE(other) DISTRIBUTED BY(name)"; + let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test(name, age DESC) INCLUDE(other) DISTRIBUTED BY(name)"; let indexed_columns = vec![ OrderByExpr { expr: Expr::Identifier(Ident::new_unchecked("name")), diff --git a/src/sqlparser/tests/sqlparser_postgres.rs b/src/sqlparser/tests/sqlparser_postgres.rs index e13ae03cc04a5..d78e71d99e080 100644 --- a/src/sqlparser/tests/sqlparser_postgres.rs +++ b/src/sqlparser/tests/sqlparser_postgres.rs @@ -1021,7 +1021,7 @@ fn parse_array() { assert_eq!( parse_sql_statements(sql), Err(ParserError::ParserError( - "syntax error at or near '['".to_string() + "syntax error at or near '[ at line:1, column:28'".to_string() )) ); @@ -1029,7 +1029,7 @@ fn parse_array() { assert_eq!( parse_sql_statements(sql), Err(ParserError::ParserError( - "syntax error at or near '['".to_string() + "syntax error at or near '[ at line:1, column:24'".to_string() )) ); @@ -1037,7 +1037,7 @@ fn parse_array() { assert_eq!( parse_sql_statements(sql), Err(ParserError::ParserError( - "syntax error at or near 'ARRAY'".to_string() + "syntax error at or near 'ARRAY at line:1, column:27'".to_string() )) ); @@ -1045,7 +1045,7 @@ fn parse_array() { assert_eq!( parse_sql_statements(sql), Err(ParserError::ParserError( - "syntax error at or near 'ARRAY'".to_string() + "syntax error at or near 'ARRAY at line:1, column:23'".to_string() )) ); diff --git a/src/sqlparser/tests/testdata/array.yaml b/src/sqlparser/tests/testdata/array.yaml index be97042cfa0c0..aa655652b2b7f 100644 --- a/src/sqlparser/tests/testdata/array.yaml +++ b/src/sqlparser/tests/testdata/array.yaml @@ -7,15 +7,15 @@ formatted_sql: CREATE TABLE t (a INT[][][]) - input: CREATE TABLE t(a int[); error_msg: |- - sql parser error: Expected ], found: ) + sql parser error: Expected ], found: ) at line:1, column:23 Near "CREATE TABLE t(a int[" - input: CREATE TABLE t(a int[[]); error_msg: |- - sql parser error: Expected ], found: [ + sql parser error: Expected ], found: [ at line:1, column:23 Near "CREATE TABLE t(a int[" - input: CREATE TABLE t(a int]); error_msg: |- - sql parser error: Expected ',' or ')' after column definition, found: ] + sql parser error: Expected ',' or ')' after column definition, found: ] at line:1, column:22 Near "CREATE TABLE t(a int" - input: SELECT foo[0] FROM foos formatted_sql: SELECT foo[0] FROM foos diff --git a/src/sqlparser/tests/testdata/create.yaml b/src/sqlparser/tests/testdata/create.yaml index b3d573ad79ba3..c6ff608bd682e 100644 --- a/src/sqlparser/tests/testdata/create.yaml +++ b/src/sqlparser/tests/testdata/create.yaml @@ -17,7 +17,7 @@ formatted_sql: CREATE TABLE t (a INT, b INT) AS SELECT 1 AS b, 2 AS a - input: CREATE SOURCE src error_msg: |- - sql parser error: Expected ROW, found: EOF + sql parser error: Expected ROW, found: EOF at the end Near "CREATE SOURCE src" - input: CREATE SOURCE src ROW FORMAT JSON formatted_sql: CREATE SOURCE src ROW FORMAT JSON @@ -44,7 +44,7 @@ formatted_sql: CREATE USER user WITH SUPERUSER CREATEDB PASSWORD 'password' - input: CREATE SINK snk error_msg: |- - sql parser error: Expected FROM or AS after CREATE SINK sink_name, found: EOF + sql parser error: Expected FROM or AS after CREATE SINK sink_name, found: EOF at the end Near "CREATE SINK snk" - input: CREATE SINK IF NOT EXISTS snk FROM mv WITH (connector = 'mysql', mysql.endpoint = '127.0.0.1:3306', mysql.table = '', mysql.database = '', mysql.user = '', mysql.password = '') formatted_sql: CREATE SINK IF NOT EXISTS snk FROM mv WITH (connector = 'mysql', mysql.endpoint = '127.0.0.1:3306', mysql.table = '', mysql.database = '', mysql.user = '', mysql.password = '') @@ -60,5 +60,5 @@ error_msg: 'sql parser error: conflicting or redundant options' - input: create user tmp with encrypted password null error_msg: |- - sql parser error: Expected literal string, found: null + sql parser error: Expected literal string, found: null at line:1, column:45 Near " tmp with encrypted password null" diff --git a/src/sqlparser/tests/testdata/insert.yaml b/src/sqlparser/tests/testdata/insert.yaml index 553d05052d4cb..4d1bb445d0027 100644 --- a/src/sqlparser/tests/testdata/insert.yaml +++ b/src/sqlparser/tests/testdata/insert.yaml @@ -1,7 +1,7 @@ # This file is automatically generated. See `src/sqlparser/test_runner/src/bin/apply.rs` for more information. - input: INSERT public.customer (id, name, active) VALUES (1, 2, 3) error_msg: |- - sql parser error: Expected INTO, found: public + sql parser error: Expected INTO, found: public at line:1, column:14 Near "INSERT" - input: INSERT INTO t VALUES(1,3), (2,4) RETURNING *, a, a as aaa formatted_sql: INSERT INTO t VALUES (1, 3), (2, 4) RETURNING (*, a, a AS aaa) diff --git a/src/sqlparser/tests/testdata/select.yaml b/src/sqlparser/tests/testdata/select.yaml index f60c44b083ff3..0ac9f0addae87 100644 --- a/src/sqlparser/tests/testdata/select.yaml +++ b/src/sqlparser/tests/testdata/select.yaml @@ -43,11 +43,11 @@ error_msg: 'sql parser error: WITH TIES cannot be specified without ORDER BY clause' - input: select * from (select 1 from 1); error_msg: |- - sql parser error: Expected identifier, found: 1 + sql parser error: Expected identifier, found: 1 at line:1, column:31 Near "from (select 1 from 1" - input: select * from (select * from tumble(t, x, interval '10' minutes)) error_msg: |- - sql parser error: Expected ), found: minutes + sql parser error: Expected ), found: minutes at line:1, column:62 Near "(t, x, interval '10'" - input: SELECT 1, FROM t error_msg: 'sql parser error: syntax error at or near "FROM"' @@ -74,7 +74,7 @@ error_msg: 'sql parser error: precision for type float must be less than 54 bits' - input: SELECT 1::int(2) error_msg: |- - sql parser error: Expected end of statement, found: ( + sql parser error: Expected end of statement, found: ( at line:1, column:14 Near "SELECT 1::int" - input: select id1, a1, id2, a2 from stream as S join version FOR SYSTEM_TIME AS OF NOW() AS V on id1= id2 formatted_sql: SELECT id1, a1, id2, a2 FROM stream AS S JOIN version FOR SYSTEM_TIME AS OF NOW() AS V ON id1 = id2 diff --git a/src/sqlparser/tests/testdata/set.yaml b/src/sqlparser/tests/testdata/set.yaml index d990a05e49e69..88aaa61949606 100644 --- a/src/sqlparser/tests/testdata/set.yaml +++ b/src/sqlparser/tests/testdata/set.yaml @@ -7,7 +7,7 @@ formatted_sql: SET TIME ZONE "Asia/Shanghai" - input: SET TIME ZONE 'Asia/Shanghai' error_msg: |- - sql parser error: Expected a value, found: EOF + sql parser error: Expected a value, found: EOF at the end Near "SET TIME ZONE 'Asia/Shanghai'" - input: SET TIME ZONE "UTC" formatted_sql: SET TIME ZONE "UTC" diff --git a/src/storage/Cargo.toml b/src/storage/Cargo.toml index 458fddc776fbf..ce12fee5e50bc 100644 --- a/src/storage/Cargo.toml +++ b/src/storage/Cargo.toml @@ -16,7 +16,7 @@ normal = ["workspace-hack"] [dependencies] arc-swap = "1" async-trait = "0.1" -auto_enums = { version = "0.7", features = ["futures"] } +auto_enums = { version = "0.8", features = ["futures03"] } await-tree = "0.1.1" bytes = { version = "1", features = ["serde"] } crossbeam = "0.8.1" @@ -26,6 +26,7 @@ enum-as-inner = "0.5" fail = "0.5" futures = { version = "0.3", default-features = false, features = ["alloc"] } futures-async-stream = "0.2" +hex = "0.4" itertools = "0.10" libc = "0.2" lz4 = "1.23.1" @@ -48,6 +49,7 @@ scopeguard = "1" sled = "0.34.7" spin = "0.9" sync-point = { path = "../utils/sync-point" } +sysinfo = { version = "0.26", default-features = false } tempfile = "3" thiserror = "1" # tikv-client = { git = "https://github.com/tikv/client-rust", rev = "5714b2", optional = true } @@ -67,8 +69,15 @@ xxhash-rust = { version = "0.8.5", features = ["xxh32", "xxh64"] } zstd = "0.11.2" [target.'cfg(target_os = "linux")'.dependencies] +procfs = { version = "0.12", default-features = false } +libc = "0.2" nix = { version = "0.25", features = ["fs", "mman"] } +[target.'cfg(target_os = "macos")'.dependencies] +darwin-libproc = { git = "https://github.com/risingwavelabs/darwin-libproc.git", rev = "a502be24bd0971463f5bcbfe035a248d8ba503b7" } +libc = "0.2.72" +mach = "0.3.2" + [target.'cfg(not(madsim))'.dependencies] workspace-hack = { path = "../workspace-hack" } diff --git a/src/storage/backup/integration_tests/common.sh b/src/storage/backup/integration_tests/common.sh index 8b4048776d118..163f4736f3abc 100644 --- a/src/storage/backup/integration_tests/common.sh +++ b/src/storage/backup/integration_tests/common.sh @@ -19,9 +19,6 @@ function clean_etcd_data() { function start_cluster() { cargo make d ci-meta-backup-test 1>/dev/null 2>&1 - execute_sql_and_expect \ - "alter system set backup_storage_url to \"minio://hummockadmin:hummockadmin@127.0.0.1:9301/hummock001\";" \ - "ALTER_SYSTEM" sleep 5 } diff --git a/src/storage/backup/src/lib.rs b/src/storage/backup/src/lib.rs index b2d371431f6cf..ab85d68095216 100644 --- a/src/storage/backup/src/lib.rs +++ b/src/storage/backup/src/lib.rs @@ -41,10 +41,7 @@ use std::hash::Hasher; use itertools::Itertools; use risingwave_hummock_sdk::compaction_group::hummock_version_ext::HummockVersionExt; use risingwave_hummock_sdk::{HummockSstableObjectId, HummockVersionId}; -use risingwave_pb::backup_service::{ - MetaSnapshotManifest as ProstMetaSnapshotManifest, - MetaSnapshotMetadata as ProstMetaSnapshotMetadata, -}; +use risingwave_pb::backup_service::{PbMetaSnapshotManifest, PbMetaSnapshotMetadata}; use risingwave_pb::hummock::HummockVersion; use serde::{Deserialize, Serialize}; @@ -102,7 +99,7 @@ pub fn xxhash64_verify(data: &[u8], checksum: u64) -> BackupResult<()> { Ok(()) } -impl From<&MetaSnapshotMetadata> for ProstMetaSnapshotMetadata { +impl From<&MetaSnapshotMetadata> for PbMetaSnapshotMetadata { fn from(m: &MetaSnapshotMetadata) -> Self { Self { id: m.id, @@ -113,7 +110,7 @@ impl From<&MetaSnapshotMetadata> for ProstMetaSnapshotMetadata { } } -impl From<&MetaSnapshotManifest> for ProstMetaSnapshotManifest { +impl From<&MetaSnapshotManifest> for PbMetaSnapshotManifest { fn from(m: &MetaSnapshotManifest) -> Self { Self { manifest_id: m.manifest_id, diff --git a/src/storage/benches/bench_compactor.rs b/src/storage/benches/bench_compactor.rs index 89a8a16e87956..fbea87203d51d 100644 --- a/src/storage/benches/bench_compactor.rs +++ b/src/storage/benches/bench_compactor.rs @@ -17,6 +17,7 @@ use std::sync::Arc; use criterion::async_executor::FuturesExecutor; use criterion::{criterion_group, criterion_main, Criterion}; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::FullKey; use risingwave_hummock_sdk::key_range::KeyRange; @@ -50,6 +51,7 @@ pub fn mock_sstable_store() -> SstableStoreRef { path, 64 << 20, 128 << 20, + 0, TieredCache::none(), )) } @@ -58,7 +60,7 @@ pub fn default_writer_opts() -> SstableWriterOptions { SstableWriterOptions { capacity_hint: None, tracker: None, - policy: CachePolicy::Fill, + policy: CachePolicy::Fill(CachePriority::High), } } @@ -90,7 +92,7 @@ async fn build_table( SstableWriterOptions { capacity_hint: None, tracker: None, - policy: CachePolicy::Fill, + policy: CachePolicy::Fill(CachePriority::High), }, ); let mut builder = SstableBuilder::for_test(sstable_object_id, writer, opt); @@ -214,7 +216,7 @@ fn bench_merge_iterator_compactor(c: &mut Criterion) { .block_on(async { build_table(sstable_store.clone(), 4, 0..test_key_size, 2).await }); let level2 = vec![info1, info2]; let read_options = Arc::new(SstableIteratorReadOptions { - prefetch: true, + cache_policy: CachePolicy::Fill(CachePriority::High), must_iterated_end_user_key: None, }); c.bench_function("bench_union_merge_iterator", |b| { @@ -231,8 +233,18 @@ fn bench_merge_iterator_compactor(c: &mut Criterion) { c.bench_function("bench_merge_iterator", |b| { b.to_async(&runtime).iter(|| { let sub_iters = vec![ - ConcatSstableIterator::new(level1.clone(), KeyRange::inf(), sstable_store.clone()), - ConcatSstableIterator::new(level2.clone(), KeyRange::inf(), sstable_store.clone()), + ConcatSstableIterator::new( + vec![0], + level1.clone(), + KeyRange::inf(), + sstable_store.clone(), + ), + ConcatSstableIterator::new( + vec![0], + level2.clone(), + KeyRange::inf(), + sstable_store.clone(), + ), ]; let iter = UnorderedMergeIteratorInner::for_compactor(sub_iters); let sstable_store1 = sstable_store.clone(); diff --git a/src/storage/benches/bench_lru_cache.rs b/src/storage/benches/bench_lru_cache.rs index 2fbd3f0a97121..f89567c7fef4e 100644 --- a/src/storage/benches/bench_lru_cache.rs +++ b/src/storage/benches/bench_lru_cache.rs @@ -24,6 +24,7 @@ use criterion::{criterion_group, criterion_main, Criterion}; use moka::future::Cache; use rand::rngs::SmallRng; use rand::{RngCore, SeedableRng}; +use risingwave_common::cache::CachePriority; use risingwave_storage::hummock::{HummockError, HummockResult, LruCache}; use tokio::runtime::{Builder, Runtime}; @@ -87,7 +88,7 @@ pub struct LruCacheImpl { impl LruCacheImpl { pub fn new(capacity: usize, fake_io_latency: Duration) -> Self { Self { - inner: Arc::new(LruCache::new(3, capacity)), + inner: Arc::new(LruCache::new(3, capacity, 0)), fake_io_latency, } } @@ -104,7 +105,7 @@ impl CacheBase for LruCacheImpl { let latency = self.fake_io_latency; let entry = self .inner - .lookup_with_request_dedup(h, key, || async move { + .lookup_with_request_dedup(h, key, CachePriority::High, || async move { get_fake_block(sst_object_id, block_idx, latency) .await .map(|block| (Arc::new(block), 1)) diff --git a/src/storage/benches/bench_multi_builder.rs b/src/storage/benches/bench_multi_builder.rs index efbe441e0f272..a7a162cf213c0 100644 --- a/src/storage/benches/bench_multi_builder.rs +++ b/src/storage/benches/bench_multi_builder.rs @@ -140,6 +140,7 @@ fn bench_builder( "test".to_string(), 64 << 20, 128 << 20, + 0, TieredCache::none(), )); diff --git a/src/storage/compactor/Cargo.toml b/src/storage/compactor/Cargo.toml index e52bdb1c275c6..d66648e8f316a 100644 --- a/src/storage/compactor/Cargo.toml +++ b/src/storage/compactor/Cargo.toml @@ -15,6 +15,7 @@ ignored = ["workspace-hack"] normal = ["workspace-hack"] [dependencies] +anyhow = "1" async-trait = "0.1" clap = { version = "4", features = ["derive"] } prometheus = { version = "0.13" } @@ -26,6 +27,8 @@ risingwave_object_store = { path = "../../object_store" } risingwave_pb = { path = "../../prost" } risingwave_rpc_client = { path = "../../rpc_client" } risingwave_storage = { path = "../../storage" } +serde = { version = "1", features = ["derive"] } +serde_json = "1" tokio = { version = "0.2", package = "madsim-tokio", features = [ "fs", "rt", diff --git a/src/storage/compactor/src/compactor_observer/observer_manager.rs b/src/storage/compactor/src/compactor_observer/observer_manager.rs index 2e9996ffaa699..6b539ecadfa27 100644 --- a/src/storage/compactor/src/compactor_observer/observer_manager.rs +++ b/src/storage/compactor/src/compactor_observer/observer_manager.rs @@ -21,6 +21,7 @@ use risingwave_hummock_sdk::filter_key_extractor::{ FilterKeyExtractorImpl, FilterKeyExtractorManagerRef, }; use risingwave_pb::catalog::Table; +use risingwave_pb::meta::relation::RelationInfo; use risingwave_pb::meta::subscribe_response::{Info, Operation}; use risingwave_pb::meta::SubscribeResponse; @@ -39,17 +40,24 @@ impl ObserverState for CompactorObserverNode { }; match info.to_owned() { - Info::Table(table_catalog) => { - assert!( - resp.version > self.version, - "resp version={:?}, current version={:?}", - resp.version, - self.version - ); + Info::RelationGroup(relation_group) => { + for relation in relation_group.relations { + match relation.relation_info.unwrap() { + RelationInfo::Table(table_catalog) => { + assert!( + resp.version > self.version, + "resp version={:?}, current version={:?}", + resp.version, + self.version + ); - self.handle_catalog_notification(resp.operation(), table_catalog); + self.handle_catalog_notification(resp.operation(), table_catalog); - self.version = resp.version; + self.version = resp.version; + } + _ => panic!("error type notification"), + }; + } } Info::HummockVersionDeltas(_) => {} Info::SystemParams(p) => { diff --git a/src/storage/compactor/src/lib.rs b/src/storage/compactor/src/lib.rs index df5984254799f..5ad04828b4815 100644 --- a/src/storage/compactor/src/lib.rs +++ b/src/storage/compactor/src/lib.rs @@ -15,6 +15,7 @@ mod compactor_observer; mod rpc; mod server; +mod telemetry; use clap::Parser; use risingwave_common_proc_macro::OverrideConfig; @@ -51,12 +52,6 @@ pub struct CompactorOpts { #[clap(long, env = "RW_META_ADDR", default_value = "http://127.0.0.1:5690")] pub meta_address: String, - /// Of the form `hummock+{object_store}` where `object_store` - /// is one of `s3://{path}`, `s3-compatible://{path}`, `minio://{path}`, `disk://{path}`, - /// `memory` or `memory-shared`. - #[clap(long, env = "RW_STATE_STORE")] - pub state_store: Option, - #[clap(long, env = "RW_COMPACTION_WORKER_THREADS_NUMBER")] pub compaction_worker_threads_number: Option, @@ -94,7 +89,6 @@ pub fn start(opts: CompactorOpts) -> Pin + Send>> { // slow compile in release mode. Box::pin(async move { tracing::info!("Compactor node options: {:?}", opts); - warn_future_deprecate_options(&opts); tracing::info!("meta address: {}", opts.meta_address.clone()); let listen_addr = opts.listen_addr.parse().unwrap(); @@ -118,9 +112,3 @@ pub fn start(opts: CompactorOpts) -> Pin + Send>> { observer_join_handle.abort(); }) } - -fn warn_future_deprecate_options(opts: &CompactorOpts) { - if opts.state_store.is_some() { - tracing::warn!("`--state-store` will not be accepted by compactor node in the next release. Please consider moving this argument to the meta node."); - } -} diff --git a/src/storage/compactor/src/server.rs b/src/storage/compactor/src/server.rs index a1296a55999d0..d22e1b2c9fb03 100644 --- a/src/storage/compactor/src/server.rs +++ b/src/storage/compactor/src/server.rs @@ -16,9 +16,11 @@ use std::net::SocketAddr; use std::sync::Arc; use std::time::Duration; -use risingwave_common::config::load_config; +use risingwave_common::config::{extract_storage_memory_config, load_config}; use risingwave_common::monitor::process_linux::monitor_process; use risingwave_common::system_param::local_manager::LocalSystemParamsManager; +use risingwave_common::telemetry::manager::TelemetryManager; +use risingwave_common::telemetry::telemetry_env_enabled; use risingwave_common::util::addr::HostAddr; use risingwave_common::{GIT_SHA, RW_VERSION}; use risingwave_common_service::metrics_manager::MetricsManager; @@ -44,6 +46,7 @@ use tracing::info; use super::compactor_observer::observer_manager::CompactorObserverNode; use crate::rpc::CompactorServiceImpl; +use crate::telemetry::CompactorTelemetryCreator; use crate::CompactorOpts; /// Fetches and runs compaction tasks. @@ -85,12 +88,14 @@ pub async fn compactor_serve( hummock_metrics.clone(), )); - let state_store_url = { - let from_local = opts.state_store.unwrap_or("".to_string()); - system_params_reader.state_store(from_local) - }; + let state_store_url = system_params_reader.state_store(); - let storage_opts = Arc::new(StorageOpts::from((&config, &system_params_reader))); + let storage_memory_config = extract_storage_memory_config(&config); + let storage_opts = Arc::new(StorageOpts::from(( + &config, + &system_params_reader, + &storage_memory_config, + ))); let object_store = Arc::new( parse_remote_object_store( state_store_url @@ -108,10 +113,14 @@ pub async fn compactor_serve( storage_opts.meta_cache_capacity_mb * (1 << 20), )); + let telemetry_enabled = system_params_reader.telemetry_enabled(); + let filter_key_extractor_manager = Arc::new(FilterKeyExtractorManager::default()); let system_params_manager = Arc::new(LocalSystemParamsManager::new(system_params_reader)); - let compactor_observer_node = - CompactorObserverNode::new(filter_key_extractor_manager.clone(), system_params_manager); + let compactor_observer_node = CompactorObserverNode::new( + filter_key_extractor_manager.clone(), + system_params_manager.clone(), + ); let observer_manager = ObserverManager::new_with_meta_client(meta_client.clone(), compactor_observer_node).await; @@ -149,7 +158,7 @@ pub async fn compactor_serve( max_concurrent_task_number, })), }); - let sub_tasks = vec![ + let mut sub_tasks = vec![ MetaClient::start_heartbeat_loop( meta_client.clone(), Duration::from_millis(config.server.heartbeat_interval_ms as u64), @@ -162,6 +171,22 @@ pub async fn compactor_serve( ), ]; + let telemetry_manager = TelemetryManager::new( + system_params_manager.watch_params(), + Arc::new(meta_client.clone()), + Arc::new(CompactorTelemetryCreator::new()), + ); + // if the toml config file or env variable disables telemetry, do not watch system params change + // because if any of configs disable telemetry, we should never start it + if config.server.telemetry_enabled && telemetry_env_enabled() { + if telemetry_enabled { + telemetry_manager.start_telemetry_reporting(); + } + sub_tasks.push(telemetry_manager.watch_params_change()); + } else { + tracing::info!("Telemetry didn't start due to config"); + } + let (shutdown_send, mut shutdown_recv) = tokio::sync::oneshot::channel(); let join_handle = tokio::spawn(async move { tonic::transport::Server::builder() diff --git a/src/storage/compactor/src/telemetry.rs b/src/storage/compactor/src/telemetry.rs new file mode 100644 index 0000000000000..a2014959c61de --- /dev/null +++ b/src/storage/compactor/src/telemetry.rs @@ -0,0 +1,75 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use risingwave_common::telemetry::report::TelemetryReportCreator; +use risingwave_common::telemetry::{ + current_timestamp, SystemData, TelemetryNodeType, TelemetryReport, TelemetryReportBase, +}; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Copy)] +pub(crate) struct CompactorTelemetryCreator {} + +impl CompactorTelemetryCreator { + pub(crate) fn new() -> Self { + Self {} + } +} + +impl TelemetryReportCreator for CompactorTelemetryCreator { + fn create_report( + &self, + tracking_id: String, + session_id: String, + up_time: u64, + ) -> anyhow::Result { + Ok(CompactorTelemetryReport::new( + tracking_id, + session_id, + up_time, + )) + } + + fn report_type(&self) -> &str { + "compactor" + } +} + +#[derive(Serialize, Deserialize)] +pub(crate) struct CompactorTelemetryReport { + #[serde(flatten)] + base: TelemetryReportBase, +} + +impl TelemetryReport for CompactorTelemetryReport { + fn to_json(&self) -> anyhow::Result { + let json = serde_json::to_string(self)?; + Ok(json) + } +} + +impl CompactorTelemetryReport { + pub(crate) fn new(tracking_id: String, session_id: String, up_time: u64) -> Self { + Self { + base: TelemetryReportBase { + tracking_id, + session_id, + system_data: SystemData::new(), + up_time, + time_stamp: current_timestamp(), + node_type: TelemetryNodeType::Compactor, + }, + } + } +} diff --git a/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs b/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs index 9426925d3469e..46f06521e80fe 100644 --- a/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs +++ b/src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs @@ -20,8 +20,8 @@ use risingwave_pb::hummock::group_delta::DeltaType; use risingwave_pb::hummock::hummock_version::Levels; use risingwave_pb::hummock::hummock_version_delta::GroupDeltas; use risingwave_pb::hummock::{ - CompactionConfig, GroupConstruct, GroupDestroy, GroupMetaChange, HummockVersion, - HummockVersionDelta, Level, LevelType, OverlappingLevel, SstableInfo, + CompactionConfig, GroupConstruct, GroupDestroy, GroupMetaChange, GroupTableChange, + HummockVersion, HummockVersionDelta, Level, LevelType, OverlappingLevel, SstableInfo, }; use super::StateTableId; @@ -38,6 +38,7 @@ pub struct GroupDeltasSummary { pub group_construct: Option, pub group_destroy: Option, pub group_meta_changes: Vec, + pub group_table_change: Option, } pub fn summarize_group_deltas(group_deltas: &GroupDeltas) -> GroupDeltasSummary { @@ -49,6 +50,8 @@ pub fn summarize_group_deltas(group_deltas: &GroupDeltas) -> GroupDeltasSummary let mut group_construct = None; let mut group_destroy = None; let mut group_meta_changes = vec![]; + let mut group_table_change = None; + for group_delta in &group_deltas.group_deltas { match group_delta.get_delta_type().unwrap() { DeltaType::IntraLevel(intra_level) => { @@ -73,6 +76,9 @@ pub fn summarize_group_deltas(group_deltas: &GroupDeltas) -> GroupDeltasSummary DeltaType::GroupMetaChange(meta_delta) => { group_meta_changes.push(meta_delta.clone()); } + DeltaType::GroupTableChange(meta_delta) => { + group_table_change = Some(meta_delta.clone()); + } } } @@ -85,6 +91,7 @@ pub fn summarize_group_deltas(group_deltas: &GroupDeltas) -> GroupDeltasSummary group_construct, group_destroy, group_meta_changes, + group_table_change, } } @@ -106,25 +113,25 @@ pub trait HummockVersionExt { fn get_object_ids(&self) -> Vec; } +pub type BranchedSstInfo = HashMap; + pub trait HummockVersionUpdateExt { fn count_new_ssts_in_group_split( - &mut self, + &self, parent_group_id: CompactionGroupId, - member_table_ids: &HashSet, + member_table_ids: HashSet, ) -> u64; fn init_with_parent_group( &mut self, parent_group_id: CompactionGroupId, group_id: CompactionGroupId, - member_table_ids: &HashSet, + member_table_ids: HashSet, new_sst_start_id: u64, ) -> Vec; fn apply_version_delta(&mut self, version_delta: &HummockVersionDelta) -> Vec; fn build_compaction_group_info(&self) -> HashMap; - fn build_branched_sst_info( - &self, - ) -> BTreeMap>>; + fn build_branched_sst_info(&self) -> BTreeMap; } impl HummockVersionExt for HummockVersion { @@ -206,9 +213,9 @@ pub type SstSplitInfo = ( impl HummockVersionUpdateExt for HummockVersion { fn count_new_ssts_in_group_split( - &mut self, + &self, parent_group_id: CompactionGroupId, - member_table_ids: &HashSet, + member_table_ids: HashSet, ) -> u64 { self.levels .get(&parent_group_id) @@ -246,7 +253,7 @@ impl HummockVersionUpdateExt for HummockVersion { &mut self, parent_group_id: CompactionGroupId, group_id: CompactionGroupId, - member_table_ids: &HashSet, + member_table_ids: HashSet, new_sst_start_id: u64, ) -> Vec { let mut new_sst_id = new_sst_start_id; @@ -260,107 +267,69 @@ impl HummockVersionUpdateExt for HummockVersion { .levels .get_many_mut([&parent_group_id, &group_id]) .unwrap(); - let remove_sst_stat_from_level = |level: &mut Level, sst: &SstableInfo| { - level.total_file_size -= sst.file_size; - level.uncompressed_file_size -= sst.uncompressed_file_size; - }; if let Some(ref mut l0) = parent_levels.l0 { for sub_level in &mut l0.sub_levels { - let mut insert_table_infos = vec![]; - for sst_info in &mut sub_level.table_infos { - if sst_info - .get_table_ids() - .iter() - .any(|table_id| member_table_ids.contains(table_id)) - { - let is_trivial = sst_info - .get_table_ids() - .iter() - .all(|table_id| member_table_ids.contains(table_id)); - let mut branch_table_info = sst_info.clone(); - branch_table_info.sst_id = new_sst_id; - new_sst_id += 1; - let parent_old_sst_id = sst_info.get_sst_id(); - split_id_vers.push(( - branch_table_info.get_object_id(), - branch_table_info.get_sst_id(), - parent_old_sst_id, - if is_trivial { - None - } else { - sst_info.sst_id = new_sst_id; - new_sst_id += 1; - Some(sst_info.get_sst_id()) - }, - )); - branch_table_info.table_ids = sst_info - .table_ids - .drain_filter(|table_id| member_table_ids.contains(table_id)) - .collect_vec(); - insert_table_infos.push(branch_table_info); + let target_l0 = cur_levels.l0.as_mut().unwrap(); + let mut target_level_idx = target_l0.sub_levels.len(); + for (idx, other) in target_l0.sub_levels.iter_mut().enumerate() { + if other.sub_level_id == sub_level.sub_level_id { + target_level_idx = idx; } } // Remove SST from sub level may result in empty sub level. It will be purged // whenever another compaction task is finished. - let removed = sub_level + let insert_table_infos = split_sst_info_for_level( + sub_level, + &mut split_id_vers, + &member_table_ids, + &mut new_sst_id, + ); + sub_level .table_infos .drain_filter(|sst_info| sst_info.table_ids.is_empty()) - .collect_vec(); - for removed_sst in removed { - remove_sst_stat_from_level(sub_level, &removed_sst); - } - add_new_sub_level( - cur_levels.l0.as_mut().unwrap(), - sub_level.get_sub_level_id(), + .for_each(|sst_info| { + sub_level.total_file_size -= sst_info.file_size; + sub_level.uncompressed_file_size -= sst_info.uncompressed_file_size; + l0.total_file_size -= sst_info.file_size; + l0.uncompressed_file_size -= sst_info.uncompressed_file_size; + }); + add_ssts_to_sub_level( + target_l0, + target_level_idx, + sub_level.sub_level_id, sub_level.level_type(), insert_table_infos, ); } } for (z, level) in parent_levels.levels.iter_mut().enumerate() { - for sst_info in &mut level.table_infos { - if sst_info - .get_table_ids() - .iter() - .any(|table_id| member_table_ids.contains(table_id)) - { - let is_trivial = sst_info - .get_table_ids() - .iter() - .all(|table_id| member_table_ids.contains(table_id)); - let mut branch_table_info = sst_info.clone(); - branch_table_info.sst_id = new_sst_id; - new_sst_id += 1; - let parent_old_sst_id = sst_info.get_sst_id(); - split_id_vers.push(( - branch_table_info.get_object_id(), - branch_table_info.get_sst_id(), - parent_old_sst_id, - if is_trivial { - None - } else { - sst_info.sst_id = new_sst_id; - new_sst_id += 1; - Some(sst_info.get_sst_id()) - }, - )); - branch_table_info.table_ids = sst_info - .table_ids - .drain_filter(|table_id| member_table_ids.contains(table_id)) - .collect_vec(); - cur_levels.levels[z].total_file_size += branch_table_info.file_size; - cur_levels.levels[z].uncompressed_file_size += - branch_table_info.uncompressed_file_size; - cur_levels.levels[z].table_infos.push(branch_table_info); - } - } - let removed = level + let insert_table_infos = split_sst_info_for_level( + level, + &mut split_id_vers, + &member_table_ids, + &mut new_sst_id, + ); + cur_levels.levels[z].total_file_size += insert_table_infos + .iter() + .map(|sst| sst.file_size) + .sum::(); + cur_levels.levels[z].uncompressed_file_size += insert_table_infos + .iter() + .map(|sst| sst.uncompressed_file_size) + .sum::(); + cur_levels.levels[z].table_infos.extend(insert_table_infos); + cur_levels.levels[z].table_infos.sort_by(|sst1, sst2| { + let a = sst1.key_range.as_ref().unwrap(); + let b = sst2.key_range.as_ref().unwrap(); + a.compare(b) + }); + level .table_infos .drain_filter(|sst_info| sst_info.table_ids.is_empty()) - .collect_vec(); - for removed_sst in removed { - remove_sst_stat_from_level(level, &removed_sst); - } + .for_each(|sst_info| { + level.total_file_size -= sst_info.file_size; + level.uncompressed_file_size -= sst_info.uncompressed_file_size; + }); } split_id_vers } @@ -381,9 +350,24 @@ impl HummockVersionUpdateExt for HummockVersion { sst_split_info.extend(self.init_with_parent_group( parent_group_id, *compaction_group_id, - &HashSet::from_iter(group_construct.get_table_ids().iter().cloned()), + HashSet::from_iter(group_construct.table_ids.clone()), group_construct.get_new_sst_start_id(), )); + } else if let Some(group_change) = &summary.group_table_change { + sst_split_info.extend(self.init_with_parent_group( + group_change.origin_group_id, + group_change.target_group_id, + HashSet::from_iter(group_change.table_ids.clone()), + group_change.new_sst_start_id, + )); + + let levels = self + .levels + .get_mut(&group_change.origin_group_id) + .expect("compaction group should exist"); + levels + .member_table_ids + .drain_filter(|t| group_change.table_ids.contains(t)); } let has_destroy = summary.group_destroy.is_some(); let levels = self @@ -398,6 +382,7 @@ impl HummockVersionUpdateExt for HummockVersion { levels .member_table_ids .drain_filter(|t| group_meta_delta.table_ids_remove.contains(t)); + levels.member_table_ids.sort(); } assert!( @@ -456,29 +441,26 @@ impl HummockVersionUpdateExt for HummockVersion { ret } - fn build_branched_sst_info( - &self, - ) -> BTreeMap>> { - let mut ret: BTreeMap<_, BTreeMap<_, Vec<_>>> = BTreeMap::new(); - for compaction_group_id in self.get_levels().keys() { - self.level_iter(*compaction_group_id, |level| { - for table_info in level.get_table_infos() { + fn build_branched_sst_info(&self) -> BTreeMap { + let mut ret: BTreeMap<_, _> = BTreeMap::new(); + for (compaction_group_id, group) in &self.levels { + let mut levels = vec![]; + levels.extend(group.l0.as_ref().unwrap().sub_levels.iter()); + levels.extend(group.levels.iter()); + for level in levels { + for table_info in &level.table_infos { + if table_info.sst_id == table_info.object_id { + continue; + } let object_id = table_info.get_object_id(); - ret.entry(object_id) - .or_default() - .entry(*compaction_group_id) - .or_default() - .push(table_info.get_sst_id()); + let entry: &mut BranchedSstInfo = ret.entry(object_id).or_default(); + if let Some(exist_sst_id) = entry.get(compaction_group_id) { + panic!("we do not allow more than one sst with the same object id in one grou. object-id: {}, duplicated sst id: {:?} and {}", object_id, exist_sst_id, table_info.sst_id); + } + entry.insert(*compaction_group_id, table_info.sst_id); } - true - }); - } - ret.retain(|object_id, v| { - v.len() != 1 || { - let sst_id_vec = v.values().next().unwrap(); - sst_id_vec.len() != 1 || sst_id_vec[0] != *object_id } - }); + } ret } } @@ -604,6 +586,51 @@ pub fn build_initial_compaction_group_levels( } } +fn split_sst_info_for_level( + level: &mut Level, + split_id_vers: &mut Vec, + member_table_ids: &HashSet, + new_sst_id: &mut u64, +) -> Vec { + // Remove SST from sub level may result in empty sub level. It will be purged + // whenever another compaction task is finished. + let mut removed = vec![]; + let mut insert_table_infos = vec![]; + for sst_info in &mut level.table_infos { + let removed_table_ids = sst_info + .table_ids + .iter() + .filter(|table_id| member_table_ids.contains(table_id)) + .cloned() + .collect_vec(); + if !removed_table_ids.is_empty() { + let is_trivial = removed_table_ids.len() == sst_info.table_ids.len(); + let mut branch_table_info = sst_info.clone(); + branch_table_info.sst_id = *new_sst_id; + *new_sst_id += 1; + let parent_old_sst_id = sst_info.get_sst_id(); + split_id_vers.push(( + branch_table_info.get_object_id(), + branch_table_info.get_sst_id(), + parent_old_sst_id, + if is_trivial { + None + } else { + sst_info.sst_id = *new_sst_id; + *new_sst_id += 1; + Some(sst_info.get_sst_id()) + }, + )); + if is_trivial { + sst_info.table_ids.clear(); + removed.push(sst_info.clone()); + } + insert_table_infos.push(branch_table_info); + } + } + insert_table_infos +} + pub fn try_get_compaction_group_id_by_table_id( version: &HummockVersion, table_id: StateTableId, @@ -680,6 +707,37 @@ pub fn new_sub_level( } } +pub fn add_ssts_to_sub_level( + l0: &mut OverlappingLevel, + sub_level_idx: usize, + insert_sub_level_id: u64, + level_type: LevelType, + insert_table_infos: Vec, +) { + if sub_level_idx < l0.sub_levels.len() { + insert_table_infos.iter().for_each(|sst| { + l0.sub_levels[sub_level_idx].total_file_size += sst.file_size; + l0.sub_levels[sub_level_idx].uncompressed_file_size += sst.uncompressed_file_size; + l0.total_file_size += sst.file_size; + l0.uncompressed_file_size += sst.uncompressed_file_size; + }); + l0.sub_levels[sub_level_idx] + .table_infos + .extend(insert_table_infos); + if l0.sub_levels[sub_level_idx].level_type == LevelType::Nonoverlapping as i32 { + l0.sub_levels[sub_level_idx] + .table_infos + .sort_by(|sst1, sst2| { + let a = sst1.key_range.as_ref().unwrap(); + let b = sst2.key_range.as_ref().unwrap(); + a.compare(b) + }); + } + return; + } + add_new_sub_level(l0, insert_sub_level_id, level_type, insert_table_infos); +} + pub fn add_new_sub_level( l0: &mut OverlappingLevel, insert_sub_level_id: u64, diff --git a/src/storage/hummock_sdk/src/filter_key_extractor.rs b/src/storage/hummock_sdk/src/filter_key_extractor.rs index 15527fc48e6d9..e3e81e681beaa 100644 --- a/src/storage/hummock_sdk/src/filter_key_extractor.rs +++ b/src/storage/hummock_sdk/src/filter_key_extractor.rs @@ -338,7 +338,7 @@ mod tests { use bytes::{BufMut, BytesMut}; use itertools::Itertools; - use risingwave_common::catalog::{ColumnDesc, ColumnId}; + use risingwave_common::catalog::ColumnDesc; use risingwave_common::constants::hummock::PROPERTIES_RETENTION_SECOND_KEY; use risingwave_common::hash::VirtualNode; use risingwave_common::row::OwnedRow; @@ -347,9 +347,9 @@ mod tests { use risingwave_common::util::ordered::OrderedRowSerde; use risingwave_common::util::sort_util::OrderType; use risingwave_pb::catalog::table::TableType; - use risingwave_pb::catalog::Table as ProstTable; - use risingwave_pb::common::{PbColumnOrder, PbDirection, PbOrderType}; - use risingwave_pb::plan_common::ColumnCatalog as ProstColumnCatalog; + use risingwave_pb::catalog::PbTable; + use risingwave_pb::common::{PbColumnOrder, PbDirection, PbNullsAre, PbOrderType}; + use risingwave_pb::plan_common::PbColumnCatalog; use tokio::task; use super::{DummyFilterKeyExtractor, FilterKeyExtractor, SchemaFilterKeyExtractor}; @@ -377,63 +377,35 @@ mod tests { assert_eq!(full_key, output_key); } - fn build_table_with_prefix_column_num(column_count: u32) -> ProstTable { - ProstTable { + fn build_table_with_prefix_column_num(column_count: u32) -> PbTable { + PbTable { id: 0, schema_id: 0, database_id: 0, name: "test".to_string(), table_type: TableType::Table as i32, columns: vec![ - ProstColumnCatalog { + PbColumnCatalog { column_desc: Some( - (&ColumnDesc { - data_type: DataType::Int64, - column_id: ColumnId::new(0), - name: "_row_id".to_string(), - field_descs: vec![], - type_name: "".to_string(), - }) - .into(), + (&ColumnDesc::new_atomic(DataType::Int64, "_row_id", 0)).into(), ), is_hidden: true, }, - ProstColumnCatalog { + PbColumnCatalog { column_desc: Some( - (&ColumnDesc { - data_type: DataType::Int64, - column_id: ColumnId::new(0), - name: "col_1".to_string(), - field_descs: vec![], - type_name: "Int64".to_string(), - }) - .into(), + (&ColumnDesc::new_atomic(DataType::Int64, "col_1", 0)).into(), ), is_hidden: false, }, - ProstColumnCatalog { + PbColumnCatalog { column_desc: Some( - (&ColumnDesc { - data_type: DataType::Float64, - column_id: ColumnId::new(0), - name: "col_2".to_string(), - field_descs: vec![], - type_name: "Float64".to_string(), - }) - .into(), + (&ColumnDesc::new_atomic(DataType::Float64, "col_2", 0)).into(), ), is_hidden: false, }, - ProstColumnCatalog { + PbColumnCatalog { column_desc: Some( - (&ColumnDesc { - data_type: DataType::Varchar, - column_id: ColumnId::new(0), - name: "col_3".to_string(), - field_descs: vec![], - type_name: "Varchar".to_string(), - }) - .into(), + (&ColumnDesc::new_atomic(DataType::Varchar, "col_3", 0)).into(), ), is_hidden: false, }, @@ -443,12 +415,14 @@ mod tests { column_index: 1, order_type: Some(PbOrderType { direction: PbDirection::Ascending as _, + nulls_are: PbNullsAre::Largest as _, }), }, PbColumnOrder { column_index: 3, order_type: Some(PbOrderType { direction: PbDirection::Ascending as _, + nulls_are: PbNullsAre::Largest as _, }), }, ], diff --git a/src/storage/hummock_sdk/src/key.rs b/src/storage/hummock_sdk/src/key.rs index 41086f90222bf..a2dee8ea7940a 100644 --- a/src/storage/hummock_sdk/src/key.rs +++ b/src/storage/hummock_sdk/src/key.rs @@ -372,9 +372,7 @@ pub struct TableKey>(pub T); impl> Debug for TableKey { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("TableKey") - .field("table_key", &self.0.as_ref().to_vec()) - .finish() + write!(f, "TableKey {{ {} }}", hex::encode(self.0.as_ref())) } } @@ -408,7 +406,7 @@ pub fn map_table_key_range(range: (Bound, Bound) /// will group these two values into one struct for convenient filtering. /// /// The encoded format is | `table_id` | `table_key` |. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] pub struct UserKey> { // When comparing `UserKey`, we first compare `table_id`, then `table_key`. So the order of // declaration matters. @@ -416,6 +414,16 @@ pub struct UserKey> { pub table_key: TableKey, } +impl> Debug for UserKey { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "UserKey {{ {}, {:?} }}", + self.table_id.table_id, self.table_key + ) + } +} + impl> UserKey { pub fn new(table_id: TableId, table_key: TableKey) -> Self { Self { @@ -547,12 +555,18 @@ impl UserKey> { /// [`FullKey`] is an internal concept in storage. It associates [`UserKey`] with an epoch. /// /// The encoded format is | `user_key` | `epoch` |. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, Default)] pub struct FullKey> { pub user_key: UserKey, pub epoch: HummockEpoch, } +impl> Debug for FullKey { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "FullKey {{ {:?}, {} }}", self.user_key, self.epoch) + } +} + impl> FullKey { pub fn new(table_id: TableId, table_key: TableKey, epoch: HummockEpoch) -> Self { Self { diff --git a/src/storage/hummock_sdk/src/lib.rs b/src/storage/hummock_sdk/src/lib.rs index 6db409280e401..4a6bc7012a5b1 100644 --- a/src/storage/hummock_sdk/src/lib.rs +++ b/src/storage/hummock_sdk/src/lib.rs @@ -32,7 +32,7 @@ use risingwave_pb::hummock::SstableInfo; use crate::compaction_group::StaticCompactionGroupId; use crate::key_range::KeyRangeCommon; -use crate::table_stats::{to_prost_table_stats_map, ProstTableStatsMap, TableStatsMap}; +use crate::table_stats::{to_prost_table_stats_map, PbTableStatsMap, TableStatsMap}; pub mod compact; pub mod compaction_group; @@ -52,6 +52,8 @@ pub type HummockCompactionTaskId = u64; pub type CompactionGroupId = u64; pub const INVALID_VERSION_ID: HummockVersionId = 0; pub const FIRST_VERSION_ID: HummockVersionId = 1; +pub const SPLIT_TABLE_COMPACTION_GROUP_ID_HEAD: u64 = 1u64 << 56; +pub const SINGLE_TABLE_COMPACTION_GROUP_ID_HEAD: u64 = 2u64 << 56; #[macro_export] /// This is wrapper for `info` log. @@ -131,14 +133,14 @@ impl LocalSstableInfo { pub struct ExtendedSstableInfo { pub compaction_group_id: CompactionGroupId, pub sst_info: SstableInfo, - pub table_stats: ProstTableStatsMap, + pub table_stats: PbTableStatsMap, } impl ExtendedSstableInfo { pub fn new( compaction_group_id: CompactionGroupId, sst_info: SstableInfo, - table_stats: ProstTableStatsMap, + table_stats: PbTableStatsMap, ) -> Self { Self { compaction_group_id, @@ -151,7 +153,7 @@ impl ExtendedSstableInfo { compaction_group_id: CompactionGroupId, sst_info: SstableInfo, ) -> Self { - Self::new(compaction_group_id, sst_info, ProstTableStatsMap::default()) + Self::new(compaction_group_id, sst_info, PbTableStatsMap::default()) } } diff --git a/src/storage/hummock_sdk/src/table_stats.rs b/src/storage/hummock_sdk/src/table_stats.rs index 19732e30cba13..02da4999bebc3 100644 --- a/src/storage/hummock_sdk/src/table_stats.rs +++ b/src/storage/hummock_sdk/src/table_stats.rs @@ -15,13 +15,13 @@ use std::borrow::Borrow; use std::collections::{HashMap, HashSet}; -use risingwave_pb::hummock::{HummockVersion, TableStats as ProstTableStats}; +use risingwave_pb::hummock::{HummockVersion, PbTableStats}; use crate::compaction_group::hummock_version_ext::HummockVersionExt; pub type TableStatsMap = HashMap; -pub type ProstTableStatsMap = HashMap; +pub type PbTableStatsMap = HashMap; #[derive(Default, Debug, Clone)] pub struct TableStats { @@ -30,7 +30,7 @@ pub struct TableStats { pub total_key_count: i64, } -impl From<&TableStats> for ProstTableStats { +impl From<&TableStats> for PbTableStats { fn from(value: &TableStats) -> Self { Self { total_key_size: value.total_key_size, @@ -40,14 +40,14 @@ impl From<&TableStats> for ProstTableStats { } } -impl From for ProstTableStats { +impl From for PbTableStats { fn from(value: TableStats) -> Self { (&value).into() } } -impl From<&ProstTableStats> for TableStats { - fn from(value: &ProstTableStats) -> Self { +impl From<&PbTableStats> for TableStats { + fn from(value: &PbTableStats) -> Self { Self { total_key_size: value.total_key_size, total_value_size: value.total_value_size, @@ -64,13 +64,13 @@ impl TableStats { } } -pub fn add_prost_table_stats(this: &mut ProstTableStats, other: &ProstTableStats) { +pub fn add_prost_table_stats(this: &mut PbTableStats, other: &PbTableStats) { this.total_key_size += other.total_key_size; this.total_value_size += other.total_value_size; this.total_key_count += other.total_key_count; } -pub fn add_prost_table_stats_map(this: &mut ProstTableStatsMap, other: &ProstTableStatsMap) { +pub fn add_prost_table_stats_map(this: &mut PbTableStatsMap, other: &PbTableStatsMap) { for (table_id, stats) in other { add_prost_table_stats(this.entry(*table_id).or_default(), stats); } @@ -84,7 +84,7 @@ pub fn add_table_stats_map(this: &mut TableStatsMap, other: &TableStatsMap) { pub fn to_prost_table_stats_map( table_stats: impl Borrow, -) -> HashMap { +) -> HashMap { table_stats .borrow() .iter() @@ -93,7 +93,7 @@ pub fn to_prost_table_stats_map( } pub fn from_prost_table_stats_map( - table_stats: impl Borrow>, + table_stats: impl Borrow>, ) -> HashMap { table_stats .borrow() @@ -103,7 +103,7 @@ pub fn from_prost_table_stats_map( } pub fn purge_prost_table_stats( - table_stats: &mut ProstTableStatsMap, + table_stats: &mut PbTableStatsMap, hummock_version: &HummockVersion, ) { let mut all_tables_in_version: HashSet = HashSet::default(); diff --git a/src/storage/hummock_test/benches/bench_hummock_iter.rs b/src/storage/hummock_test/benches/bench_hummock_iter.rs index 5240c6f7b0771..80b2672079a50 100644 --- a/src/storage/hummock_test/benches/bench_hummock_iter.rs +++ b/src/storage/hummock_test/benches/bench_hummock_iter.rs @@ -18,13 +18,14 @@ use std::sync::Arc; use bytes::Bytes; use criterion::{criterion_group, criterion_main, Criterion}; use futures::{pin_mut, TryStreamExt}; +use risingwave_common::cache::CachePriority; use risingwave_hummock_test::get_notification_client_for_test; use risingwave_hummock_test::test_utils::TestIngestBatch; use risingwave_meta::hummock::test_utils::setup_compute_env; use risingwave_meta::hummock::MockHummockMetaClient; use risingwave_storage::hummock::iterator::test_utils::mock_sstable_store; use risingwave_storage::hummock::test_utils::default_opts_for_test; -use risingwave_storage::hummock::HummockStorage; +use risingwave_storage::hummock::{CachePolicy, HummockStorage}; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::*; use risingwave_storage::StateStore; @@ -106,6 +107,7 @@ fn criterion_benchmark(c: &mut Criterion) { table_id: Default::default(), read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, )) .unwrap(); diff --git a/src/storage/hummock_test/src/compactor_tests.rs b/src/storage/hummock_test/src/compactor_tests.rs index 7ee1b780e75fc..076d6622ca28e 100644 --- a/src/storage/hummock_test/src/compactor_tests.rs +++ b/src/storage/hummock_test/src/compactor_tests.rs @@ -22,6 +22,7 @@ pub(crate) mod tests { use bytes::Bytes; use itertools::Itertools; use rand::Rng; + use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_common::constants::hummock::CompactionFilterFlag; use risingwave_common::util::epoch::Epoch; @@ -47,7 +48,7 @@ pub(crate) mod tests { use risingwave_storage::hummock::iterator::test_utils::mock_sstable_store; use risingwave_storage::hummock::sstable_store::SstableStoreRef; use risingwave_storage::hummock::{ - HummockStorage as GlobalHummockStorage, HummockStorage, MemoryLimiter, + CachePolicy, HummockStorage as GlobalHummockStorage, HummockStorage, MemoryLimiter, SstableObjectIdManager, }; use risingwave_storage::monitor::{CompactorMetrics, StoreLocalStatistic}; @@ -254,7 +255,7 @@ pub(crate) mod tests { val.extend_from_slice(&compact_task.watermark.to_be_bytes()); let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); let compactor = hummock_manager_ref.get_idle_compactor().await.unwrap(); hummock_manager_ref .assign_compaction_task(&compact_task, compactor.context_id()) @@ -305,6 +306,7 @@ pub(crate) mod tests { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -324,6 +326,7 @@ pub(crate) mod tests { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await; @@ -379,7 +382,7 @@ pub(crate) mod tests { compact_task.current_epoch_time = 0; let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); let compactor = hummock_manager_ref.get_idle_compactor().await.unwrap(); hummock_manager_ref .assign_compaction_task(&compact_task, compactor.context_id()) @@ -440,6 +443,7 @@ pub(crate) mod tests { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -729,13 +733,12 @@ pub(crate) mod tests { .await .unwrap() .unwrap(); - compact_task.existing_table_ids.push(2); let compaction_filter_flag = CompactionFilterFlag::STATE_CLEAN | CompactionFilterFlag::TTL; compact_task.compaction_filter_mask = compaction_filter_flag.bits(); // 3. pick compactor and assign let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); let compactor = hummock_manager_ref.get_idle_compactor().await.unwrap(); hummock_manager_ref .assign_compaction_task(&compact_task, compactor.context_id()) @@ -806,6 +809,7 @@ pub(crate) mod tests { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -903,7 +907,6 @@ pub(crate) mod tests { .unwrap() .unwrap(); - compact_task.existing_table_ids.push(existing_table_id); let compaction_filter_flag = CompactionFilterFlag::STATE_CLEAN | CompactionFilterFlag::TTL; compact_task.compaction_filter_mask = compaction_filter_flag.bits(); let retention_seconds_expire_second = 1; @@ -916,7 +919,7 @@ pub(crate) mod tests { compact_task.current_epoch_time = epoch; let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); let compactor = hummock_manager_ref.get_idle_compactor().await.unwrap(); hummock_manager_ref .assign_compaction_task(&compact_task, compactor.context_id()) @@ -988,6 +991,7 @@ pub(crate) mod tests { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1092,7 +1096,6 @@ pub(crate) mod tests { kv_count, ); - compact_task.existing_table_ids.push(existing_table_id); let compaction_filter_flag = CompactionFilterFlag::STATE_CLEAN | CompactionFilterFlag::TTL; compact_task.compaction_filter_mask = compaction_filter_flag.bits(); // compact_task.table_options = @@ -1100,7 +1103,7 @@ pub(crate) mod tests { compact_task.current_epoch_time = epoch; let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); let compactor = hummock_manager_ref.get_idle_compactor().await.unwrap(); hummock_manager_ref .assign_compaction_task(&compact_task, compactor.context_id()) @@ -1172,6 +1175,7 @@ pub(crate) mod tests { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1224,7 +1228,7 @@ pub(crate) mod tests { flush_and_commit(&hummock_meta_client, &storage, 130).await; let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); // 2. get compact task let manual_compcation_option = ManualCompactionOption { diff --git a/src/storage/hummock_test/src/failpoint_tests.rs b/src/storage/hummock_test/src/failpoint_tests.rs index 69914073166cd..edd80efec11f5 100644 --- a/src/storage/hummock_test/src/failpoint_tests.rs +++ b/src/storage/hummock_test/src/failpoint_tests.rs @@ -16,6 +16,7 @@ use std::ops::Bound; use std::sync::Arc; use bytes::{BufMut, Bytes}; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::TABLE_PREFIX_LEN; use risingwave_hummock_sdk::HummockReadEpoch; @@ -24,7 +25,7 @@ use risingwave_meta::hummock::MockHummockMetaClient; use risingwave_rpc_client::HummockMetaClient; use risingwave_storage::hummock::iterator::test_utils::mock_sstable_store; use risingwave_storage::hummock::test_utils::{count_stream, default_opts_for_test}; -use risingwave_storage::hummock::HummockStorage; +use risingwave_storage::hummock::{CachePolicy, HummockStorage}; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::{ LocalStateStore, NewLocalOptions, PrefetchOptions, ReadOptions, StateStoreRead, WriteOptions, @@ -106,6 +107,7 @@ async fn test_failpoints_state_store_read_upload() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -160,6 +162,7 @@ async fn test_failpoints_state_store_read_upload() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await; @@ -175,6 +178,7 @@ async fn test_failpoints_state_store_read_upload() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await; @@ -197,6 +201,7 @@ async fn test_failpoints_state_store_read_upload() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -238,6 +243,7 @@ async fn test_failpoints_state_store_read_upload() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -255,6 +261,7 @@ async fn test_failpoints_state_store_read_upload() { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await diff --git a/src/storage/hummock_test/src/hummock_storage_tests.rs b/src/storage/hummock_test/src/hummock_storage_tests.rs index e76e9e3a10bda..17d1101dccf24 100644 --- a/src/storage/hummock_test/src/hummock_storage_tests.rs +++ b/src/storage/hummock_test/src/hummock_storage_tests.rs @@ -18,10 +18,12 @@ use std::sync::Arc; use bytes::{BufMut, Bytes}; use futures::TryStreamExt; use parking_lot::RwLock; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::{map_table_key_range, FullKey, UserKey, TABLE_PREFIX_LEN}; use risingwave_rpc_client::HummockMetaClient; use risingwave_storage::hummock::store::version::{read_filter_for_batch, read_filter_for_local}; +use risingwave_storage::hummock::CachePolicy; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::*; use risingwave_storage::StateStore; @@ -97,6 +99,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -116,6 +119,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -137,6 +141,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -171,6 +176,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -207,6 +213,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -227,6 +234,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -247,6 +255,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -282,6 +291,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -303,6 +313,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -323,6 +334,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -365,6 +377,7 @@ async fn test_storage_basic() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -511,6 +524,7 @@ async fn test_state_store_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -557,6 +571,7 @@ async fn test_state_store_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -581,6 +596,7 @@ async fn test_state_store_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -623,6 +639,7 @@ async fn test_state_store_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -726,6 +743,7 @@ async fn test_delete_get() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -815,6 +833,7 @@ async fn test_multiple_epoch_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -834,6 +853,7 @@ async fn test_multiple_epoch_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -852,6 +872,7 @@ async fn test_multiple_epoch_sync() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -960,6 +981,7 @@ async fn test_iter_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -984,6 +1006,7 @@ async fn test_iter_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1006,6 +1029,7 @@ async fn test_iter_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1048,6 +1072,7 @@ async fn test_iter_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1072,6 +1097,7 @@ async fn test_iter_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1096,6 +1122,7 @@ async fn test_iter_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1219,6 +1246,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1249,6 +1277,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1279,6 +1308,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1351,6 +1381,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1390,6 +1421,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1429,6 +1461,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1468,6 +1501,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1513,6 +1547,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1552,6 +1587,7 @@ async fn test_hummock_version_reader() { prefix_hint: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, read_snapshot, ) @@ -1653,6 +1689,7 @@ async fn test_get_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1673,6 +1710,7 @@ async fn test_get_with_min_epoch() { prefix_hint: Some(Bytes::from(prefix_hint.clone())), read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1693,6 +1731,7 @@ async fn test_get_with_min_epoch() { prefix_hint: Some(Bytes::from(prefix_hint.clone())), read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1713,6 +1752,7 @@ async fn test_get_with_min_epoch() { prefix_hint: Some(Bytes::from(prefix_hint.clone())), read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1759,6 +1799,7 @@ async fn test_get_with_min_epoch() { prefix_hint: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1780,6 +1821,7 @@ async fn test_get_with_min_epoch() { prefix_hint: Some(Bytes::from(prefix_hint.clone())), read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1803,6 +1845,7 @@ async fn test_get_with_min_epoch() { prefix_hint: Some(Bytes::from(prefix_hint.clone())), read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1825,6 +1868,7 @@ async fn test_get_with_min_epoch() { prefix_hint: Some(Bytes::from(prefix_hint.clone())), read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await diff --git a/src/storage/hummock_test/src/snapshot_tests.rs b/src/storage/hummock_test/src/snapshot_tests.rs index 51d9527c5541f..a345ec3e0f1ea 100644 --- a/src/storage/hummock_test/src/snapshot_tests.rs +++ b/src/storage/hummock_test/src/snapshot_tests.rs @@ -17,9 +17,11 @@ use std::sync::Arc; use bytes::Bytes; use futures::TryStreamExt; +use risingwave_common::cache::CachePriority; use risingwave_hummock_sdk::HummockReadEpoch; use risingwave_meta::hummock::MockHummockMetaClient; use risingwave_rpc_client::HummockMetaClient; +use risingwave_storage::hummock::CachePolicy; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::{ LocalStateStore, NewLocalOptions, PrefetchOptions, ReadOptions, WriteOptions, @@ -46,6 +48,7 @@ macro_rules! assert_count_range_scan { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await diff --git a/src/storage/hummock_test/src/state_store_tests.rs b/src/storage/hummock_test/src/state_store_tests.rs index 076ebffe69cbe..807bbe3b1bc85 100644 --- a/src/storage/hummock_test/src/state_store_tests.rs +++ b/src/storage/hummock_test/src/state_store_tests.rs @@ -18,6 +18,7 @@ use std::sync::Arc; use bytes::Bytes; use futures::{pin_mut, TryStreamExt}; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::FullKey; use risingwave_hummock_sdk::{ @@ -28,7 +29,7 @@ use risingwave_meta::hummock::MockHummockMetaClient; use risingwave_rpc_client::HummockMetaClient; use risingwave_storage::hummock::iterator::test_utils::mock_sstable_store; use risingwave_storage::hummock::test_utils::{count_stream, default_opts_for_test}; -use risingwave_storage::hummock::HummockStorage; +use risingwave_storage::hummock::{CachePolicy, HummockStorage}; use risingwave_storage::storage_value::StorageValue; use risingwave_storage::store::*; @@ -49,6 +50,7 @@ async fn test_empty_read_v2() { table_id: TableId { table_id: 2333 }, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -65,6 +67,7 @@ async fn test_empty_read_v2() { table_id: TableId { table_id: 2333 }, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -163,6 +166,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -181,6 +185,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -201,6 +206,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -236,6 +242,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -272,6 +279,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -291,6 +299,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -310,6 +319,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -330,6 +340,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -350,6 +361,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -369,6 +381,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -389,6 +402,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -417,6 +431,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -435,6 +450,7 @@ async fn test_basic_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -617,6 +633,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -637,6 +654,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -671,6 +689,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -691,6 +710,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -711,6 +731,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -731,6 +752,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -750,6 +772,7 @@ async fn test_reload_storage() { retention_seconds: None, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -790,6 +813,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -810,6 +834,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -830,6 +855,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -852,6 +878,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -922,6 +949,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -941,6 +969,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -960,6 +989,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -981,6 +1011,7 @@ async fn test_write_anytime_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -1138,6 +1169,7 @@ async fn test_delete_get_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -1225,6 +1257,7 @@ async fn test_multiple_epoch_sync_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -1244,6 +1277,7 @@ async fn test_multiple_epoch_sync_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await @@ -1262,6 +1296,7 @@ async fn test_multiple_epoch_sync_inner( retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), } ) .await diff --git a/src/storage/hummock_test/src/sync_point_tests.rs b/src/storage/hummock_test/src/sync_point_tests.rs index 3211721b48e53..51ac3d46fa5c1 100644 --- a/src/storage/hummock_test/src/sync_point_tests.rs +++ b/src/storage/hummock_test/src/sync_point_tests.rs @@ -17,6 +17,7 @@ use std::sync::Arc; use std::time::Duration; use bytes::Bytes; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::hummock::CompactionFilterFlag; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::compaction_group::hummock_version_ext::HummockVersionExt; @@ -34,7 +35,7 @@ use risingwave_meta::storage::MemStore; use risingwave_pb::hummock::compact_task::TaskStatus; use risingwave_rpc_client::HummockMetaClient; use risingwave_storage::hummock::compactor::{Compactor, CompactorContext}; -use risingwave_storage::hummock::SstableObjectIdManager; +use risingwave_storage::hummock::{CachePolicy, SstableObjectIdManager}; use risingwave_storage::store::{LocalStateStore, NewLocalOptions, ReadOptions}; use risingwave_storage::StateStore; use serial_test::serial; @@ -278,7 +279,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() { )); let compactor_manager = hummock_manager_ref.compactor_manager_ref_for_test(); - compactor_manager.add_compactor(worker_node.id, u64::MAX); + compactor_manager.add_compactor(worker_node.id, u64::MAX, 16); let mut local = storage .new_local(NewLocalOptions::for_test(existing_table_id.into())) @@ -387,6 +388,7 @@ async fn test_syncpoints_get_in_delete_range_boundary() { retention_seconds: None, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; let get_result = storage .get(Bytes::from("hhh"), 120, read_options.clone()) diff --git a/src/storage/hummock_test/src/test_utils.rs b/src/storage/hummock_test/src/test_utils.rs index 465e4654c15c1..da2763ca6cef1 100644 --- a/src/storage/hummock_test/src/test_utils.rs +++ b/src/storage/hummock_test/src/test_utils.rs @@ -29,7 +29,7 @@ use risingwave_meta::hummock::test_utils::{ use risingwave_meta::hummock::{HummockManagerRef, MockHummockMetaClient}; use risingwave_meta::manager::MetaSrvEnv; use risingwave_meta::storage::{MemStore, MetaStore}; -use risingwave_pb::catalog::Table as ProstTable; +use risingwave_pb::catalog::PbTable; use risingwave_pb::common::WorkerNode; use risingwave_pb::hummock::version_update_payload; use risingwave_rpc_client::HummockMetaClient; @@ -179,7 +179,7 @@ pub async fn register_tables_with_id_for_test( pub async fn register_tables_with_catalog_for_test( filter_key_extractor_manager: &FilterKeyExtractorManagerRef, hummock_manager_ref: &HummockManagerRef, - tables: &[ProstTable], + tables: &[PbTable], ) { update_filter_key_extractor_for_tables(filter_key_extractor_manager, tables); let table_ids = tables.iter().map(|t| t.id).collect_vec(); @@ -207,7 +207,7 @@ impl HummockTestEnv { .await; } - pub async fn register_table(&self, table: ProstTable) { + pub async fn register_table(&self, table: PbTable) { register_tables_with_catalog_for_test( self.storage.filter_key_extractor_manager(), &self.manager, diff --git a/src/storage/src/hummock/block_cache.rs b/src/storage/src/hummock/block_cache.rs index d012e8be3014a..61dd21c64f13a 100644 --- a/src/storage/src/hummock/block_cache.rs +++ b/src/storage/src/hummock/block_cache.rs @@ -18,7 +18,9 @@ use std::ops::Deref; use std::sync::Arc; use futures::Future; -use risingwave_common::cache::{CacheableEntry, LookupResponse, LruCache, LruCacheEventListener}; +use risingwave_common::cache::{ + CachePriority, CacheableEntry, LookupResponse, LruCache, LruCacheEventListener, +}; use risingwave_hummock_sdk::HummockSstableObjectId; use tokio::sync::oneshot::Receiver; use tokio::task::JoinHandle; @@ -118,21 +120,28 @@ impl BlockResponse { } impl BlockCache { - pub fn new(capacity: usize, max_shard_bits: usize) -> Self { - Self::new_inner(capacity, max_shard_bits, None) + pub fn new(capacity: usize, max_shard_bits: usize, high_priority_ratio: usize) -> Self { + Self::new_inner(capacity, max_shard_bits, high_priority_ratio, None) } pub fn with_event_listener( capacity: usize, max_shard_bits: usize, + high_priority_ratio: usize, listener: BlockCacheEventListener, ) -> Self { - Self::new_inner(capacity, max_shard_bits, Some(listener)) + Self::new_inner( + capacity, + max_shard_bits, + high_priority_ratio, + Some(listener), + ) } fn new_inner( capacity: usize, mut max_shard_bits: usize, + high_priority_ratio: usize, listener: Option, ) -> Self { if capacity == 0 { @@ -143,8 +152,13 @@ impl BlockCache { } let cache = match listener { - Some(listener) => LruCache::with_event_listener(max_shard_bits, capacity, listener), - None => LruCache::new(max_shard_bits, capacity), + Some(listener) => LruCache::with_event_listener( + max_shard_bits, + capacity, + high_priority_ratio, + listener, + ), + None => LruCache::new(max_shard_bits, capacity, high_priority_ratio), }; Self { @@ -163,12 +177,14 @@ impl BlockCache { object_id: HummockSstableObjectId, block_idx: u64, block: Box, + priority: CachePriority, ) -> BlockHolder { BlockHolder::from_cached_block(self.inner.insert( (object_id, block_idx), Self::hash(object_id, block_idx), block.capacity(), block, + priority, )) } @@ -176,6 +192,7 @@ impl BlockCache { &self, object_id: HummockSstableObjectId, block_idx: u64, + priority: CachePriority, mut fetch_block: F, ) -> BlockResponse where @@ -186,7 +203,7 @@ impl BlockCache { let key = (object_id, block_idx); match self .inner - .lookup_with_request_dedup::<_, HummockError, _>(h, key, || { + .lookup_with_request_dedup::<_, HummockError, _>(h, key, priority, || { let f = fetch_block(); async move { let block = f.await?; diff --git a/src/storage/src/hummock/compactor/compaction_utils.rs b/src/storage/src/hummock/compactor/compaction_utils.rs index da8307896e188..8aa2a0ce19d14 100644 --- a/src/storage/src/hummock/compactor/compaction_utils.rs +++ b/src/storage/src/hummock/compactor/compaction_utils.rs @@ -127,8 +127,9 @@ pub struct TaskConfig { pub split_by_table: bool, } -pub fn estimate_memory_use_for_compaction(task: &CompactTask) -> u64 { +pub fn estimate_state_for_compaction(task: &CompactTask) -> (u64, usize) { let mut total_memory_size = 0; + let mut total_file_count = 0; for level in &task.input_ssts { if level.level_type == LevelType::Nonoverlapping as i32 { if let Some(table) = level.table_infos.first() { @@ -139,8 +140,11 @@ pub fn estimate_memory_use_for_compaction(task: &CompactTask) -> u64 { total_memory_size += table.file_size; } } + + total_file_count += level.table_infos.len(); } - total_memory_size + + (total_memory_size, total_file_count) } pub fn build_multi_compaction_filter(compact_task: &CompactTask) -> MultiCompactionFilter { diff --git a/src/storage/src/hummock/compactor/compactor_runner.rs b/src/storage/src/hummock/compactor/compactor_runner.rs index 2064b0844888c..61a81ea3c1f48 100644 --- a/src/storage/src/hummock/compactor/compactor_runner.rs +++ b/src/storage/src/hummock/compactor/compactor_runner.rs @@ -53,17 +53,6 @@ impl CompactorRunner { .map(|table| table.file_size) .sum::(); - let stats_target_table_ids: HashSet = task - .input_ssts - .iter() - .flat_map(|i| { - i.table_infos - .iter() - .flat_map(|t| t.table_ids.clone()) - .collect_vec() - }) - .collect(); - let mut options: SstableBuilderOptions = context.storage_opts.as_ref().into(); options.capacity = std::cmp::min(task.target_file_size as usize, max_target_file_size); options.compression_algorithm = match task.compression_algorithm { @@ -89,7 +78,7 @@ impl CompactorRunner { cache_policy: CachePolicy::NotFill, gc_delete_keys: task.gc_delete_keys, watermark: task.watermark, - stats_target_table_ids: Some(stats_target_table_ids), + stats_target_table_ids: Some(HashSet::from_iter(task.existing_table_ids.clone())), task_type: task.task_type(), split_by_table: task.split_by_state_table, }, @@ -181,6 +170,7 @@ impl CompactorRunner { .cloned() .collect_vec(); table_iters.push(ConcatSstableIterator::new( + self.compact_task.existing_table_ids.clone(), tables, self.compactor.task_config.key_range.clone(), self.sstable_store.clone(), @@ -192,6 +182,7 @@ impl CompactorRunner { continue; } table_iters.push(ConcatSstableIterator::new( + self.compact_task.existing_table_ids.clone(), vec![table_info.clone()], self.compactor.task_config.key_range.clone(), self.sstable_store.clone(), diff --git a/src/storage/src/hummock/compactor/iterator.rs b/src/storage/src/hummock/compactor/iterator.rs index fc1bee3f96e14..070546f0a5bef 100644 --- a/src/storage/src/hummock/compactor/iterator.rs +++ b/src/storage/src/hummock/compactor/iterator.rs @@ -13,11 +13,13 @@ // limitations under the License. use std::cmp::Ordering; +use std::collections::HashSet; use std::future::Future; use std::sync::atomic::AtomicU64; use std::sync::{atomic, Arc}; use std::time::Instant; +use risingwave_hummock_sdk::compaction_group::StateTableId; use risingwave_hummock_sdk::key::FullKey; use risingwave_hummock_sdk::key_range::KeyRange; use risingwave_hummock_sdk::KeyComparator; @@ -45,6 +47,7 @@ struct SstableStreamIterator { /// For key sanity check of divided SST and debugging sstable_info: SstableInfo, + existing_table_ids: HashSet, } impl SstableStreamIterator { @@ -64,6 +67,7 @@ impl SstableStreamIterator { /// The iterator reads at most `max_block_count` from the stream. pub fn new( sstable_info: &SstableInfo, + existing_table_ids: HashSet, block_stream: BlockStream, max_block_count: usize, stats: &StoreLocalStatistic, @@ -73,6 +77,7 @@ impl SstableStreamIterator { block_iter: None, remaining_blocks: max_block_count, stats_ptr: stats.remote_io_time.clone(), + existing_table_ids, sstable_info: sstable_info.clone(), } } @@ -80,10 +85,8 @@ impl SstableStreamIterator { async fn prune_from_valid_block_iter(&mut self) -> HummockResult<()> { while let Some(block_iter) = self.block_iter.as_mut() { if self - .sstable_info - .get_table_ids() - .binary_search(&block_iter.table_id().table_id) - .is_ok() + .existing_table_ids + .contains(&block_iter.table_id().table_id) { return Ok(()); } else { @@ -111,6 +114,7 @@ impl SstableStreamIterator { if !block_iter.is_valid() { // `seek_key` is larger than everything in the first block. self.next_block().await?; + } else { } } @@ -214,7 +218,9 @@ pub struct ConcatSstableIterator { cur_idx: usize, /// All non-overlapping tables. - tables: Vec, + sstables: Vec, + + existing_table_ids: HashSet, sstable_store: SstableStoreRef, @@ -226,7 +232,8 @@ impl ConcatSstableIterator { /// arranged in ascending order when it serves as a forward iterator, /// and arranged in descending order when it serves as a backward iterator. pub fn new( - tables: Vec, + existing_table_ids: Vec, + sst_infos: Vec, key_range: KeyRange, sstable_store: SstableStoreRef, ) -> Self { @@ -234,7 +241,8 @@ impl ConcatSstableIterator { key_range, sstable_iter: None, cur_idx: 0, - tables, + sstables: sst_infos, + existing_table_ids: HashSet::from_iter(existing_table_ids), sstable_store, stats: StoreLocalStatistic::default(), } @@ -243,7 +251,7 @@ impl ConcatSstableIterator { /// Resets the iterator, loads the specified SST, and seeks in that SST to `seek_key` if given. async fn seek_idx( &mut self, - mut idx: usize, + idx: usize, seek_key: Option>, ) -> HummockResult<()> { self.sstable_iter.take(); @@ -257,14 +265,25 @@ impl ConcatSstableIterator { (None, true) => None, (None, false) => Some(FullKey::decode(&self.key_range.left)), }; - - while idx < self.tables.len() { - let table_info = &self.tables[idx]; - let table = self + self.cur_idx = idx; + while self.cur_idx < self.sstables.len() { + let table_info = &self.sstables[self.cur_idx]; + let mut found = table_info + .table_ids + .iter() + .any(|table_id| self.existing_table_ids.contains(table_id)); + if !found { + self.cur_idx += 1; + seek_key = None; + continue; + } + let sstable = self .sstable_store .sstable(table_info, &mut self.stats) .await?; - let block_metas = &table.value().meta.block_metas; + let stats_ptr = self.stats.remote_io_time.clone(); + let now = Instant::now(); + let block_metas = &sstable.value().meta.block_metas; let mut start_index = match seek_key { None => 0, Some(seek_key) => { @@ -286,32 +305,24 @@ impl ConcatSstableIterator { ) != Ordering::Greater }) }; - while start_index < end_index { let start_block_table_id = block_metas[start_index].table_id(); - if table_info - .get_table_ids() - .binary_search(&start_block_table_id.table_id) - .is_ok() + if self + .existing_table_ids + .contains(&block_metas[start_index].table_id().table_id) { break; - } else { - start_index += - &block_metas[(start_index + 1)..].partition_point(|block_meta| { - block_meta.table_id() == start_block_table_id - }) + 1; } + start_index += &block_metas[(start_index + 1)..] + .partition_point(|block_meta| block_meta.table_id() == start_block_table_id) + + 1; } - - let found = if end_index <= start_index { - false + if start_index >= end_index { + found = false; } else { - let stats_ptr = self.stats.remote_io_time.clone(); - let now = Instant::now(); - let block_stream = self .sstable_store - .get_stream(table.value(), Some(start_index)) + .get_stream(sstable.value(), Some(start_index)) .await?; // Determine time needed to open stream. @@ -320,6 +331,7 @@ impl ConcatSstableIterator { let mut sstable_iter = SstableStreamIterator::new( table_info, + self.existing_table_ids.clone(), block_stream, end_index - start_index, &self.stats, @@ -328,17 +340,14 @@ impl ConcatSstableIterator { if sstable_iter.is_valid() { self.sstable_iter = Some(sstable_iter); - true } else { - false + found = false; } - }; - self.cur_idx = idx; - + } if found { return Ok(()); } else { - idx += 1; + self.cur_idx += 1; seek_key = None; } } @@ -396,7 +405,7 @@ impl HummockIterator for ConcatSstableIterator { Ordering::Greater => key, } }; - let table_idx = self.tables.partition_point(|table| { + let table_idx = self.sstables.partition_point(|table| { // We use the maximum key of an SST for the search. That way, we guarantee that the // resulting SST contains either that key or the next-larger KV-pair. Subsequently, // we avoid calling `seek_idx()` twice if the determined SST does not contain `key`. @@ -456,8 +465,12 @@ mod tests { test_key_of(start_index).encode().into(), test_key_of(end_index).encode().into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); iter.seek(FullKey::decode(&kr.left)).await.unwrap(); for idx in start_index..end_index { @@ -476,16 +489,24 @@ mod tests { test_key_of(30000).encode().into(), test_key_of(40000).encode().into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); iter.seek(FullKey::decode(&kr.left)).await.unwrap(); assert!(!iter.is_valid()); let kr = KeyRange::new( test_key_of(start_index).encode().into(), test_key_of(40000).encode().into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); iter.seek(FullKey::decode(&kr.left)).await.unwrap(); for idx in start_index..30000 { let key = iter.key(); @@ -504,8 +525,12 @@ mod tests { test_key_of(0).encode().into(), test_key_of(40000).encode().into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); iter.seek(test_key_of(10000).to_ref()).await.unwrap(); assert!(iter.is_valid() && iter.cur_idx == 1 && iter.key() == test_key_of(10000).to_ref()); iter.seek(test_key_of(10001).to_ref()).await.unwrap(); @@ -524,8 +549,12 @@ mod tests { test_key_of(6000).encode().into(), test_key_of(16000).encode().into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); iter.seek(test_key_of(17000).to_ref()).await.unwrap(); assert!(!iter.is_valid()); iter.seek(test_key_of(1).to_ref()).await.unwrap(); @@ -555,10 +584,14 @@ mod tests { test_key_of(0).encode().into(), test_key_of(40000).encode().into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); let sst = sstable_store - .sstable(&iter.tables[0], &mut iter.stats) + .sstable(&iter.sstables[0], &mut iter.stats) .await .unwrap(); let block_metas = &sst.value().meta.block_metas; @@ -591,8 +624,12 @@ mod tests { next_full_key(&block_1_smallest_key).into(), prev_full_key(&block_2_smallest_key).into(), ); - let mut iter = - ConcatSstableIterator::new(table_infos.clone(), kr.clone(), sstable_store.clone()); + let mut iter = ConcatSstableIterator::new( + vec![0], + table_infos.clone(), + kr.clone(), + sstable_store.clone(), + ); // Use block_2_smallest_key as seek key and result in invalid iterator. let seek_key = FullKey::decode(&block_2_smallest_key); assert!(seek_key.cmp(&FullKey::decode(&kr.right)) == Ordering::Greater); diff --git a/src/storage/src/hummock/compactor/mod.rs b/src/storage/src/hummock/compactor/mod.rs index 99ea00f9eaf39..6b241ccc32373 100644 --- a/src/storage/src/hummock/compactor/mod.rs +++ b/src/storage/src/hummock/compactor/mod.rs @@ -23,6 +23,7 @@ pub(super) mod task_progress; use std::collections::{HashMap, HashSet}; use std::marker::PhantomData; +use std::ops::Div; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::{Arc, Mutex}; use std::time::Duration; @@ -37,6 +38,7 @@ use futures::future::try_join_all; use futures::{stream, StreamExt}; pub use iterator::ConcatSstableIterator; use itertools::Itertools; +use risingwave_common::util::resource_util; use risingwave_hummock_sdk::compact::compact_task_to_string; use risingwave_hummock_sdk::filter_key_extractor::FilterKeyExtractorImpl; use risingwave_hummock_sdk::key::FullKey; @@ -44,9 +46,12 @@ use risingwave_hummock_sdk::table_stats::{add_table_stats_map, TableStats, Table use risingwave_hummock_sdk::LocalSstableInfo; use risingwave_pb::hummock::compact_task::TaskStatus; use risingwave_pb::hummock::subscribe_compact_tasks_response::Task; -use risingwave_pb::hummock::{CompactTask, CompactTaskProgress, SubscribeCompactTasksResponse}; +use risingwave_pb::hummock::{ + CompactTask, CompactTaskProgress, CompactorWorkload, SubscribeCompactTasksResponse, +}; use risingwave_rpc_client::HummockMetaClient; pub use shared_buffer_compact::compact; +use sysinfo::{CpuRefreshKind, ProcessExt, ProcessRefreshKind, RefreshKind, System, SystemExt}; use tokio::sync::oneshot::{Receiver, Sender}; use tokio::task::JoinHandle; @@ -55,7 +60,7 @@ use self::task_progress::TaskProgress; use super::multi_builder::CapacitySplitTableBuilder; use super::{HummockResult, SstableBuilderOptions, XorFilterBuilder}; use crate::hummock::compactor::compaction_utils::{ - build_multi_compaction_filter, estimate_memory_use_for_compaction, generate_splits, + build_multi_compaction_filter, estimate_state_for_compaction, generate_splits, }; use crate::hummock::compactor::compactor_runner::CompactorRunner; use crate::hummock::compactor::task_progress::TaskProgressGuard; @@ -157,11 +162,12 @@ impl Compactor { .with_label_values(&[compact_task.input_ssts[0].level_idx.to_string().as_str()]) .start_timer(); - let need_quota = estimate_memory_use_for_compaction(&compact_task); + let (need_quota, file_counts) = estimate_state_for_compaction(&compact_task); tracing::info!( - "Ready to handle compaction task: {} need memory: {} target_level {} compression_algorithm {:?}", + "Ready to handle compaction task: {} need memory: {} input_file_counts {} target_level {} compression_algorithm {:?}", compact_task.task_id, need_quota, + file_counts, compact_task.target_level, compact_task.compression_algorithm, ); @@ -337,13 +343,21 @@ impl Compactor { ) -> (JoinHandle<()>, Sender<()>) { type CompactionShutdownMap = Arc>>>; let (shutdown_tx, mut shutdown_rx) = tokio::sync::oneshot::channel(); - let stream_retry_interval = Duration::from_secs(60); + let stream_retry_interval = Duration::from_secs(30); let task_progress = compactor_context.task_progress_manager.clone(); let task_progress_update_interval = Duration::from_millis(1000); + let cpu_core_num = resource_util::cpu::total_cpu_available() as u32; + + let mut system = + System::new_with_specifics(RefreshKind::new().with_cpu(CpuRefreshKind::everything())); + let pid = sysinfo::get_current_pid().unwrap(); + let join_handle = tokio::spawn(async move { let shutdown_map = CompactionShutdownMap::default(); let mut min_interval = tokio::time::interval(stream_retry_interval); let mut task_progress_interval = tokio::time::interval(task_progress_update_interval); + let mut workload_collect_interval = tokio::time::interval(Duration::from_secs(60)); + // This outer loop is to recreate stream. 'start_stream: loop { tokio::select! { @@ -358,7 +372,7 @@ impl Compactor { let config = compactor_context.lock_config().await; let mut stream = match hummock_meta_client - .subscribe_compact_tasks(config.max_concurrent_task_number) + .subscribe_compact_tasks(config.max_concurrent_task_number, cpu_core_num) .await { Ok(stream) => { @@ -376,6 +390,8 @@ impl Compactor { drop(config); let executor = compactor_context.compaction_executor.clone(); + let mut last_workload = CompactorWorkload::default(); + // This inner loop is to consume stream or report task progress. 'consume_stream: loop { let message = tokio::select! { @@ -388,12 +404,34 @@ impl Compactor { num_ssts_uploaded: progress.num_ssts_uploaded.load(Ordering::Relaxed), }); } - if let Err(e) = hummock_meta_client.report_compaction_task_progress(progress_list).await { + + if let Err(e) = hummock_meta_client.compactor_heartbeat(progress_list, last_workload.clone()).await { // ignore any errors while trying to report task progress tracing::warn!("Failed to report task progress. {e:?}"); } continue; } + + _ = workload_collect_interval.tick() => { + let refresh_result = system.refresh_process_specifics(pid, ProcessRefreshKind::new().with_cpu()); + debug_assert!(refresh_result); + let cpu = if let Some(process) = system.process(pid) { + process.cpu_usage().div(cpu_core_num as f32) as u32 + } else { + tracing::warn!("fail to get process pid {:?}", pid); + 0 + }; + + tracing::debug!("compactor cpu usage {cpu}"); + let workload = CompactorWorkload { + cpu, + }; + + last_workload = workload.clone(); + + continue; + } + message = stream.next() => { message }, @@ -412,15 +450,13 @@ impl Compactor { let shutdown = shutdown_map.clone(); let context = compactor_context.clone(); let meta_client = hummock_meta_client.clone(); + executor.spawn(async move { match task { Task::CompactTask(compact_task) => { let (tx, rx) = tokio::sync::oneshot::channel(); let task_id = compact_task.task_id; - shutdown - .lock() - .unwrap() - .insert(task_id, tx); + shutdown.lock().unwrap().insert(task_id, tx); Compactor::compact(context, compact_task, rx).await; shutdown.lock().unwrap().remove(&task_id); } @@ -458,15 +494,15 @@ impl Compactor { "Cancellation of compaction task failed. task_id: {}", cancel_compact_task.task_id ); - } - } else { - tracing::warn!( + } + } else { + tracing::warn!( "Attempting to cancel non-existent compaction task. task_id: {}", cancel_compact_task.task_id ); - } } } + } }); } Some(Err(e)) => { diff --git a/src/storage/src/hummock/compactor/shared_buffer_compact.rs b/src/storage/src/hummock/compactor/shared_buffer_compact.rs index 89a3109fdebcd..a6a189d0033f8 100644 --- a/src/storage/src/hummock/compactor/shared_buffer_compact.rs +++ b/src/storage/src/hummock/compactor/shared_buffer_compact.rs @@ -19,6 +19,7 @@ use bytes::Bytes; use futures::future::try_join_all; use futures::{stream, StreamExt, TryFutureExt}; use itertools::Itertools; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::compaction_group::StaticCompactionGroupId; use risingwave_hummock_sdk::filter_key_extractor::FilterKeyExtractorImpl; @@ -256,7 +257,7 @@ impl SharedBufferCompactRunner { options, super::TaskConfig { key_range, - cache_policy: CachePolicy::Fill, + cache_policy: CachePolicy::Fill(CachePriority::High), gc_delete_keys: GC_DELETE_KEYS_FOR_FLUSH, watermark: GC_WATERMARK_FOR_FLUSH, stats_target_table_ids: None, diff --git a/src/storage/src/hummock/file_cache/buffer.rs b/src/storage/src/hummock/file_cache/buffer.rs index b44d07889e759..5514ef241c96c 100644 --- a/src/storage/src/hummock/file_cache/buffer.rs +++ b/src/storage/src/hummock/file_cache/buffer.rs @@ -15,7 +15,7 @@ use std::sync::Arc; use parking_lot::RwLock; -use risingwave_common::cache::LruCache; +use risingwave_common::cache::{CachePriority, LruCache}; use super::LRU_SHARD_BITS; use crate::hummock::{TieredCacheEntryHolder, TieredCacheKey, TieredCacheValue}; @@ -73,15 +73,16 @@ where Self { capacity, core: Arc::new(RwLock::new(TwoLevelBufferCore { - active_buffer: Arc::new(LruCache::new(LRU_SHARD_BITS, capacity)), - frozen_buffer: Arc::new(LruCache::new(LRU_SHARD_BITS, capacity)), + active_buffer: Arc::new(LruCache::new(LRU_SHARD_BITS, capacity, 0)), + frozen_buffer: Arc::new(LruCache::new(LRU_SHARD_BITS, capacity, 0)), })), } } pub fn insert(&self, hash: u64, key: K, charge: usize, value: V) { let core = self.core.read(); - core.active_buffer.insert(key, hash, charge, value); + core.active_buffer + .insert(key, hash, charge, value, CachePriority::High); } pub fn get(&self, hash: u64, key: &K) -> Option> { @@ -114,7 +115,7 @@ where } pub fn rotate(&self) -> Buffer { - let mut buffer = Arc::new(LruCache::new(LRU_SHARD_BITS, self.capacity)); + let mut buffer = Arc::new(LruCache::new(LRU_SHARD_BITS, self.capacity, 0)); let mut core = self.core.write(); std::mem::swap(&mut buffer, &mut core.active_buffer); std::mem::swap(&mut buffer, &mut core.frozen_buffer); diff --git a/src/storage/src/hummock/file_cache/cache.rs b/src/storage/src/hummock/file_cache/cache.rs index 20967aae95815..ced1684fa4f72 100644 --- a/src/storage/src/hummock/file_cache/cache.rs +++ b/src/storage/src/hummock/file_cache/cache.rs @@ -16,7 +16,7 @@ use std::collections::hash_map::RandomState; use std::sync::Arc; use async_trait::async_trait; -use risingwave_common::cache::LruCache; +use risingwave_common::cache::{CachePriority, LruCache}; use risingwave_common::util::iter_util::ZipEqFast; use tokio::sync::Notify; @@ -110,6 +110,7 @@ where hash, utils::align_up(self.store.block_size(), encoded_value_len), slot, + CachePriority::High, ); bytes += utils::align_up(self.store.block_size(), encoded_value_len); } @@ -198,6 +199,7 @@ where let indices = Arc::new(LruCache::with_event_listener( LRU_SHARD_BITS, options.capacity, + 0, store.clone(), )); store.restore(&indices, &hash_builder).await?; diff --git a/src/storage/src/hummock/file_cache/store.rs b/src/storage/src/hummock/file_cache/store.rs index a4836936f20cc..aa9193d629793 100644 --- a/src/storage/src/hummock/file_cache/store.rs +++ b/src/storage/src/hummock/file_cache/store.rs @@ -20,7 +20,7 @@ use nix::sys::statfs::{ statfs, FsType as NixFsType, BTRFS_SUPER_MAGIC, EXT4_SUPER_MAGIC, TMPFS_MAGIC, }; use parking_lot::RwLock; -use risingwave_common::cache::{LruCache, LruCacheEventListener}; +use risingwave_common::cache::{CachePriority, LruCache, LruCacheEventListener}; use risingwave_common::util::iter_util::ZipEqFast; use tokio::sync::RwLock as AsyncRwLock; use tracing::Instrument; @@ -355,6 +355,7 @@ where hash_builder.hash_one(&key), utils::align_up(self.block_size, block_loc.len as usize), slot, + CachePriority::High, ); } } diff --git a/src/storage/src/hummock/hummock_meta_client.rs b/src/storage/src/hummock/hummock_meta_client.rs index bc17505bc0d51..b91cfc03f246d 100644 --- a/src/storage/src/hummock/hummock_meta_client.rs +++ b/src/storage/src/hummock/hummock_meta_client.rs @@ -19,7 +19,8 @@ use futures::stream::BoxStream; use risingwave_hummock_sdk::table_stats::TableStatsMap; use risingwave_hummock_sdk::{HummockSstableObjectId, LocalSstableInfo, SstObjectIdRange}; use risingwave_pb::hummock::{ - CompactTask, CompactTaskProgress, HummockSnapshot, HummockVersion, VacuumTask, + CompactTask, CompactTaskProgress, CompactorWorkload, HummockSnapshot, HummockVersion, + VacuumTask, }; use risingwave_rpc_client::error::Result; use risingwave_rpc_client::{CompactTaskItem, HummockMetaClient, MetaClient}; @@ -122,18 +123,20 @@ impl HummockMetaClient for MonitoredHummockMetaClient { async fn subscribe_compact_tasks( &self, max_concurrent_task_number: u64, + cpu_core_num: u32, ) -> Result> { self.meta_client - .subscribe_compact_tasks(max_concurrent_task_number) + .subscribe_compact_tasks(max_concurrent_task_number, cpu_core_num) .await } - async fn report_compaction_task_progress( + async fn compactor_heartbeat( &self, progress: Vec, + workload: CompactorWorkload, ) -> Result<()> { self.meta_client - .report_compaction_task_progress(progress) + .compactor_heartbeat(progress, workload) .await } diff --git a/src/storage/src/hummock/iterator/backward_merge.rs b/src/storage/src/hummock/iterator/backward_merge.rs index ebc2517d14cd3..e76b9040bfb04 100644 --- a/src/storage/src/hummock/iterator/backward_merge.rs +++ b/src/storage/src/hummock/iterator/backward_merge.rs @@ -14,6 +14,7 @@ #[cfg(test)] mod test { + use risingwave_common::cache::CachePriority; use crate::hummock::iterator::test_utils::{ default_builder_opt_for_test, gen_iterator_test_sstable_base, iterator_test_key_of, @@ -53,15 +54,33 @@ mod test { let cache = create_small_table_cache(); let iters = vec![ BackwardSstableIterator::new( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), ), BackwardSstableIterator::new( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store.clone(), ), BackwardSstableIterator::new( - cache.insert(table2.id, table2.id, 1, Box::new(table2)), + cache.insert( + table2.id, + table2.id, + 1, + Box::new(table2), + CachePriority::High, + ), sstable_store, ), ]; @@ -116,15 +135,33 @@ mod test { let cache = create_small_table_cache(); let iters = vec![ BackwardSstableIterator::new( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), ), BackwardSstableIterator::new( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store.clone(), ), BackwardSstableIterator::new( - cache.insert(table2.id, table2.id, 1, Box::new(table2)), + cache.insert( + table2.id, + table2.id, + 1, + Box::new(table2), + CachePriority::High, + ), sstable_store, ), ]; @@ -193,11 +230,23 @@ mod test { let cache = create_small_table_cache(); let iters = vec![ BackwardSstableIterator::new( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store.clone(), ), BackwardSstableIterator::new( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store, ), ]; diff --git a/src/storage/src/hummock/iterator/backward_user.rs b/src/storage/src/hummock/iterator/backward_user.rs index 4965782e75a66..3b71ce4a113c2 100644 --- a/src/storage/src/hummock/iterator/backward_user.rs +++ b/src/storage/src/hummock/iterator/backward_user.rs @@ -296,6 +296,7 @@ mod tests { use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; + use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::prev_key; @@ -341,9 +342,27 @@ mod tests { ) .await; let cache = create_small_table_cache(); - let handle0 = cache.insert(table0.id, table0.id, 1, Box::new(table0)); - let handle1 = cache.insert(table1.id, table1.id, 1, Box::new(table1)); - let handle2 = cache.insert(table2.id, table2.id, 1, Box::new(table2)); + let handle0 = cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ); + let handle1 = cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ); + let handle2 = cache.insert( + table2.id, + table2.id, + 1, + Box::new(table2), + CachePriority::High, + ); let backward_iters = vec![ BackwardSstableIterator::new(handle1, sstable_store.clone()), @@ -397,9 +416,27 @@ mod tests { ) .await; let cache = create_small_table_cache(); - let handle0 = cache.insert(table0.id, table0.id, 1, Box::new(table0)); - let handle1 = cache.insert(table1.id, table1.id, 1, Box::new(table1)); - let handle2 = cache.insert(table2.id, table2.id, 1, Box::new(table2)); + let handle0 = cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ); + let handle1 = cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ); + let handle2 = cache.insert( + table2.id, + table2.id, + 1, + Box::new(table2), + CachePriority::High, + ); let backward_iters = vec![ BackwardSstableIterator::new(handle0, sstable_store.clone()), BackwardSstableIterator::new(handle1, sstable_store.clone()), @@ -464,11 +501,23 @@ mod tests { let cache = create_small_table_cache(); let backward_iters = vec![ BackwardSstableIterator::new( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), ), BackwardSstableIterator::new( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store, ), ]; @@ -515,7 +564,13 @@ mod tests { let sstable = gen_iterator_test_sstable_from_kv_pair(0, kv_pairs, sstable_store.clone()).await; let cache = create_small_table_cache(); - let handle = cache.insert(sstable.id, sstable.id, 1, Box::new(sstable)); + let handle = cache.insert( + sstable.id, + sstable.id, + 1, + Box::new(sstable), + CachePriority::High, + ); let backward_iters = vec![BackwardSstableIterator::new(handle, sstable_store)]; let bmi = UnorderedMergeIteratorInner::new(backward_iters); @@ -594,7 +649,13 @@ mod tests { let sstable = gen_iterator_test_sstable_from_kv_pair(0, kv_pairs, sstable_store.clone()).await; let cache = create_small_table_cache(); - let handle = cache.insert(sstable.id, sstable.id, 1, Box::new(sstable)); + let handle = cache.insert( + sstable.id, + sstable.id, + 1, + Box::new(sstable), + CachePriority::High, + ); let backward_iters = vec![BackwardSstableIterator::new(handle, sstable_store)]; let bmi = UnorderedMergeIteratorInner::new(backward_iters); @@ -675,7 +736,13 @@ mod tests { gen_iterator_test_sstable_from_kv_pair(0, kv_pairs, sstable_store.clone()).await; let cache = create_small_table_cache(); let backward_iters = vec![BackwardSstableIterator::new( - cache.insert(sstable.id, sstable.id, 1, Box::new(sstable)), + cache.insert( + sstable.id, + sstable.id, + 1, + Box::new(sstable), + CachePriority::High, + ), sstable_store, )]; let bmi = UnorderedMergeIteratorInner::new(backward_iters); @@ -754,7 +821,13 @@ mod tests { let sstable = gen_iterator_test_sstable_from_kv_pair(0, kv_pairs, sstable_store.clone()).await; let cache = create_small_table_cache(); - let handle = cache.insert(sstable.id, sstable.id, 1, Box::new(sstable)); + let handle = cache.insert( + sstable.id, + sstable.id, + 1, + Box::new(sstable), + CachePriority::High, + ); let backward_iters = vec![BackwardSstableIterator::new(handle, sstable_store)]; let bmi = UnorderedMergeIteratorInner::new(backward_iters); @@ -852,7 +925,13 @@ mod tests { _ => unimplemented!(), }; let cache = create_small_table_cache(); - let handle = cache.insert(sstable.id, sstable.id, 1, Box::new(sstable)); + let handle = cache.insert( + sstable.id, + sstable.id, + 1, + Box::new(sstable), + CachePriority::High, + ); let backward_iters = vec![BackwardSstableIterator::new(handle, sstable_store)]; let bmi = UnorderedMergeIteratorInner::new(backward_iters); let mut bui = BackwardUserIterator::for_test(bmi, (start_bound, end_bound)); @@ -1093,7 +1172,13 @@ mod tests { .await; let cache = create_small_table_cache(); - let handle0 = cache.insert(table0.id, table0.id, 1, Box::new(table0)); + let handle0 = cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ); let backward_iters = vec![BackwardSstableIterator::new(handle0, sstable_store)]; diff --git a/src/storage/src/hummock/iterator/forward_merge.rs b/src/storage/src/hummock/iterator/forward_merge.rs index a1e43bde20694..df31dcb1b3d24 100644 --- a/src/storage/src/hummock/iterator/forward_merge.rs +++ b/src/storage/src/hummock/iterator/forward_merge.rs @@ -20,6 +20,7 @@ mod test { use std::task::Poll; use futures::{pin_mut, FutureExt}; + use risingwave_common::cache::CachePriority; use risingwave_hummock_sdk::key::{FullKey, TableKey, UserKey}; use crate::hummock::iterator::test_utils::{ @@ -173,12 +174,12 @@ mod test { OrderedMergeIteratorInner, > = HummockIteratorUnion::First(UnorderedMergeIteratorInner::new(vec![ SstableIterator::create( - cache.insert(table0.id, table0.id, 1, table0), + cache.insert(table0.id, table0.id, 1, table0, CachePriority::High), sstable_store.clone(), read_options.clone(), ), SstableIterator::create( - cache.insert(table1.id, table1.id, 1, table1), + cache.insert(table1.id, table1.id, 1, table1, CachePriority::High), sstable_store.clone(), read_options.clone(), ), @@ -280,6 +281,7 @@ mod test { non_overlapped_sstable.id, 1, non_overlapped_sstable, + CachePriority::High, ), sstable_store.clone(), read_options.clone(), @@ -290,6 +292,7 @@ mod test { overlapped_new_sstable.id, 1, overlapped_new_sstable, + CachePriority::High, ), sstable_store.clone(), read_options.clone(), @@ -300,6 +303,7 @@ mod test { overlapped_old_sstable.id, 1, overlapped_old_sstable, + CachePriority::High, ), sstable_store.clone(), read_options.clone(), diff --git a/src/storage/src/hummock/iterator/forward_user.rs b/src/storage/src/hummock/iterator/forward_user.rs index b14907771b0c6..8769fe286c0a5 100644 --- a/src/storage/src/hummock/iterator/forward_user.rs +++ b/src/storage/src/hummock/iterator/forward_user.rs @@ -263,6 +263,8 @@ mod tests { use std::ops::Bound::*; use std::sync::Arc; + use risingwave_common::cache::CachePriority; + use super::*; use crate::hummock::iterator::test_utils::{ default_builder_opt_for_test, gen_iterator_test_sstable_base, @@ -311,17 +313,35 @@ mod tests { let cache = create_small_table_cache(); let iters = vec![ SstableIterator::create( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), read_options.clone(), ), SstableIterator::create( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store.clone(), read_options.clone(), ), SstableIterator::create( - cache.insert(table2.id, table2.id, 1, Box::new(table2)), + cache.insert( + table2.id, + table2.id, + 1, + Box::new(table2), + CachePriority::High, + ), sstable_store, read_options.clone(), ), @@ -378,17 +398,35 @@ mod tests { let cache = create_small_table_cache(); let iters = vec![ SstableIterator::create( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), read_options.clone(), ), SstableIterator::create( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store.clone(), read_options.clone(), ), SstableIterator::create( - cache.insert(table2.id, table2.id, 1, Box::new(table2)), + cache.insert( + table2.id, + table2.id, + 1, + Box::new(table2), + CachePriority::High, + ), sstable_store, read_options, ), @@ -455,12 +493,24 @@ mod tests { let cache = create_small_table_cache(); let iters = vec![ SstableIterator::create( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), read_options.clone(), ), SstableIterator::create( - cache.insert(table1.id, table1.id, 1, Box::new(table1)), + cache.insert( + table1.id, + table1.id, + 1, + Box::new(table1), + CachePriority::High, + ), sstable_store.clone(), read_options, ), @@ -519,7 +569,7 @@ mod tests { let cache = create_small_table_cache(); let read_options = Arc::new(SstableIteratorReadOptions::default()); let iters = vec![SstableIterator::create( - cache.insert(table.id, table.id, 1, Box::new(table)), + cache.insert(table.id, table.id, 1, Box::new(table), CachePriority::High), sstable_store, read_options, )]; @@ -602,7 +652,7 @@ mod tests { let cache = create_small_table_cache(); let read_options = Arc::new(SstableIteratorReadOptions::default()); let iters = vec![SstableIterator::create( - cache.insert(table.id, table.id, 1, Box::new(table)), + cache.insert(table.id, table.id, 1, Box::new(table), CachePriority::High), sstable_store, read_options, )]; @@ -670,7 +720,7 @@ mod tests { let cache = create_small_table_cache(); let read_options = Arc::new(SstableIteratorReadOptions::default()); let iters = vec![SstableIterator::create( - cache.insert(table.id, table.id, 1, Box::new(table)), + cache.insert(table.id, table.id, 1, Box::new(table), CachePriority::High), sstable_store, read_options, )]; @@ -739,7 +789,7 @@ mod tests { let cache = create_small_table_cache(); let read_options = Arc::new(SstableIteratorReadOptions::default()); let iters = vec![SstableIterator::create( - cache.insert(table.id, table.id, 1, Box::new(table)), + cache.insert(table.id, table.id, 1, Box::new(table), CachePriority::High), sstable_store, read_options, )]; @@ -818,7 +868,13 @@ mod tests { .await; let cache = create_small_table_cache(); let iters = vec![SstableIterator::create( - cache.insert(table0.id, table0.id, 1, Box::new(table0)), + cache.insert( + table0.id, + table0.id, + 1, + Box::new(table0), + CachePriority::High, + ), sstable_store.clone(), read_options.clone(), )]; @@ -856,7 +912,7 @@ mod tests { let read_options = Arc::new(SstableIteratorReadOptions::default()); let table_id = table.id; let iters = vec![SstableIterator::create( - cache.insert(table.id, table.id, 1, Box::new(table)), + cache.insert(table.id, table.id, 1, Box::new(table), CachePriority::High), sstable_store.clone(), read_options.clone(), )]; diff --git a/src/storage/src/hummock/iterator/test_utils.rs b/src/storage/src/hummock/iterator/test_utils.rs index 55810400d1293..4d1fa1fdd1404 100644 --- a/src/storage/src/hummock/iterator/test_utils.rs +++ b/src/storage/src/hummock/iterator/test_utils.rs @@ -17,6 +17,7 @@ use std::sync::Arc; use bytes::Bytes; use itertools::Itertools; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use risingwave_hummock_sdk::key::{FullKey, UserKey}; use risingwave_hummock_sdk::{HummockEpoch, HummockSstableObjectId}; @@ -68,6 +69,7 @@ pub fn mock_sstable_store_with_object_store(store: ObjectStoreRef) -> SstableSto path, 64 << 20, 64 << 20, + 0, TieredCache::none(), )) } @@ -205,7 +207,7 @@ pub async fn gen_merge_iterator_interleave_test_sstable_iters( key_count, ) .await; - let handle = cache.insert(table.id, table.id, 1, Box::new(table)); + let handle = cache.insert(table.id, table.id, 1, Box::new(table), CachePriority::High); result.push(SstableIterator::create( handle, sstable_store.clone(), diff --git a/src/storage/src/hummock/mod.rs b/src/storage/src/hummock/mod.rs index 586e06aebe7cf..a50547d0478db 100644 --- a/src/storage/src/hummock/mod.rs +++ b/src/storage/src/hummock/mod.rs @@ -383,7 +383,7 @@ pub async fn get_from_sstable_info( let mut iter = SstableIterator::create( sstable, sstable_store_ref.clone(), - Arc::new(SstableIteratorReadOptions::default()), + Arc::new(SstableIteratorReadOptions::from(read_options)), ); iter.seek(full_key).await?; // Iterator has sought passed the borders. diff --git a/src/storage/src/hummock/observer_manager.rs b/src/storage/src/hummock/observer_manager.rs index 43cd67fb4f89a..5065b4f2619b7 100644 --- a/src/storage/src/hummock/observer_manager.rs +++ b/src/storage/src/hummock/observer_manager.rs @@ -21,6 +21,7 @@ use risingwave_hummock_sdk::filter_key_extractor::{ }; use risingwave_pb::catalog::Table; use risingwave_pb::hummock::version_update_payload; +use risingwave_pb::meta::relation::RelationInfo; use risingwave_pb::meta::subscribe_response::{Info, Operation}; use risingwave_pb::meta::SubscribeResponse; use tokio::sync::mpsc::UnboundedSender; @@ -46,19 +47,25 @@ impl ObserverState for HummockObserverNode { }; match info.to_owned() { - Info::Table(table_catalog) => { - assert!( - resp.version > self.version, - "resp version={:?}, current version={:?}", - resp.version, - self.version - ); - - self.handle_catalog_notification(resp.operation(), table_catalog); - - self.version = resp.version; + Info::RelationGroup(relation_group) => { + for relation in relation_group.relations { + match relation.relation_info.unwrap() { + RelationInfo::Table(table_catalog) => { + assert!( + resp.version > self.version, + "resp version={:?}, current version={:?}", + resp.version, + self.version + ); + + self.handle_catalog_notification(resp.operation(), table_catalog); + + self.version = resp.version; + } + _ => panic!("error type notification"), + }; + } } - Info::HummockVersionDeltas(hummock_version_deltas) => { let _ = self .version_update_sender diff --git a/src/storage/src/hummock/sstable/backward_sstable_iterator.rs b/src/storage/src/hummock/sstable/backward_sstable_iterator.rs index d36ebd1c2443d..2ffb9629941ac 100644 --- a/src/storage/src/hummock/sstable/backward_sstable_iterator.rs +++ b/src/storage/src/hummock/sstable/backward_sstable_iterator.rs @@ -16,6 +16,7 @@ use std::cmp::Ordering::{Equal, Less}; use std::future::Future; use std::sync::Arc; +use risingwave_common::cache::CachePriority; use risingwave_hummock_sdk::key::FullKey; use crate::hummock::iterator::{Backward, HummockIterator}; @@ -67,7 +68,7 @@ impl BackwardSstableIterator { .get( self.sst.value(), idx as usize, - crate::hummock::CachePolicy::Fill, + crate::hummock::CachePolicy::Fill(CachePriority::High), &mut self.stats, ) .await?; @@ -197,7 +198,7 @@ mod tests { // path. assert!(sstable.meta.block_metas.len() > 10); let cache = create_small_table_cache(); - let handle = cache.insert(0, 0, 1, Box::new(sstable)); + let handle = cache.insert(0, 0, 1, Box::new(sstable), CachePriority::High); let mut sstable_iter = BackwardSstableIterator::new(handle, sstable_store); let mut cnt = TEST_KEYS_COUNT; sstable_iter.rewind().await.unwrap(); @@ -224,7 +225,7 @@ mod tests { // path. assert!(sstable.meta.block_metas.len() > 10); let cache = create_small_table_cache(); - let handle = cache.insert(0, 0, 1, Box::new(sstable)); + let handle = cache.insert(0, 0, 1, Box::new(sstable), CachePriority::High); let mut sstable_iter = BackwardSstableIterator::new(handle, sstable_store); let mut all_key_to_test = (0..TEST_KEYS_COUNT).collect_vec(); let mut rng = thread_rng(); diff --git a/src/storage/src/hummock/sstable/forward_sstable_iterator.rs b/src/storage/src/hummock/sstable/forward_sstable_iterator.rs index af62ba157e708..7109d1a7ef65c 100644 --- a/src/storage/src/hummock/sstable/forward_sstable_iterator.rs +++ b/src/storage/src/hummock/sstable/forward_sstable_iterator.rs @@ -25,7 +25,8 @@ use super::Sstable; use crate::hummock::iterator::{Forward, HummockIterator}; use crate::hummock::sstable::SstableIteratorReadOptions; use crate::hummock::{ - BlockHolder, BlockIterator, BlockResponse, SstableStore, SstableStoreRef, TableHolder, + BlockHolder, BlockIterator, BlockResponse, CachePolicy, SstableStore, SstableStoreRef, + TableHolder, }; use crate::monitor::StoreLocalStatistic; @@ -40,7 +41,7 @@ pub trait SstableIteratorType: HummockIterator + 'static { /// Prefetching may increase the memory footprint of the CN process because the prefetched blocks /// cannot be evicted. enum BlockFetcher { - Simple, + Simple(SimpleFetchContext), Prefetch(PrefetchContext), } @@ -53,9 +54,9 @@ impl BlockFetcher { stats: &mut StoreLocalStatistic, ) -> HummockResult { match self { - BlockFetcher::Simple => { + BlockFetcher::Simple(context) => { sstable_store - .get(sst, block_idx, crate::hummock::CachePolicy::Fill, stats) + .get(sst, block_idx, context.cache_policy, stats) .await } BlockFetcher::Prefetch(context) => { @@ -67,20 +68,27 @@ impl BlockFetcher { } } +struct SimpleFetchContext { + cache_policy: CachePolicy, +} + struct PrefetchContext { prefetched_blocks: VecDeque<(usize, BlockResponse)>, /// block[cur_idx..=dest_idx] will definitely be visited in the future. dest_idx: usize, + + cache_policy: CachePolicy, } const DEFAULT_PREFETCH_BLOCK_NUM: usize = 1; impl PrefetchContext { - fn new(dest_idx: usize) -> Self { + fn new(dest_idx: usize, cache_policy: CachePolicy) -> Self { Self { prefetched_blocks: VecDeque::with_capacity(DEFAULT_PREFETCH_BLOCK_NUM + 1), dest_idx, + cache_policy, } } @@ -106,7 +114,7 @@ impl PrefetchContext { self.prefetched_blocks.push_back(( idx, sstable_store - .get_block_response(sst, idx, crate::hummock::CachePolicy::Fill, stats) + .get_block_response(sst, idx, self.cache_policy, stats) .await?, )); } @@ -121,12 +129,7 @@ impl PrefetchContext { self.prefetched_blocks.push_back(( next_prefetch_idx, sstable_store - .get_block_response( - sst, - next_prefetch_idx, - crate::hummock::CachePolicy::Fill, - stats, - ) + .get_block_response(sst, next_prefetch_idx, self.cache_policy, stats) .await?, )); } @@ -163,7 +166,9 @@ impl SstableIterator { Self { block_iter: None, cur_idx: 0, - block_fetcher: BlockFetcher::Simple, + block_fetcher: BlockFetcher::Simple(SimpleFetchContext { + cache_policy: options.cache_policy, + }), sst: sstable, sstable_store, stats: StoreLocalStatistic::default(), @@ -211,7 +216,10 @@ impl SstableIterator { } }; if start_idx < dest_idx { - self.block_fetcher = BlockFetcher::Prefetch(PrefetchContext::new(dest_idx)); + self.block_fetcher = BlockFetcher::Prefetch(PrefetchContext::new( + dest_idx, + self.options.cache_policy, + )); } } } @@ -344,6 +352,7 @@ impl SstableIteratorType for SstableIterator { mod tests { use itertools::Itertools; use rand::prelude::*; + use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; use super::*; @@ -389,7 +398,7 @@ mod tests { assert!(sstable.meta.block_metas.len() > 10); let cache = create_small_table_cache(); - let handle = cache.insert(0, 0, 1, Box::new(sstable)); + let handle = cache.insert(0, 0, 1, Box::new(sstable), CachePriority::High); inner_test_forward_iterator(sstable_store.clone(), handle).await; } @@ -403,7 +412,7 @@ mod tests { // path. assert!(sstable.meta.block_metas.len() > 10); let cache = create_small_table_cache(); - let handle = cache.insert(0, 0, 1, Box::new(sstable)); + let handle = cache.insert(0, 0, 1, Box::new(sstable), CachePriority::High); let mut sstable_iter = SstableIterator::create( handle, @@ -497,7 +506,7 @@ mod tests { .unwrap(), sstable_store, Arc::new(SstableIteratorReadOptions { - prefetch: true, + cache_policy: CachePolicy::Fill(CachePriority::High), must_iterated_end_user_key: None, }), ); diff --git a/src/storage/src/hummock/sstable/mod.rs b/src/storage/src/hummock/sstable/mod.rs index b0ff85c521d9a..dce0105853f2b 100644 --- a/src/storage/src/hummock/sstable/mod.rs +++ b/src/storage/src/hummock/sstable/mod.rs @@ -62,6 +62,8 @@ use xxhash_rust::{xxh32, xxh64}; use self::utils::{xxhash64_checksum, xxhash64_verify}; use super::{HummockError, HummockResult}; +use crate::hummock::CachePolicy; +use crate::store::ReadOptions; const DEFAULT_META_BUFFER_CAPACITY: usize = 4096; const MAGIC: u32 = 0x5785ab73; @@ -283,6 +285,7 @@ impl SstableMeta { /// | estimated size (4B) | key count (4B) | /// | smallest key len (4B) | smallest key | /// | largest key len (4B) | largest key | + /// | M (4B) | /// | range-tombstone 0 | ... | range-tombstone M-1 | /// | file offset of this meta block (8B) | /// | checksum (8B) | version (4B) | magic (4B) | @@ -397,10 +400,19 @@ impl SstableMeta { #[derive(Default)] pub struct SstableIteratorReadOptions { - pub prefetch: bool, + pub cache_policy: CachePolicy, pub must_iterated_end_user_key: Option>>, } +impl From<&ReadOptions> for SstableIteratorReadOptions { + fn from(read_options: &ReadOptions) -> Self { + Self { + cache_policy: read_options.cache_policy, + must_iterated_end_user_key: None, + } + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/storage/src/hummock/sstable_store.rs b/src/storage/src/hummock/sstable_store.rs index 7761f52712b9c..66a7d3f3f2dbb 100644 --- a/src/storage/src/hummock/sstable_store.rs +++ b/src/storage/src/hummock/sstable_store.rs @@ -19,7 +19,7 @@ use await_tree::InstrumentAwait; use bytes::{Buf, BufMut, Bytes}; use fail::fail_point; use itertools::Itertools; -use risingwave_common::cache::LruCacheEventListener; +use risingwave_common::cache::{CachePriority, LruCacheEventListener}; use risingwave_hummock_sdk::HummockSstableObjectId; use risingwave_object_store::object::{ BlockLocation, MonitoredStreamingReader, ObjectError, ObjectMetadata, ObjectStoreRef, @@ -105,11 +105,17 @@ pub enum CachePolicy { /// Disable read cache and not fill the cache afterwards. Disable, /// Try reading the cache and fill the cache afterwards. - Fill, + Fill(CachePriority), /// Read the cache but not fill the cache afterwards. NotFill, } +impl Default for CachePolicy { + fn default() -> Self { + CachePolicy::Fill(CachePriority::High) + } +} + pub struct SstableStore { path: String, store: ObjectStoreRef, @@ -124,6 +130,7 @@ impl SstableStore { path: String, block_cache_capacity: usize, meta_cache_capacity: usize, + high_priority_ratio: usize, tiered_cache: TieredCache<(HummockSstableObjectId, u64), Box>, ) -> Self { // TODO: We should validate path early. Otherwise object store won't report invalid path @@ -132,7 +139,7 @@ impl SstableStore { while (meta_cache_capacity >> shard_bits) < MIN_BUFFER_SIZE_PER_SHARD && shard_bits > 0 { shard_bits -= 1; } - let meta_cache = Arc::new(LruCache::new(shard_bits, meta_cache_capacity)); + let meta_cache = Arc::new(LruCache::new(shard_bits, meta_cache_capacity, 0)); let listener = Arc::new(BlockCacheEventListener { tiered_cache: tiered_cache.clone(), }); @@ -143,6 +150,7 @@ impl SstableStore { block_cache: BlockCache::with_event_listener( block_cache_capacity, MAX_CACHE_SHARD_BITS, + high_priority_ratio, listener, ), meta_cache, @@ -158,12 +166,12 @@ impl SstableStore { block_cache_capacity: usize, meta_cache_capacity: usize, ) -> Self { - let meta_cache = Arc::new(LruCache::new(0, meta_cache_capacity)); + let meta_cache = Arc::new(LruCache::new(0, meta_cache_capacity, 0)); let tiered_cache = TieredCache::none(); Self { path, store, - block_cache: BlockCache::new(block_cache_capacity, 0), + block_cache: BlockCache::new(block_cache_capacity, 0, 0), meta_cache, tiered_cache, } @@ -261,11 +269,12 @@ impl SstableStore { }; match policy { - CachePolicy::Fill => { - Ok(self - .block_cache - .get_or_insert_with(object_id, block_index as u64, fetch_block)) - } + CachePolicy::Fill(priority) => Ok(self.block_cache.get_or_insert_with( + object_id, + block_index as u64, + priority, + fetch_block, + )), CachePolicy::NotFill => match self.block_cache.get(object_id, block_index as u64) { Some(block) => Ok(BlockResponse::Block(block)), None => match self @@ -351,29 +360,34 @@ impl SstableStore { let object_id = sst.get_object_id(); let result = self .meta_cache - .lookup_with_request_dedup::<_, HummockError, _>(object_id, object_id, || { - let store = self.store.clone(); - let meta_path = self.get_sst_data_path(object_id); - local_cache_meta_block_miss += 1; - let stats_ptr = stats.remote_io_time.clone(); - let loc = BlockLocation { - offset: sst.meta_offset as usize, - size: (sst.file_size - sst.meta_offset) as usize, - }; - async move { - let now = minstant::Instant::now(); - let buf = store - .read(&meta_path, Some(loc)) - .await - .map_err(HummockError::object_io_error)?; - let meta = SstableMeta::decode(&mut &buf[..])?; - let sst = Sstable::new(object_id, meta); - let charge = sst.estimate_size(); - let add = (now.elapsed().as_secs_f64() * 1000.0).ceil(); - stats_ptr.fetch_add(add as u64, Ordering::Relaxed); - Ok((Box::new(sst), charge)) - } - }) + .lookup_with_request_dedup::<_, HummockError, _>( + object_id, + object_id, + CachePriority::High, + || { + let store = self.store.clone(); + let meta_path = self.get_sst_data_path(object_id); + local_cache_meta_block_miss += 1; + let stats_ptr = stats.remote_io_time.clone(); + let loc = BlockLocation { + offset: sst.meta_offset as usize, + size: (sst.file_size - sst.meta_offset) as usize, + }; + async move { + let now = minstant::Instant::now(); + let buf = store + .read(&meta_path, Some(loc)) + .await + .map_err(HummockError::object_io_error)?; + let meta = SstableMeta::decode(&mut &buf[..])?; + let sst = Sstable::new(object_id, meta); + let charge = sst.estimate_size(); + let add = (now.elapsed().as_secs_f64() * 1000.0).ceil(); + stats_ptr.fetch_add(add as u64, Ordering::Relaxed); + Ok((Box::new(sst), charge)) + } + }, + ) .verbose_instrument_await("meta_cache_lookup") .await; result.map(|table_holder| (table_holder, local_cache_meta_block_miss)) @@ -410,8 +424,13 @@ impl SstableStore { pub fn insert_meta_cache(&self, object_id: HummockSstableObjectId, meta: SstableMeta) { let sst = Sstable::new(object_id, meta); let charge = sst.estimate_size(); - self.meta_cache - .insert(object_id, object_id, charge, Box::new(sst)); + self.meta_cache.insert( + object_id, + object_id, + charge, + Box::new(sst), + CachePriority::High, + ); } pub fn insert_block_cache( @@ -420,7 +439,8 @@ impl SstableStore { block_index: u64, block: Box, ) { - self.block_cache.insert(object_id, block_index, block); + self.block_cache + .insert(object_id, block_index, block, CachePriority::High); } pub fn get_meta_memory_usage(&self) -> u64 { @@ -566,7 +586,7 @@ impl SstableWriter for BatchUploadWriter { async fn write_block(&mut self, block: &[u8], meta: &BlockMeta) -> HummockResult<()> { self.buf.extend_from_slice(block); - if let CachePolicy::Fill = self.policy { + if let CachePolicy::Fill(_) = self.policy { self.block_info.push(Block::decode( Bytes::from(block.to_vec()), meta.uncompressed_size as usize, @@ -596,7 +616,7 @@ impl SstableWriter for BatchUploadWriter { self.sstable_store.insert_meta_cache(self.object_id, meta); // Add block cache. - if CachePolicy::Fill == self.policy { + if let CachePolicy::Fill(fill_cache_priority) = self.policy { // The `block_info` may be empty when there is only range-tombstones, because we // store them in meta-block. for (block_idx, block) in self.block_info.into_iter().enumerate() { @@ -604,6 +624,7 @@ impl SstableWriter for BatchUploadWriter { self.object_id, block_idx as u64, Box::new(block), + fill_cache_priority, ); } } @@ -655,7 +676,7 @@ impl SstableWriter for StreamingUploadWriter { async fn write_block(&mut self, block_data: &[u8], meta: &BlockMeta) -> HummockResult<()> { self.data_len += block_data.len(); let block_data = Bytes::from(block_data.to_vec()); - if let CachePolicy::Fill = self.policy { + if let CachePolicy::Fill(_) = self.policy { let block = Block::decode(block_data.clone(), meta.uncompressed_size as usize)?; self.blocks.push(block); } @@ -690,13 +711,14 @@ impl SstableWriter for StreamingUploadWriter { self.sstable_store.insert_meta_cache(self.object_id, meta); // Add block cache. - if let CachePolicy::Fill = self.policy { + if let CachePolicy::Fill(fill_high_priority_cache) = self.policy { debug_assert!(!self.blocks.is_empty()); for (block_idx, block) in self.blocks.into_iter().enumerate() { self.sstable_store.block_cache.insert( self.object_id, block_idx as u64, Box::new(block), + fill_high_priority_cache, ); } } diff --git a/src/storage/src/hummock/store/version.rs b/src/storage/src/hummock/store/version.rs index f6ef7308daf11..6839ddda15e51 100644 --- a/src/storage/src/hummock/store/version.rs +++ b/src/storage/src/hummock/store/version.rs @@ -583,7 +583,7 @@ impl HummockVersionReader { staging_iters.push(HummockIteratorUnion::Second(SstableIterator::new( table_holder, self.sstable_store.clone(), - Arc::new(SstableIteratorReadOptions::default()), + Arc::new(SstableIteratorReadOptions::from(&read_options)), ))); } local_stats.staging_sst_iter_count = staging_sst_iter_count; @@ -637,6 +637,7 @@ impl HummockVersionReader { for sstable_info in fetch_meta_req { let inner_req_count = req_count; let capture_ref = async { + // We would fill block to high priority cache for level-0 self.sstable_store .sstable_syncable(sstable_info, &local_stats) .in_span(Span::enter_with_local_parent("get_sstable")) @@ -662,7 +663,7 @@ impl HummockVersionReader { drop(buffered); timer.observe_duration(); - let mut sst_read_options = SstableIteratorReadOptions::default(); + let mut sst_read_options = SstableIteratorReadOptions::from(&read_options); if read_options.prefetch_options.exhaust_iter { sst_read_options.must_iterated_end_user_key = Some(user_key_range.1.map(|key| key.cloned())); diff --git a/src/storage/src/hummock/test_utils.rs b/src/storage/src/hummock/test_utils.rs index af149f1ac728b..13a6523fabbb8 100644 --- a/src/storage/src/hummock/test_utils.rs +++ b/src/storage/src/hummock/test_utils.rs @@ -50,6 +50,7 @@ pub fn default_opts_for_test() -> StorageOpts { write_conflict_detection_enabled: true, block_cache_capacity_mb: 64, meta_cache_capacity_mb: 64, + high_priority_ratio: 0, disable_remote_compactor: false, enable_local_spill: false, local_object_store: "memory".to_string(), @@ -344,5 +345,5 @@ pub async fn count_stream(s: impl Stream> + Send) -> } pub fn create_small_table_cache() -> Arc>> { - Arc::new(LruCache::new(1, 4)) + Arc::new(LruCache::new(1, 4, 0)) } diff --git a/src/storage/src/hummock/utils.rs b/src/storage/src/hummock/utils.rs index cb2a0fb29fe58..35373f857eaa7 100644 --- a/src/storage/src/hummock/utils.rs +++ b/src/storage/src/hummock/utils.rs @@ -20,6 +20,7 @@ use std::sync::atomic::{AtomicU64, Ordering as AtomicOrdering}; use std::sync::Arc; use bytes::Bytes; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::{TableId, TableOption}; use risingwave_hummock_sdk::can_concat; use risingwave_hummock_sdk::key::{ @@ -30,6 +31,7 @@ use tokio::sync::Notify; use super::{HummockError, HummockResult}; use crate::error::StorageResult; +use crate::hummock::CachePolicy; use crate::mem_table::{KeyOp, MemTableError}; use crate::store::{ReadOptions, StateStoreRead}; @@ -352,6 +354,7 @@ pub(crate) async fn do_insert_sanity_check( ignore_range_tombstone: false, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; let stored_value = inner.get(key.clone(), epoch, read_options).await?; @@ -382,6 +385,7 @@ pub(crate) async fn do_delete_sanity_check( ignore_range_tombstone: false, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; match inner.get(key.clone(), epoch, read_options).await? { None => Err(Box::new(MemTableError::InconsistentOperation { @@ -422,6 +426,7 @@ pub(crate) async fn do_update_sanity_check( table_id, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; match inner.get(key.clone(), epoch, read_options).await? { diff --git a/src/storage/src/hummock/validator.rs b/src/storage/src/hummock/validator.rs index de14532414ce2..1a0128685fe29 100644 --- a/src/storage/src/hummock/validator.rs +++ b/src/storage/src/hummock/validator.rs @@ -23,7 +23,7 @@ use risingwave_pb::hummock::ValidationTask; use crate::hummock::iterator::HummockIterator; use crate::hummock::sstable::SstableIteratorReadOptions; use crate::hummock::sstable_store::SstableStoreRef; -use crate::hummock::SstableIterator; +use crate::hummock::{CachePolicy, SstableIterator}; use crate::monitor::StoreLocalStatistic; /// Validate SSTs in terms of Ordered, Locally unique and Globally unique. @@ -58,7 +58,10 @@ pub async fn validate_ssts(task: ValidationTask, sstable_store: SstableStoreRef) let mut iter = SstableIterator::new( holder, sstable_store.clone(), - Arc::new(SstableIteratorReadOptions::default()), + Arc::new(SstableIteratorReadOptions { + cache_policy: CachePolicy::NotFill, + must_iterated_end_user_key: None, + }), ); let mut previous_key: Option>> = None; if let Err(err) = iter.rewind().await { diff --git a/src/storage/src/hummock/value.rs b/src/storage/src/hummock/value.rs index 70f32bba0e0c8..d5eae5ad0deac 100644 --- a/src/storage/src/hummock/value.rs +++ b/src/storage/src/hummock/value.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::fmt::Debug; + use bytes::{Buf, BufMut, Bytes}; use super::{HummockError, HummockResult}; @@ -24,12 +26,23 @@ pub const VALUE_PUT: u8 = 0; /// /// Its encoding is a 1-byte flag + storage value. For `Put`, storage value contains both value meta /// and user value. For `Delete`, storage value contains only value meta. -#[derive(Debug, Clone)] +#[derive(Clone)] pub enum HummockValue { Put(T), Delete, } +impl> Debug for HummockValue { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match &self { + HummockValue::Put(v) => { + write!(f, "HummockValue {{ PUT, {} }}", hex::encode(v.as_ref())) + } + HummockValue::Delete => write!(f, "HummockValue {{ DELETE }}"), + } + } +} + impl Copy for HummockValue where T: Copy {} impl PartialEq for HummockValue { diff --git a/src/storage/src/opts.rs b/src/storage/src/opts.rs index 9fd919a6ef51b..e196366a3c751 100644 --- a/src/storage/src/opts.rs +++ b/src/storage/src/opts.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use risingwave_common::config::RwConfig; +use risingwave_common::config::{extract_storage_memory_config, RwConfig, StorageMemoryConfig}; use risingwave_common::system_param::default_system_params; use risingwave_common::system_param::reader::SystemParamsReader; @@ -40,6 +40,8 @@ pub struct StorageOpts { pub block_cache_capacity_mb: usize, /// Capacity of sstable meta cache. pub meta_cache_capacity_mb: usize, + /// Percent of the ratio of high priority data in block-cache + pub high_priority_ratio: usize, pub disable_remote_compactor: bool, pub enable_local_spill: bool, /// Local object store root. We should call `get_local_object_store` to get the object store. @@ -73,12 +75,13 @@ impl Default for StorageOpts { fn default() -> Self { let c = RwConfig::default(); let p = default_system_params(); - Self::from((&c, &p.into())) + let s = extract_storage_memory_config(&c); + Self::from((&c, &p.into(), &s)) } } -impl From<(&RwConfig, &SystemParamsReader)> for StorageOpts { - fn from((c, p): (&RwConfig, &SystemParamsReader)) -> Self { +impl From<(&RwConfig, &SystemParamsReader, &StorageMemoryConfig)> for StorageOpts { + fn from((c, p, s): (&RwConfig, &SystemParamsReader, &StorageMemoryConfig)) -> Self { Self { sstable_size_mb: p.sstable_size_mb(), block_size_kb: p.block_size_kb(), @@ -87,23 +90,24 @@ impl From<(&RwConfig, &SystemParamsReader)> for StorageOpts { share_buffer_compaction_worker_threads_number: c .storage .share_buffer_compaction_worker_threads_number, - shared_buffer_capacity_mb: c.storage.shared_buffer_capacity_mb, + shared_buffer_capacity_mb: s.shared_buffer_capacity_mb, data_directory: p.data_directory().to_string(), write_conflict_detection_enabled: c.storage.write_conflict_detection_enabled, - block_cache_capacity_mb: c.storage.block_cache_capacity_mb, - meta_cache_capacity_mb: c.storage.meta_cache_capacity_mb, + high_priority_ratio: s.high_priority_ratio_in_percent, + block_cache_capacity_mb: s.block_cache_capacity_mb, + meta_cache_capacity_mb: s.meta_cache_capacity_mb, disable_remote_compactor: c.storage.disable_remote_compactor, enable_local_spill: c.storage.enable_local_spill, local_object_store: c.storage.local_object_store.to_string(), share_buffer_upload_concurrency: c.storage.share_buffer_upload_concurrency, - compactor_memory_limit_mb: c.storage.compactor_memory_limit_mb, + compactor_memory_limit_mb: s.compactor_memory_limit_mb, sstable_id_remote_fetch_number: c.storage.sstable_id_remote_fetch_number, min_sst_size_for_streaming_upload: c.storage.min_sst_size_for_streaming_upload, max_sub_compaction: c.storage.max_sub_compaction, max_concurrent_compaction_task_number: c.storage.max_concurrent_compaction_task_number, file_cache_dir: c.storage.file_cache.dir.clone(), file_cache_capacity_mb: c.storage.file_cache.capacity_mb, - file_cache_total_buffer_capacity_mb: c.storage.file_cache.total_buffer_capacity_mb, + file_cache_total_buffer_capacity_mb: s.file_cache_total_buffer_capacity_mb, file_cache_file_fallocate_unit_mb: c.storage.file_cache.cache_file_fallocate_unit_mb, file_cache_meta_fallocate_unit_mb: c.storage.file_cache.cache_meta_fallocate_unit_mb, file_cache_file_max_write_size_mb: c.storage.file_cache.cache_file_max_write_size_mb, diff --git a/src/storage/src/store.rs b/src/storage/src/store.rs index 1ccc2a0a72c66..85e5e5e303d07 100644 --- a/src/storage/src/store.rs +++ b/src/storage/src/store.rs @@ -25,6 +25,7 @@ use risingwave_hummock_sdk::key::{FullKey, KeyPayloadType}; use risingwave_hummock_sdk::{HummockReadEpoch, LocalSstableInfo}; use crate::error::{StorageError, StorageResult}; +use crate::hummock::CachePolicy; use crate::monitor::{MonitoredStateStore, MonitoredStorageMetrics}; use crate::storage_value::StorageValue; use crate::write_batch::WriteBatch; @@ -335,6 +336,7 @@ pub struct ReadOptions { pub prefix_hint: Option, pub ignore_range_tombstone: bool, pub prefetch_options: PrefetchOptions, + pub cache_policy: CachePolicy, pub retention_seconds: Option, pub table_id: TableId, diff --git a/src/storage/src/store_impl.rs b/src/storage/src/store_impl.rs index 105d37e4ce121..ffcb410835674 100644 --- a/src/storage/src/store_impl.rs +++ b/src/storage/src/store_impl.rs @@ -595,6 +595,7 @@ impl StateStoreImpl { opts.data_directory.to_string(), opts.block_cache_capacity_mb * (1 << 20), opts.meta_cache_capacity_mb * (1 << 20), + opts.high_priority_ratio, tiered_cache, )); let notification_client = diff --git a/src/storage/src/table/batch_table/storage_table.rs b/src/storage/src/table/batch_table/storage_table.rs index 4d5dbec793e9f..ffbe57ff71e8b 100644 --- a/src/storage/src/table/batch_table/storage_table.rs +++ b/src/storage/src/table/batch_table/storage_table.rs @@ -25,9 +25,8 @@ use futures::{Stream, StreamExt}; use futures_async_stream::try_stream; use itertools::{Either, Itertools}; use risingwave_common::buffer::Bitmap; -use risingwave_common::catalog::{ - get_dist_key_in_pk_indices, ColumnDesc, ColumnId, Schema, TableId, TableOption, -}; +use risingwave_common::cache::CachePriority; +use risingwave_common::catalog::{ColumnDesc, ColumnId, Schema, TableId, TableOption}; use risingwave_common::hash::{VirtualNode, VnodeBitmapExt}; use risingwave_common::row::{self, OwnedRow, Row, RowExt}; use risingwave_common::util::ordered::*; @@ -42,6 +41,7 @@ use tracing::trace; use super::iter_utils; use crate::error::{StorageError, StorageResult}; +use crate::hummock::CachePolicy; use crate::row_serde::row_serde_util::{ parse_raw_key_to_vnode_and_key, serialize_pk, serialize_pk_with_vnode, }; @@ -183,7 +183,7 @@ impl StorageTableInner { order_types: Vec, pk_indices: Vec, Distribution { - dist_key_indices, + dist_key_in_pk_indices, vnodes, }: Distribution, table_option: TableOption, @@ -244,7 +244,6 @@ impl StorageTableInner { } }; - let dist_key_in_pk_indices = get_dist_key_in_pk_indices(&dist_key_indices, &pk_indices); let key_output_indices = match key_output_indices.is_empty() { true => None, false => Some(key_output_indices), @@ -340,6 +339,7 @@ impl StorageTableInner { table_id: self.table_id, read_version_from_backup: read_backup, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; if let Some(value) = self.store.get(serialized_pk, epoch, read_options).await? { // Refer to [`StorageTableInnerIterInner::new`] for necessity of `validate_read_epoch`. @@ -382,6 +382,13 @@ impl StorageTableInner { Ok(None) } } + + /// Update the vnode bitmap of the storage table, returns the previous vnode bitmap. + #[must_use = "the executor should decide whether to manipulate the cache based on the previous vnode bitmap"] + pub fn update_vnode_bitmap(&mut self, new_vnodes: Arc) -> Arc { + assert_eq!(self.vnodes.len(), new_vnodes.len()); + std::mem::replace(&mut self.vnodes, new_vnodes) + } } pub trait PkAndRowStream = Stream, OwnedRow)>> + Send; @@ -413,6 +420,16 @@ impl StorageTableInner { ordered: bool, prefetch_options: PrefetchOptions, ) -> StorageResult> { + let cache_policy = match ( + encoded_key_range.start_bound(), + encoded_key_range.end_bound(), + ) { + // To prevent unbounded range scan queries from polluting the block cache, use the + // low priority fill policy. + (Unbounded, _) | (_, Unbounded) => CachePolicy::Fill(CachePriority::Low), + _ => CachePolicy::Fill(CachePriority::High), + }; + let raw_key_ranges = if !ordered && matches!(encoded_key_range.start_bound(), Unbounded) && matches!(encoded_key_range.end_bound(), Unbounded) @@ -456,6 +473,7 @@ impl StorageTableInner { table_id: self.table_id, read_version_from_backup: read_backup, prefetch_options, + cache_policy, }; let pk_serializer = match self.output_row_in_key_indices.is_empty() { true => None, @@ -482,7 +500,7 @@ impl StorageTableInner { })) .await?; - #[auto_enum(futures::Stream)] + #[auto_enum(futures03::Stream)] let iter = match iterators.len() { 0 => unreachable!(), 1 => iterators.into_iter().next().unwrap(), diff --git a/src/storage/src/table/mod.rs b/src/storage/src/table/mod.rs index 53baaaf2dc78b..1bb9731eb7682 100644 --- a/src/storage/src/table/mod.rs +++ b/src/storage/src/table/mod.rs @@ -21,11 +21,11 @@ use risingwave_common::array::DataChunk; use risingwave_common::buffer::{Bitmap, BitmapBuilder}; use risingwave_common::catalog::Schema; use risingwave_common::hash::VirtualNode; -use risingwave_common::row::{OwnedRow, Row, RowExt}; -use risingwave_common::util::hash_util::Crc32FastBuilder; +use risingwave_common::row::{OwnedRow, Row}; use risingwave_common::util::iter_util::ZipEqFast; use crate::error::StorageResult; + /// For tables without distribution (singleton), the `DEFAULT_VNODE` is encoded. pub const DEFAULT_VNODE: VirtualNode = VirtualNode::ZERO; @@ -33,7 +33,7 @@ pub const DEFAULT_VNODE: VirtualNode = VirtualNode::ZERO; #[derive(Debug)] pub struct Distribution { /// Indices of distribution key for computing vnode, based on the all columns of the table. - pub dist_key_indices: Vec, + pub dist_key_in_pk_indices: Vec, /// Virtual nodes that the table is partitioned into. pub vnodes: Arc, @@ -49,7 +49,7 @@ impl Distribution { vnodes.finish().into() }); Self { - dist_key_indices: vec![], + dist_key_in_pk_indices: vec![], vnodes: FALLBACK_VNODES.clone(), } } @@ -66,12 +66,12 @@ impl Distribution { } /// Distribution that accesses all vnodes, mainly used for tests. - pub fn all_vnodes(dist_key_indices: Vec) -> Self { + pub fn all_vnodes(dist_key_in_pk_indices: Vec) -> Self { /// A bitmap that all vnodes are set. static ALL_VNODES: LazyLock> = LazyLock::new(|| Bitmap::ones(VirtualNode::COUNT).into()); Self { - dist_key_indices, + dist_key_in_pk_indices, vnodes: ALL_VNODES.clone(), } } @@ -123,7 +123,7 @@ pub fn compute_vnode(row: impl Row, indices: &[usize], vnodes: &Bitmap) -> Virtu let vnode = if indices.is_empty() { DEFAULT_VNODE } else { - let vnode = (&row).project(indices).hash(Crc32FastBuilder).to_vnode(); + let vnode = VirtualNode::compute_row(&row, indices); check_vnode_is_set(vnode, vnodes); vnode }; @@ -147,12 +147,11 @@ pub fn compute_chunk_vnode( .iter() .map(|idx| pk_indices[*idx]) .collect_vec(); - chunk - .get_hash_values(&dist_key_indices, Crc32FastBuilder) + + VirtualNode::compute_chunk(chunk, &dist_key_indices) .into_iter() .zip_eq_fast(chunk.vis().iter()) - .map(|(h, vis)| { - let vnode = h.to_vnode(); + .map(|(vnode, vis)| { // Ignore the invisible rows. if vis { check_vnode_is_set(vnode, vnodes); diff --git a/src/stream/Cargo.toml b/src/stream/Cargo.toml index 7bba32e665a01..7539ae6a2f55f 100644 --- a/src/stream/Cargo.toml +++ b/src/stream/Cargo.toml @@ -77,3 +77,4 @@ workspace-hack = { path = "../workspace-hack" } [dev-dependencies] assert_matches = "1" risingwave_hummock_test = { path = "../storage/hummock_test", features = ["test"] } +tracing-test = "0.2" diff --git a/src/stream/src/common/table/state_table.rs b/src/stream/src/common/table/state_table.rs index ece7293f6ef28..482fbc3c0d6bc 100644 --- a/src/stream/src/common/table/state_table.rs +++ b/src/stream/src/common/table/state_table.rs @@ -21,6 +21,7 @@ use futures::{Stream, StreamExt}; use itertools::{izip, Itertools}; use risingwave_common::array::{Op, StreamChunk, Vis}; use risingwave_common::buffer::Bitmap; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::{get_dist_key_in_pk_indices, ColumnDesc, TableId, TableOption}; use risingwave_common::hash::{VirtualNode, VnodeBitmapExt}; use risingwave_common::row::{self, CompactedRow, OwnedRow, Row, RowExt}; @@ -35,6 +36,7 @@ use risingwave_hummock_sdk::key::{ }; use risingwave_pb::catalog::Table; use risingwave_storage::error::StorageError; +use risingwave_storage::hummock::CachePolicy; use risingwave_storage::mem_table::MemTableError; use risingwave_storage::row_serde::row_serde_util::{ deserialize_pk_with_vnode, serialize_pk, serialize_pk_with_vnode, @@ -47,6 +49,7 @@ use risingwave_storage::StateStore; use tracing::trace; use super::watermark::{WatermarkBufferByEpoch, WatermarkBufferStrategy}; +use crate::cache::cache_may_stale; use crate::executor::{StreamExecutorError, StreamExecutorResult}; /// This num is arbitrary and we may want to improve this choice in the future. @@ -315,31 +318,6 @@ where Distribution::fallback(), None, false, - 0, - ) - .await - } - - /// Create a state table without distribution, with given `prefix_hint_len`, used for unit - /// tests. - pub async fn new_without_distribution_with_prefix_hint_len( - store: S, - table_id: TableId, - columns: Vec, - order_types: Vec, - pk_indices: Vec, - prefix_hint_len: usize, - ) -> Self { - Self::new_with_distribution_inner( - store, - table_id, - columns, - order_types, - pk_indices, - Distribution::fallback(), - None, - true, - prefix_hint_len, ) .await } @@ -364,7 +342,6 @@ where distribution, value_indices, true, - 0, ) .await } @@ -387,7 +364,6 @@ where distribution, value_indices, false, - 0, ) .await } @@ -400,12 +376,11 @@ where order_types: Vec, pk_indices: Vec, Distribution { - dist_key_indices, + dist_key_in_pk_indices, vnodes, }: Distribution, value_indices: Option>, is_consistent_op: bool, - prefix_hint_len: usize, ) -> Self { let local_state_store = store .new_local(NewLocalOptions { @@ -439,7 +414,6 @@ where .collect_vec(), None => table_columns.iter().map(|c| c.column_id).collect_vec(), }; - let dist_key_in_pk_indices = get_dist_key_in_pk_indices(&dist_key_indices, &pk_indices); Self { table_id, local_store: local_state_store, @@ -447,7 +421,7 @@ where row_serde: SD::new(&column_ids, Arc::from(data_types.into_boxed_slice())), pk_indices, dist_key_in_pk_indices, - prefix_hint_len, + prefix_hint_len: 0, vnodes, table_option: Default::default(), vnode_col_idx_in_pk: None, @@ -577,6 +551,7 @@ where ignore_range_tombstone: false, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; self.local_store @@ -606,7 +581,7 @@ where /// Update the vnode bitmap of the state table, returns the previous vnode bitmap. #[must_use = "the executor should decide whether to manipulate the cache based on the previous vnode bitmap"] - pub fn update_vnode_bitmap(&mut self, new_vnodes: Arc) -> Arc { + pub fn update_vnode_bitmap(&mut self, new_vnodes: Arc) -> (Arc, bool) { assert!( !self.is_dirty(), "vnode bitmap should only be updated when state table is clean" @@ -619,9 +594,16 @@ where } assert_eq!(self.vnodes.len(), new_vnodes.len()); - self.cur_watermark = None; + let cache_may_stale = cache_may_stale(&self.vnodes, &new_vnodes); - std::mem::replace(&mut self.vnodes, new_vnodes) + if cache_may_stale { + self.cur_watermark = None; + } + + ( + std::mem::replace(&mut self.vnodes, new_vnodes), + cache_may_stale, + ) } } @@ -829,22 +811,28 @@ where } else { Some(self.pk_serde.prefix(1)) }; - let range_end_suffix = watermark.map(|watermark| { + let watermark_suffix = watermark.map(|watermark| { serialize_pk( row::once(Some(watermark)), prefix_serializer.as_ref().unwrap(), ) }); - if let Some(range_end_suffix) = range_end_suffix { - let range_begin_suffix = vec![]; - trace!(table_id = %self.table_id, range_end = ?range_end_suffix, vnodes = ?{ + if let Some(watermark_suffix) = watermark_suffix { + // We either serialize null into `0u8`, data into `(1u8 || scalar)`, or serialize null + // into `1u8`, data into `(0u8 || scalar)`. We do not want to delete null + // here, so `range_begin_suffix` cannot be `vec![]` when null is represented as `0u8`. + let range_begin_suffix = watermark_suffix + .first() + .map(|bit| vec![*bit]) + .unwrap_or_default(); + trace!(table_id = %self.table_id, watermark = ?watermark_suffix, vnodes = ?{ self.vnodes.iter_vnodes().collect_vec() }, "delete range"); for vnode in self.vnodes.iter_vnodes() { let mut range_begin = vnode.to_be_bytes().to_vec(); let mut range_end = range_begin.clone(); range_begin.extend(&range_begin_suffix); - range_end.extend(&range_end_suffix); + range_end.extend(&watermark_suffix); delete_ranges.push((Bytes::from(range_begin), Bytes::from(range_end))); } } @@ -1008,6 +996,7 @@ where table_id: self.table_id, read_version_from_backup: false, prefetch_options, + cache_policy: CachePolicy::Fill(CachePriority::High), }; Ok(self.local_store.iter(key_range, read_options).await?) @@ -1054,6 +1043,7 @@ where table_id: self.table_id, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }; self.local_store diff --git a/src/stream/src/common/table/test_utils.rs b/src/stream/src/common/table/test_utils.rs index 1d317cf80933d..526f6864b3a99 100644 --- a/src/stream/src/common/table/test_utils.rs +++ b/src/stream/src/common/table/test_utils.rs @@ -16,7 +16,7 @@ use itertools::Itertools; use risingwave_common::catalog::{ColumnDesc, TableId}; use risingwave_common::util::iter_util::ZipEqFast; use risingwave_common::util::sort_util::OrderType; -use risingwave_pb::catalog::Table as ProstTable; +use risingwave_pb::catalog::PbTable; use risingwave_pb::common::PbColumnOrder; use risingwave_pb::plan_common::ColumnCatalog; @@ -26,7 +26,7 @@ pub(crate) fn gen_prost_table( order_types: Vec, pk_index: Vec, read_prefix_len_hint: u32, -) -> ProstTable { +) -> PbTable { let col_len = column_descs.len() as i32; gen_prost_table_with_value_indices( table_id, @@ -45,7 +45,7 @@ pub(crate) fn gen_prost_table_with_value_indices( pk_index: Vec, read_prefix_len_hint: u32, value_indices: Vec, -) -> ProstTable { +) -> PbTable { let prost_pk = pk_index .iter() .zip_eq_fast(order_types.iter()) @@ -62,7 +62,7 @@ pub(crate) fn gen_prost_table_with_value_indices( }) .collect(); - ProstTable { + PbTable { id: table_id.table_id(), columns: prost_columns, pk: prost_pk, diff --git a/src/stream/src/error.rs b/src/stream/src/error.rs index d2250cceeb92e..7c92a2b4e0235 100644 --- a/src/stream/src/error.rs +++ b/src/stream/src/error.rs @@ -16,7 +16,7 @@ use std::backtrace::Backtrace; use risingwave_common::array::ArrayError; use risingwave_expr::ExprError; -use risingwave_pb::ProstFieldNotFound; +use risingwave_pb::PbFieldNotFound; use risingwave_storage::error::StorageError; use crate::executor::StreamExecutorError; @@ -95,8 +95,8 @@ impl From for StreamError { } } -impl From for StreamError { - fn from(err: ProstFieldNotFound) -> Self { +impl From for StreamError { + fn from(err: PbFieldNotFound) -> Self { Self::from(anyhow::anyhow!( "Failed to decode prost: field not found `{}`", err.0 diff --git a/src/stream/src/executor/actor.rs b/src/stream/src/executor/actor.rs index 7044e62b20615..5a26b43947b8e 100644 --- a/src/stream/src/executor/actor.rs +++ b/src/stream/src/executor/actor.rs @@ -15,9 +15,9 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; +use anyhow::anyhow; use await_tree::InstrumentAwait; use futures::future::join_all; -use futures::pin_mut; use hytra::TrAdder; use minitrace::prelude::*; use parking_lot::Mutex; @@ -173,33 +173,33 @@ where }; let mut last_epoch: Option = None; - - let stream = Box::new(self.consumer).execute(); - pin_mut!(stream); + let mut stream = Box::pin(Box::new(self.consumer).execute()); // Drive the streaming task with an infinite loop - while let Some(barrier) = stream - .next() - .in_span(span) - .instrument_await( - last_epoch.map_or("Epoch ".into(), |e| format!("Epoch {}", e.curr)), - ) - .await - .transpose()? - { - last_epoch = Some(barrier.epoch); + let result = loop { + let barrier = match stream + .try_next() + .in_span(span) + .instrument_await( + last_epoch.map_or("Epoch ".into(), |e| format!("Epoch {}", e.curr)), + ) + .await + { + Ok(Some(barrier)) => barrier, + Ok(None) => break Err(anyhow!("actor exited unexpectedly").into()), + Err(err) => break Err(err), + }; // Collect barriers to local barrier manager self.context.lock_barrier_manager().collect(id, &barrier); // Then stop this actor if asked - let to_stop = barrier.is_stop_or_update_drop_actor(id); - if to_stop { - tracing::trace!(actor_id = id, "actor exit"); - return Ok(()); + if barrier.is_stop(id) { + break Ok(()); } // Tracing related work + last_epoch = Some(barrier.epoch); span = { let mut span = Span::enter_with_local_parent("actor_poll"); span.add_property(|| ("otel.name", span_name.to_string())); @@ -208,8 +208,24 @@ where span.add_property(|| ("epoch", barrier.epoch.curr.to_string())); span }; - } + }; + + spawn_blocking_drop_stream(stream).await; - Ok(()) + tracing::trace!(actor_id = id, "actor exit"); + result } } + +/// Drop the stream in a blocking task to avoid interfering with other actors. +/// +/// Logically the actor is dropped after we send the barrier with `Drop` mutation to the +/// downstream,thus making the `drop`'s progress asynchronous. However, there might be a +/// considerable amount of data in the executors' in-memory cache, dropping these structures might +/// be a CPU-intensive task. This may lead to the runtime being unable to schedule other actors if +/// the `drop` is called on the current thread. +pub async fn spawn_blocking_drop_stream(stream: T) { + let _ = tokio::task::spawn_blocking(move || drop(stream)) + .instrument_await("drop_stream") + .await; +} diff --git a/src/stream/src/executor/agg_common.rs b/src/stream/src/executor/agg_common.rs index ecd61febe9db5..47f59f68d1ecd 100644 --- a/src/stream/src/executor/agg_common.rs +++ b/src/stream/src/executor/agg_common.rs @@ -25,7 +25,7 @@ use crate::executor::{ActorContextRef, PkIndices}; use crate::task::AtomicU64Ref; /// Arguments needed to construct an `XxxAggExecutor`. -pub struct AggExecutorArgs { +pub struct AggExecutorArgs { // basic pub input: Box, pub actor_ctx: ActorContextRef, @@ -44,15 +44,18 @@ pub struct AggExecutorArgs { pub watermark_epoch: AtomicU64Ref, // extra - pub extra: Option, + pub extra: E, } -/// Extra arguments needed to construct an `XxxAggExecutor`. -pub struct AggExecutorArgsExtra { - // hash agg specific things - pub group_key_indices: Vec, +pub trait AggExecutorExtraArgs {} - // things only used by hash agg currently - pub metrics: Arc, +pub struct SimpleAggExecutorExtraArgs {} +impl AggExecutorExtraArgs for SimpleAggExecutorExtraArgs {} + +/// Extra arguments needed to construct an `HashAggExecutor`. +pub struct GroupAggExecutorExtraArgs { + pub group_key_indices: Vec, pub chunk_size: usize, + pub metrics: Arc, } +impl AggExecutorExtraArgs for GroupAggExecutorExtraArgs {} diff --git a/src/stream/src/executor/aggregation/agg_group.rs b/src/stream/src/executor/aggregation/agg_group.rs index 6b875b176c7a8..e26a2e487e232 100644 --- a/src/stream/src/executor/aggregation/agg_group.rs +++ b/src/stream/src/executor/aggregation/agg_group.rs @@ -31,80 +31,15 @@ use crate::common::table::state_table::StateTable; use crate::executor::error::StreamExecutorResult; use crate::executor::PkIndices; -mod changes_builder { - use super::*; - - pub(super) fn insert_new_outputs( - curr_outputs: &OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> usize { - new_ops.push(Op::Insert); - - for (builder, new_value) in builders.iter_mut().zip_eq_fast(curr_outputs.iter()) { - trace!("insert datum: {:?}", new_value); - builder.append_datum(new_value); - } - - 1 - } - - pub(super) fn delete_old_outputs( - prev_outputs: &OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> usize { - new_ops.push(Op::Delete); - - for (builder, old_value) in builders.iter_mut().zip_eq_fast(prev_outputs.iter()) { - trace!("delete datum: {:?}", old_value); - builder.append_datum(old_value); - } - - 1 - } - - pub(super) fn update_outputs( - prev_outputs: &OwnedRow, - curr_outputs: &OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> usize { - if prev_outputs == curr_outputs { - // Fast path for no change. - return 0; - } - - new_ops.push(Op::UpdateDelete); - new_ops.push(Op::UpdateInsert); - - for (builder, old_value, new_value) in itertools::multizip(( - builders.iter_mut(), - prev_outputs.iter(), - curr_outputs.iter(), - )) { - trace!( - "update datum: prev = {:?}, curr = {:?}", - old_value, - new_value - ); - builder.append_datum(old_value); - builder.append_datum(new_value); - } - - 2 - } -} - pub trait Strategy { - fn build_changes( + /// Infer the change type of the aggregation result. Don't need to take the ownership of + /// `prev_outputs` and `curr_outputs`. + fn infer_change_type( prev_row_count: usize, curr_row_count: usize, prev_outputs: Option<&OwnedRow>, curr_outputs: &OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> usize; + ) -> Option; } /// The strategy that always outputs the aggregation result no matter there're input rows or not. @@ -114,14 +49,12 @@ pub struct AlwaysOutput; pub struct OnlyOutputIfHasInput; impl Strategy for AlwaysOutput { - fn build_changes( + fn infer_change_type( prev_row_count: usize, curr_row_count: usize, prev_outputs: Option<&OwnedRow>, curr_outputs: &OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> usize { + ) -> Option { match prev_outputs { None => { // First time to build changes, assert to ensure correctness. @@ -130,46 +63,48 @@ impl Strategy for AlwaysOutput { assert_eq!(prev_row_count, 0); // Generate output no matter whether current row count is 0 or not. - changes_builder::insert_new_outputs(curr_outputs, builders, new_ops) + Some(AggChangeType::Insert) } Some(prev_outputs) => { - if prev_row_count == 0 && curr_row_count == 0 { - // No rows exist. - return 0; + if prev_row_count == 0 && curr_row_count == 0 || prev_outputs == curr_outputs { + // No rows exist, or output is not changed. + None + } else { + Some(AggChangeType::Update) } - changes_builder::update_outputs(prev_outputs, curr_outputs, builders, new_ops) } } } } impl Strategy for OnlyOutputIfHasInput { - fn build_changes( + fn infer_change_type( prev_row_count: usize, curr_row_count: usize, prev_outputs: Option<&OwnedRow>, curr_outputs: &OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> usize { + ) -> Option { match (prev_row_count, curr_row_count) { (0, 0) => { // No rows of current group exist. - 0 + None } (0, _) => { // Insert new output row for this newly emerged group. - changes_builder::insert_new_outputs(curr_outputs, builders, new_ops) + Some(AggChangeType::Insert) } (_, 0) => { // Delete old output row for this newly disappeared group. - let prev_outputs = prev_outputs.expect("must exist previous outputs"); - changes_builder::delete_old_outputs(prev_outputs, builders, new_ops) + Some(AggChangeType::Delete) } (_, _) => { // Update output row. - let prev_outputs = prev_outputs.expect("must exist previous outputs"); - changes_builder::update_outputs(prev_outputs, curr_outputs, builders, new_ops) + if prev_outputs.expect("must exist previous outputs") == curr_outputs { + // No output change. + None + } else { + Some(AggChangeType::Update) + } } } } @@ -178,7 +113,7 @@ impl Strategy for OnlyOutputIfHasInput { /// [`AggGroup`] manages agg states of all agg calls for one `group_key`. pub struct AggGroup { /// Group key. - group_key: Option, // TODO(rc): we can remove this + group_key: Option, /// Current managed states for all [`AggCall`]s. states: Vec>, @@ -201,14 +136,25 @@ impl Debug for AggGroup { } } -/// Information about the changes built by `AggState::build_changes`. -pub struct AggChangesInfo { - /// The number of rows and corresponding ops in the changes. - pub n_appended_ops: usize, - /// The result row containing group key prefix. To be inserted into result table. - pub result_row: OwnedRow, - /// The previous outputs of all agg calls recorded in the `AggState`. - pub prev_outputs: Option, +/// Type of aggregation change. +pub enum AggChangeType { + Insert, + Delete, + Update, +} + +/// Aggregation change. The result rows include group key prefix. +pub enum AggChange { + Insert { + new_row: OwnedRow, + }, + Delete { + old_row: OwnedRow, + }, + Update { + old_row: OwnedRow, + new_row: OwnedRow, + }, } impl AggGroup { @@ -318,8 +264,10 @@ impl AggGroup { self.states.iter_mut().for_each(|state| state.reset()); } - /// Get the outputs of all managed agg states. + /// Get the outputs of all managed agg states, without group key prefix. /// Possibly need to read/sync from state table if the state not cached in memory. + /// This method is idempotent, i.e. it can be called multiple times and the outputs are + /// guaranteed to be the same. pub async fn get_outputs( &mut self, storages: &[AggStateStorage], @@ -349,15 +297,9 @@ impl AggGroup { .map(OwnedRow::new) } - /// Build changes into `builders` and `new_ops`, according to previous and current agg outputs. - /// Returns [`AggChangesInfo`] contains information about changes built. - /// The saved previous outputs will be updated to the latest outputs after building changes. - pub fn build_changes( - &mut self, - curr_outputs: OwnedRow, - builders: &mut [ArrayBuilderImpl], - new_ops: &mut Vec, - ) -> AggChangesInfo { + /// Build aggregation result change, according to previous and current agg outputs. + /// The saved previous outputs will be updated to the latest outputs after this method. + pub fn build_change(&mut self, curr_outputs: OwnedRow) -> Option { let prev_row_count = self.prev_row_count(); let curr_row_count = curr_outputs[self.row_count_index] .as_ref() @@ -370,27 +312,78 @@ impl AggGroup { curr_row_count ); - let n_appended_ops = Strtg::build_changes( + let change_type = Strtg::infer_change_type( prev_row_count, curr_row_count, self.prev_outputs.as_ref(), &curr_outputs, - builders, - new_ops, ); - let result_row = self.group_key().chain(&curr_outputs).into_owned_row(); + // Split `AggChangeType` and `AggChange` to avoid unnecessary cloning. + change_type.map(|change_type| match change_type { + AggChangeType::Insert => { + let new_row = self.group_key().chain(&curr_outputs).into_owned_row(); + self.prev_outputs = Some(curr_outputs); + AggChange::Insert { new_row } + } + AggChangeType::Delete => { + let prev_outputs = self.prev_outputs.take(); + let old_row = self.group_key().chain(prev_outputs).into_owned_row(); + AggChange::Delete { old_row } + } + AggChangeType::Update => { + let new_row = self.group_key().chain(&curr_outputs).into_owned_row(); + let prev_outputs = self.prev_outputs.replace(curr_outputs); + let old_row = self.group_key().chain(prev_outputs).into_owned_row(); + AggChange::Update { old_row, new_row } + } + }) + } - let prev_outputs = if n_appended_ops == 0 { - self.prev_outputs.clone() - } else { - std::mem::replace(&mut self.prev_outputs, Some(curr_outputs)) - }; + pub fn apply_change_to_builders( + &self, + change: &AggChange, + builders: &mut [ArrayBuilderImpl], + ops: &mut Vec, + ) { + match change { + AggChange::Insert { new_row } => { + trace!("insert row: {:?}", new_row); + ops.push(Op::Insert); + for (builder, new_value) in builders.iter_mut().zip_eq_fast(new_row.iter()) { + builder.append_datum(new_value); + } + } + AggChange::Delete { old_row } => { + trace!("delete row: {:?}", old_row); + ops.push(Op::Delete); + for (builder, old_value) in builders.iter_mut().zip_eq_fast(old_row.iter()) { + builder.append_datum(old_value); + } + } + AggChange::Update { old_row, new_row } => { + trace!("update row: prev = {:?}, curr = {:?}", old_row, new_row); + ops.push(Op::UpdateDelete); + ops.push(Op::UpdateInsert); + for (builder, old_value, new_value) in + itertools::multizip((builders.iter_mut(), old_row.iter(), new_row.iter())) + { + builder.append_datum(old_value); + builder.append_datum(new_value); + } + } + } + } - AggChangesInfo { - n_appended_ops, - result_row, - prev_outputs, + pub fn apply_change_to_result_table( + &self, + change: &AggChange, + result_table: &mut StateTable, + ) { + match change { + AggChange::Insert { new_row } => result_table.insert(new_row), + AggChange::Delete { old_row } => result_table.delete(old_row), + AggChange::Update { old_row, new_row } => result_table.update(old_row, new_row), } } } diff --git a/src/stream/src/executor/aggregation/agg_impl/foldable.rs b/src/stream/src/executor/aggregation/agg_impl/foldable.rs index 2f025eda1fde2..efc228e49f32b 100644 --- a/src/stream/src/executor/aggregation/agg_impl/foldable.rs +++ b/src/stream/src/executor/aggregation/agg_impl/foldable.rs @@ -406,9 +406,9 @@ impl_fold_agg! { I64Array, Int64, DecimalArray } impl_fold_agg! { I64Array, Int64, StructArray } impl_fold_agg! { I64Array, Int64, ListArray } impl_fold_agg! { I64Array, Int64, IntervalArray } -impl_fold_agg! { I64Array, Int64, NaiveTimeArray } -impl_fold_agg! { I64Array, Int64, NaiveDateArray } -impl_fold_agg! { I64Array, Int64, NaiveDateTimeArray } +impl_fold_agg! { I64Array, Int64, TimeArray } +impl_fold_agg! { I64Array, Int64, DateArray } +impl_fold_agg! { I64Array, Int64, TimestampArray } // max/min impl_fold_agg! { I16Array, Int16, I16Array } impl_fold_agg! { I32Array, Int32, I32Array } @@ -419,9 +419,9 @@ impl_fold_agg! { Utf8Array, Utf8, Utf8Array } impl_fold_agg! { BytesArray, Bytea, BytesArray } impl_fold_agg! { StructArray, Struct, StructArray } impl_fold_agg! { IntervalArray, Interval, IntervalArray } -impl_fold_agg! { NaiveTimeArray, NaiveTime, NaiveTimeArray } -impl_fold_agg! { NaiveDateArray, NaiveDate, NaiveDateArray } -impl_fold_agg! { NaiveDateTimeArray, NaiveDateTime, NaiveDateTimeArray } +impl_fold_agg! { TimeArray, Time, TimeArray } +impl_fold_agg! { DateArray, Date, DateArray } +impl_fold_agg! { TimestampArray, Timestamp, TimestampArray } // sum impl_fold_agg! { DecimalArray, Decimal, I64Array } // avg @@ -430,7 +430,7 @@ impl_fold_agg! { F64Array, Float64, F32Array } #[cfg(test)] mod tests { use risingwave_common::array::I64Array; - use risingwave_common::types::OrderedF64; + use risingwave_common::types::F64; use risingwave_common::{array, array_nonnull}; use super::*; @@ -503,7 +503,7 @@ mod tests { .map(|(c, v)| { ( if c == '+' { Op::Insert } else { Op::Delete }, - Some(OrderedF64::from(v)), + Some(F64::from(v)), ) }) .unzip(); @@ -516,7 +516,7 @@ mod tests { .unwrap(); assert_eq!( agg.get_output().unwrap().unwrap().as_float64(), - &OrderedF64::from(expected) + &F64::from(expected) ); } } diff --git a/src/stream/src/executor/aggregation/agg_impl/mod.rs b/src/stream/src/executor/aggregation/agg_impl/mod.rs index 92108a82a8f47..0093212644650 100644 --- a/src/stream/src/executor/aggregation/agg_impl/mod.rs +++ b/src/stream/src/executor/aggregation/agg_impl/mod.rs @@ -24,9 +24,9 @@ use dyn_clone::DynClone; pub use foldable::*; use risingwave_common::array::stream_chunk::Ops; use risingwave_common::array::{ - Array, ArrayBuilder, ArrayBuilderImpl, ArrayImpl, BoolArray, BytesArray, DecimalArray, - F32Array, F64Array, I16Array, I32Array, I64Array, IntervalArray, ListArray, NaiveDateArray, - NaiveDateTimeArray, NaiveTimeArray, StructArray, Utf8Array, + Array, ArrayBuilder, ArrayBuilderImpl, ArrayImpl, BoolArray, BytesArray, DateArray, + DecimalArray, F32Array, F64Array, I16Array, I32Array, I64Array, IntervalArray, ListArray, + StructArray, TimeArray, TimestampArray, Utf8Array, }; use risingwave_common::buffer::Bitmap; use risingwave_common::types::{DataType, Datum}; @@ -164,14 +164,9 @@ pub fn create_streaming_agg_impl( (Count, boolean, int64, StreamingCountAgg::), (Count, varchar, int64, StreamingCountAgg::), (Count, interval, int64, StreamingCountAgg::), - (Count, date, int64, StreamingCountAgg::), - ( - Count, - timestamp, - int64, - StreamingCountAgg:: - ), - (Count, time, int64, StreamingCountAgg::), + (Count, date, int64, StreamingCountAgg::), + (Count, timestamp, int64, StreamingCountAgg::), + (Count, time, int64, StreamingCountAgg::), (Count, struct_type, int64, StreamingCountAgg::), (Count, list, int64, StreamingCountAgg::), // Sum0 @@ -211,14 +206,9 @@ pub fn create_streaming_agg_impl( (Min, float32, float32, StreamingMinAgg::), (Min, float64, float64, StreamingMinAgg::), (Min, interval, interval, StreamingMinAgg::), - (Min, time, time, StreamingMinAgg::), - (Min, date, date, StreamingMinAgg::), - ( - Min, - timestamp, - timestamp, - StreamingMinAgg:: - ), + (Min, time, time, StreamingMinAgg::), + (Min, date, date, StreamingMinAgg::), + (Min, timestamp, timestamp, StreamingMinAgg::), (Min, timestamptz, timestamptz, StreamingMinAgg::), (Min, varchar, varchar, StreamingMinAgg::), (Min, bytea, bytea, StreamingMinAgg::), @@ -230,14 +220,9 @@ pub fn create_streaming_agg_impl( (Max, float32, float32, StreamingMaxAgg::), (Max, float64, float64, StreamingMaxAgg::), (Max, interval, interval, StreamingMaxAgg::), - (Max, time, time, StreamingMaxAgg::), - (Max, date, date, StreamingMaxAgg::), - ( - Max, - timestamp, - timestamp, - StreamingMaxAgg:: - ), + (Max, time, time, StreamingMaxAgg::), + (Max, date, date, StreamingMaxAgg::), + (Max, timestamp, timestamp, StreamingMaxAgg::), (Max, timestamptz, timestamptz, StreamingMaxAgg::), (Max, varchar, varchar, StreamingMaxAgg::), (Max, bytea, bytea, StreamingMaxAgg::), diff --git a/src/stream/src/executor/backfill.rs b/src/stream/src/executor/backfill.rs index 1bbf6a5d2bb30..794c93e35126f 100644 --- a/src/stream/src/executor/backfill.rs +++ b/src/stream/src/executor/backfill.rs @@ -25,7 +25,7 @@ use risingwave_common::buffer::BitmapBuilder; use risingwave_common::catalog::Schema; use risingwave_common::row::{self, OwnedRow, Row, RowExt}; use risingwave_common::util::iter_util::ZipEqFast; -use risingwave_common::util::sort_util::{Direction, OrderType}; +use risingwave_common::util::sort_util::{compare_datum, OrderType}; use risingwave_hummock_sdk::HummockReadEpoch; use risingwave_storage::store::PrefetchOptions; use risingwave_storage::table::batch_table::storage_table::StorageTable; @@ -117,7 +117,7 @@ where // If the barrier is a conf change of creating this mview, we follow the procedure of // backfill. Otherwise, it means we've recovered and we can forward the upstream messages // directly. - let to_create_mv = first_barrier.is_add_dispatcher(self.actor_id); + let to_create_mv = first_barrier.is_newly_added(self.actor_id); // If the snapshot is empty, we don't need to backfill. let is_snapshot_empty: bool = { let snapshot = Self::snapshot_read(&self.table, init_epoch, None, false); @@ -373,12 +373,9 @@ where match row .project(pk_in_output_indices) .iter() - .zip_eq_fast(pk_order.iter()) + .zip_eq_fast(pk_order.iter().copied()) .cmp_by(current_pos.iter(), |(x, order), y| { - match order.direction() { - Direction::Ascending => x.cmp(&y), - Direction::Descending => y.cmp(&x), - } + compare_datum(x, y, order) }) { Ordering::Less | Ordering::Equal => true, Ordering::Greater => false, diff --git a/src/stream/src/executor/chain.rs b/src/stream/src/executor/chain.rs index f4081492928ae..56a10da734d37 100644 --- a/src/stream/src/executor/chain.rs +++ b/src/stream/src/executor/chain.rs @@ -74,9 +74,11 @@ impl ChainExecutor { // If the barrier is a conf change of creating this mview, init snapshot from its epoch // and begin to consume the snapshot. // Otherwise, it means we've recovered and the snapshot is already consumed. - let to_consume_snapshot = barrier.is_add_dispatcher(self.actor_id) && !self.upstream_only; + let to_consume_snapshot = barrier.is_newly_added(self.actor_id) && !self.upstream_only; - if self.upstream_only { + // If the barrier is a conf change of creating this mview, and the snapshot is not to be + // consumed, we can finish the progress immediately. + if barrier.is_newly_added(self.actor_id) && self.upstream_only { self.progress.finish(barrier.epoch.curr); } @@ -100,7 +102,7 @@ impl ChainExecutor { #[for_await] for msg in upstream { let msg = msg?; - if let Message::Barrier(barrier) = &msg { + if to_consume_snapshot && let Message::Barrier(barrier) = &msg { self.progress.finish(barrier.epoch.curr); } yield msg; @@ -174,6 +176,7 @@ mod test { ..Default::default() }], }, + added_actors: maplit::hashset! { actor_id }, splits: Default::default(), })), Message::Chunk(StreamChunk::from_pretty("I\n + 3")), diff --git a/src/stream/src/executor/dispatch.rs b/src/stream/src/executor/dispatch.rs index f115985bf63ba..f1a8c9d1ee23d 100644 --- a/src/stream/src/executor/dispatch.rs +++ b/src/stream/src/executor/dispatch.rs @@ -25,10 +25,9 @@ use itertools::Itertools; use risingwave_common::array::{Op, StreamChunk}; use risingwave_common::buffer::BitmapBuilder; use risingwave_common::hash::{ActorMapping, ExpandedActorMapping, VirtualNode}; -use risingwave_common::util::hash_util::Crc32FastBuilder; use risingwave_common::util::iter_util::ZipEqFast; -use risingwave_pb::stream_plan::update_mutation::DispatcherUpdate as ProstDispatcherUpdate; -use risingwave_pb::stream_plan::Dispatcher as ProstDispatcher; +use risingwave_pb::stream_plan::update_mutation::PbDispatcherUpdate; +use risingwave_pb::stream_plan::PbDispatcher; use smallvec::{smallvec, SmallVec}; use tracing::event; @@ -106,7 +105,7 @@ impl DispatchExecutorInner { /// Add new dispatchers to the executor. Will check whether their ids are unique. fn add_dispatchers<'a>( &mut self, - new_dispatchers: impl IntoIterator, + new_dispatchers: impl IntoIterator, ) -> StreamResult<()> { let new_dispatchers: Vec<_> = new_dispatchers .into_iter() @@ -136,7 +135,7 @@ impl DispatchExecutorInner { /// Update the dispatcher BEFORE we actually dispatch this barrier. We'll only add the new /// outputs. - fn pre_update_dispatcher(&mut self, update: &ProstDispatcherUpdate) -> StreamResult<()> { + fn pre_update_dispatcher(&mut self, update: &PbDispatcherUpdate) -> StreamResult<()> { let outputs: Vec<_> = update .added_downstream_actor_id .iter() @@ -151,7 +150,7 @@ impl DispatchExecutorInner { /// Update the dispatcher AFTER we dispatch this barrier. We'll remove some outputs and finally /// update the hash mapping. - fn post_update_dispatcher(&mut self, update: &ProstDispatcherUpdate) -> StreamResult<()> { + fn post_update_dispatcher(&mut self, update: &PbDispatcherUpdate) -> StreamResult<()> { let ids = update.removed_downstream_actor_id.iter().copied().collect(); let dispatcher = self.find_dispatcher(update.dispatcher_id); @@ -174,7 +173,7 @@ impl DispatchExecutorInner { /// For `Add` and `Update`, update the dispatchers before we dispatch the barrier. fn pre_mutate_dispatchers(&mut self, mutation: &Option>) -> StreamResult<()> { let Some(mutation) = mutation.as_deref() else { - return Ok(()) + return Ok(()); }; match mutation { @@ -199,7 +198,7 @@ impl DispatchExecutorInner { /// For `Stop` and `Update`, update the dispatchers after we dispatch the barrier. fn post_mutate_dispatchers(&mut self, mutation: &Option>) -> StreamResult<()> { let Some(mutation) = mutation.as_deref() else { - return Ok(()) + return Ok(()); }; match mutation { @@ -262,15 +261,12 @@ impl StreamConsumer for DispatchExecutor { #[for_await] for msg in input { let msg: Message = msg?; - let (barrier, message) = match msg { + let (barrier, span) = match msg { Message::Chunk(_) => (None, "dispatch_chunk"), Message::Barrier(ref barrier) => (Some(barrier.clone()), "dispatch_barrier"), Message::Watermark(_) => (None, "dispatch_watermark"), }; - self.inner - .dispatch(msg) - .verbose_instrument_await(message) - .await?; + self.inner.dispatch(msg).instrument_await(span).await?; if let Some(barrier) = barrier { yield barrier; } @@ -291,7 +287,7 @@ impl DispatcherImpl { pub fn new( context: &SharedContext, actor_id: ActorId, - dispatcher: &ProstDispatcher, + dispatcher: &PbDispatcher, ) -> StreamResult { let outputs = dispatcher .downstream_actor_id @@ -596,13 +592,7 @@ impl Dispatcher for HashDataDispatcher { let num_outputs = self.outputs.len(); // get hash value of every line by its key - let hash_builder = Crc32FastBuilder; - let vnodes = chunk - .data_chunk() - .get_hash_values(&self.keys, hash_builder) - .into_iter() - .map(|hash| hash.to_vnode()) - .collect_vec(); + let vnodes = VirtualNode::compute_chunk(chunk.data_chunk(), &self.keys); tracing::trace!(target: "events::stream::dispatch::hash", "\n{}\n keys {:?} => {:?}", chunk.to_pretty_string(), self.keys, vnodes); @@ -898,6 +888,7 @@ mod tests { use risingwave_common::array::{Array, ArrayBuilder, I32ArrayBuilder, Op}; use risingwave_common::catalog::Schema; use risingwave_common::hash::VirtualNode; + use risingwave_common::util::hash_util::Crc32FastBuilder; use risingwave_common::util::iter_util::ZipEqFast; use risingwave_pb::stream_plan::DispatcherType; @@ -1035,7 +1026,7 @@ mod tests { let broadcast_dispatcher = DispatcherImpl::new( &ctx, actor_id, - &ProstDispatcher { + &PbDispatcher { r#type: DispatcherType::Broadcast as _, dispatcher_id: broadcast_dispatcher_id, downstream_actor_id: vec![untouched, old], @@ -1048,7 +1039,7 @@ mod tests { let simple_dispatcher = DispatcherImpl::new( &ctx, actor_id, - &ProstDispatcher { + &PbDispatcher { r#type: DispatcherType::Simple as _, dispatcher_id: simple_dispatcher_id, downstream_actor_id: vec![old_simple], @@ -1085,7 +1076,7 @@ mod tests { // 4. Send a configuration change barrier for broadcast dispatcher. let dispatcher_updates = maplit::hashmap! { - actor_id => vec![ProstDispatcherUpdate { + actor_id => vec![PbDispatcherUpdate { actor_id, dispatcher_id: broadcast_dispatcher_id, added_downstream_actor_id: vec![new], @@ -1136,7 +1127,7 @@ mod tests { // 9. Send a configuration change barrier for simple dispatcher. let dispatcher_updates = maplit::hashmap! { - actor_id => vec![ProstDispatcherUpdate { + actor_id => vec![PbDispatcherUpdate { actor_id, dispatcher_id: simple_dispatcher_id, added_downstream_actor_id: vec![new_simple], diff --git a/src/stream/src/executor/dynamic_filter.rs b/src/stream/src/executor/dynamic_filter.rs index f4da5696ebf8d..c8f7a1f1bf612 100644 --- a/src/stream/src/executor/dynamic_filter.rs +++ b/src/stream/src/executor/dynamic_filter.rs @@ -25,9 +25,7 @@ use risingwave_common::hash::VnodeBitmapExt; use risingwave_common::row::{once, OwnedRow as RowData, Row}; use risingwave_common::types::{DataType, Datum, ScalarImpl, ToDatumRef, ToOwnedDatum}; use risingwave_common::util::iter_util::ZipEqDebug; -use risingwave_expr::expr::{ - new_binary_expr, BoxedExpression, InputRefExpression, LiteralExpression, -}; +use risingwave_expr::expr::{build, BoxedExpression, InputRefExpression, LiteralExpression}; use risingwave_pb::expr::expr_node::Type as ExprNodeType; use risingwave_pb::expr::expr_node::Type::{ GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, @@ -267,11 +265,13 @@ impl DynamicFilterExecutor { assert_eq!(l_data_type, r_data_type); let dynamic_cond = move |literal: Datum| { literal.map(|scalar| { - new_binary_expr( + build( self.comparator, DataType::Boolean, - Box::new(InputRefExpression::new(l_data_type.clone(), self.key_l)), - Box::new(LiteralExpression::new(r_data_type.clone(), Some(scalar))), + vec![ + Box::new(InputRefExpression::new(l_data_type.clone(), self.key_l)), + Box::new(LiteralExpression::new(r_data_type.clone(), Some(scalar))), + ], ) }) }; @@ -456,7 +456,7 @@ impl DynamicFilterExecutor { // Update the vnode bitmap for the left state table if asked. if let Some(vnode_bitmap) = barrier.as_update_vnode_bitmap(self.ctx.id) { - let _previous_vnode_bitmap = + let (_previous_vnode_bitmap, _cache_may_stale) = self.left_table.update_vnode_bitmap(vnode_bitmap); } diff --git a/src/stream/src/executor/error.rs b/src/stream/src/executor/error.rs index eafb17e977ae4..88c09bd7d043e 100644 --- a/src/stream/src/executor/error.rs +++ b/src/stream/src/executor/error.rs @@ -21,7 +21,7 @@ use risingwave_common::util::value_encoding::error::ValueEncodingError; use risingwave_connector::error::ConnectorError; use risingwave_connector::sink::SinkError; use risingwave_expr::ExprError; -use risingwave_pb::ProstFieldNotFound; +use risingwave_pb::PbFieldNotFound; use risingwave_rpc_client::error::RpcError; use risingwave_storage::error::StorageError; @@ -173,8 +173,8 @@ impl From for StreamExecutorError { } } -impl From for StreamExecutorError { - fn from(err: ProstFieldNotFound) -> Self { +impl From for StreamExecutorError { + fn from(err: PbFieldNotFound) -> Self { Self::from(anyhow::anyhow!( "Failed to decode prost: field not found `{}`", err.0 diff --git a/src/stream/src/executor/filter.rs b/src/stream/src/executor/filter.rs index 61b9495d0f8c6..86f890c19cf5c 100644 --- a/src/stream/src/executor/filter.rs +++ b/src/stream/src/executor/filter.rs @@ -199,8 +199,7 @@ mod tests { use risingwave_common::array::StreamChunk; use risingwave_common::catalog::{Field, Schema}; use risingwave_common::types::DataType; - use risingwave_expr::expr::{new_binary_expr, InputRefExpression}; - use risingwave_pb::expr::expr_node::Type; + use risingwave_expr::expr::build_from_pretty; use super::super::test_utils::MockSource; use super::super::*; @@ -234,15 +233,8 @@ mod tests { }; let source = MockSource::with_chunks(schema, PkIndices::new(), vec![chunk1, chunk2]); - let left_expr = InputRefExpression::new(DataType::Int64, 0); - let right_expr = InputRefExpression::new(DataType::Int64, 1); - let test_expr = new_binary_expr( - Type::GreaterThan, - DataType::Boolean, - Box::new(left_expr), - Box::new(right_expr), - ) - .unwrap(); + let test_expr = build_from_pretty("(greater_than:boolean $0:int8 $1:int8)"); + let filter = Box::new(FilterExecutor::new( ActorContext::create(123), Box::new(source), diff --git a/src/stream/src/executor/global_simple_agg.rs b/src/stream/src/executor/global_simple_agg.rs index 85d8b8abdc2fe..41e7cc5e3162d 100644 --- a/src/stream/src/executor/global_simple_agg.rs +++ b/src/stream/src/executor/global_simple_agg.rs @@ -16,14 +16,12 @@ use futures::StreamExt; use futures_async_stream::try_stream; use risingwave_common::array::StreamChunk; use risingwave_common::catalog::Schema; -use risingwave_common::row::RowExt; use risingwave_common::util::iter_util::ZipEqFast; use risingwave_storage::StateStore; -use super::agg_common::AggExecutorArgs; +use super::agg_common::{AggExecutorArgs, SimpleAggExecutorExtraArgs}; use super::aggregation::{ - agg_call_filter_res, iter_table_storage, AggChangesInfo, AggStateStorage, AlwaysOutput, - DistinctDeduplicater, + agg_call_filter_res, iter_table_storage, AggStateStorage, AlwaysOutput, DistinctDeduplicater, }; use super::*; use crate::common::table::state_table::StateTable; @@ -128,7 +126,7 @@ impl Executor for GlobalSimpleAggExecutor { } impl GlobalSimpleAggExecutor { - pub fn new(args: AggExecutorArgs) -> StreamResult { + pub fn new(args: AggExecutorArgs) -> StreamResult { let input_info = args.input.info(); let schema = generate_agg_schema(args.input.as_ref(), &args.agg_calls, None); Ok(Self { @@ -251,29 +249,18 @@ impl GlobalSimpleAggExecutor { let mut new_ops = Vec::with_capacity(2); // Retrieve modified states and put the changes into the builders. let curr_outputs = vars.agg_group.get_outputs(&this.storages).await?; - let AggChangesInfo { - result_row, - prev_outputs, - n_appended_ops, - } = vars - .agg_group - .build_changes(curr_outputs, &mut builders, &mut new_ops); - - if n_appended_ops == 0 { + if let Some(change) = vars.agg_group.build_change(curr_outputs) { + vars.agg_group + .apply_change_to_builders(&change, &mut builders, &mut new_ops); + vars.agg_group + .apply_change_to_result_table(&change, &mut this.result_table); + this.result_table.commit(epoch).await?; + } else { // Agg result is not changed. this.result_table.commit_no_data_expected(epoch); return Ok(None); } - // Update the result table with latest agg outputs. - if let Some(prev_outputs) = prev_outputs { - let old_row = vars.agg_group.group_key().chain(prev_outputs); - this.result_table.update(old_row, result_row); - } else { - this.result_table.insert(result_row); - } - this.result_table.commit(epoch).await?; - let columns = builders .into_iter() .map(|builder| builder.finish().into()) diff --git a/src/stream/src/executor/hash_agg.rs b/src/stream/src/executor/hash_agg.rs index 245921beb4060..ad56c27e6f0b8 100644 --- a/src/stream/src/executor/hash_agg.rs +++ b/src/stream/src/executor/hash_agg.rs @@ -14,6 +14,7 @@ use std::collections::{HashMap, HashSet}; use std::marker::PhantomData; +use std::ptr::NonNull; use std::sync::Arc; use futures::{stream, StreamExt, TryStreamExt}; @@ -24,12 +25,11 @@ use risingwave_common::array::StreamChunk; use risingwave_common::buffer::{Bitmap, BitmapBuilder}; use risingwave_common::catalog::Schema; use risingwave_common::hash::{HashKey, PrecomputedBuildHasher}; -use risingwave_common::row::RowExt; use risingwave_common::util::epoch::EpochPair; use risingwave_common::util::iter_util::ZipEqFast; use risingwave_storage::StateStore; -use super::agg_common::AggExecutorArgs; +use super::agg_common::{AggExecutorArgs, GroupAggExecutorExtraArgs}; use super::aggregation::{ agg_call_filter_res, iter_table_storage, AggStateStorage, DistinctDeduplicater, OnlyOutputIfHasInput, @@ -41,14 +41,14 @@ use super::{ use crate::cache::{cache_may_stale, new_with_hasher, ExecutorCache}; use crate::common::table::state_table::StateTable; use crate::error::StreamResult; -use crate::executor::aggregation::{generate_agg_schema, AggCall, AggChangesInfo, AggGroup}; +use crate::executor::aggregation::{generate_agg_schema, AggCall, AggGroup as GenericAggGroup}; use crate::executor::error::StreamExecutorError; use crate::executor::monitor::StreamingMetrics; use crate::executor::{BoxedMessageStream, Message}; use crate::task::AtomicU64Ref; -type BoxedAggGroup = Box>; -type AggGroupCache = ExecutorCache, PrecomputedBuildHasher>; +type AggGroup = GenericAggGroup; +type AggGroupCache = ExecutorCache, PrecomputedBuildHasher>; /// [`HashAggExecutor`] could process large amounts of data using a state backend. It works as /// follows: @@ -177,14 +177,12 @@ impl Executor for HashAggExecutor { } impl HashAggExecutor { - pub fn new(args: AggExecutorArgs) -> StreamResult { - let extra_args = args.extra.unwrap(); - + pub fn new(args: AggExecutorArgs) -> StreamResult { let input_info = args.input.info(); let schema = generate_agg_schema( args.input.as_ref(), &args.agg_calls, - Some(&extra_args.group_key_indices), + Some(&args.extra.group_key_indices), ); Ok(Self { input: args.input, @@ -198,16 +196,16 @@ impl HashAggExecutor { }, input_pk_indices: input_info.pk_indices, input_schema: input_info.schema, - group_key_indices: extra_args.group_key_indices, + group_key_indices: args.extra.group_key_indices, agg_calls: args.agg_calls, row_count_index: args.row_count_index, storages: args.storages, result_table: args.result_table, distinct_dedup_tables: args.distinct_dedup_tables, watermark_epoch: args.watermark_epoch, - chunk_size: extra_args.chunk_size, extreme_cache_size: args.extreme_cache_size, - metrics: extra_args.metrics, + chunk_size: args.extra.chunk_size, + metrics: args.extra.metrics, }, }) } @@ -255,19 +253,17 @@ impl HashAggExecutor { Some(async { // Create `AggGroup` for the current group if not exists. This will // fetch previous agg result from the result table. - let agg_group = Box::new( - AggGroup::create( - Some(key.deserialize(group_key_types)?), - &this.agg_calls, - &this.storages, - &this.result_table, - &this.input_pk_indices, - this.row_count_index, - this.extreme_cache_size, - &this.input_schema, - ) - .await?, - ); + let agg_group = AggGroup::create( + Some(key.deserialize(group_key_types)?), + &this.agg_calls, + &this.storages, + &this.result_table, + &this.input_pk_indices, + this.row_count_index, + this.extreme_cache_size, + &this.input_schema, + ) + .await?; Ok::<_, StreamExecutorError>((key.clone(), agg_group)) }) } @@ -345,7 +341,7 @@ impl HashAggExecutor { // Apply chunk to each of the state (per agg_call), for each group. for (key, visibility) in group_visibilities { - let agg_group = vars.agg_group_cache.get_mut(&key).unwrap().as_mut(); + let agg_group = vars.agg_group_cache.get_mut(&key).unwrap(); let visibilities = call_visibilities .iter() .map(Option::as_ref) @@ -411,8 +407,6 @@ impl HashAggExecutor { let dirty_cnt = vars.group_change_set.len(); if dirty_cnt > 0 { // Produce the stream chunk - let group_key_data_types = - &this.info.schema.data_types()[..this.group_key_indices.len()]; let mut group_chunks = IterChunks::chunks(vars.group_change_set.drain(), this.chunk_size); while let Some(batch) = group_chunks.next() { @@ -423,8 +417,7 @@ impl HashAggExecutor { let agg_group = vars .agg_group_cache .get_mut(key) - .expect("changed group must have corresponding AggGroup") - .as_mut(); + .expect("changed group must have corresponding AggGroup"); agg_group.flush_state_if_needed(&mut this.storages).await?; } @@ -436,11 +429,17 @@ impl HashAggExecutor { // Calculate current outputs, concurrently. let futs = keys_in_batch.into_iter().map(|key| { - // Pop out the agg group temporarily. - let mut agg_group = vars - .agg_group_cache - .pop(&key) - .expect("changed group must have corresponding AggGroup"); + // Get agg group of the key. + let agg_group = { + let mut ptr: NonNull<_> = vars + .agg_group_cache + .get_mut(&key) + .expect("changed group must have corresponding AggGroup") + .into(); + // SAFETY: `key`s in `keys_in_batch` are unique by nature, because they're + // from `group_change_set` which is a set. + unsafe { ptr.as_mut() } + }; async { let curr_outputs = agg_group.get_outputs(&this.storages).await?; Ok::<_, StreamExecutorError>((key, agg_group, curr_outputs)) @@ -452,34 +451,11 @@ impl HashAggExecutor { .try_collect() .await?; - for (key, mut agg_group, curr_outputs) in outputs_in_batch { - let AggChangesInfo { - n_appended_ops, - result_row, - prev_outputs, - } = agg_group.build_changes( - curr_outputs, - &mut builders[this.group_key_indices.len()..], - &mut new_ops, - ); - - if n_appended_ops != 0 { - for _ in 0..n_appended_ops { - key.deserialize_to_builders( - &mut builders[..this.group_key_indices.len()], - group_key_data_types, - )?; - } - if let Some(prev_outputs) = prev_outputs { - let old_row = agg_group.group_key().chain(prev_outputs); - this.result_table.update(old_row, result_row); - } else { - this.result_table.insert(result_row); - } + for (_key, agg_group, curr_outputs) in outputs_in_batch { + if let Some(change) = agg_group.build_change(curr_outputs) { + agg_group.apply_change_to_builders(&change, &mut builders, &mut new_ops); + agg_group.apply_change_to_result_table(&change, &mut this.result_table); } - - // Put the agg group back into the agg group cache. - vars.agg_group_cache.put(key, agg_group); } let columns = builders @@ -635,7 +611,7 @@ mod tests { use risingwave_storage::memory::MemoryStateStore; use risingwave_storage::StateStore; - use crate::executor::agg_common::{AggExecutorArgs, AggExecutorArgsExtra}; + use crate::executor::agg_common::{AggExecutorArgs, GroupAggExecutorExtraArgs}; use crate::executor::aggregation::{AggArgs, AggCall}; use crate::executor::monitor::StreamingMetrics; use crate::executor::test_utils::agg_executor::{ @@ -694,12 +670,11 @@ mod tests { distinct_dedup_tables: Default::default(), watermark_epoch: Arc::new(AtomicU64::new(0)), - extra: Some(AggExecutorArgsExtra { + extra: GroupAggExecutorExtraArgs { group_key_indices, - - metrics: Arc::new(StreamingMetrics::unused()), chunk_size: 1024, - }), + metrics: Arc::new(StreamingMetrics::unused()), + }, }) .unwrap() .boxed() diff --git a/src/stream/src/executor/hash_join.rs b/src/stream/src/executor/hash_join.rs index c2023e2a3a3cb..75e9b5949e080 100644 --- a/src/stream/src/executor/hash_join.rs +++ b/src/stream/src/executor/hash_join.rs @@ -30,6 +30,7 @@ use risingwave_common::types::{DataType, ToOwnedDatum}; use risingwave_common::util::epoch::EpochPair; use risingwave_common::util::iter_util::ZipEqDebug; use risingwave_expr::expr::BoxedExpression; +use risingwave_expr::ExprError; use risingwave_storage::StateStore; use self::JoinType::{FullOuter, LeftOuter, LeftSemi, RightAnti, RightOuter, RightSemi}; @@ -52,6 +53,10 @@ use crate::task::AtomicU64Ref; /// enum is not supported in const generic. // TODO: Use enum to replace this once [feature(adt_const_params)](https://github.com/rust-lang/rust/issues/95174) get completed. pub type JoinTypePrimitive = u8; + +/// Evict the cache every n rows. +const EVICT_EVERY_N_ROWS: u32 = 1024; + #[allow(non_snake_case, non_upper_case_globals)] pub mod JoinType { use super::JoinTypePrimitive; @@ -168,6 +173,17 @@ struct JoinSide { /// The mapping from input indices of a side to output columes. i2o_mapping: Vec<(usize, usize)>, i2o_mapping_indexed: MultiMap, + /// The first field of the ith element indicates that when a watermark at the ith column of + /// this side comes, what band join conditions should be updated in order to possibly + /// generate a new watermark at that column or the corresponding column in the counterpart + /// join side. + /// + /// The second field indicates that whether the column is required less than the + /// the corresponding column in the counterpart join side in the band join condition. + input2inequality_index: Vec>, + /// (i, j) in this `Vec` means that state data in this join side can be cleaned if the value of + /// its ith column is less than the synthetic watermark of the jth band join condition. + state_clean_columns: Vec<(usize, usize)>, /// Whether degree table is needed for this side. need_degree_table: bool, } @@ -229,6 +245,12 @@ pub struct HashJoinExecutor, /// Optional non-equi join conditions cond: Option, + /// Column indices of watermark output and offset expression of each inequality, respectively. + inequality_pairs: Vec<(Vec, Option)>, + /// The output watermark of each inequality condition and its value is the minimum of the + /// calculation result of both side. It will be used to generate watermark into downstream + /// and do state cleaning if `clean_state` field of that inequality is `true`. + inequality_watermarks: Vec>, /// Identity string identity: String, @@ -242,6 +264,8 @@ pub struct HashJoinExecutor, /// The maximum size of the chunk produced by executor at a time chunk_size: usize, + /// Count the messages received, clear to 0 when counted to `EVICT_EVERY_N_MESSAGES` + cnt_rows_received: u32, /// watermark column index -> `BufferedWatermarks` watermark_buffers: BTreeMap>, @@ -414,6 +438,7 @@ impl HashJoinExecutor, executor_id: u64, cond: Option, + inequality_pairs: Vec<(usize, usize, bool, Option)>, op_info: String, state_table_l: StateTable, degree_state_table_l: StateTable, @@ -538,6 +563,55 @@ impl HashJoinExecutor HashJoinExecutor HashJoinExecutor HashJoinExecutor { - for watermark_to_emit in self.handle_watermark(SideType::Left, watermark)? { + for watermark_to_emit in + self.handle_watermark(SideType::Left, watermark).await? + { yield Message::Watermark(watermark_to_emit); } } AlignedMessage::WatermarkRight(watermark) => { - for watermark_to_emit in self.handle_watermark(SideType::Right, watermark)? { + for watermark_to_emit in + self.handle_watermark(SideType::Right, watermark).await? + { yield Message::Watermark(watermark_to_emit); } } @@ -659,9 +744,11 @@ impl HashJoinExecutor HashJoinExecutor HashJoinExecutor HashJoinExecutor, + side_match: &mut JoinSide, + cnt_rows_received: &mut u32, + ) { + *cnt_rows_received += 1; + if *cnt_rows_received == EVICT_EVERY_N_ROWS { + side_update.ht.evict(); + side_match.ht.evict(); + *cnt_rows_received = 0; + } + } + + async fn handle_watermark( &mut self, side: SideTypePrimitive, watermark: Watermark, @@ -801,6 +904,37 @@ impl HashJoinExecutor input_watermark.val = value.unwrap(), + Err(err) => { + if !matches!(err, ExprError::NumericOutOfRange) { + self.ctx.on_compute_error(err, self.identity.as_str()); + } + continue; + }, + } + }; + if let Some(selected_watermark) = buffers.handle_watermark(side, input_watermark) { + for output_idx in &self.inequality_pairs[*inequality_index].0 { + watermarks_to_emit.push(selected_watermark.clone().with_idx(*output_idx)); + } + self.inequality_watermarks[*inequality_index] = Some(selected_watermark); + } + } Ok(watermarks_to_emit) } @@ -843,9 +977,11 @@ impl HashJoinExecutor, actual_output_data_types: &'a [DataType], cond: &'a mut Option, + inequality_watermarks: &'a [Option], chunk: StreamChunk, append_only_optimize: bool, chunk_size: usize, + cnt_rows_received: &'a mut u32, ) { let chunk = chunk.compact(); @@ -855,6 +991,16 @@ impl HashJoinExecutor { stream_chunk_builder: StreamChunkBuilder::new( chunk_size, @@ -866,6 +1012,8 @@ impl HashJoinExecutor = Self::hash_eq_match(key, &mut side_match.ht).await?; match op { @@ -873,6 +1021,7 @@ impl HashJoinExecutor HashJoinExecutor HashJoinExecutor HashJoinExecutor HashJoinExecutor HashJoinExecutor { let mut degree = 0; if let Some(mut matched_rows) = matched_rows { + let mut matched_rows_to_clean = vec![]; for (matched_row_ref, matched_row) in matched_rows.values_mut(&side_match.all_data_types) { @@ -974,6 +1149,7 @@ impl HashJoinExecutor HashJoinExecutor HashJoinExecutor (StateTable, StateTable) { let column_descs = data_types .iter() .enumerate() .map(|(id, data_type)| ColumnDesc::unnamed(ColumnId::new(id as i32), data_type.clone())) .collect_vec(); - let state_table = StateTable::new_without_distribution_with_prefix_hint_len( + let state_table = StateTable::new_without_distribution( mem_state.clone(), TableId::new(table_id), column_descs, order_types.to_vec(), pk_indices.to_vec(), - prefix_hint_len, ) .await; @@ -1087,21 +1283,19 @@ mod tests { (state_table, degree_state_table) } - fn create_cond() -> BoxedExpression { - let left_expr = InputRefExpression::new(DataType::Int64, 1); - let right_expr = InputRefExpression::new(DataType::Int64, 3); - new_binary_expr( - Type::LessThan, - DataType::Boolean, - Box::new(left_expr), - Box::new(right_expr), + fn create_cond(condition_text: Option) -> BoxedExpression { + build_from_pretty( + condition_text + .as_deref() + .unwrap_or("(less_than:boolean $1:int8 $3:int8)"), ) - .unwrap() } async fn create_executor( with_condition: bool, null_safe: bool, + condition_text: Option, + inequality_pairs: Vec<(usize, usize, bool, Option)>, ) -> (MessageSender, MessageSender, BoxedMessageStream) { let schema = Schema { fields: vec![ @@ -1111,10 +1305,9 @@ mod tests { }; let (tx_l, source_l) = MockSource::channel(schema.clone(), vec![1]); let (tx_r, source_r) = MockSource::channel(schema, vec![1]); - let join_key_indices = vec![0]; - let params_l = JoinParams::new(join_key_indices.clone(), vec![1]); - let params_r = JoinParams::new(join_key_indices.clone(), vec![1]); - let cond = with_condition.then(create_cond); + let params_l = JoinParams::new(vec![0], vec![1]); + let params_r = JoinParams::new(vec![0], vec![1]); + let cond = with_condition.then(|| create_cond(condition_text)); let mem_state = MemoryStateStore::new(); @@ -1124,7 +1317,6 @@ mod tests { &[OrderType::ascending(), OrderType::ascending()], &[0, 1], 0, - join_key_indices.len(), ) .await; @@ -1134,7 +1326,6 @@ mod tests { &[OrderType::ascending(), OrderType::ascending()], &[0, 1], 2, - join_key_indices.len(), ) .await; @@ -1155,6 +1346,7 @@ mod tests { (0..schema_len).collect_vec(), 1, cond, + inequality_pairs, "HashJoinExecutor".to_string(), state_l, degree_state_l, @@ -1168,6 +1360,14 @@ mod tests { (tx_l, tx_r, Box::new(executor).execute()) } + async fn create_classical_executor( + with_condition: bool, + null_safe: bool, + condition_text: Option, + ) -> (MessageSender, MessageSender, BoxedMessageStream) { + create_executor::(with_condition, null_safe, condition_text, vec![]).await + } + async fn create_append_only_executor( with_condition: bool, ) -> (MessageSender, MessageSender, BoxedMessageStream) { @@ -1180,10 +1380,9 @@ mod tests { }; let (tx_l, source_l) = MockSource::channel(schema.clone(), vec![0]); let (tx_r, source_r) = MockSource::channel(schema, vec![0]); - let join_key_indices = vec![0, 1]; - let params_l = JoinParams::new(join_key_indices.clone(), vec![]); - let params_r = JoinParams::new(join_key_indices.clone(), vec![]); - let cond = with_condition.then(create_cond); + let params_l = JoinParams::new(vec![0, 1], vec![]); + let params_r = JoinParams::new(vec![0, 1], vec![]); + let cond = with_condition.then(|| create_cond(None)); let mem_state = MemoryStateStore::new(); @@ -1197,7 +1396,6 @@ mod tests { ], &[0, 1, 0], 0, - join_key_indices.len(), ) .await; @@ -1211,7 +1409,6 @@ mod tests { ], &[0, 1, 1], 0, - join_key_indices.len(), ) .await; let schema_len = match T { @@ -1231,6 +1428,7 @@ mod tests { (0..schema_len).collect_vec(), 1, cond, + vec![], "HashJoinExecutor".to_string(), state_l, degree_state_l, @@ -1244,6 +1442,93 @@ mod tests { (tx_l, tx_r, Box::new(executor).execute()) } + #[tokio::test] + async fn test_interval_join() -> StreamExecutorResult<()> { + let chunk_l1 = StreamChunk::from_pretty( + " I I + + 1 4 + + 2 3 + + 2 5 + + 3 6", + ); + let chunk_l2 = StreamChunk::from_pretty( + " I I + + 3 8 + - 3 8", + ); + let chunk_r1 = StreamChunk::from_pretty( + " I I + + 2 6 + + 4 8 + + 6 9", + ); + let chunk_r2 = StreamChunk::from_pretty( + " I I + + 2 3 + + 6 11", + ); + let (mut tx_l, mut tx_r, mut hash_join) = create_executor::<{ JoinType::Inner }>( + true, + false, + Some(String::from("(and:boolean (greater_than:boolean $1:int8 (subtract:int8 $3:int8 2:int8)) (greater_than:boolean $3:int8 (subtract:int8 $1:int8 2:int8)))")), + vec![(1, 3, true, Some(build_from_pretty("(subtract:int8 $0:int8 2:int8)"))), (3, 1, true, Some(build_from_pretty("(subtract:int8 $0:int8 2:int8)")))], + ) + .await; + + // push the init barrier for left and right + tx_l.push_barrier(1, false); + tx_r.push_barrier(1, false); + hash_join.next_unwrap_ready_barrier()?; + + // push the 1st left chunk + tx_l.push_chunk(chunk_l1); + hash_join.next_unwrap_pending(); + + // push the init barrier for left and right + tx_l.push_barrier(2, false); + tx_r.push_barrier(2, false); + hash_join.next_unwrap_ready_barrier()?; + + // push the 2nd left chunk + tx_l.push_chunk(chunk_l2); + hash_join.next_unwrap_pending(); + + tx_l.push_watermark(1, DataType::Int64, ScalarImpl::Int64(10)); + hash_join.next_unwrap_pending(); + + tx_r.push_watermark(1, DataType::Int64, ScalarImpl::Int64(6)); + let output_watermark = hash_join.next_unwrap_ready_watermark()?; + assert_eq!( + output_watermark, + Watermark::new(1, DataType::Int64, ScalarImpl::Int64(4)) + ); + let output_watermark = hash_join.next_unwrap_ready_watermark()?; + assert_eq!( + output_watermark, + Watermark::new(3, DataType::Int64, ScalarImpl::Int64(6)) + ); + + // push the 1st right chunk + tx_r.push_chunk(chunk_r1); + let chunk = hash_join.next_unwrap_ready_chunk()?; + // data "2 3" should have been cleaned + assert_eq!( + chunk, + StreamChunk::from_pretty( + " I I I I + + 2 5 2 6" + ) + ); + + // push the 2nd right chunk + tx_r.push_chunk(chunk_r2); + // pending means that state clean is successful, or the executor will yield a chunk "+ 2 3 + // 2 3" here. + hash_join.next_unwrap_pending(); + + Ok(()) + } + #[tokio::test] async fn test_streaming_hash_inner_join() -> StreamExecutorResult<()> { let chunk_l1 = StreamChunk::from_pretty( @@ -1269,7 +1554,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::Inner }>(false, false).await; + create_classical_executor::<{ JoinType::Inner }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -1339,7 +1624,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::Inner }>(false, true).await; + create_classical_executor::<{ JoinType::Inner }>(false, true, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -1421,7 +1706,7 @@ mod tests { - 6 9", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::LeftSemi }>(false, false).await; + create_classical_executor::<{ JoinType::LeftSemi }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -1531,7 +1816,7 @@ mod tests { - 6 9", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::LeftSemi }>(false, true).await; + create_classical_executor::<{ JoinType::LeftSemi }>(false, true, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -1860,7 +2145,7 @@ mod tests { - 6 9", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::RightSemi }>(false, false).await; + create_classical_executor::<{ JoinType::RightSemi }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -1972,7 +2257,7 @@ mod tests { - 1 3", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::LeftAnti }>(false, false).await; + create_classical_executor::<{ JoinType::LeftAnti }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2102,7 +2387,7 @@ mod tests { - 1 3", ); let (mut tx_r, mut tx_l, mut hash_join) = - create_executor::<{ JoinType::LeftAnti }>(false, false).await; + create_classical_executor::<{ JoinType::LeftAnti }>(false, false, None).await; // push the init barrier for left and right tx_r.push_barrier(1, false); @@ -2218,7 +2503,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::Inner }>(false, false).await; + create_classical_executor::<{ JoinType::Inner }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2313,7 +2598,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::Inner }>(false, false).await; + create_classical_executor::<{ JoinType::Inner }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2408,7 +2693,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::LeftOuter }>(false, false).await; + create_classical_executor::<{ JoinType::LeftOuter }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2492,7 +2777,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::LeftOuter }>(false, true).await; + create_classical_executor::<{ JoinType::LeftOuter }>(false, true, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2576,7 +2861,7 @@ mod tests { - 5 10", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::RightOuter }>(false, false).await; + create_classical_executor::<{ JoinType::RightOuter }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2804,7 +3089,7 @@ mod tests { - 5 10", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::FullOuter }>(false, false).await; + create_classical_executor::<{ JoinType::FullOuter }>(false, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2894,7 +3179,7 @@ mod tests { + 1 2", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::FullOuter }>(true, false).await; + create_classical_executor::<{ JoinType::FullOuter }>(true, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -2986,7 +3271,7 @@ mod tests { + 6 11", ); let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::Inner }>(true, false).await; + create_classical_executor::<{ JoinType::Inner }>(true, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); @@ -3022,7 +3307,7 @@ mod tests { #[tokio::test] async fn test_streaming_hash_join_watermark() -> StreamExecutorResult<()> { let (mut tx_l, mut tx_r, mut hash_join) = - create_executor::<{ JoinType::Inner }>(true, false).await; + create_classical_executor::<{ JoinType::Inner }>(true, false, None).await; // push the init barrier for left and right tx_l.push_barrier(1, false); diff --git a/src/stream/src/executor/hop_window.rs b/src/stream/src/executor/hop_window.rs index ded6e3fcf4fe3..c9eb64c6f7f32 100644 --- a/src/stream/src/executor/hop_window.rs +++ b/src/stream/src/executor/hop_window.rs @@ -18,7 +18,7 @@ use futures::StreamExt; use futures_async_stream::try_stream; use risingwave_common::array::column::Column; use risingwave_common::array::{StreamChunk, Vis}; -use risingwave_common::types::IntervalUnit; +use risingwave_common::types::Interval; use risingwave_expr::expr::BoxedExpression; use risingwave_expr::ExprError; @@ -30,8 +30,8 @@ pub struct HopWindowExecutor { pub input: BoxedExecutor, pub info: ExecutorInfo, pub time_col_idx: usize, - pub window_slide: IntervalUnit, - pub window_size: IntervalUnit, + pub window_slide: Interval, + pub window_size: Interval, window_start_exprs: Vec, window_end_exprs: Vec, pub output_indices: Vec, @@ -44,8 +44,8 @@ impl HopWindowExecutor { input: BoxedExecutor, info: ExecutorInfo, time_col_idx: usize, - window_slide: IntervalUnit, - window_size: IntervalUnit, + window_slide: Interval, + window_size: Interval, window_start_exprs: Vec, window_end_exprs: Vec, output_indices: Vec, @@ -199,8 +199,8 @@ mod tests { use futures::StreamExt; use risingwave_common::array::stream_chunk::StreamChunkTestExt; use risingwave_common::catalog::{Field, Schema}; - use risingwave_common::types::test_utils::IntervalUnitTestExt; - use risingwave_common::types::{DataType, IntervalUnit}; + use risingwave_common::types::test_utils::IntervalTestExt; + use risingwave_common::types::{DataType, Interval}; use risingwave_expr::expr::test_utils::make_hop_window_expression; use super::super::*; @@ -227,9 +227,9 @@ mod tests { ); let input = MockSource::with_chunks(schema.clone(), pk_indices.clone(), vec![chunk]).boxed(); - let window_slide = IntervalUnit::from_minutes(15); - let window_size = IntervalUnit::from_minutes(30); - let window_offset = IntervalUnit::from_minutes(0); + let window_slide = Interval::from_minutes(15); + let window_size = Interval::from_minutes(30); + let window_offset = Interval::from_minutes(0); let (window_start_exprs, window_end_exprs) = make_hop_window_expression( DataType::Timestamp, 2, @@ -350,9 +350,9 @@ mod tests { let pk_indices = vec![0]; let (tx, source) = MockSource::channel(schema.clone(), pk_indices.clone()); - let window_slide = IntervalUnit::from_minutes(15); - let window_size = IntervalUnit::from_minutes(30); - let offset = IntervalUnit::from_minutes(0); + let window_slide = Interval::from_minutes(15); + let window_size = Interval::from_minutes(30); + let offset = Interval::from_minutes(0); let (window_start_exprs, window_end_exprs) = make_hop_window_expression(DataType::Timestamp, 2, window_size, window_slide, offset) .unwrap(); diff --git a/src/stream/src/executor/integration_tests.rs b/src/stream/src/executor/integration_tests.rs index eb9d70679b78e..4eae8cfc7abf1 100644 --- a/src/stream/src/executor/integration_tests.rs +++ b/src/stream/src/executor/integration_tests.rs @@ -196,6 +196,7 @@ async fn test_merger_sum_aggr() { ], 3, MultiMap::new(), + 0.0, ); let items = Arc::new(Mutex::new(vec![])); diff --git a/src/stream/src/executor/lookup.rs b/src/stream/src/executor/lookup.rs index db068fefc9b5b..94e9eeab76742 100644 --- a/src/stream/src/executor/lookup.rs +++ b/src/stream/src/executor/lookup.rs @@ -28,6 +28,8 @@ mod impl_; pub use impl_::LookupExecutorParams; +use super::ActorContextRef; + #[cfg(test)] mod tests; @@ -38,6 +40,8 @@ mod tests; /// The output schema is `| stream columns | arrangement columns |`. /// The input is required to be first stream and then arrangement. pub struct LookupExecutor { + ctx: ActorContextRef, + /// the data types of the produced data chunk inside lookup (before reordering) chunk_data_types: Vec, diff --git a/src/stream/src/executor/lookup/cache.rs b/src/stream/src/executor/lookup/cache.rs index 498cb164a9620..0922b0b7a3323 100644 --- a/src/stream/src/executor/lookup/cache.rs +++ b/src/stream/src/executor/lookup/cache.rs @@ -64,6 +64,11 @@ impl LookupCache { self.data.update_epoch(epoch); } + /// Clear the cache. + pub fn clear(&mut self) { + self.data.clear(); + } + pub fn new(watermark_epoch: AtomicU64Ref) -> Self { let cache = ExecutorCache::new(new_unbounded(watermark_epoch)); Self { data: cache } diff --git a/src/stream/src/executor/lookup/impl_.rs b/src/stream/src/executor/lookup/impl_.rs index 12b7610f1635a..375c307054724 100644 --- a/src/stream/src/executor/lookup/impl_.rs +++ b/src/stream/src/executor/lookup/impl_.rs @@ -28,16 +28,19 @@ use risingwave_storage::table::TableIter; use risingwave_storage::StateStore; use super::sides::{stream_lookup_arrange_prev_epoch, stream_lookup_arrange_this_epoch}; +use crate::cache::cache_may_stale; use crate::common::StreamChunkBuilder; use crate::executor::error::{StreamExecutorError, StreamExecutorResult}; use crate::executor::lookup::cache::LookupCache; use crate::executor::lookup::sides::{ArrangeJoinSide, ArrangeMessage, StreamJoinSide}; use crate::executor::lookup::LookupExecutor; -use crate::executor::{Barrier, Executor, Message, PkIndices}; +use crate::executor::{ActorContextRef, Barrier, Executor, Message, PkIndices}; use crate::task::AtomicU64Ref; /// Parameters for [`LookupExecutor`]. pub struct LookupExecutorParams { + pub ctx: ActorContextRef, + /// The side for arrangement. Currently, it should be a /// `MaterializeExecutor`. pub arrangement: Box, @@ -116,6 +119,7 @@ pub struct LookupExecutorParams { impl LookupExecutor { pub fn new(params: LookupExecutorParams) -> Self { let LookupExecutorParams { + ctx, arrangement, stream, arrangement_col_descs, @@ -202,6 +206,7 @@ impl LookupExecutor { ); Self { + ctx, chunk_data_types, schema: output_schema, pk_indices, @@ -273,10 +278,8 @@ impl LookupExecutor { self.lookup_cache.flush(); } - // Use the new stream barrier epoch as new cache epoch - self.lookup_cache.update_epoch(barrier.epoch.curr); + self.process_barrier(&barrier); - self.process_barrier(barrier.clone()).await?; if self.arrangement.use_current_epoch { // When lookup this epoch, stream side barrier always come after arrangement // ready, so we can forward barrier now. @@ -336,11 +339,23 @@ impl LookupExecutor { } } - /// Store the barrier. - #[expect(clippy::unused_async)] - async fn process_barrier(&mut self, barrier: Barrier) -> StreamExecutorResult<()> { - self.last_barrier = Some(barrier); - Ok(()) + /// Process the barrier and apply changes if necessary. + fn process_barrier(&mut self, barrier: &Barrier) { + if let Some(vnode_bitmap) = barrier.as_update_vnode_bitmap(self.ctx.id) { + let previous_vnode_bitmap = self + .arrangement + .storage_table + .update_vnode_bitmap(vnode_bitmap.clone()); + + // Manipulate the cache if necessary. + if cache_may_stale(&previous_vnode_bitmap, &vnode_bitmap) { + self.lookup_cache.clear(); + } + } + + // Use the new stream barrier epoch as new cache epoch + self.lookup_cache.update_epoch(barrier.epoch.curr); + self.last_barrier = Some(barrier.clone()); } /// Lookup all rows corresponding to a join key in shared buffer. diff --git a/src/stream/src/executor/lookup/tests.rs b/src/stream/src/executor/lookup/tests.rs index 66898dbd0d48a..5fda9504d17f7 100644 --- a/src/stream/src/executor/lookup/tests.rs +++ b/src/stream/src/executor/lookup/tests.rs @@ -20,7 +20,7 @@ use futures::StreamExt; use itertools::Itertools; use risingwave_common::array::stream_chunk::StreamChunkTestExt; use risingwave_common::array::StreamChunk; -use risingwave_common::catalog::{ColumnDesc, ColumnId, ConflictBehavior, Field, Schema, TableId}; +use risingwave_common::catalog::{ColumnDesc, ConflictBehavior, Field, Schema, TableId}; use risingwave_common::types::DataType; use risingwave_common::util::sort_util::{ColumnOrder, OrderType}; use risingwave_storage::memory::MemoryStateStore; @@ -30,25 +30,13 @@ use crate::executor::lookup::impl_::LookupExecutorParams; use crate::executor::lookup::LookupExecutor; use crate::executor::test_utils::*; use crate::executor::{ - Barrier, BoxedMessageStream, Executor, MaterializeExecutor, Message, PkIndices, + ActorContext, Barrier, BoxedMessageStream, Executor, MaterializeExecutor, Message, PkIndices, }; fn arrangement_col_descs() -> Vec { vec![ - ColumnDesc { - data_type: DataType::Int64, - column_id: ColumnId::new(0), - name: "rowid_column".to_string(), - field_descs: vec![], - type_name: "".to_string(), - }, - ColumnDesc { - data_type: DataType::Int64, - column_id: ColumnId::new(1), - name: "join_column".to_string(), - field_descs: vec![], - type_name: "".to_string(), - }, + ColumnDesc::new_atomic(DataType::Int64, "rowid_column", 0), + ColumnDesc::new_atomic(DataType::Int64, "join_column", 1), ] } @@ -152,20 +140,8 @@ async fn create_arrangement( /// | b | | | 3 -> 4 | fn create_source() -> Box { let columns = vec![ - ColumnDesc { - data_type: DataType::Int64, - column_id: ColumnId::new(1), - name: "join_column".to_string(), - field_descs: vec![], - type_name: "".to_string(), - }, - ColumnDesc { - data_type: DataType::Int64, - column_id: ColumnId::new(2), - name: "rowid_column".to_string(), - field_descs: vec![], - type_name: "".to_string(), - }, + ColumnDesc::new_atomic(DataType::Int64, "join_column", 1), + ColumnDesc::new_atomic(DataType::Int64, "rowid_column", 2), ]; // Prepare source chunks. @@ -218,6 +194,7 @@ async fn test_lookup_this_epoch() { let arrangement = create_arrangement(table_id, store.clone()).await; let stream = create_source(); let lookup_executor = Box::new(LookupExecutor::new(LookupExecutorParams { + ctx: ActorContext::create(0), arrangement, stream, arrangement_col_descs: arrangement_col_descs(), @@ -281,14 +258,13 @@ async fn test_lookup_this_epoch() { } #[tokio::test] -#[ignore] -// Deprecated because the ability to read from prev epoch has been deprecated. async fn test_lookup_last_epoch() { let store = MemoryStateStore::new(); let table_id = TableId::new(1); let arrangement = create_arrangement(table_id, store.clone()).await; let stream = create_source(); let lookup_executor = Box::new(LookupExecutor::new(LookupExecutorParams { + ctx: ActorContext::create(0), arrangement, stream, arrangement_col_descs: arrangement_col_descs(), diff --git a/src/stream/src/executor/lookup_union.rs b/src/stream/src/executor/lookup_union.rs index a1be7e90b3984..f8385ff971359 100644 --- a/src/stream/src/executor/lookup_union.rs +++ b/src/stream/src/executor/lookup_union.rs @@ -119,7 +119,7 @@ impl LookupUnionExecutor { msg @ Message::Chunk(_) => yield msg, Message::Barrier(barrier) => { if let Some(this_barrier) = &this_barrier { - if this_barrier != &barrier { + if this_barrier.epoch != barrier.epoch { return Err(StreamExecutorError::align_barrier( this_barrier.clone(), barrier, diff --git a/src/stream/src/executor/managed_state/join/mod.rs b/src/stream/src/executor/managed_state/join/mod.rs index 5dad98f000eb0..e0988f23e3b8f 100644 --- a/src/stream/src/executor/managed_state/join/mod.rs +++ b/src/stream/src/executor/managed_state/join/mod.rs @@ -36,7 +36,7 @@ use risingwave_common::util::sort_util::OrderType; use risingwave_storage::store::PrefetchOptions; use risingwave_storage::StateStore; -use crate::cache::{cache_may_stale, new_with_hasher_in, ExecutorCache}; +use crate::cache::{new_with_hasher_in, ExecutorCache}; use crate::common::table::state_table::StateTable; use crate::executor::error::StreamExecutorResult; use crate::executor::monitor::StreamingMetrics; @@ -161,7 +161,6 @@ pub struct JoinHashMapMetrics { total_lookup_count: usize, /// How many times have we miss the cache when insert row insert_cache_miss_count: usize, - may_exist_true_count: usize, } impl JoinHashMapMetrics { @@ -173,7 +172,6 @@ impl JoinHashMapMetrics { lookup_miss_count: 0, total_lookup_count: 0, insert_cache_miss_count: 0, - may_exist_true_count: 0, } } @@ -190,14 +188,9 @@ impl JoinHashMapMetrics { .join_insert_cache_miss_count .with_label_values(&[&self.actor_id, self.side]) .inc_by(self.insert_cache_miss_count as u64); - self.metrics - .join_may_exist_true_count - .with_label_values(&[&self.actor_id, self.side]) - .inc_by(self.may_exist_true_count as u64); self.total_lookup_count = 0; self.lookup_miss_count = 0; self.insert_cache_miss_count = 0; - self.may_exist_true_count = 0; } } @@ -318,16 +311,16 @@ impl JoinHashMap { } /// Update the vnode bitmap and manipulate the cache if necessary. - pub fn update_vnode_bitmap(&mut self, vnode_bitmap: Arc) { - let previous_vnode_bitmap = self.state.table.update_vnode_bitmap(vnode_bitmap.clone()); - let _ = self - .degree_state - .table - .update_vnode_bitmap(vnode_bitmap.clone()); - - if cache_may_stale(&previous_vnode_bitmap, &vnode_bitmap) { + pub fn update_vnode_bitmap(&mut self, vnode_bitmap: Arc) -> bool { + let (_previous_vnode_bitmap, cache_may_stale) = + self.state.table.update_vnode_bitmap(vnode_bitmap.clone()); + let _ = self.degree_state.table.update_vnode_bitmap(vnode_bitmap); + + if cache_may_stale { self.inner.clear(); } + + cache_may_stale } pub fn update_watermark(&mut self, watermark: ScalarImpl) { @@ -435,22 +428,11 @@ impl JoinHashMap { // Update cache entry.insert(pk, value.encode()); } else if self.pk_contained_in_jk { - // Refill cache when the join key contains primary key. + // Refill cache when the join key exist in neither cache or storage. self.metrics.insert_cache_miss_count += 1; let mut state = JoinEntryState::default(); state.insert(pk, value.encode()); self.update_state(key, state.into()); - } else { - let prefix = key.deserialize(&self.join_key_data_types)?; - self.metrics.insert_cache_miss_count += 1; - // Refill cache when the join key exists in neither cache or storage. - if !self.state.table.may_exist(&prefix).await? { - let mut state = JoinEntryState::default(); - state.insert(pk, value.encode()); - self.update_state(key, state.into()); - } else { - self.metrics.may_exist_true_count += 1; - } } // Update the flush buffer. @@ -462,6 +444,7 @@ impl JoinHashMap { /// Insert a row. /// Used when the side does not need to update degree. + #[allow(clippy::unused_async)] pub async fn insert_row(&mut self, key: &K, value: impl Row) -> StreamExecutorResult<()> { let join_row = JoinRow::new(&value, 0); let pk = (&value) @@ -471,22 +454,11 @@ impl JoinHashMap { // Update cache entry.insert(pk, join_row.encode()); } else if self.pk_contained_in_jk { - // Refill cache when the join key contains primary key. + // Refill cache when the join key exist in neither cache or storage. self.metrics.insert_cache_miss_count += 1; let mut state = JoinEntryState::default(); state.insert(pk, join_row.encode()); self.update_state(key, state.into()); - } else { - let prefix = key.deserialize(&self.join_key_data_types)?; - self.metrics.insert_cache_miss_count += 1; - // Refill cache when the join key exists in neither cache or storage. - if !self.state.table.may_exist(&prefix).await? { - let mut state = JoinEntryState::default(); - state.insert(pk, join_row.encode()); - self.update_state(key, state.into()); - } else { - self.metrics.may_exist_true_count += 1; - } } // Update the flush buffer. diff --git a/src/stream/src/executor/managed_state/top_n/top_n_state.rs b/src/stream/src/executor/managed_state/top_n/top_n_state.rs index 40441f77bb15c..8dee8fb7fba8e 100644 --- a/src/stream/src/executor/managed_state/top_n/top_n_state.rs +++ b/src/stream/src/executor/managed_state/top_n/top_n_state.rs @@ -354,9 +354,10 @@ mod tests { #[tokio::test] async fn test_managed_top_n_state_fill_cache() { + let data_types = vec![DataType::Varchar, DataType::Int64]; let state_table = { let mut tb = create_in_memory_state_table( - &[DataType::Varchar, DataType::Int64], + &data_types, &[OrderType::ascending(), OrderType::ascending()], &[0, 1], ) @@ -382,7 +383,7 @@ mod tests { let rows = vec![row1, row2, row3, row4, row5]; let ordered_rows = vec![row1_bytes, row2_bytes, row3_bytes, row4_bytes, row5_bytes]; - let mut cache = TopNCache::::new(1, 1); + let mut cache = TopNCache::::new(1, 1, data_types); managed_state.insert(rows[3].clone()); managed_state.insert(rows[1].clone()); diff --git a/src/stream/src/executor/merge.rs b/src/stream/src/executor/merge.rs index 40fd5fe5c1976..ad734cf05d3e8 100644 --- a/src/stream/src/executor/merge.rs +++ b/src/stream/src/executor/merge.rs @@ -144,6 +144,21 @@ impl MergeExecutor { ); barrier.passed_actors.push(actor_id); + if let Some(Mutation::Update { dispatchers, .. }) = barrier.mutation.as_deref() + { + if select_all + .upstream_actor_ids() + .iter() + .any(|actor_id| dispatchers.contains_key(actor_id)) + { + // `Watermark` of upstream may become stale after downstream scaling. + select_all + .buffered_watermarks + .values_mut() + .for_each(|buffers| buffers.clear()); + } + } + if let Some(update) = barrier.as_update_merge(self.actor_context.id, self.upstream_fragment_id) { @@ -330,7 +345,7 @@ impl Stream for SelectReceivers { // If this barrier asks the actor to stop, we do not reset the active upstreams so that the // next call would return `Poll::Ready(None)` due to `is_terminated`. let upstreams = std::mem::take(&mut self.blocked); - if barrier.is_stop_or_update_drop_actor(self.actor_id) { + if barrier.is_stop(self.actor_id) { drop(upstreams); } else { self.extend_active(upstreams); diff --git a/src/stream/src/executor/mod.rs b/src/stream/src/executor/mod.rs index cf2be19024e38..7b71a06101dea 100644 --- a/src/stream/src/executor/mod.rs +++ b/src/stream/src/executor/mod.rs @@ -34,16 +34,15 @@ use risingwave_common::util::value_encoding::{deserialize_datum, serialize_datum use risingwave_connector::source::SplitImpl; use risingwave_expr::expr::BoxedExpression; use risingwave_expr::ExprError; -use risingwave_pb::data::{Datum as ProstDatum, Epoch as ProstEpoch}; -use risingwave_pb::expr::InputRef as ProstInputRef; +use risingwave_pb::data::{PbDatum, PbEpoch}; +use risingwave_pb::expr::PbInputRef; use risingwave_pb::stream_plan::add_mutation::Dispatchers; -use risingwave_pb::stream_plan::barrier::Mutation as ProstMutation; +use risingwave_pb::stream_plan::barrier::PbMutation; use risingwave_pb::stream_plan::stream_message::StreamMessage; use risingwave_pb::stream_plan::update_mutation::{DispatcherUpdate, MergeUpdate}; use risingwave_pb::stream_plan::{ - AddMutation, Barrier as ProstBarrier, Dispatcher as ProstDispatcher, PauseMutation, - ResumeMutation, SourceChangeSplitMutation, StopMutation, StreamMessage as ProstStreamMessage, - UpdateMutation, Watermark as ProstWatermark, + AddMutation, PauseMutation, PbBarrier, PbDispatcher, PbStreamMessage, PbWatermark, + ResumeMutation, SourceChangeSplitMutation, StopMutation, UpdateMutation, }; use smallvec::SmallVec; @@ -208,7 +207,7 @@ pub const INVALID_EPOCH: u64 = 0; type UpstreamFragmentId = FragmentId; -/// See [`risingwave_pb::stream_plan::barrier::Mutation`] for the semantics of each mutation. +/// See [`PbMutation`] for the semantics of each mutation. #[derive(Debug, Clone, PartialEq, EnumAsInner)] pub enum Mutation { Stop(HashSet), @@ -220,7 +219,8 @@ pub enum Mutation { actor_splits: HashMap>, }, Add { - adds: HashMap>, + adds: HashMap>, + added_actors: HashSet, // TODO: remove this and use `SourceChangesSplit` after we support multiple mutations. splits: HashMap>, }, @@ -278,7 +278,7 @@ impl Barrier { } /// Whether this barrier is to stop the actor with `actor_id`. - pub fn is_stop_or_update_drop_actor(&self, actor_id: ActorId) -> bool { + pub fn is_stop(&self, actor_id: ActorId) -> bool { self.all_stop_actors() .map_or(false, |actors| actors.contains(&actor_id)) } @@ -292,15 +292,16 @@ impl Barrier { } } - /// Whether this barrier is to add new dispatchers for the actor with `actor_id`. - pub fn is_add_dispatcher(&self, actor_id: ActorId) -> bool { - matches!( - self.mutation.as_deref(), - Some(Mutation::Add {adds, ..}) if adds - .values() - .flatten() - .any(|dispatcher| dispatcher.downstream_actor_id.contains(&actor_id)) - ) + /// Whether this barrier is to newly add the actor with `actor_id`. This is used for `Chain` and + /// `Values` to decide whether to output the existing (historical) data. + /// + /// By "newly", we mean the actor belongs to a subgraph of a new streaming job. That is, actors + /// added for scaling are not included. + pub fn is_newly_added(&self, actor_id: ActorId) -> bool { + match self.mutation.as_deref() { + Some(Mutation::Add { added_actors, .. }) => added_actors.contains(&actor_id), + _ => false, + } } /// Whether this barrier is for pause. @@ -364,9 +365,23 @@ impl Mutation { matches!(self, Mutation::Stop(_)) } - fn to_protobuf(&self) -> ProstMutation { + fn to_protobuf(&self) -> PbMutation { + let actor_splits_to_protobuf = |actor_splits: &HashMap>| { + actor_splits + .iter() + .map(|(&actor_id, splits)| { + ( + actor_id, + ConnectorSplits { + splits: splits.clone().iter().map(ConnectorSplit::from).collect(), + }, + ) + }) + .collect::>() + }; + match self { - Mutation::Stop(actors) => ProstMutation::Stop(StopMutation { + Mutation::Stop(actors) => PbMutation::Stop(StopMutation { actors: actors.iter().copied().collect::>(), }), Mutation::Update { @@ -375,7 +390,7 @@ impl Mutation { vnode_bitmaps, dropped_actors, actor_splits, - } => ProstMutation::Update(UpdateMutation { + } => PbMutation::Update(UpdateMutation { dispatcher_update: dispatchers.values().flatten().cloned().collect(), merge_update: merges.values().cloned().collect(), actor_vnode_bitmap_update: vnode_bitmaps @@ -383,63 +398,50 @@ impl Mutation { .map(|(&actor_id, bitmap)| (actor_id, bitmap.to_protobuf())) .collect(), dropped_actors: dropped_actors.iter().cloned().collect(), - actor_splits: actor_splits + actor_splits: actor_splits_to_protobuf(actor_splits), + }), + Mutation::Add { + adds, + added_actors, + splits, + } => PbMutation::Add(AddMutation { + actor_dispatchers: adds .iter() - .map(|(&actor_id, splits)| { + .map(|(&actor_id, dispatchers)| { ( actor_id, - ConnectorSplits { - splits: splits.clone().iter().map(ConnectorSplit::from).collect(), + Dispatchers { + dispatchers: dispatchers.clone(), }, ) }) .collect(), + added_actors: added_actors.iter().copied().collect(), + actor_splits: actor_splits_to_protobuf(splits), }), - Mutation::Add { adds, .. } => ProstMutation::Add(AddMutation { - actor_dispatchers: adds + Mutation::SourceChangeSplit(changes) => PbMutation::Splits(SourceChangeSplitMutation { + actor_splits: changes .iter() - .map(|(&actor_id, dispatchers)| { + .map(|(&actor_id, splits)| { ( actor_id, - Dispatchers { - dispatchers: dispatchers.clone(), + ConnectorSplits { + splits: splits.clone().iter().map(ConnectorSplit::from).collect(), }, ) }) .collect(), - ..Default::default() }), - Mutation::SourceChangeSplit(changes) => { - ProstMutation::Splits(SourceChangeSplitMutation { - actor_splits: changes - .iter() - .map(|(&actor_id, splits)| { - ( - actor_id, - ConnectorSplits { - splits: splits - .clone() - .iter() - .map(ConnectorSplit::from) - .collect(), - }, - ) - }) - .collect(), - }) - } - Mutation::Pause => ProstMutation::Pause(PauseMutation {}), - Mutation::Resume => ProstMutation::Resume(ResumeMutation {}), + Mutation::Pause => PbMutation::Pause(PauseMutation {}), + Mutation::Resume => PbMutation::Resume(ResumeMutation {}), } } - fn from_protobuf(prost: &ProstMutation) -> StreamExecutorResult { + fn from_protobuf(prost: &PbMutation) -> StreamExecutorResult { let mutation = match prost { - ProstMutation::Stop(stop) => { - Mutation::Stop(HashSet::from_iter(stop.get_actors().clone())) - } + PbMutation::Stop(stop) => Mutation::Stop(HashSet::from_iter(stop.get_actors().clone())), - ProstMutation::Update(update) => Mutation::Update { + PbMutation::Update(update) => Mutation::Update { dispatchers: update .dispatcher_update .iter() @@ -472,12 +474,13 @@ impl Mutation { .collect(), }, - ProstMutation::Add(add) => Mutation::Add { + PbMutation::Add(add) => Mutation::Add { adds: add .actor_dispatchers .iter() .map(|(&actor_id, dispatchers)| (actor_id, dispatchers.dispatchers.clone())) .collect(), + added_actors: add.added_actors.iter().copied().collect(), // TODO: remove this and use `SourceChangesSplit` after we support multiple // mutations. splits: add @@ -496,7 +499,7 @@ impl Mutation { .collect(), }, - ProstMutation::Splits(s) => { + PbMutation::Splits(s) => { let mut change_splits: Vec<(ActorId, Vec)> = Vec::with_capacity(s.actor_splits.len()); for (&actor_id, splits) in &s.actor_splits { @@ -513,15 +516,15 @@ impl Mutation { } Mutation::SourceChangeSplit(change_splits.into_iter().collect()) } - ProstMutation::Pause(_) => Mutation::Pause, - ProstMutation::Resume(_) => Mutation::Resume, + PbMutation::Pause(_) => Mutation::Pause, + PbMutation::Resume(_) => Mutation::Resume, }; Ok(mutation) } } impl Barrier { - pub fn to_protobuf(&self) -> ProstBarrier { + pub fn to_protobuf(&self) -> PbBarrier { let Barrier { epoch, mutation, @@ -529,8 +532,8 @@ impl Barrier { passed_actors, .. }: Barrier = self.clone(); - ProstBarrier { - epoch: Some(ProstEpoch { + PbBarrier { + epoch: Some(PbEpoch { curr: epoch.curr, prev: epoch.prev, }), @@ -541,7 +544,7 @@ impl Barrier { } } - pub fn from_protobuf(prost: &ProstBarrier) -> StreamExecutorResult { + pub fn from_protobuf(prost: &PbBarrier) -> StreamExecutorResult { let mutation = prost .mutation .as_ref() @@ -624,19 +627,19 @@ impl Watermark { .map(|new_col_idx| self.with_idx(new_col_idx)) } - pub fn to_protobuf(&self) -> ProstWatermark { - ProstWatermark { - column: Some(ProstInputRef { + pub fn to_protobuf(&self) -> PbWatermark { + PbWatermark { + column: Some(PbInputRef { index: self.col_idx as _, r#type: Some(self.data_type.to_protobuf()), }), - val: Some(ProstDatum { + val: Some(PbDatum { body: serialize_datum(Some(&self.val)), }), } } - pub fn from_protobuf(prost: &ProstWatermark) -> StreamExecutorResult { + pub fn from_protobuf(prost: &PbWatermark) -> StreamExecutorResult { let col_ref = prost.get_column()?; let data_type = DataType::from(col_ref.get_type()?); let val = deserialize_datum(prost.get_val()?.get_body().as_slice(), &data_type)? @@ -692,7 +695,7 @@ impl Message { ) } - pub fn to_protobuf(&self) -> ProstStreamMessage { + pub fn to_protobuf(&self) -> PbStreamMessage { let prost = match self { Self::Chunk(stream_chunk) => { let prost_stream_chunk = stream_chunk.to_protobuf(); @@ -701,12 +704,12 @@ impl Message { Self::Barrier(barrier) => StreamMessage::Barrier(barrier.clone().to_protobuf()), Self::Watermark(watermark) => StreamMessage::Watermark(watermark.to_protobuf()), }; - ProstStreamMessage { + PbStreamMessage { stream_message: Some(prost), } } - pub fn from_protobuf(prost: &ProstStreamMessage) -> StreamExecutorResult { + pub fn from_protobuf(prost: &PbStreamMessage) -> StreamExecutorResult { let res = match prost.get_stream_message()? { StreamMessage::StreamChunk(chunk) => Message::Chunk(StreamChunk::from_protobuf(chunk)?), StreamMessage::Barrier(barrier) => Message::Barrier(Barrier::from_protobuf(barrier)?), diff --git a/src/stream/src/executor/monitor/streaming_stats.rs b/src/stream/src/executor/monitor/streaming_stats.rs index 59aa97fa31314..fc6fe6a03f8f4 100644 --- a/src/stream/src/executor/monitor/streaming_stats.rs +++ b/src/stream/src/executor/monitor/streaming_stats.rs @@ -53,7 +53,6 @@ pub struct StreamingMetrics { pub join_lookup_miss_count: GenericCounterVec, pub join_total_lookup_count: GenericCounterVec, pub join_insert_cache_miss_count: GenericCounterVec, - pub join_may_exist_true_count: GenericCounterVec, pub join_actor_input_waiting_duration_ns: GenericCounterVec, pub join_match_duration_ns: GenericCounterVec, pub join_barrier_align_duration: HistogramVec, @@ -275,7 +274,7 @@ impl StreamingMetrics { let join_lookup_miss_count = register_int_counter_vec_with_registry!( "stream_join_lookup_miss_count", - "Join executor lookup miss count", + "Join executor lookup miss duration", &["actor_id", "side"], registry ) @@ -283,7 +282,7 @@ impl StreamingMetrics { let join_total_lookup_count = register_int_counter_vec_with_registry!( "stream_join_lookup_total_count", - "Join executor lookup total count", + "Join executor lookup total operation", &["actor_id", "side"], registry ) @@ -291,15 +290,7 @@ impl StreamingMetrics { let join_insert_cache_miss_count = register_int_counter_vec_with_registry!( "stream_join_insert_cache_miss_count", - "Count of cache miss when insert rows in join executor", - &["actor_id", "side"], - registry - ) - .unwrap(); - - let join_may_exist_true_count = register_int_counter_vec_with_registry!( - "stream_join_may_exist_true_count", - "Count of may_exist's true returns of when insert rows in join executor", + "Join executor cache miss when insert operation", &["actor_id", "side"], registry ) @@ -486,7 +477,6 @@ impl StreamingMetrics { join_lookup_miss_count, join_total_lookup_count, join_insert_cache_miss_count, - join_may_exist_true_count, join_actor_input_waiting_duration_ns, join_match_duration_ns, join_barrier_align_duration, diff --git a/src/stream/src/executor/mview/materialize.rs b/src/stream/src/executor/mview/materialize.rs index 5ae1d4e5cad63..6bfd1758e00ec 100644 --- a/src/stream/src/executor/mview/materialize.rs +++ b/src/stream/src/executor/mview/materialize.rs @@ -122,7 +122,7 @@ impl MaterializeExecutor { Message::Watermark(w) => Message::Watermark(w), Message::Chunk(chunk) => { match self.conflict_behavior { - ConflictBehavior::OverWrite | ConflictBehavior::IgnoreConflict => { + ConflictBehavior::Overwrite | ConflictBehavior::IgnoreConflict => { // create MaterializeBuffer from chunk let buffer = MaterializeBuffer::fill_buffer_from_chunk( chunk, @@ -138,11 +138,7 @@ impl MaterializeExecutor { let fixed_changes = self .materialize_cache - .handlle_conflict( - buffer, - &self.state_table, - &self.conflict_behavior, - ) + .handle_conflict(buffer, &self.state_table, &self.conflict_behavior) .await?; // TODO(st1page): when materialize partial columns(), we should @@ -430,7 +426,7 @@ impl MaterializeCache { } } - pub async fn handlle_conflict<'a, S: StateStore>( + pub async fn handle_conflict<'a, S: StateStore>( &mut self, buffer: MaterializeBuffer, table: &StateTableInner, @@ -446,7 +442,7 @@ impl MaterializeCache { match row_op { KeyOp::Insert(new_row) => { match conflict_behavior { - ConflictBehavior::OverWrite => { + ConflictBehavior::Overwrite => { match self.force_get(&key) { Some(old_row) => fixed_changes.push(( key.clone(), @@ -476,7 +472,7 @@ impl MaterializeCache { } KeyOp::Delete(_) => { match conflict_behavior { - ConflictBehavior::OverWrite => { + ConflictBehavior::Overwrite => { match self.force_get(&key) { Some(old_row) => { fixed_changes @@ -496,7 +492,7 @@ impl MaterializeCache { } KeyOp::Update((_, new_row)) => { match conflict_behavior { - ConflictBehavior::OverWrite => { + ConflictBehavior::Overwrite => { match self.force_get(&key) { Some(old_row) => fixed_changes.push(( key.clone(), @@ -770,7 +766,7 @@ mod tests { column_ids, 1, Arc::new(AtomicU64::new(0)), - ConflictBehavior::OverWrite, + ConflictBehavior::Overwrite, ) .await, ) @@ -903,7 +899,7 @@ mod tests { column_ids, 1, Arc::new(AtomicU64::new(0)), - ConflictBehavior::OverWrite, + ConflictBehavior::Overwrite, ) .await, ) diff --git a/src/stream/src/executor/now.rs b/src/stream/src/executor/now.rs index 5e489589d059a..7f154fd7da9d7 100644 --- a/src/stream/src/executor/now.rs +++ b/src/stream/src/executor/now.rs @@ -204,7 +204,7 @@ mod tests { assert_eq!( chunk_msg.into_chunk().unwrap().compact(), StreamChunk::from_pretty( - " TSZ + " I + 1617235200001000" ) ); @@ -233,7 +233,7 @@ mod tests { assert_eq!( chunk_msg.into_chunk().unwrap().compact(), StreamChunk::from_pretty( - " TSZ + " I - 1617235200001000 + 1617235200002000" ) diff --git a/src/stream/src/executor/project.rs b/src/stream/src/executor/project.rs index 86ecb80a5feda..50307e7192f7e 100644 --- a/src/stream/src/executor/project.rs +++ b/src/stream/src/executor/project.rs @@ -40,6 +40,10 @@ struct Inner { /// All the watermark derivations, (input_column_index, output_column_index). And the /// derivation expression is the project's expression itself. watermark_derivations: MultiMap, + + /// the selectivity threshold which should be in [0,1]. for the chunk with selectivity less + /// than the threshold, the Project executor will construct a new chunk before expr evaluation, + materialize_selectivity_threshold: f64, } impl ProjectExecutor { @@ -50,6 +54,7 @@ impl ProjectExecutor { exprs: Vec, executor_id: u64, watermark_derivations: MultiMap, + materialize_selectivity_threshold: f64, ) -> Self { let info = ExecutorInfo { schema: input.schema().to_owned(), @@ -74,6 +79,7 @@ impl ProjectExecutor { }, exprs, watermark_derivations, + materialize_selectivity_threshold, }, } } @@ -110,10 +116,12 @@ impl Inner { &self, chunk: StreamChunk, ) -> StreamExecutorResult> { - let chunk = chunk.compact(); - + let chunk = if chunk.selectivity() <= self.materialize_selectivity_threshold { + chunk.compact() + } else { + chunk + }; let (data_chunk, ops) = chunk.into_parts(); - let mut projected_columns = Vec::new(); for expr in &self.exprs { @@ -125,8 +133,9 @@ impl Inner { let new_column = Column::new(evaluated_expr); projected_columns.push(new_column); } - - let new_chunk = StreamChunk::new(ops, projected_columns, None); + let (_, vis) = data_chunk.into_parts(); + let vis = vis.into_visibility(); + let new_chunk = StreamChunk::new(ops, projected_columns, vis); Ok(Some(new_chunk)) } @@ -188,8 +197,7 @@ mod tests { use risingwave_common::array::StreamChunk; use risingwave_common::catalog::{Field, Schema}; use risingwave_common::types::DataType; - use risingwave_expr::expr::{new_binary_expr, InputRefExpression, LiteralExpression}; - use risingwave_pb::expr::expr_node::Type; + use risingwave_expr::expr::build_from_pretty; use super::super::test_utils::MockSource; use super::super::*; @@ -216,15 +224,7 @@ mod tests { }; let source = MockSource::with_chunks(schema, PkIndices::new(), vec![chunk1, chunk2]); - let left_expr = InputRefExpression::new(DataType::Int64, 0); - let right_expr = InputRefExpression::new(DataType::Int64, 1); - let test_expr = new_binary_expr( - Type::Add, - DataType::Int64, - Box::new(left_expr), - Box::new(right_expr), - ) - .unwrap(); + let test_expr = build_from_pretty("(add:int8 $0:int8 $1:int8)"); let project = Box::new(ProjectExecutor::new( ActorContext::create(123), @@ -233,6 +233,7 @@ mod tests { vec![test_expr], 1, MultiMap::new(), + 0.0, )); let mut project = project.execute(); @@ -269,25 +270,8 @@ mod tests { }; let (mut tx, source) = MockSource::channel(schema, PkIndices::new()); - let a_left_expr = InputRefExpression::new(DataType::Int64, 0); - let a_right_expr = LiteralExpression::new(DataType::Int64, Some(ScalarImpl::Int64(1))); - let a_expr = new_binary_expr( - Type::Add, - DataType::Int64, - Box::new(a_left_expr), - Box::new(a_right_expr), - ) - .unwrap(); - - let b_left_expr = InputRefExpression::new(DataType::Int64, 0); - let b_right_expr = LiteralExpression::new(DataType::Int64, Some(ScalarImpl::Int64(1))); - let b_expr = new_binary_expr( - Type::Subtract, - DataType::Int64, - Box::new(b_left_expr), - Box::new(b_right_expr), - ) - .unwrap(); + let a_expr = build_from_pretty("(add:int8 $0:int8 1:int8)"); + let b_expr = build_from_pretty("(subtract:int8 $0:int8 1:int8)"); let project = Box::new(ProjectExecutor::new( ActorContext::create(123), @@ -296,6 +280,7 @@ mod tests { vec![a_expr, b_expr], 1, MultiMap::from_iter(vec![(0, 0), (0, 1)].into_iter()), + 0.0, )); let mut project = project.execute(); diff --git a/src/stream/src/executor/project_set.rs b/src/stream/src/executor/project_set.rs index 3d908d9e55df4..046db5003c56e 100644 --- a/src/stream/src/executor/project_set.rs +++ b/src/stream/src/executor/project_set.rs @@ -210,11 +210,9 @@ mod tests { use risingwave_common::array::StreamChunk; use risingwave_common::catalog::{Field, Schema}; use risingwave_common::types::DataType; - use risingwave_expr::expr::{ - new_binary_expr, Expression, InputRefExpression, LiteralExpression, - }; + use risingwave_expr::expr::{build, Expression, InputRefExpression, LiteralExpression}; use risingwave_expr::table_function::repeat_tf; - use risingwave_pb::expr::expr_node::Type; + use risingwave_pb::expr::expr_node::PbType; use super::super::test_utils::MockSource; use super::super::*; @@ -243,15 +241,16 @@ mod tests { }; let source = MockSource::with_chunks(schema, PkIndices::new(), vec![chunk1, chunk2]); - let left_expr = InputRefExpression::new(DataType::Int64, 0); - let right_expr = InputRefExpression::new(DataType::Int64, 1); - let test_expr = new_binary_expr( - Type::Add, + let test_expr = build( + PbType::Add, DataType::Int64, - Box::new(left_expr), - Box::new(right_expr), + vec![ + Box::new(InputRefExpression::new(DataType::Int64, 0)), + Box::new(InputRefExpression::new(DataType::Int64, 1)), + ], ) .unwrap(); + let tf1 = repeat_tf( LiteralExpression::new(DataType::Int32, Some(1_i32.into())).boxed(), 1, diff --git a/src/stream/src/executor/rearranged_chain.rs b/src/stream/src/executor/rearranged_chain.rs index c713eb231189c..b374d8b408155 100644 --- a/src/stream/src/executor/rearranged_chain.rs +++ b/src/stream/src/executor/rearranged_chain.rs @@ -114,7 +114,7 @@ impl RearrangedChainExecutor { // If the barrier is a conf change of creating this mview, init snapshot from its epoch // and begin to consume the snapshot. // Otherwise, it means we've recovered and the snapshot is already consumed. - let to_consume_snapshot = first_barrier.is_add_dispatcher(self.actor_id); + let to_consume_snapshot = first_barrier.is_newly_added(self.actor_id); // The first barrier message should be propagated. yield Message::Barrier(first_barrier.clone()); diff --git a/src/stream/src/executor/row_id_gen.rs b/src/stream/src/executor/row_id_gen.rs index eea4a3bba7c23..d101fe485c5f0 100644 --- a/src/stream/src/executor/row_id_gen.rs +++ b/src/stream/src/executor/row_id_gen.rs @@ -15,8 +15,9 @@ use futures::StreamExt; use futures_async_stream::try_stream; use risingwave_common::array::column::Column; +use risingwave_common::array::serial_array::{Serial, SerialArrayBuilder}; use risingwave_common::array::stream_chunk::Ops; -use risingwave_common::array::{ArrayBuilder, I64ArrayBuilder, Op, StreamChunk}; +use risingwave_common::array::{ArrayBuilder, Op, StreamChunk}; use risingwave_common::buffer::Bitmap; use risingwave_common::catalog::Schema; use risingwave_common::util::epoch::UNIX_RISINGWAVE_DATE_EPOCH; @@ -77,13 +78,13 @@ impl RowIdGenExecutor { /// Generate a row ID column according to ops. async fn gen_row_id_column_by_op(&mut self, column: &Column, ops: Ops<'_>) -> Column { let len = column.array_ref().len(); - let mut builder = I64ArrayBuilder::new(len); + let mut builder = SerialArrayBuilder::new(len); for (datum, op) in column.array_ref().iter().zip_eq_fast(ops) { // Only refill row_id for insert operation. match op { - Op::Insert => builder.append(Some(self.row_id_generator.next().await)), - _ => builder.append(Some(i64::try_from(datum.unwrap()).unwrap())), + Op::Insert => builder.append(Some(self.row_id_generator.next().await.into())), + _ => builder.append(Some(Serial::try_from(datum.unwrap()).unwrap())), } } @@ -159,7 +160,7 @@ mod tests { #[tokio::test] async fn test_row_id_gen_executor() { let schema = Schema::new(vec![ - Field::unnamed(DataType::Int64), + Field::unnamed(DataType::Serial), Field::unnamed(DataType::Int64), ]); let pk_indices = vec![0]; @@ -184,7 +185,7 @@ mod tests { // Insert operation let chunk1 = StreamChunk::from_pretty( - " I I + " SRL I + . 1 + . 2 + . 6 @@ -198,7 +199,7 @@ mod tests { .unwrap() .into_chunk() .unwrap(); - let row_id_col: &PrimitiveArray = chunk.column_at(row_id_index).array_ref().into(); + let row_id_col: &PrimitiveArray = chunk.column_at(row_id_index).array_ref().into(); row_id_col.iter().for_each(|row_id| { // Should generate row id for insert operations. assert!(row_id.is_some()); @@ -206,7 +207,7 @@ mod tests { // Update operation let chunk2 = StreamChunk::from_pretty( - " I I + " SRL I U- 32874283748 1 U+ 32874283748 999", ); @@ -218,14 +219,14 @@ mod tests { .unwrap() .into_chunk() .unwrap(); - let row_id_col: &PrimitiveArray = chunk.column_at(row_id_index).array_ref().into(); + let row_id_col: &PrimitiveArray = chunk.column_at(row_id_index).array_ref().into(); // Should not generate row id for update operations. - assert_eq!(row_id_col.value_at(0).unwrap(), 32874283748); - assert_eq!(row_id_col.value_at(1).unwrap(), 32874283748); + assert_eq!(row_id_col.value_at(0).unwrap(), Serial::from(32874283748)); + assert_eq!(row_id_col.value_at(1).unwrap(), Serial::from(32874283748)); // Delete operation let chunk3 = StreamChunk::from_pretty( - " I I + " SRL I - 84629409685 1", ); tx.push_chunk(chunk3); @@ -236,8 +237,8 @@ mod tests { .unwrap() .into_chunk() .unwrap(); - let row_id_col: &PrimitiveArray = chunk.column_at(row_id_index).array_ref().into(); + let row_id_col: &PrimitiveArray = chunk.column_at(row_id_index).array_ref().into(); // Should not generate row id for delete operations. - assert_eq!(row_id_col.value_at(0).unwrap(), 84629409685); + assert_eq!(row_id_col.value_at(0).unwrap(), Serial::from(84629409685)); } } diff --git a/src/stream/src/executor/sink.rs b/src/stream/src/executor/sink.rs index f0c82b4e397ce..434fbe8c10ed2 100644 --- a/src/stream/src/executor/sink.rs +++ b/src/stream/src/executor/sink.rs @@ -85,7 +85,7 @@ impl SinkExecutor { input: materialize_executor, metrics, config, - identity: format!("SinkExecutor_{:?}", executor_id), + identity: format!("SinkExecutor {:X?}", executor_id), pk_indices, schema, connector_params, diff --git a/src/stream/src/executor/sort.rs b/src/stream/src/executor/sort.rs index cc6b606443671..fb700b6ddabcf 100644 --- a/src/stream/src/executor/sort.rs +++ b/src/stream/src/executor/sort.rs @@ -217,7 +217,7 @@ impl SortExecutor { // Update the vnode bitmap for the state table if asked. Also update the buffer. if let Some(vnode_bitmap) = barrier.as_update_vnode_bitmap(self.context.id) { - let prev_vnode_bitmap = + let (prev_vnode_bitmap, _cache_may_stale) = self.state_table.update_vnode_bitmap(vnode_bitmap.clone()); self.fill_buffer(Some(&prev_vnode_bitmap), &vnode_bitmap) .await?; diff --git a/src/stream/src/executor/source/source_executor.rs b/src/stream/src/executor/source/source_executor.rs index 0558b70e6f5e0..67d33cc059a77 100644 --- a/src/stream/src/executor/source/source_executor.rs +++ b/src/stream/src/executor/source/source_executor.rs @@ -488,21 +488,21 @@ impl Debug for SourceExecutor { #[cfg(test)] mod tests { - use std::sync::atomic::AtomicU64; + use std::time::Duration; use maplit::{convert_args, hashmap}; use risingwave_common::array::StreamChunk; - use risingwave_common::catalog::{ColumnId, ConflictBehavior, Field, Schema, TableId}; + use risingwave_common::catalog::{ColumnId, Field, Schema, TableId}; use risingwave_common::test_prelude::StreamChunkTestExt; use risingwave_common::types::DataType; - use risingwave_common::util::sort_util::{ColumnOrder, OrderType}; use risingwave_connector::source::datagen::DatagenSplit; use risingwave_pb::catalog::StreamSourceInfo; - use risingwave_pb::plan_common::RowFormatType as ProstRowFormatType; + use risingwave_pb::plan_common::PbRowFormatType; use risingwave_source::connector_test_utils::create_source_desc_builder; use risingwave_storage::memory::MemoryStateStore; use tokio::sync::mpsc::unbounded_channel; + use tracing_test::traced_test; use super::*; use crate::executor::ActorContext; @@ -519,7 +519,7 @@ mod tests { let pk_column_ids = vec![0]; let pk_indices = vec![0]; let source_info = StreamSourceInfo { - row_format: ProstRowFormatType::Native as i32, + row_format: PbRowFormatType::Native as i32, ..Default::default() }; let (barrier_tx, barrier_rx) = unbounded_channel::(); @@ -570,6 +570,7 @@ mod tests { let init_barrier = Barrier::new_test_barrier(1).with_mutation(Mutation::Add { adds: HashMap::new(), + added_actors: HashSet::new(), splits: hashmap! { ActorId::default() => vec![ SplitImpl::Datagen(DatagenSplit { @@ -600,6 +601,7 @@ mod tests { ); } + #[traced_test] #[tokio::test] async fn test_split_change_mutation() { let table_id = TableId::default(); @@ -610,14 +612,14 @@ mod tests { let pk_column_ids = vec![0]; let pk_indices = vec![0_usize]; let source_info = StreamSourceInfo { - row_format: ProstRowFormatType::Native as i32, + row_format: PbRowFormatType::Native as i32, ..Default::default() }; let properties = convert_args!(hashmap!( "connector" => "datagen", - "fields.v1.min" => "1", - "fields.v1.max" => "1000", - "fields.v1.seed" => "12345", + "fields.v1.kind" => "sequence", + "fields.v1.start" => "11", + "fields.v1.end" => "11111", )); let source_desc_builder = create_source_desc_builder( @@ -658,23 +660,11 @@ mod tests { u64::MAX, 1, ); - - let mut materialize = MaterializeExecutor::for_test( - Box::new(executor), - mem_state_store.clone(), - TableId::from(0x2333), - vec![ColumnOrder::new(0, OrderType::ascending())], - column_ids, - 2, - Arc::new(AtomicU64::new(0)), - ConflictBehavior::NoCheck, - ) - .await - .boxed() - .execute(); + let mut handler = Box::new(executor).execute(); let init_barrier = Barrier::new_test_barrier(1).with_mutation(Mutation::Add { adds: HashMap::new(), + added_actors: HashSet::new(), splits: hashmap! { ActorId::default() => vec![ SplitImpl::Datagen(DatagenSplit { @@ -687,11 +677,11 @@ mod tests { }); barrier_tx.send(init_barrier).unwrap(); - (materialize.next().await.unwrap().unwrap()) + (handler.next().await.unwrap().unwrap()) .into_barrier() .unwrap(); - let mut ready_chunks = materialize.ready_chunks(10); + let mut ready_chunks = handler.ready_chunks(10); let chunks = (ready_chunks.next().await.unwrap()) .into_iter() .map(|msg| msg.unwrap().into_chunk().unwrap()) @@ -701,10 +691,10 @@ mod tests { chunk_1, StreamChunk::from_pretty( " i - + 533 - + 833 - + 738 - + 344", + + 11 + + 14 + + 17 + + 20", ) ); @@ -719,6 +709,11 @@ mod tests { split_num: 3, start_offset: None, }), + SplitImpl::Datagen(DatagenSplit { + split_index: 2, + split_num: 3, + start_offset: None, + }), ]; let change_split_mutation = @@ -751,18 +746,22 @@ mod tests { let chunk_2 = StreamChunk::concat(chunks).sort_rows(); assert_eq!( chunk_2, - // mixed from datagen split 0 and 1 + // mixed from datagen split 0, 1 and 2 StreamChunk::from_pretty( " i + + 12 + + 13 + + 15 + + 16 + + 18 + + 19 + + 23 + + 26 + 29 - + 201 - + 344 - + 425 - + 525 - + 533 - + 833", + + 32", ) ); + tracing::debug!("chunk_2: {:?}", chunk_2.to_pretty_string()); let barrier = Barrier::new_test_barrier(3).with_mutation(Mutation::Pause); barrier_tx.send(barrier).unwrap(); diff --git a/src/stream/src/executor/source/state_table_handler.rs b/src/stream/src/executor/source/state_table_handler.rs index 1377120a075b7..f578db63221eb 100644 --- a/src/stream/src/executor/source/state_table_handler.rs +++ b/src/stream/src/executor/source/state_table_handler.rs @@ -27,8 +27,8 @@ use risingwave_common::{bail, row}; use risingwave_connector::source::{SplitId, SplitImpl, SplitMetaData}; use risingwave_hummock_sdk::key::next_key; use risingwave_pb::catalog::table::TableType; -use risingwave_pb::catalog::Table as ProstTable; -use risingwave_pb::common::{PbColumnOrder, PbDirection, PbOrderType}; +use risingwave_pb::catalog::PbTable; +use risingwave_pb::common::{PbColumnOrder, PbDirection, PbNullsAre, PbOrderType}; use risingwave_pb::data::data_type::TypeName; use risingwave_pb::data::DataType; use risingwave_pb::plan_common::{ColumnCatalog, ColumnDesc}; @@ -46,7 +46,7 @@ pub struct SourceStateTableHandler { } impl SourceStateTableHandler { - pub async fn from_table_catalog(table_catalog: &ProstTable, store: S) -> Self { + pub async fn from_table_catalog(table_catalog: &PbTable, store: S) -> Self { // The state of source should not be cleaned up by retention_seconds assert!(!table_catalog .properties @@ -199,7 +199,7 @@ impl SourceStateTableHandler { // align with schema defined in `LogicalSource::infer_internal_table_catalog`. The function is used // for test purpose and should not be used in production. -pub fn default_source_internal_table(id: u32) -> ProstTable { +pub fn default_source_internal_table(id: u32) -> PbTable { let make_column = |column_type: TypeName, column_id: i32| -> ColumnCatalog { ColumnCatalog { column_desc: Some(ColumnDesc { @@ -218,7 +218,7 @@ pub fn default_source_internal_table(id: u32) -> ProstTable { make_column(TypeName::Varchar, 0), make_column(TypeName::Jsonb, 1), ]; - ProstTable { + PbTable { id, schema_id: SchemaId::placeholder().schema_id, database_id: DatabaseId::placeholder().database_id, @@ -230,6 +230,7 @@ pub fn default_source_internal_table(id: u32) -> ProstTable { column_index: 0, order_type: Some(PbOrderType { direction: PbDirection::Ascending as _, + nulls_are: PbNullsAre::Largest as _, }), }], ..Default::default() diff --git a/src/stream/src/executor/subtask.rs b/src/stream/src/executor/subtask.rs index c4873087c568a..cfdd8ba12e7a1 100644 --- a/src/stream/src/executor/subtask.rs +++ b/src/stream/src/executor/subtask.rs @@ -18,7 +18,9 @@ use tokio::sync::mpsc; use tokio::sync::mpsc::error::SendError; use tokio_stream::wrappers::ReceiverStream; -use super::{BoxedExecutor, Executor, ExecutorInfo, MessageStreamItem}; +use super::actor::spawn_blocking_drop_stream; +use super::{BoxedExecutor, Executor, ExecutorInfo, Message, MessageStreamItem}; +use crate::task::ActorId; /// Handle used to drive the subtask. pub type SubtaskHandle = impl Future + Send + 'static; @@ -59,7 +61,7 @@ impl Executor for SubtaskRxExecutor { /// Used when there're multiple stateful executors in an actor. These subtasks can be concurrently /// executed to improve the I/O performance, while the computing resource can be still bounded to a /// single thread. -pub fn wrap(input: BoxedExecutor) -> (SubtaskHandle, SubtaskRxExecutor) { +pub fn wrap(input: BoxedExecutor, actor_id: ActorId) -> (SubtaskHandle, SubtaskRxExecutor) { let (tx, rx) = mpsc::channel(1); let rx_executor = SubtaskRxExecutor { info: ExecutorInfo { @@ -71,7 +73,18 @@ pub fn wrap(input: BoxedExecutor) -> (SubtaskHandle, SubtaskRxExecutor) { let handle = async move { let mut input = input.execute(); + while let Some(item) = input.next().await { + // Decide whether to stop the subtask. We explicitly do this instead of relying on the + // termination of the input stream, because we don't want to exhaust the stream, which + // causes the stream dropped in the scope of the current async task and blocks other + // actors. See `spawn_blocking_drop_stream` for more details. + let to_stop = match &item { + Ok(Message::Barrier(barrier)) => barrier.is_stop(actor_id), + Ok(_) => false, + Err(_) => true, + }; + // It's possible that the downstream itself yields an error (e.g. from remote input) and // finishes, so we may fail to send the message. In this case, we can simply ignore the // send error and exit as well. If the message itself is another error, log it. @@ -84,7 +97,13 @@ pub fn wrap(input: BoxedExecutor) -> (SubtaskHandle, SubtaskRxExecutor) { } break; } + + if to_stop { + break; + } } + + spawn_blocking_drop_stream(input).await; } .instrument_await("Subtask"); diff --git a/src/stream/src/executor/test_utils.rs b/src/stream/src/executor/test_utils.rs index 8d86ead85473b..e85b2be70a0c5 100644 --- a/src/stream/src/executor/test_utils.rs +++ b/src/stream/src/executor/test_utils.rs @@ -201,6 +201,14 @@ pub trait StreamExecutorTestExt: MessageStream + Unpin { self.next_unwrap_ready() .map(|msg| msg.into_barrier().expect("expect barrier")) } + + /// Asserts that the executor is ready on a [`Watermark`] now, returning the next barrier. + /// + /// Panics if it is pending or the next message is not a [`Watermark`]. + fn next_unwrap_ready_watermark(&mut self) -> StreamExecutorResult { + self.next_unwrap_ready() + .map(|msg| msg.into_watermark().expect("expect watermark")) + } } // FIXME: implement on any `impl MessageStream` if the analyzer works well. @@ -218,7 +226,7 @@ pub mod agg_executor { use crate::common::table::state_table::StateTable; use crate::common::StateTableColumnMapping; - use crate::executor::agg_common::AggExecutorArgs; + use crate::executor::agg_common::{AggExecutorArgs, SimpleAggExecutorExtraArgs}; use crate::executor::aggregation::{AggCall, AggStateStorage}; use crate::executor::{ ActorContextRef, BoxedExecutor, Executor, GlobalSimpleAggExecutor, PkIndices, @@ -381,7 +389,7 @@ pub mod agg_executor { distinct_dedup_tables: Default::default(), watermark_epoch: Arc::new(AtomicU64::new(0)), - extra: None, + extra: SimpleAggExecutorExtraArgs {}, }) .unwrap() .boxed() diff --git a/src/stream/src/executor/top_n/group_top_n.rs b/src/stream/src/executor/top_n/group_top_n.rs index de8a42edb86e4..9cc03f2e66a71 100644 --- a/src/stream/src/executor/top_n/group_top_n.rs +++ b/src/stream/src/executor/top_n/group_top_n.rs @@ -28,7 +28,7 @@ use risingwave_storage::StateStore; use super::top_n_cache::TopNCacheTrait; use super::utils::*; use super::TopNCache; -use crate::cache::{cache_may_stale, new_unbounded, ExecutorCache}; +use crate::cache::{new_unbounded, ExecutorCache}; use crate::common::table::state_table::StateTable; use crate::error::StreamResult; use crate::executor::error::StreamExecutorResult; @@ -37,7 +37,7 @@ use crate::executor::{ActorContextRef, Executor, ExecutorInfo, PkIndices, Waterm use crate::task::AtomicU64Ref; pub type GroupTopNExecutor = - TopNExecutorWrapper>; + TopNExecutorWrapper>; impl GroupTopNExecutor { #[allow(clippy::too_many_arguments)] @@ -56,7 +56,7 @@ impl GroupTopNExecutor GroupTopNExecutor { +pub struct InnerGroupTopNExecutor { info: ExecutorInfo, /// `LIMIT XXX`. None means no limit. @@ -94,7 +94,7 @@ pub struct InnerGroupTopNExecutorNew InnerGroupTopNExecutorNew { +impl InnerGroupTopNExecutor { #[allow(clippy::too_many_arguments)] pub fn new( input_info: ExecutorInfo, @@ -158,7 +158,7 @@ impl DerefMut for GroupTopNCache TopNExecutorBase - for InnerGroupTopNExecutorNew + for InnerGroupTopNExecutor where TopNCache: TopNCacheTrait, { @@ -178,7 +178,8 @@ where // If 'self.caches' does not already have a cache for the current group, create a new // cache for it and insert it into `self.caches` if !self.caches.contains(group_cache_key) { - let mut topn_cache = TopNCache::new(self.offset, self.limit); + let mut topn_cache = + TopNCache::new(self.offset, self.limit, self.schema().data_types()); self.managed_state .init_topn_cache(Some(group_key), &mut topn_cache) .await?; @@ -221,12 +222,12 @@ where } fn update_vnode_bitmap(&mut self, vnode_bitmap: Arc) { - let previous_vnode_bitmap = self + let (_previous_vnode_bitmap, cache_may_stale) = self .managed_state .state_table - .update_vnode_bitmap(vnode_bitmap.clone()); + .update_vnode_bitmap(vnode_bitmap); - if cache_may_stale(&previous_vnode_bitmap, &vnode_bitmap) { + if cache_may_stale { self.caches.clear(); } } diff --git a/src/stream/src/executor/top_n/group_top_n_appendonly.rs b/src/stream/src/executor/top_n/group_top_n_appendonly.rs index 48b31d5d1fc4e..c173f44759e8f 100644 --- a/src/stream/src/executor/top_n/group_top_n_appendonly.rs +++ b/src/stream/src/executor/top_n/group_top_n_appendonly.rs @@ -42,7 +42,6 @@ use super::group_top_n::GroupTopNCache; use super::top_n_cache::AppendOnlyTopNCacheTrait; use super::utils::*; use super::TopNCache; -use crate::cache::cache_may_stale; use crate::common::table::state_table::StateTable; use crate::error::StreamResult; use crate::executor::error::StreamExecutorResult; @@ -54,7 +53,7 @@ use crate::task::AtomicU64Ref; /// to keep all the data records/rows that have been seen. As long as a record /// is no longer being in the result set, it can be deleted. pub type AppendOnlyGroupTopNExecutor = - TopNExecutorWrapper>; + TopNExecutorWrapper>; impl AppendOnlyGroupTopNExecutor @@ -75,7 +74,7 @@ impl Ok(TopNExecutorWrapper { input, ctx, - inner: InnerAppendOnlyGroupTopNExecutorNew::new( + inner: InnerAppendOnlyGroupTopNExecutor::new( info, storage_key, offset_and_limit, @@ -89,7 +88,7 @@ impl } } -pub struct InnerAppendOnlyGroupTopNExecutorNew { +pub struct InnerAppendOnlyGroupTopNExecutor { info: ExecutorInfo, /// `LIMIT XXX`. None means no limit. @@ -114,7 +113,7 @@ pub struct InnerAppendOnlyGroupTopNExecutorNew - InnerAppendOnlyGroupTopNExecutorNew + InnerAppendOnlyGroupTopNExecutor { #[allow(clippy::too_many_arguments)] pub fn new( @@ -153,7 +152,7 @@ impl } #[async_trait] impl TopNExecutorBase - for InnerAppendOnlyGroupTopNExecutorNew + for InnerAppendOnlyGroupTopNExecutor where TopNCache: AppendOnlyTopNCacheTrait, { @@ -164,7 +163,7 @@ where let keys = K::build(&self.group_by, chunk.data_chunk())?; let data_types = self.schema().data_types(); - let row_deserializer = RowDeserializer::new(data_types); + let row_deserializer = RowDeserializer::new(data_types.clone()); for ((op, row_ref), group_cache_key) in chunk.rows().zip_eq_debug(keys.iter()) { // The pk without group by @@ -176,7 +175,7 @@ where // If 'self.caches' does not already have a cache for the current group, create a new // cache for it and insert it into `self.caches` if !self.caches.contains(group_cache_key) { - let mut topn_cache = TopNCache::new(self.offset, self.limit); + let mut topn_cache = TopNCache::new(self.offset, self.limit, data_types.clone()); self.managed_state .init_topn_cache(Some(group_key), &mut topn_cache) .await?; @@ -207,12 +206,12 @@ where } fn update_vnode_bitmap(&mut self, vnode_bitmap: Arc) { - let previous_vnode_bitmap = self + let (_previous_vnode_bitmap, cache_may_stale) = self .managed_state .state_table - .update_vnode_bitmap(vnode_bitmap.clone()); + .update_vnode_bitmap(vnode_bitmap); - if cache_may_stale(&previous_vnode_bitmap, &vnode_bitmap) { + if cache_may_stale { self.caches.clear(); } } diff --git a/src/stream/src/executor/top_n/top_n_appendonly.rs b/src/stream/src/executor/top_n/top_n_appendonly.rs index 626b45a60f9df..fcdab8550f2a3 100644 --- a/src/stream/src/executor/top_n/top_n_appendonly.rs +++ b/src/stream/src/executor/top_n/top_n_appendonly.rs @@ -129,6 +129,7 @@ impl InnerAppendOnlyTopNExecutor::new(state_table, cache_key_serde.clone()); + let data_types = schema.data_types(); Ok(Self { info: ExecutorInfo { @@ -138,7 +139,7 @@ impl InnerAppendOnlyTopNExecutor { pub offset: usize, /// Assumption: `limit != 0` pub limit: usize, + + /// Data types for the full row. + /// + /// For debug formatting only. + data_types: Vec, +} + +impl Debug for TopNCache { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "TopNCache {{\n offset: {}, limit: {}, high_capacity: {},\n", + self.offset, self.limit, self.high_capacity + )?; + + fn format_cache( + f: &mut std::fmt::Formatter<'_>, + cache: &BTreeMap, + data_types: &[DataType], + ) -> std::fmt::Result { + if cache.is_empty() { + return write!(f, " "); + } + write!( + f, + " {}", + cache + .iter() + .format_with("\n ", |item, f| f(&format_args!( + "{:?}, {}", + item.0, + item.1.deserialize(data_types).unwrap().display(), + ))) + ) + } + + writeln!(f, " low:")?; + format_cache(f, &self.low, &self.data_types)?; + writeln!(f, "\n middle:")?; + format_cache(f, &self.middle, &self.data_types)?; + writeln!(f, "\n high:")?; + format_cache(f, &self.high, &self.data_types)?; + + write!(f, "\n}}")?; + Ok(()) + } } /// `CacheKey` is composed of `(order_by, remaining columns of pk)`. @@ -67,10 +116,11 @@ pub trait TopNCacheTrait { /// /// Changes in `self.middle` is recorded to `res_ops` and `res_rows`, which will be /// used to generate messages to be sent to downstream operators. + #[allow(clippy::too_many_arguments)] fn insert( &mut self, cache_key: CacheKey, - row: impl Row, + row: impl Row + Send, res_ops: &mut Vec, res_rows: &mut Vec, ); @@ -96,7 +146,8 @@ pub trait TopNCacheTrait { } impl TopNCache { - pub fn new(offset: usize, limit: usize) -> Self { + /// `data_types` -- Data types for the full row. + pub fn new(offset: usize, limit: usize, data_types: Vec) -> Self { assert!(limit != 0); if WITH_TIES { // It's trickier to support. @@ -113,6 +164,7 @@ impl TopNCache { .unwrap_or(usize::MAX), offset, limit, + data_types, } } @@ -137,13 +189,19 @@ impl TopNCache { pub fn is_middle_cache_full(&self) -> bool { // For WITH_TIES, the middle cache can exceed the capacity. if !WITH_TIES { - assert!(self.middle.len() <= self.limit); + assert!( + self.middle.len() <= self.limit, + "the middle cache exceeds the capacity\n{self:?}" + ); } let full = self.middle.len() >= self.limit; if full { assert!(self.is_low_cache_full()); } else { - assert!(self.high.is_empty()); + assert!( + self.high.is_empty(), + "the high cache is not empty when middle cache is not full:\n{self:?}" + ); } full } @@ -153,11 +211,33 @@ impl TopNCache { if !WITH_TIES { assert!(self.high.len() <= self.high_capacity); } - let full = self.high.len() >= self.high_capacity; - if full { - assert!(self.is_middle_cache_full()); + self.high.len() >= self.high_capacity + } + + /// Use this method instead of `self.high.insert` directly when possible. + /// + /// It only inserts into high cache if the key is smaller than the largest key in the high + /// cache. Otherwise, we simply ignore the row. We will wait until the high cache becomes + /// empty and fill it at that time. + fn insert_high_cache(&mut self, cache_key: CacheKey, row: CompactedRow, is_from_middle: bool) { + if !self.is_high_cache_full() { + if is_from_middle { + self.high.insert(cache_key, row); + return; + } + // For direct insert, we need to check if the key is smaller than the largest key + if let Some(high_last) = self.high.last_key_value() && cache_key <= *high_last.0 { + debug_assert!(cache_key != *high_last.0, "cache_key should be unique"); + self.high.insert(cache_key, row); + } + } else { + let high_last = self.high.last_entry().unwrap(); + if cache_key <= *high_last.key() { + debug_assert!(cache_key != *high_last.key(), "cache_key should be unique"); + high_last.remove_entry(); + self.high.insert(cache_key, row); + } } - full } } @@ -166,7 +246,7 @@ impl TopNCacheTrait for TopNCache { fn insert( &mut self, cache_key: CacheKey, - row: impl Row, + row: impl Row + Send, res_ops: &mut Vec, res_rows: &mut Vec, ) { @@ -195,6 +275,7 @@ impl TopNCacheTrait for TopNCache { return; } + let mut is_from_middle = false; let elem_to_compare_with_high = { let middle_last = self.middle.last_entry().unwrap(); if elem_to_compare_with_middle.0 <= *middle_last.key() { @@ -207,23 +288,18 @@ impl TopNCacheTrait for TopNCache { res_rows.push(elem_to_compare_with_middle.1.clone()); self.middle .insert(elem_to_compare_with_middle.0, elem_to_compare_with_middle.1); + is_from_middle = true; res } else { elem_to_compare_with_middle } }; - if !self.is_high_cache_full() { - self.high - .insert(elem_to_compare_with_high.0, elem_to_compare_with_high.1); - } else { - let high_last = self.high.last_entry().unwrap(); - if elem_to_compare_with_high.0 <= *high_last.key() { - high_last.remove_entry(); - self.high - .insert(elem_to_compare_with_high.0, elem_to_compare_with_high.1); - } - } + self.insert_high_cache( + elem_to_compare_with_high.0, + elem_to_compare_with_high.1, + is_from_middle, + ); } #[allow(clippy::too_many_arguments)] @@ -308,7 +384,7 @@ impl TopNCacheTrait for TopNCache { fn insert( &mut self, cache_key: CacheKey, - row: impl Row, + row: impl Row + Send, res_ops: &mut Vec, res_rows: &mut Vec, ) { @@ -381,21 +457,11 @@ impl TopNCacheTrait for TopNCache { Ordering::Greater => { // The row is in high. let elem_to_compare_with_high = elem_to_compare_with_middle; - if !self.is_high_cache_full() { - self.high.insert( - elem_to_compare_with_high.0, - (&elem_to_compare_with_high.1).into(), - ); - } else { - let high_last = self.high.last_entry().unwrap(); - if elem_to_compare_with_high.0 <= *high_last.key() { - high_last.remove_entry(); - self.high.insert( - elem_to_compare_with_high.0, - (&elem_to_compare_with_high.1).into(), - ); - } - } + self.insert_high_cache( + elem_to_compare_with_high.0, + elem_to_compare_with_high.1.into(), + false, + ); } } } diff --git a/src/stream/src/executor/top_n/top_n_plain.rs b/src/stream/src/executor/top_n/top_n_plain.rs index 8356380e55f3a..faba24ef9d35f 100644 --- a/src/stream/src/executor/top_n/top_n_plain.rs +++ b/src/stream/src/executor/top_n/top_n_plain.rs @@ -30,7 +30,7 @@ use crate::executor::{ActorContextRef, Executor, ExecutorInfo, PkIndices, Waterm /// `TopNExecutor` works with input with modification, it keeps all the data /// records/rows that have been seen, and returns topN records overall. pub type TopNExecutor = - TopNExecutorWrapper>; + TopNExecutorWrapper>; impl TopNExecutor { #[allow(clippy::too_many_arguments)] @@ -48,7 +48,7 @@ impl TopNExecutor { Ok(TopNExecutorWrapper { input, ctx, - inner: InnerTopNExecutorNew::new( + inner: InnerTopNExecutor::new( info, storage_key, offset_and_limit, @@ -76,7 +76,7 @@ impl TopNExecutor { Ok(TopNExecutorWrapper { input, ctx, - inner: InnerTopNExecutorNew::new( + inner: InnerTopNExecutor::new( info, storage_key, offset_and_limit, @@ -102,7 +102,7 @@ impl TopNExecutor { ) -> StreamResult { let info = input.info(); - let mut inner = InnerTopNExecutorNew::new( + let mut inner = InnerTopNExecutor::new( info, storage_key, offset_and_limit, @@ -111,13 +111,13 @@ impl TopNExecutor { state_table, )?; - inner.cache.high_capacity = 1; + inner.cache.high_capacity = 2; Ok(TopNExecutorWrapper { input, ctx, inner }) } } -pub struct InnerTopNExecutorNew { +pub struct InnerTopNExecutor { info: ExecutorInfo, /// The storage key indices of the `TopNExecutor` @@ -132,7 +132,7 @@ pub struct InnerTopNExecutorNew { cache_key_serde: CacheKeySerde, } -impl InnerTopNExecutorNew { +impl InnerTopNExecutor { /// # Arguments /// /// `storage_key` -- the storage pk. It's composed of the ORDER BY columns and the missing @@ -158,6 +158,7 @@ impl InnerTopNExecutorNew { let cache_key_serde = create_cache_key_serde(&storage_key, &pk_indices, &schema, &order_by, &[]); let managed_state = ManagedTopNState::::new(state_table, cache_key_serde.clone()); + let data_types = schema.data_types(); Ok(Self { info: ExecutorInfo { @@ -167,14 +168,14 @@ impl InnerTopNExecutorNew { }, managed_state, storage_key_indices: storage_key.into_iter().map(|op| op.column_index).collect(), - cache: TopNCache::new(num_offset, num_limit), + cache: TopNCache::new(num_offset, num_limit, data_types), cache_key_serde, }) } } #[async_trait] -impl TopNExecutorBase for InnerTopNExecutorNew +impl TopNExecutorBase for InnerTopNExecutor where TopNCache: TopNCacheTrait, { @@ -1079,10 +1080,11 @@ mod tests { ), StreamChunk::from_pretty( " I I - + 3 8 - + 1 6 - + 2 7 - + 10 9", + + 3 6 + + 3 7 + + 1 8 + + 2 9 + + 10 10", ), StreamChunk::from_pretty( " I I @@ -1090,7 +1092,7 @@ mod tests { ), StreamChunk::from_pretty( " I I - - 1 6", + - 1 8", ), ]; let schema = Schema { @@ -1168,11 +1170,13 @@ mod tests { *res.as_chunk().unwrap(), StreamChunk::from_pretty( " I I - + 3 8 - - 3 8 + + 3 6 + + 3 7 + - 3 7 + - 3 6 - 3 2 - + 1 6 - + 2 7" + + 1 8 + + 2 9" ) ); @@ -1185,15 +1189,16 @@ mod tests { ) ); - // High cache has only one capacity, but we need to trigger 2 inserts here! + // High cache has only 2 capacity, but we need to trigger 3 inserts here! let res = top_n_executor.next().await.unwrap().unwrap(); assert_eq!( *res.as_chunk().unwrap(), StreamChunk::from_pretty( " I I - - 1 6 + - 1 8 + 3 2 - + 3 8 + + 3 6 + + 3 7 " ) ); @@ -1219,10 +1224,11 @@ mod tests { ), StreamChunk::from_pretty( " I I - + 3 8 - + 1 6 - + 2 7 - + 10 9", + + 3 6 + + 3 7 + + 1 8 + + 2 9 + + 10 10", ), ]; let schema = Schema { @@ -1251,7 +1257,7 @@ mod tests { ), StreamChunk::from_pretty( " I I - - 1 6", + - 1 8", ), ]; let schema = Schema { @@ -1314,11 +1320,13 @@ mod tests { *res.as_chunk().unwrap(), StreamChunk::from_pretty( " I I - + 3 8 - - 3 8 + + 3 6 + + 3 7 + - 3 7 + - 3 6 - 3 2 - + 1 6 - + 2 7" + + 1 8 + + 2 9" ) ); @@ -1366,19 +1374,20 @@ mod tests { ) ); - // High cache has only one capacity, but we need to trigger 2 inserts here! + // High cache has only 2 capacity, but we need to trigger 3 inserts here! let res = top_n_executor.next().await.unwrap().unwrap(); assert_eq!( *res.as_chunk().unwrap(), StreamChunk::from_pretty( " I I - - 1 6 + - 1 8 + 3 2 - + 3 8 + + 3 6 + + 3 7 " ) ); - + println!("hello"); // barrier assert_matches!( top_n_executor.next().await.unwrap().unwrap(), diff --git a/src/stream/src/executor/watermark_filter.rs b/src/stream/src/executor/watermark_filter.rs index f43b17b75c7c3..0b587b23ff5e4 100644 --- a/src/stream/src/executor/watermark_filter.rs +++ b/src/stream/src/executor/watermark_filter.rs @@ -23,7 +23,7 @@ use risingwave_common::row::{OwnedRow, Row}; use risingwave_common::types::{DataType, ScalarImpl}; use risingwave_common::{bail, row}; use risingwave_expr::expr::{ - new_binary_expr, BoxedExpression, Expression, InputRefExpression, LiteralExpression, + build, BoxedExpression, Expression, InputRefExpression, LiteralExpression, }; use risingwave_expr::Result as ExprResult; use risingwave_pb::expr::expr_node::Type; @@ -199,7 +199,8 @@ impl WatermarkFilterExecutor { Message::Barrier(barrier) => { // Update the vnode bitmap for state tables of all agg calls if asked. if let Some(vnode_bitmap) = barrier.as_update_vnode_bitmap(ctx.id) { - let previous_vnode_bitmap = table.update_vnode_bitmap(vnode_bitmap.clone()); + let (previous_vnode_bitmap, _cache_may_stale) = + table.update_vnode_bitmap(vnode_bitmap.clone()); // Take the global max watermark when scaling happens. if previous_vnode_bitmap != vnode_bitmap { @@ -235,11 +236,13 @@ impl WatermarkFilterExecutor { event_time_col_idx: usize, watermark: ScalarImpl, ) -> ExprResult { - new_binary_expr( + build( Type::GreaterThanOrEqual, DataType::Boolean, - InputRefExpression::new(watermark_type.clone(), event_time_col_idx).boxed(), - LiteralExpression::new(watermark_type, Some(watermark)).boxed(), + vec![ + InputRefExpression::new(watermark_type.clone(), event_time_col_idx).boxed(), + LiteralExpression::new(watermark_type, Some(watermark)).boxed(), + ], ) } @@ -282,8 +285,9 @@ mod tests { use risingwave_common::array::StreamChunk; use risingwave_common::catalog::{ColumnDesc, ColumnId, Field, Schema, TableId}; use risingwave_common::test_prelude::StreamChunkTestExt; - use risingwave_common::types::{IntervalUnit, NaiveDateWrapper}; + use risingwave_common::types::Date; use risingwave_common::util::sort_util::OrderType; + use risingwave_expr::expr::build_from_pretty; use risingwave_storage::memory::MemoryStateStore; use risingwave_storage::table::Distribution; @@ -323,8 +327,6 @@ mod tests { async fn create_watermark_filter_executor( mem_state: MemoryStateStore, ) -> (BoxedExecutor, MessageSender) { - let interval_type = DataType::Interval; - let schema = Schema { fields: vec![ Field::unnamed(DataType::Int16), // pk @@ -332,19 +334,7 @@ mod tests { ], }; - let watermark_expr = new_binary_expr( - Type::Subtract, - WATERMARK_TYPE.clone(), - InputRefExpression::new(WATERMARK_TYPE.clone(), 1).boxed(), - LiteralExpression::new( - interval_type, - Some(ScalarImpl::Interval(IntervalUnit::from_month_day_usec( - 0, 1, 0, - ))), - ) - .boxed(), - ) - .unwrap(); + let watermark_expr = build_from_pretty("(subtract:timestamp $1:timestamp 1day:interval)"); let table = create_in_memory_state_table( mem_state, @@ -429,8 +419,8 @@ mod tests { let watermark = executor.next().await.unwrap().unwrap(); assert_eq!( watermark.into_watermark().unwrap(), - watermark!(ScalarImpl::NaiveDateTime( - NaiveDateWrapper::from_ymd_uncheck(2022, 11, 7).and_hms_uncheck(0, 0, 0) + watermark!(ScalarImpl::Timestamp( + Date::from_ymd_uncheck(2022, 11, 7).and_hms_uncheck(0, 0, 0) )) ); @@ -452,8 +442,8 @@ mod tests { let watermark = executor.next().await.unwrap().unwrap(); assert_eq!( watermark.into_watermark().unwrap(), - watermark!(ScalarImpl::NaiveDateTime( - NaiveDateWrapper::from_ymd_uncheck(2022, 11, 9).and_hms_uncheck(0, 0, 0) + watermark!(ScalarImpl::Timestamp( + Date::from_ymd_uncheck(2022, 11, 9).and_hms_uncheck(0, 0, 0) )) ); @@ -476,8 +466,8 @@ mod tests { let watermark = executor.next().await.unwrap().unwrap(); assert_eq!( watermark.into_watermark().unwrap(), - watermark!(ScalarImpl::NaiveDateTime( - NaiveDateWrapper::from_ymd_uncheck(2022, 11, 9).and_hms_uncheck(0, 0, 0) + watermark!(ScalarImpl::Timestamp( + Date::from_ymd_uncheck(2022, 11, 9).and_hms_uncheck(0, 0, 0) )) ); @@ -495,8 +485,8 @@ mod tests { let watermark = executor.next().await.unwrap().unwrap(); assert_eq!( watermark.into_watermark().unwrap(), - watermark!(ScalarImpl::NaiveDateTime( - NaiveDateWrapper::from_ymd_uncheck(2022, 11, 13).and_hms_uncheck(0, 0, 0) + watermark!(ScalarImpl::Timestamp( + Date::from_ymd_uncheck(2022, 11, 13).and_hms_uncheck(0, 0, 0) )) ); } diff --git a/src/stream/src/executor/wrapper.rs b/src/stream/src/executor/wrapper.rs index 158508d3dc5c6..b2e574b095599 100644 --- a/src/stream/src/executor/wrapper.rs +++ b/src/stream/src/executor/wrapper.rs @@ -118,6 +118,8 @@ impl WrapperExecutor { let stream = trace::instrument_await_tree(info.clone(), extra.actor_id, extra.executor_id, stream); + // Schema check + let stream = schema_check::schema_check(info.clone(), stream); // Epoch check let stream = epoch_check::epoch_check(info, stream); diff --git a/src/stream/src/executor/wrapper/schema_check.rs b/src/stream/src/executor/wrapper/schema_check.rs index 4bc99d3b3c8bb..d23eca2b455c6 100644 --- a/src/stream/src/executor/wrapper/schema_check.rs +++ b/src/stream/src/executor/wrapper/schema_check.rs @@ -27,13 +27,25 @@ pub async fn schema_check(info: Arc, input: impl MessageStream) { for message in input { let message = message?; - if let Message::Chunk(chunk) = &message { - risingwave_common::util::schema_check::schema_check( + match &message { + Message::Chunk(chunk) => risingwave_common::util::schema_check::schema_check( info.schema.fields().iter().map(|f| &f.data_type), chunk.columns(), - ) - .unwrap_or_else(|e| panic!("schema check failed on {}: {}", info.identity, e)); + ), + Message::Watermark(watermark) => { + let expected = info.schema.fields()[watermark.col_idx].data_type(); + let found = &watermark.data_type; + if &expected != found { + Err(format!( + "watermark type mismatched: expected {expected}, found {found}" + )) + } else { + Ok(()) + } + } + Message::Barrier(_) => Ok(()), } + .unwrap_or_else(|e| panic!("schema check failed on {}: {}", info.identity, e)); yield message; } diff --git a/src/stream/src/from_proto/agg_common.rs b/src/stream/src/from_proto/agg_common.rs index 29f4001837b6e..9a527df245133 100644 --- a/src/stream/src/from_proto/agg_common.rs +++ b/src/stream/src/from_proto/agg_common.rs @@ -52,8 +52,6 @@ pub fn build_agg_call_from_prost( .map(|col_order| { let col_idx = col_order.get_column_index() as usize; let order_type = OrderType::from_protobuf(col_order.get_order_type().unwrap()); - // TODO(yuchao): `nulls first/last` is not supported yet, so it's ignore here, - // see also `risingwave_common::util::sort_util::compare_values` ColumnOrder::new(col_idx, order_type) }) .collect(); diff --git a/src/stream/src/from_proto/batch_query.rs b/src/stream/src/from_proto/batch_query.rs index a03825ab461e0..7d24f04bed1fc 100644 --- a/src/stream/src/from_proto/batch_query.rs +++ b/src/stream/src/from_proto/batch_query.rs @@ -66,14 +66,14 @@ impl ExecutorBuilder for BatchQueryExecutorBuilder { .map(|k| k.column_index as usize) .collect_vec(); - let dist_key_indices = table_desc - .dist_key_indices + let dist_key_in_pk_indices = table_desc + .dist_key_in_pk_indices .iter() .map(|&k| k as usize) .collect_vec(); let distribution = match params.vnode_bitmap { Some(vnodes) => Distribution { - dist_key_indices, + dist_key_in_pk_indices, vnodes: vnodes.into(), }, None => Distribution::fallback(), diff --git a/src/stream/src/from_proto/chain.rs b/src/stream/src/from_proto/chain.rs index 6f7dcc81a01be..2cf464acb9522 100644 --- a/src/stream/src/from_proto/chain.rs +++ b/src/stream/src/from_proto/chain.rs @@ -105,14 +105,14 @@ impl ExecutorBuilder for ChainExecutorBuilder { .map(|k| k.column_index as usize) .collect_vec(); - let dist_key_indices = table_desc - .dist_key_indices + let dist_key_in_pk_indices = table_desc + .dist_key_in_pk_indices .iter() .map(|&k| k as usize) .collect_vec(); let distribution = match params.vnode_bitmap { Some(vnodes) => Distribution { - dist_key_indices, + dist_key_in_pk_indices, vnodes: vnodes.into(), }, None => Distribution::fallback(), diff --git a/src/stream/src/from_proto/global_simple_agg.rs b/src/stream/src/from_proto/global_simple_agg.rs index 2656b374d4bc1..cebce95cb3b7b 100644 --- a/src/stream/src/from_proto/global_simple_agg.rs +++ b/src/stream/src/from_proto/global_simple_agg.rs @@ -22,7 +22,7 @@ use super::agg_common::{ }; use super::*; use crate::common::table::state_table::StateTable; -use crate::executor::agg_common::AggExecutorArgs; +use crate::executor::agg_common::{AggExecutorArgs, SimpleAggExecutorExtraArgs}; use crate::executor::aggregation::AggCall; use crate::executor::GlobalSimpleAggExecutor; @@ -69,7 +69,7 @@ impl ExecutorBuilder for GlobalSimpleAggExecutorBuilder { distinct_dedup_tables, watermark_epoch: stream.get_watermark_epoch(), - extra: None, + extra: SimpleAggExecutorExtraArgs {}, })? .boxed()) } diff --git a/src/stream/src/from_proto/hash_agg.rs b/src/stream/src/from_proto/hash_agg.rs index a264d11241e66..b01239251f766 100644 --- a/src/stream/src/from_proto/hash_agg.rs +++ b/src/stream/src/from_proto/hash_agg.rs @@ -26,12 +26,12 @@ use super::agg_common::{ }; use super::*; use crate::common::table::state_table::StateTable; -use crate::executor::agg_common::{AggExecutorArgs, AggExecutorArgsExtra}; +use crate::executor::agg_common::{AggExecutorArgs, GroupAggExecutorExtraArgs}; use crate::executor::aggregation::AggCall; use crate::executor::HashAggExecutor; pub struct HashAggExecutorDispatcherArgs { - args: AggExecutorArgs, + args: AggExecutorArgs, group_key_types: Vec, } @@ -111,12 +111,11 @@ impl ExecutorBuilder for HashAggExecutorBuilder { distinct_dedup_tables, watermark_epoch: stream.get_watermark_epoch(), - extra: Some(AggExecutorArgsExtra { + extra: GroupAggExecutorExtraArgs { group_key_indices, - - metrics: params.executor_stats, chunk_size: params.env.config().developer.stream_chunk_size, - }), + metrics: params.executor_stats, + }, }, group_key_types, } diff --git a/src/stream/src/from_proto/hash_join.rs b/src/stream/src/from_proto/hash_join.rs index 4f0b8b19143ac..1356ca99767ec 100644 --- a/src/stream/src/from_proto/hash_join.rs +++ b/src/stream/src/from_proto/hash_join.rs @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::cmp::min; use std::sync::Arc; use risingwave_common::hash::{HashKey, HashKeyDispatcher}; use risingwave_common::types::DataType; -use risingwave_expr::expr::{build_from_prost, BoxedExpression}; +use risingwave_expr::expr::{build, build_from_prost, BoxedExpression, InputRefExpression}; +pub use risingwave_pb::expr::expr_node::Type as ExprType; use risingwave_pb::plan_common::JoinType as JoinTypeProto; use risingwave_pb::stream_plan::HashJoinNode; @@ -82,6 +84,31 @@ impl ExecutorBuilder for HashJoinExecutorBuilder { Err(_) => None, }; trace!("Join non-equi condition: {:?}", condition); + let mut inequality_pairs = Vec::with_capacity(node.get_inequality_pairs().len()); + for inequality_pair in node.get_inequality_pairs() { + let key_required_larger = inequality_pair.get_key_required_larger() as usize; + let key_required_smaller = inequality_pair.get_key_required_smaller() as usize; + inequality_pairs.push(( + key_required_larger, + key_required_smaller, + inequality_pair.get_clean_state(), + if let Some(delta_expression) = inequality_pair.delta_expression.as_ref() { + let data_type = source_l.schema().fields + [min(key_required_larger, key_required_smaller)] + .data_type(); + Some(build( + delta_expression.delta_type(), + data_type.clone(), + vec![ + Box::new(InputRefExpression::new(data_type, 0)), + build_from_prost(delta_expression.delta.as_ref().unwrap())?, + ], + )?) + } else { + None + }, + )); + } let join_key_data_types = params_l .join_key_indices @@ -111,6 +138,7 @@ impl ExecutorBuilder for HashJoinExecutorBuilder { output_indices, executor_id: params.executor_id, cond: condition, + inequality_pairs, op_info: params.op_info, state_table_l, degree_state_table_l, @@ -139,6 +167,7 @@ struct HashJoinExecutorDispatcherArgs { output_indices: Vec, executor_id: u64, cond: Option, + inequality_pairs: Vec<(usize, usize, bool, Option)>, op_info: String, state_table_l: StateTable, degree_state_table_l: StateTable, @@ -171,6 +200,7 @@ impl HashKeyDispatcher for HashJoinExecutorDispatcherArgs { self.output_indices, self.executor_id, self.cond, + self.inequality_pairs, self.op_info, self.state_table_l, self.degree_state_table_l, diff --git a/src/stream/src/from_proto/lookup.rs b/src/stream/src/from_proto/lookup.rs index 7696cea1d0cf8..df574e5587214 100644 --- a/src/stream/src/from_proto/lookup.rs +++ b/src/stream/src/from_proto/lookup.rs @@ -82,14 +82,14 @@ impl ExecutorBuilder for LookupExecutorBuilder { .map(|k| k.column_index as usize) .collect_vec(); - let dist_key_indices = table_desc - .dist_key_indices + let dist_key_in_pk_indices = table_desc + .dist_key_in_pk_indices .iter() .map(|&k| k as usize) .collect_vec(); let distribution = match params.vnode_bitmap { Some(vnodes) => Distribution { - dist_key_indices, + dist_key_in_pk_indices, vnodes: vnodes.into(), }, None => Distribution::fallback(), @@ -125,6 +125,7 @@ impl ExecutorBuilder for LookupExecutorBuilder { ); Ok(Box::new(LookupExecutor::new(LookupExecutorParams { + ctx: params.actor_context, schema: params.schema, arrangement, stream, diff --git a/src/stream/src/from_proto/mod.rs b/src/stream/src/from_proto/mod.rs index 8a9fee89f39f0..d292a39644479 100644 --- a/src/stream/src/from_proto/mod.rs +++ b/src/stream/src/from_proto/mod.rs @@ -127,7 +127,7 @@ pub async fn create_executor( NodeBody::Source => SourceExecutorBuilder, NodeBody::Sink => SinkExecutorBuilder, NodeBody::Project => ProjectExecutorBuilder, - NodeBody::TopN => TopNExecutorNewBuilder, + NodeBody::TopN => TopNExecutorBuilder, NodeBody::AppendOnlyTopN => AppendOnlyTopNExecutorBuilder, NodeBody::LocalSimpleAgg => LocalSimpleAggExecutorBuilder, NodeBody::GlobalSimpleAgg => GlobalSimpleAggExecutorBuilder, diff --git a/src/stream/src/from_proto/mview.rs b/src/stream/src/from_proto/mview.rs index d61bc7ccfe30c..d0444ecdfa0da 100644 --- a/src/stream/src/from_proto/mview.rs +++ b/src/stream/src/from_proto/mview.rs @@ -46,17 +46,8 @@ impl ExecutorBuilder for MaterializeExecutorBuilder { let table = node.get_table()?; let versioned = table.version.is_some(); - let conflict_behavior = match table.handle_pk_conflict_behavior() { - risingwave_pb::catalog::HandleConflictBehavior::NoCheckUnspecified => { - ConflictBehavior::NoCheck - } - risingwave_pb::catalog::HandleConflictBehavior::Overwrite => { - ConflictBehavior::OverWrite - } - risingwave_pb::catalog::HandleConflictBehavior::Ignore => { - ConflictBehavior::IgnoreConflict - } - }; + let conflict_behavior = + ConflictBehavior::from_protobuf(&table.handle_pk_conflict_behavior()); macro_rules! new_executor { ($SD:ident) => { @@ -112,17 +103,8 @@ impl ExecutorBuilder for ArrangeExecutorBuilder { // FIXME: Lookup is now implemented without cell-based table API and relies on all vnodes // being `DEFAULT_VNODE`, so we need to make the Arrange a singleton. let vnodes = params.vnode_bitmap.map(Arc::new); - let conflict_behavior = match table.handle_pk_conflict_behavior() { - risingwave_pb::catalog::HandleConflictBehavior::NoCheckUnspecified => { - ConflictBehavior::NoCheck - } - risingwave_pb::catalog::HandleConflictBehavior::Overwrite => { - ConflictBehavior::OverWrite - } - risingwave_pb::catalog::HandleConflictBehavior::Ignore => { - ConflictBehavior::IgnoreConflict - } - }; + let conflict_behavior = + ConflictBehavior::from_protobuf(&table.handle_pk_conflict_behavior()); let executor = MaterializeExecutor::<_, BasicSerde>::new( input, store, diff --git a/src/stream/src/from_proto/project.rs b/src/stream/src/from_proto/project.rs index e9c0808921c48..a148e39f458bc 100644 --- a/src/stream/src/from_proto/project.rs +++ b/src/stream/src/from_proto/project.rs @@ -15,6 +15,7 @@ use multimap::MultiMap; use risingwave_common::util::iter_util::ZipEqFast; use risingwave_expr::expr::build_from_prost; +use risingwave_pb::expr::expr_node; use risingwave_pb::stream_plan::ProjectNode; use super::*; @@ -49,7 +50,11 @@ impl ExecutorBuilder for ProjectExecutorBuilder { .map(|key| *key as usize), ), ); - + let extremely_light = node.get_select_list().iter().all(|expr| { + let expr_type = expr.get_expr_type().unwrap(); + expr_type == expr_node::Type::InputRef || expr_type == expr_node::Type::ConstantValue + }); + let materialize_selectivity_threshold = if extremely_light { 0.0 } else { 0.5 }; Ok(ProjectExecutor::new( params.actor_context, input, @@ -57,6 +62,7 @@ impl ExecutorBuilder for ProjectExecutorBuilder { project_exprs, params.executor_id, watermark_derivations, + materialize_selectivity_threshold, ) .boxed()) } diff --git a/src/stream/src/from_proto/sink.rs b/src/stream/src/from_proto/sink.rs index ee7dc0628ba60..f200d7211dc1d 100644 --- a/src/stream/src/from_proto/sink.rs +++ b/src/stream/src/from_proto/sink.rs @@ -37,10 +37,10 @@ impl ExecutorBuilder for SinkExecutorBuilder { let sink_type = SinkType::from_proto(sink_desc.get_sink_type().unwrap()); let mut properties = sink_desc.get_properties().clone(); let pk_indices = sink_desc - .pk + .downstream_pk .iter() - .map(|pk| pk.column_index as usize) - .collect::>(); + .map(|i| *i as usize) + .collect_vec(); let schema = sink_desc.columns.iter().map(Into::into).collect(); // This field can be used to distinguish a specific actor in parallelism to prevent // transaction execution errors diff --git a/src/stream/src/from_proto/temporal_join.rs b/src/stream/src/from_proto/temporal_join.rs index 43404b9eb129f..7344aebd6c551 100644 --- a/src/stream/src/from_proto/temporal_join.rs +++ b/src/stream/src/from_proto/temporal_join.rs @@ -64,14 +64,14 @@ impl ExecutorBuilder for TemporalJoinExecutorBuilder { .map(|k| k.column_index as usize) .collect_vec(); - let dist_key_indices = table_desc - .dist_key_indices + let dist_key_in_pk_indices = table_desc + .dist_key_in_pk_indices .iter() .map(|&k| k as usize) .collect_vec(); let distribution = match params.vnode_bitmap.clone() { Some(vnodes) => Distribution { - dist_key_indices, + dist_key_in_pk_indices, vnodes: vnodes.into(), }, None => Distribution::fallback(), diff --git a/src/stream/src/from_proto/top_n.rs b/src/stream/src/from_proto/top_n.rs index df1261112700f..930db956c2b21 100644 --- a/src/stream/src/from_proto/top_n.rs +++ b/src/stream/src/from_proto/top_n.rs @@ -21,10 +21,10 @@ use super::*; use crate::common::table::state_table::StateTable; use crate::executor::TopNExecutor; -pub struct TopNExecutorNewBuilder; +pub struct TopNExecutorBuilder; #[async_trait::async_trait] -impl ExecutorBuilder for TopNExecutorNewBuilder { +impl ExecutorBuilder for TopNExecutorBuilder { type Node = TopNNode; async fn new_boxed_executor( diff --git a/src/stream/src/task/barrier_manager.rs b/src/stream/src/task/barrier_manager.rs index 3116aba68164f..548117bc8f12c 100644 --- a/src/stream/src/task/barrier_manager.rs +++ b/src/stream/src/task/barrier_manager.rs @@ -16,7 +16,7 @@ use std::collections::{HashMap, HashSet}; use anyhow::anyhow; use prometheus::HistogramTimer; -use risingwave_pb::stream_service::barrier_complete_response::CreateMviewProgress as ProstCreateMviewProgress; +use risingwave_pb::stream_service::barrier_complete_response::PbCreateMviewProgress; use tokio::sync::mpsc::UnboundedSender; use tokio::sync::oneshot; use tokio::sync::oneshot::Receiver; @@ -42,7 +42,7 @@ pub const ENABLE_BARRIER_AGGREGATION: bool = false; /// Collect result of some barrier on current compute node. Will be reported to the meta service. #[derive(Debug)] pub struct CollectResult { - pub create_mview_progress: Vec, + pub create_mview_progress: Vec, } enum BarrierState { diff --git a/src/stream/src/task/env.rs b/src/stream/src/task/env.rs index 9f5097dc333d3..e4499cd7c2336 100644 --- a/src/stream/src/task/env.rs +++ b/src/stream/src/task/env.rs @@ -20,6 +20,8 @@ use risingwave_common::system_param::local_manager::LocalSystemParamsManagerRef; use risingwave_common::util::addr::HostAddr; use risingwave_connector::source::monitor::SourceMetrics; use risingwave_connector::ConnectorParams; +#[cfg(test)] +use risingwave_pb::connector_service::SinkPayloadFormat; use risingwave_source::dml_manager::DmlManagerRef; use risingwave_storage::StateStoreImpl; @@ -90,7 +92,7 @@ impl StreamEnvironment { use risingwave_storage::monitor::MonitoredStorageMetrics; StreamEnvironment { server_addr: "127.0.0.1:5688".parse().unwrap(), - connector_params: ConnectorParams::new(None), + connector_params: ConnectorParams::new(None, SinkPayloadFormat::Json), config: Arc::new(StreamingConfig::default()), worker_id: WorkerNodeId::default(), state_store: StateStoreImpl::shared_in_memory_store(Arc::new( diff --git a/src/stream/src/task/stream_manager.rs b/src/stream/src/task/stream_manager.rs index c9e26b70b4e61..3edac01990869 100644 --- a/src/stream/src/task/stream_manager.rs +++ b/src/stream/src/task/stream_manager.rs @@ -310,18 +310,19 @@ impl LocalStreamManager { Ok(()) } - pub async fn drop_actor(&self, actors: &[ActorId]) -> StreamResult<()> { + /// Drop the resources of the given actors. + pub async fn drop_actors(&self, actors: &[ActorId]) -> StreamResult<()> { let mut core = self.core.lock().await; - for id in actors { - core.drop_actor(*id); + for &id in actors { + core.drop_actor(id); } tracing::debug!(actors = ?actors, "drop actors"); Ok(()) } - /// Force stop all actors on this worker. + /// Force stop all actors on this worker, and then drop their resources. pub async fn stop_all_actors(&self) -> StreamResult<()> { - self.core.lock().await.drop_all_actors().await; + self.core.lock().await.stop_all_actors().await; // Clear shared buffer in storage to release memory self.clear_storage_buffer().await; self.clear_all_senders_and_collect_rx(); @@ -557,7 +558,7 @@ impl LocalStreamManagerCore { // If there're multiple stateful executors in this actor, we will wrap it into a subtask. let executor = if has_stateful && is_stateful { - let (subtask, executor) = subtask::wrap(executor); + let (subtask, executor) = subtask::wrap(executor, actor_context.id); subtasks.push(subtask); executor.boxed() } else { @@ -781,14 +782,16 @@ impl LocalStreamManagerCore { .inspect(|handle| handle.abort()); self.context.actor_infos.write().remove(&actor_id); self.actors.remove(&actor_id); - // Task should have already stopped when this method is invoked. - self.handles - .remove(&actor_id) - .inspect(|handle| handle.abort()); + + // Task should have already stopped when this method is invoked. There might be some + // clean-up work left (like dropping in-memory data structures), but we don't have to wait + // for them to finish, in order to make this request non-blocking. + self.handles.remove(&actor_id); } - /// `drop_all_actors` is invoked by meta node via RPC for recovery purpose. - async fn drop_all_actors(&mut self) { + /// `stop_all_actors` is invoked by meta node via RPC for recovery purpose. Different from the + /// `drop_actor`, the execution of the actors will be aborted. + async fn stop_all_actors(&mut self) { for (actor_id, handle) in &self.handles { tracing::debug!("force stopping actor {}", actor_id); handle.abort(); diff --git a/src/tests/compaction_test/src/compaction_test_runner.rs b/src/tests/compaction_test/src/compaction_test_runner.rs index 5636032e64e98..1544214751ae3 100644 --- a/src/tests/compaction_test/src/compaction_test_runner.rs +++ b/src/tests/compaction_test/src/compaction_test_runner.rs @@ -24,8 +24,9 @@ use anyhow::anyhow; use bytes::{BufMut, Bytes, BytesMut}; use clap::Parser; use futures::TryStreamExt; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::TableId; -use risingwave_common::config::{load_config, NO_OVERRIDE}; +use risingwave_common::config::{extract_storage_memory_config, load_config, NO_OVERRIDE}; use risingwave_common::util::addr::HostAddr; use risingwave_common::util::iter_util::ZipEqFast; use risingwave_hummock_sdk::{CompactionGroupId, HummockEpoch, FIRST_VERSION_ID}; @@ -33,7 +34,7 @@ use risingwave_pb::common::WorkerType; use risingwave_pb::hummock::{HummockVersion, HummockVersionDelta}; use risingwave_rpc_client::{HummockMetaClient, MetaClient}; use risingwave_storage::hummock::hummock_meta_client::MonitoredHummockMetaClient; -use risingwave_storage::hummock::{HummockStorage, TieredCacheMetricsBuilder}; +use risingwave_storage::hummock::{CachePolicy, HummockStorage, TieredCacheMetricsBuilder}; use risingwave_storage::monitor::{ CompactorMetrics, HummockMetrics, HummockStateStoreMetrics, MonitoredStateStore, MonitoredStorageMetrics, ObjectStoreMetrics, @@ -82,6 +83,7 @@ pub async fn compaction_test_main( let _meta_handle = tokio::spawn(start_meta_node( meta_listen_addr.clone(), + opts.state_store.clone(), opts.config_path_for_meta.clone(), )); @@ -92,7 +94,6 @@ pub async fn compaction_test_main( let (compactor_thrd, compactor_shutdown_tx) = start_compactor_thread( opts.meta_address.clone(), advertise_addr.to_string(), - opts.state_store.clone(), opts.config_path.clone(), ); @@ -124,25 +125,30 @@ pub async fn compaction_test_main( Ok(()) } -pub async fn start_meta_node(listen_addr: String, config_path: String) { +pub async fn start_meta_node(listen_addr: String, state_store: String, config_path: String) { let meta_opts = risingwave_meta::MetaNodeOpts::parse_from([ "meta-node", "--listen-addr", &listen_addr, + "--advertise-addr", + &listen_addr, "--backend", "mem", - "--checkpoint-frequency", - &CHECKPOINT_FREQ_FOR_REPLAY.to_string(), + "--state-store", + &state_store, "--config-path", &config_path, ]); - // We set a large checkpoint frequency to prevent the embedded meta node - // to commit new epochs to avoid bumping the hummock version during version log replay. - assert_eq!(CHECKPOINT_FREQ_FOR_REPLAY, meta_opts.checkpoint_frequency); let config = load_config( &meta_opts.config_path, Some(meta_opts.override_opts.clone()), ); + // We set a large checkpoint frequency to prevent the embedded meta node + // to commit new epochs to avoid bumping the hummock version during version log replay. + assert_eq!( + CHECKPOINT_FREQ_FOR_REPLAY, + config.system.checkpoint_frequency + ); assert!( config.meta.enable_compaction_deterministic, "enable_compaction_deterministic should be set" @@ -154,19 +160,16 @@ pub async fn start_meta_node(listen_addr: String, config_path: String) { async fn start_compactor_node( meta_rpc_endpoint: String, advertise_addr: String, - state_store: String, config_path: String, ) { let opts = risingwave_compactor::CompactorOpts::parse_from([ "compactor-node", - "--host", + "--listen-addr", "127.0.0.1:5550", "--advertise-addr", &advertise_addr, "--meta-address", &meta_rpc_endpoint, - "--state-store", - &state_store, "--config-path", &config_path, ]); @@ -176,7 +179,6 @@ async fn start_compactor_node( pub fn start_compactor_thread( meta_endpoint: String, advertise_addr: String, - state_store: String, config_path: String, ) -> (JoinHandle<()>, std::sync::mpsc::Sender<()>) { let (tx, rx) = std::sync::mpsc::channel(); @@ -188,7 +190,7 @@ pub fn start_compactor_thread( runtime.block_on(async { tokio::spawn(async { tracing::info!("Starting compactor node"); - start_compactor_node(meta_endpoint, advertise_addr, state_store, config_path).await + start_compactor_node(meta_endpoint, advertise_addr, config_path).await }); rx.recv().unwrap(); }); @@ -349,7 +351,12 @@ async fn start_replay( } // Creates a hummock state store *after* we reset the hummock version - let storage_opts = Arc::new(StorageOpts::from((&config, &system_params))); + let storage_memory_config = extract_storage_memory_config(&config); + let storage_opts = Arc::new(StorageOpts::from(( + &config, + &system_params, + &storage_memory_config, + ))); let hummock = create_hummock_store_with_metrics(&meta_client, storage_opts, &opts).await?; // Replay version deltas from FIRST_VERSION_ID to the version before reset @@ -623,6 +630,7 @@ async fn open_hummock_iters( ignore_range_tombstone: false, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await?; diff --git a/src/tests/compaction_test/src/delete_range_runner.rs b/src/tests/compaction_test/src/delete_range_runner.rs index aab5ab40a7901..ddbc3afe8175f 100644 --- a/src/tests/compaction_test/src/delete_range_runner.rs +++ b/src/tests/compaction_test/src/delete_range_runner.rs @@ -23,9 +23,12 @@ use bytes::Bytes; use futures::StreamExt; use rand::rngs::StdRng; use rand::{RngCore, SeedableRng}; +use risingwave_common::cache::CachePriority; use risingwave_common::catalog::hummock::PROPERTIES_RETENTION_SECOND_KEY; use risingwave_common::catalog::TableId; -use risingwave_common::config::{load_config, RwConfig, NO_OVERRIDE}; +use risingwave_common::config::{ + extract_storage_memory_config, load_config, RwConfig, NO_OVERRIDE, +}; use risingwave_hummock_sdk::compact::CompactorRuntimeConfig; use risingwave_hummock_sdk::compaction_group::StaticCompactionGroupId; use risingwave_hummock_sdk::filter_key_extractor::{ @@ -37,14 +40,14 @@ use risingwave_meta::hummock::test_utils::setup_compute_env_with_config; use risingwave_meta::hummock::MockHummockMetaClient; use risingwave_object_store::object::object_metrics::ObjectStoreMetrics; use risingwave_object_store::object::parse_remote_object_store; -use risingwave_pb::catalog::Table as ProstTable; +use risingwave_pb::catalog::PbTable; use risingwave_pb::hummock::{CompactionConfig, CompactionGroupInfo}; use risingwave_pb::meta::SystemParams; use risingwave_rpc_client::HummockMetaClient; use risingwave_storage::hummock::compactor::{CompactionExecutor, CompactorContext}; use risingwave_storage::hummock::sstable_store::SstableStoreRef; use risingwave_storage::hummock::{ - HummockStorage, MemoryLimiter, SstableObjectIdManager, SstableStore, TieredCache, + CachePolicy, HummockStorage, MemoryLimiter, SstableObjectIdManager, SstableStore, TieredCache, }; use risingwave_storage::monitor::{CompactorMetrics, HummockStateStoreMetrics}; use risingwave_storage::opts::StorageOpts; @@ -102,7 +105,7 @@ async fn compaction_test( worker_node.id, )); - let delete_key_table = ProstTable { + let delete_key_table = PbTable { id: 1, schema_id: 1, database_id: 1, @@ -163,7 +166,12 @@ async fn compaction_test( ..Default::default() } .into(); - let storage_opts = Arc::new(StorageOpts::from((&config, &system_params))); + let storage_memory_config = extract_storage_memory_config(&config); + let storage_opts = Arc::new(StorageOpts::from(( + &config, + &system_params, + &storage_memory_config, + ))); let state_store_metrics = Arc::new(HummockStateStoreMetrics::unused()); let compactor_metrics = Arc::new(CompactorMetrics::unused()); let object_store_metrics = Arc::new(ObjectStoreMetrics::unused()); @@ -176,8 +184,9 @@ async fn compaction_test( let sstable_store = Arc::new(SstableStore::new( Arc::new(remote_object_store), system_params.data_directory().to_string(), - config.storage.block_cache_capacity_mb * (1 << 20), - config.storage.meta_cache_capacity_mb * (1 << 20), + storage_memory_config.block_cache_capacity_mb * (1 << 20), + storage_memory_config.meta_cache_capacity_mb * (1 << 20), + 0, TieredCache::none(), )); @@ -392,6 +401,7 @@ impl NormalState { table_id: self.table_id, read_version_from_backup: false, prefetch_options: Default::default(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -418,6 +428,7 @@ impl NormalState { table_id: self.table_id, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await @@ -450,6 +461,7 @@ impl CheckState for NormalState { table_id: self.table_id, read_version_from_backup: false, prefetch_options: PrefetchOptions::new_for_exhaust_iter(), + cache_policy: CachePolicy::Fill(CachePriority::High), }, ) .await diff --git a/src/tests/e2e_extended_mode/Cargo.toml b/src/tests/e2e_extended_mode/Cargo.toml new file mode 100644 index 0000000000000..831c7ba35a636 --- /dev/null +++ b/src/tests/e2e_extended_mode/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "risingwave_e2e_extended_mode_test" +version = { workspace = true } +edition = { workspace = true } +homepage = { workspace = true } +keywords = { workspace = true } +license = { workspace = true } +repository = { workspace = true } + +[package.metadata.cargo-machete] +ignored = ["workspace-hack"] + +[package.metadata.cargo-udeps.ignore] +normal = ["workspace-hack"] + +[dependencies] +anyhow = { version = "1", features = ["backtrace"] } +chrono = { version = "0.4", features = ['serde'] } +clap = { version = "4", features = ["derive"] } +pg_interval = "0.4" +rust_decimal ={ version = "1.25", features = ["db-postgres","db-tokio-postgres"] } +tokio = { version = "1", features = ["rt", "macros","rt-multi-thread"] } +tokio-postgres = { version = "0.7", features = ["with-chrono-0_4"] } +tracing = "0.1" +tracing-subscriber = "0.3.16" + +[[bin]] +name = "risingwave_e2e_extended_mode_test" +path = "src/main.rs" diff --git a/src/tests/e2e_extended_mode/README.md b/src/tests/e2e_extended_mode/README.md new file mode 100644 index 0000000000000..5c0a1fbc96871 --- /dev/null +++ b/src/tests/e2e_extended_mode/README.md @@ -0,0 +1,21 @@ +This is a program used for e2e test in extended mode. + +## What is difference between it and extended_mode/*.slt in e2e_test + +For e2e test in extended query mode, there are two thing we can't test in sqllogitest +1. bind parameter +2. max row number +See [detail](https://www.postgresql.org/docs/15/protocol-flow.html#PROTOCOL-FLOW-PIPELINING:~:text=Once%20a%20portal,count%20is%20ignored) + +So before sqllogictest supporting these, we test these function in this program. + +In the future, we may merge it to e2e_text/extended_query + +# How to run + +```shell +RUST_BACKTRACE=1 target/debug/risingwave_e2e_extended_mode_test --host 127.0.0.1 \ + -p 4566 \ + -u root \ + --database dev \ +``` \ No newline at end of file diff --git a/src/tests/e2e_extended_mode/src/main.rs b/src/tests/e2e_extended_mode/src/main.rs new file mode 100644 index 0000000000000..32f5419048492 --- /dev/null +++ b/src/tests/e2e_extended_mode/src/main.rs @@ -0,0 +1,48 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +mod opts; +mod test; + +use std::process::exit; + +use clap::Parser; +use tracing::{error, info}; + +use crate::opts::Opts; +use crate::test::TestSuite; + +#[tokio::main(flavor = "multi_thread", worker_threads = 5)] +async fn main() { + exit(run_test().await) +} + +async fn run_test() -> i32 { + let opts = Opts::parse(); + + tracing_subscriber::fmt::init(); + + let test_suite = TestSuite::new(opts); + + match test_suite.test().await { + Ok(_) => { + info!("Risingwave e2e extended mode test completed successfully!"); + 0 + } + Err(e) => { + error!("Risingwave e2e extended mode test failed: {:?}. Please ensure that your psql version is larger than 14.1", e); + 1 + } + } +} diff --git a/src/tests/e2e_extended_mode/src/opts.rs b/src/tests/e2e_extended_mode/src/opts.rs new file mode 100644 index 0000000000000..bd83c54e3e8ff --- /dev/null +++ b/src/tests/e2e_extended_mode/src/opts.rs @@ -0,0 +1,33 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use clap::{Parser, ValueHint}; + +#[derive(Parser, Debug, Clone)] +pub struct Opts { + /// Database name used to connect to pg. + #[clap(name = "DB", long = "database", default_value = "dev")] + pub pg_db_name: String, + /// Username used to connect to postgresql. + #[clap(name = "PG_USERNAME", short = 'u', long = "user", default_value="postgres", value_hint=ValueHint::Username)] + pub pg_user_name: String, + /// Postgresql server address to test against. + #[clap(name = "PG_SERVER_ADDRESS", long = "host", default_value = "localhost")] + pub pg_server_host: String, + /// Postgresql server port to test against. + #[clap(name = "PG_SERVER_PORT", short = 'p', long = "port")] + pub pg_server_port: u16, + #[clap(name = "PG_PASSWARD", long = "password", default_value = "")] + pub pg_password: String, +} diff --git a/src/tests/e2e_extended_mode/src/test.rs b/src/tests/e2e_extended_mode/src/test.rs new file mode 100644 index 0000000000000..abf701af763ce --- /dev/null +++ b/src/tests/e2e_extended_mode/src/test.rs @@ -0,0 +1,334 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use anyhow::anyhow; +use chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc}; +use pg_interval::Interval; +use rust_decimal::prelude::FromPrimitive; +use rust_decimal::Decimal; +use tokio_postgres::types::Type; +use tokio_postgres::NoTls; + +use crate::opts::Opts; + +pub struct TestSuite { + config: String, +} + +macro_rules! test_eq { + ($left:expr, $right:expr $(,)?) => { + match (&$left, &$right) { + (left_val, right_val) => { + if !(*left_val == *right_val) { + return Err(anyhow!( + "assertion failed: `(left == right)` \ + (left: `{:?}`, right: `{:?}`)", + left_val, + right_val + )); + } + } + } + }; +} + +impl TestSuite { + pub fn new(opts: Opts) -> Self { + let config = if !opts.pg_password.is_empty() { + format!( + "dbname={} user={} host={} port={} password={}", + opts.pg_db_name, + opts.pg_user_name, + opts.pg_server_host, + opts.pg_server_port, + opts.pg_password + ) + } else { + format!( + "dbname={} user={} host={} port={}", + opts.pg_db_name, opts.pg_user_name, opts.pg_server_host, opts.pg_server_port + ) + }; + Self { config } + } + + pub async fn test(&self) -> anyhow::Result<()> { + self.binary_param_and_result().await?; + self.dql_dml_with_param().await?; + self.max_row().await?; + Ok(()) + } + + pub async fn binary_param_and_result(&self) -> anyhow::Result<()> { + // Connect to the database. + let (client, connection) = tokio_postgres::connect(&self.config, NoTls).await?; + + // The connection object performs the actual communication with the database, + // so spawn it off to run on its own. + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + + for row in client.query("select $1::SMALLINT;", &[&1024_i16]).await? { + let data: i16 = row.try_get(0)?; + test_eq!(data, 1024); + } + + for row in client.query("select $1::INT;", &[&144232_i32]).await? { + let data: i32 = row.try_get(0)?; + test_eq!(data, 144232); + } + + for row in client.query("select $1::BIGINT;", &[&99999999_i64]).await? { + let data: i64 = row.try_get(0)?; + test_eq!(data, 99999999); + } + + for row in client + .query("select $1::DECIMAL;", &[&Decimal::from_f32(2.33454_f32)]) + .await? + { + let data: Decimal = row.try_get(0)?; + test_eq!(data, Decimal::from_f32(2.33454_f32).unwrap()); + } + + for row in client.query("select $1::BOOL;", &[&true]).await? { + let data: bool = row.try_get(0)?; + assert!(data); + } + + for row in client.query("select $1::REAL;", &[&1.234234_f32]).await? { + let data: f32 = row.try_get(0)?; + test_eq!(data, 1.234234); + } + + // TODO(ZENOTME): After #8112, risingwave should support this case. (DOUBLE PRECISION TYPE) + // for row in client + // .query("select $1::DOUBLE PRECISION;", &[&234234.23490238483_f64]) + // .await? + // { + // let data: f64 = row.try_get(0)?; + // test_eq!(data, 234234.23490238483); + // } + for row in client + .query("select $1::FLOAT8;", &[&234234.23490238483_f64]) + .await? + { + let data: f64 = row.try_get(0)?; + test_eq!(data, 234234.23490238483); + } + + for row in client + .query( + "select $1::date;", + &[&NaiveDate::from_ymd_opt(2022, 1, 1).unwrap()], + ) + .await? + { + let data: NaiveDate = row.try_get(0)?; + test_eq!(data, NaiveDate::from_ymd_opt(2022, 1, 1).unwrap()); + } + + for row in client + .query( + "select $1::time", + &[&NaiveTime::from_hms_opt(10, 0, 0).unwrap()], + ) + .await? + { + let data: NaiveTime = row.try_get(0)?; + test_eq!(data, NaiveTime::from_hms_opt(10, 0, 0).unwrap()); + } + + for row in client + .query( + "select $1::timestamp", + &[&NaiveDate::from_ymd_opt(2022, 1, 1) + .unwrap() + .and_hms_opt(10, 0, 0) + .unwrap()], + ) + .await? + { + let data: NaiveDateTime = row.try_get(0)?; + test_eq!( + data, + NaiveDate::from_ymd_opt(2022, 1, 1) + .unwrap() + .and_hms_opt(10, 0, 0) + .unwrap() + ); + } + + let timestamptz = DateTime::::from_utc( + NaiveDate::from_ymd_opt(2022, 1, 1) + .unwrap() + .and_hms_opt(10, 0, 0) + .unwrap(), + Utc, + ); + for row in client + .query("select $1::timestamptz", &[×tamptz]) + .await? + { + let data: DateTime = row.try_get(0)?; + test_eq!(data, timestamptz); + } + + for row in client + .query("select $1::interval", &[&Interval::new(1, 1, 24000000)]) + .await? + { + let data: Interval = row.try_get(0)?; + test_eq!(data, Interval::new(1, 1, 24000000)); + } + + Ok(()) + } + + /// TODO(ZENOTME): After #8112, risingwave should support to change all `prepare_typed` to + /// `prepare`. We don't need to provide the type explicitly. + async fn dql_dml_with_param(&self) -> anyhow::Result<()> { + let (client, connection) = tokio_postgres::connect(&self.config, NoTls).await?; + + // The connection object performs the actual communication with the database, + // so spawn it off to run on its own. + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + + client.query("create table t(id int)", &[]).await?; + + let insert_statement = client + .prepare_typed("insert INTO t (id) VALUES ($1)", &[Type::INT4]) + .await?; + + for i in 0..20 { + client.execute(&insert_statement, &[&i]).await?; + } + client.execute("flush", &[]).await?; + + let update_statement = client + .prepare_typed( + "update t set id = $1 where id < $2", + &[Type::INT4, Type::INT4], + ) + .await?; + let query_statement = client + .prepare_typed( + "select * FROM t where id < $1 order by id ASC", + &[Type::INT4], + ) + .await?; + let delete_statement = client + .prepare_typed("delete FROM t where id < $1", &[Type::INT4]) + .await?; + + let mut i = 0; + for row in client.query(&query_statement, &[&10_i32]).await? { + let id: i32 = row.try_get(0)?; + test_eq!(id, i); + i += 1; + } + test_eq!(i, 10); + + client + .execute(&update_statement, &[&100_i32, &10_i32]) + .await?; + client.execute("flush", &[]).await?; + + let mut i = 0; + for _ in client.query(&query_statement, &[&10_i32]).await? { + i += 1; + } + test_eq!(i, 0); + + client.execute(&delete_statement, &[&20_i32]).await?; + client.execute("flush", &[]).await?; + + let mut i = 0; + for row in client.query(&query_statement, &[&101_i32]).await? { + let id: i32 = row.try_get(0)?; + test_eq!(id, 100); + i += 1; + } + test_eq!(i, 10); + + client.execute("drop table t", &[]).await?; + + Ok(()) + } + + async fn max_row(&self) -> anyhow::Result<()> { + let (mut client, connection) = tokio_postgres::connect(&self.config, NoTls).await?; + + // The connection object performs the actual communication with the database, + // so spawn it off to run on its own. + tokio::spawn(async move { + if let Err(e) = connection.await { + eprintln!("connection error: {}", e); + } + }); + + client.query("create table t(id int)", &[]).await?; + + let insert_statement = client + .prepare_typed("insert INTO t (id) VALUES ($1)", &[Type::INT4]) + .await?; + + for i in 0..10 { + client.execute(&insert_statement, &[&i]).await?; + } + client.execute("flush", &[]).await?; + + let transaction = client.transaction().await?; + let statement = transaction + .prepare_typed("SELECT * FROM t order by id", &[]) + .await?; + let portal = transaction.bind(&statement, &[]).await?; + + for t in 0..5 { + let rows = transaction.query_portal(&portal, 1).await?; + test_eq!(rows.len(), 1); + let row = rows.get(0).unwrap(); + let id: i32 = row.get(0); + test_eq!(id, t); + } + + let mut i = 5; + for row in transaction.query_portal(&portal, 3).await? { + let id: i32 = row.get(0); + test_eq!(id, i); + i += 1; + } + test_eq!(i, 8); + + for row in transaction.query_portal(&portal, 5).await? { + let id: i32 = row.get(0); + test_eq!(id, i); + i += 1; + } + test_eq!(i, 10); + + transaction.rollback().await?; + + client.execute("drop table t", &[]).await?; + + Ok(()) + } +} diff --git a/src/tests/regress/data/schedule b/src/tests/regress/data/schedule index 21773c1177d02..712e4420f2999 100644 --- a/src/tests/regress/data/schedule +++ b/src/tests/regress/data/schedule @@ -9,4 +9,5 @@ test: boolean varchar int2 int4 int8 float4 float8 comments test: date time timestamp interval +test: arrays test: jsonb diff --git a/src/tests/regress/data/sql/arrays.sql b/src/tests/regress/data/sql/arrays.sql index 912233ef96810..923d9ebab2e06 100644 --- a/src/tests/regress/data/sql/arrays.sql +++ b/src/tests/regress/data/sql/arrays.sql @@ -2,245 +2,245 @@ -- ARRAYS -- -CREATE TABLE arrtest ( - a int2[], - b int4[][][], - c name[], - d text[][], - e float8[], - f char(5)[], - g varchar(5)[] -); +--@ CREATE TABLE arrtest ( +--@ a int2[], +--@ b int4[][][], +--@ c name[], +--@ d text[][], +--@ e float8[], +--@ f char(5)[], +--@ g varchar(5)[] +--@ ); -- -- only the 'e' array is 0-based, the others are 1-based. -- -INSERT INTO arrtest (a[1:5], b[1:1][1:2][1:2], c, d, f, g) - VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}'); - -UPDATE arrtest SET e[0] = '1.1'; - -UPDATE arrtest SET e[1] = '2.2'; - -INSERT INTO arrtest (f) - VALUES ('{"too long"}'); - -INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g) - VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}', - '{{"elt1", "elt2"}}', '{"3.4", "6.7"}', - '{"abc","abcde"}', '{"abc","abcde"}'); - -INSERT INTO arrtest (a, b[1:2], c, d[1:2]) - VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}'); - -INSERT INTO arrtest (b[2]) VALUES(now()); -- error, type mismatch - -INSERT INTO arrtest (b[1:2]) VALUES(now()); -- error, type mismatch - -SELECT * FROM arrtest; - -SELECT arrtest.a[1], - arrtest.b[1][1][1], - arrtest.c[1], - arrtest.d[1][1], - arrtest.e[0] - FROM arrtest; - -SELECT a[1], b[1][1][1], c[1], d[1][1], e[0] - FROM arrtest; - -SELECT a[1:3], - b[1:1][1:2][1:2], - c[1:2], - d[1:1][1:2] - FROM arrtest; - -SELECT array_ndims(a) AS a,array_ndims(b) AS b,array_ndims(c) AS c - FROM arrtest; - -SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c - FROM arrtest; +--@ INSERT INTO arrtest (a[1:5], b[1:1][1:2][1:2], c, d, f, g) +--@ VALUES ('{1,2,3,4,5}', '{{{0,0},{1,2}}}', '{}', '{}', '{}', '{}'); +--@ +--@ UPDATE arrtest SET e[0] = '1.1'; +--@ +--@ UPDATE arrtest SET e[1] = '2.2'; +--@ +--@ INSERT INTO arrtest (f) +--@ VALUES ('{"too long"}'); +--@ +--@ INSERT INTO arrtest (a, b[1:2][1:2], c, d, e, f, g) +--@ VALUES ('{11,12,23}', '{{3,4},{4,5}}', '{"foobar"}', +--@ '{{"elt1", "elt2"}}', '{"3.4", "6.7"}', +--@ '{"abc","abcde"}', '{"abc","abcde"}'); +--@ +--@ INSERT INTO arrtest (a, b[1:2], c, d[1:2]) +--@ VALUES ('{}', '{3,4}', '{foo,bar}', '{bar,foo}'); +--@ +--@ INSERT INTO arrtest (b[2]) VALUES(now()); -- error, type mismatch +--@ +--@ INSERT INTO arrtest (b[1:2]) VALUES(now()); -- error, type mismatch +--@ +--@ SELECT * FROM arrtest; +--@ +--@ SELECT arrtest.a[1], +--@ arrtest.b[1][1][1], +--@ arrtest.c[1], +--@ arrtest.d[1][1], +--@ arrtest.e[0] +--@ FROM arrtest; +--@ +--@ SELECT a[1], b[1][1][1], c[1], d[1][1], e[0] +--@ FROM arrtest; +--@ +--@ SELECT a[1:3], +--@ b[1:1][1:2][1:2], +--@ c[1:2], +--@ d[1:1][1:2] +--@ FROM arrtest; +--@ +--@ SELECT array_ndims(a) AS a,array_ndims(b) AS b,array_ndims(c) AS c +--@ FROM arrtest; +--@ +--@ SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c +--@ FROM arrtest; -- returns nothing -SELECT * - FROM arrtest - WHERE a[1] < 5 and - c = '{"foobar"}'::_name; - -UPDATE arrtest - SET a[1:2] = '{16,25}' - WHERE NOT a = '{}'::_int2; - -UPDATE arrtest - SET b[1:1][1:1][1:2] = '{113, 117}', - b[1:1][1:2][2:2] = '{142, 147}' - WHERE array_dims(b) = '[1:1][1:2][1:2]'; - -UPDATE arrtest - SET c[2:2] = '{"new_word"}' - WHERE array_dims(c) is not null; - -SELECT a,b,c FROM arrtest; - -SELECT a[1:3], - b[1:1][1:2][1:2], - c[1:2], - d[1:1][2:2] - FROM arrtest; - -SELECT b[1:1][2][2], - d[1:1][2] - FROM arrtest; - -INSERT INTO arrtest(a) VALUES('{1,null,3}'); -SELECT a FROM arrtest; -UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL; -SELECT a FROM arrtest WHERE a[2] IS NULL; -DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL; -SELECT a,b,c FROM arrtest; +--@ SELECT * +--@ FROM arrtest +--@ WHERE a[1] < 5 and +--@ c = '{"foobar"}'::_name; +--@ +--@ UPDATE arrtest +--@ SET a[1:2] = '{16,25}' +--@ WHERE NOT a = '{}'::_int2; +--@ +--@ UPDATE arrtest +--@ SET b[1:1][1:1][1:2] = '{113, 117}', +--@ b[1:1][1:2][2:2] = '{142, 147}' +--@ WHERE array_dims(b) = '[1:1][1:2][1:2]'; +--@ +--@ UPDATE arrtest +--@ SET c[2:2] = '{"new_word"}' +--@ WHERE array_dims(c) is not null; +--@ +--@ SELECT a,b,c FROM arrtest; +--@ +--@ SELECT a[1:3], +--@ b[1:1][1:2][1:2], +--@ c[1:2], +--@ d[1:1][2:2] +--@ FROM arrtest; +--@ +--@ SELECT b[1:1][2][2], +--@ d[1:1][2] +--@ FROM arrtest; +--@ +--@ INSERT INTO arrtest(a) VALUES('{1,null,3}'); +--@ SELECT a FROM arrtest; +--@ UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL; +--@ SELECT a FROM arrtest WHERE a[2] IS NULL; +--@ DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL; +--@ SELECT a,b,c FROM arrtest; -- test mixed slice/scalar subscripting -select '{{1,2,3},{4,5,6},{7,8,9}}'::int[]; -select ('{{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; -select '[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[]; -select ('[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; +--@ select '{{1,2,3},{4,5,6},{7,8,9}}'::int[]; +--@ select ('{{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; +--@ select '[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[]; +--@ select ('[0:2][0:2]={{1,2,3},{4,5,6},{7,8,9}}'::int[])[1:2][2]; -- -- check subscription corner cases -- -- More subscripts than MAXDIM (6) -SELECT ('{}'::int[])[1][2][3][4][5][6][7]; +--@ SELECT ('{}'::int[])[1][2][3][4][5][6][7]; -- NULL index yields NULL when selecting -SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL][1]; -SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL:1][1]; -SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][1:NULL][1]; +--@ SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL][1]; +--@ SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][NULL:1][1]; +--@ SELECT ('{{{1},{2},{3}},{{4},{5},{6}}}'::int[])[1][1:NULL][1]; -- NULL index in assignment is an error -UPDATE arrtest - SET c[NULL] = '{"can''t assign"}' - WHERE array_dims(c) is not null; -UPDATE arrtest - SET c[NULL:1] = '{"can''t assign"}' - WHERE array_dims(c) is not null; -UPDATE arrtest - SET c[1:NULL] = '{"can''t assign"}' - WHERE array_dims(c) is not null; +--@ UPDATE arrtest +--@ SET c[NULL] = '{"can''t assign"}' +--@ WHERE array_dims(c) is not null; +--@ UPDATE arrtest +--@ SET c[NULL:1] = '{"can''t assign"}' +--@ WHERE array_dims(c) is not null; +--@ UPDATE arrtest +--@ SET c[1:NULL] = '{"can''t assign"}' +--@ WHERE array_dims(c) is not null; -- Un-subscriptable type SELECT (now())[1]; -- test slices with empty lower and/or upper index -CREATE TEMP TABLE arrtest_s ( - a int2[], - b int2[][] -); -INSERT INTO arrtest_s VALUES ('{1,2,3,4,5}', '{{1,2,3}, {4,5,6}, {7,8,9}}'); -INSERT INTO arrtest_s VALUES ('[0:4]={1,2,3,4,5}', '[0:2][0:2]={{1,2,3}, {4,5,6}, {7,8,9}}'); - -SELECT * FROM arrtest_s; -SELECT a[:3], b[:2][:2] FROM arrtest_s; -SELECT a[2:], b[2:][2:] FROM arrtest_s; -SELECT a[:], b[:] FROM arrtest_s; +--@ CREATE TEMP TABLE arrtest_s ( +--@ a int2[], +--@ b int2[][] +--@ ); +--@ INSERT INTO arrtest_s VALUES ('{1,2,3,4,5}', '{{1,2,3}, {4,5,6}, {7,8,9}}'); +--@ INSERT INTO arrtest_s VALUES ('[0:4]={1,2,3,4,5}', '[0:2][0:2]={{1,2,3}, {4,5,6}, {7,8,9}}'); +--@ +--@ SELECT * FROM arrtest_s; +--@ SELECT a[:3], b[:2][:2] FROM arrtest_s; +--@ SELECT a[2:], b[2:][2:] FROM arrtest_s; +--@ SELECT a[:], b[:] FROM arrtest_s; -- updates -UPDATE arrtest_s SET a[:3] = '{11, 12, 13}', b[:2][:2] = '{{11,12}, {14,15}}' - WHERE array_lower(a,1) = 1; -SELECT * FROM arrtest_s; -UPDATE arrtest_s SET a[3:] = '{23, 24, 25}', b[2:][2:] = '{{25,26}, {28,29}}'; -SELECT * FROM arrtest_s; -UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; -SELECT * FROM arrtest_s; -UPDATE arrtest_s SET a[:] = '{23, 24, 25}'; -- fail, too small -INSERT INTO arrtest_s VALUES(NULL, NULL); -UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; -- fail, no good with null +--@ UPDATE arrtest_s SET a[:3] = '{11, 12, 13}', b[:2][:2] = '{{11,12}, {14,15}}' +--@ WHERE array_lower(a,1) = 1; +--@ SELECT * FROM arrtest_s; +--@ UPDATE arrtest_s SET a[3:] = '{23, 24, 25}', b[2:][2:] = '{{25,26}, {28,29}}'; +--@ SELECT * FROM arrtest_s; +--@ UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; +--@ SELECT * FROM arrtest_s; +--@ UPDATE arrtest_s SET a[:] = '{23, 24, 25}'; -- fail, too small +--@ INSERT INTO arrtest_s VALUES(NULL, NULL); +--@ UPDATE arrtest_s SET a[:] = '{11, 12, 13, 14, 15}'; -- fail, no good with null -- check with fixed-length-array type, such as point -SELECT f1[0:1] FROM POINT_TBL; -SELECT f1[0:] FROM POINT_TBL; -SELECT f1[:1] FROM POINT_TBL; -SELECT f1[:] FROM POINT_TBL; +--@ SELECT f1[0:1] FROM POINT_TBL; +--@ SELECT f1[0:] FROM POINT_TBL; +--@ SELECT f1[:1] FROM POINT_TBL; +--@ SELECT f1[:] FROM POINT_TBL; -- subscript assignments to fixed-width result in NULL if previous value is NULL -UPDATE point_tbl SET f1[0] = 10 WHERE f1 IS NULL RETURNING *; -INSERT INTO point_tbl(f1[0]) VALUES(0) RETURNING *; +--@ UPDATE point_tbl SET f1[0] = 10 WHERE f1 IS NULL RETURNING *; +--@ INSERT INTO point_tbl(f1[0]) VALUES(0) RETURNING *; -- NULL assignments get ignored -UPDATE point_tbl SET f1[0] = NULL WHERE f1::text = '(10,10)'::point::text RETURNING *; +--@ UPDATE point_tbl SET f1[0] = NULL WHERE f1::text = '(10,10)'::point::text RETURNING *; -- but non-NULL subscript assignments work -UPDATE point_tbl SET f1[0] = -10, f1[1] = -10 WHERE f1::text = '(10,10)'::point::text RETURNING *; +--@ UPDATE point_tbl SET f1[0] = -10, f1[1] = -10 WHERE f1::text = '(10,10)'::point::text RETURNING *; -- but not to expand the range -UPDATE point_tbl SET f1[3] = 10 WHERE f1::text = '(-10,-10)'::point::text RETURNING *; +--@ UPDATE point_tbl SET f1[3] = 10 WHERE f1::text = '(-10,-10)'::point::text RETURNING *; -- -- test array extension -- -CREATE TEMP TABLE arrtest1 (i int[], t text[]); -insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); -select * from arrtest1; -update arrtest1 set i[2] = 22, t[2] = 'twenty-two'; -select * from arrtest1; -update arrtest1 set i[5] = 5, t[5] = 'five'; -select * from arrtest1; -update arrtest1 set i[8] = 8, t[8] = 'eight'; -select * from arrtest1; -update arrtest1 set i[0] = 0, t[0] = 'zero'; -select * from arrtest1; -update arrtest1 set i[-3] = -3, t[-3] = 'minus-three'; -select * from arrtest1; -update arrtest1 set i[0:2] = array[10,11,12], t[0:2] = array['ten','eleven','twelve']; -select * from arrtest1; -update arrtest1 set i[8:10] = array[18,null,20], t[8:10] = array['p18',null,'p20']; -select * from arrtest1; -update arrtest1 set i[11:12] = array[null,22], t[11:12] = array[null,'p22']; -select * from arrtest1; -update arrtest1 set i[15:16] = array[null,26], t[15:16] = array[null,'p26']; -select * from arrtest1; -update arrtest1 set i[-5:-3] = array[-15,-14,-13], t[-5:-3] = array['m15','m14','m13']; -select * from arrtest1; -update arrtest1 set i[-7:-6] = array[-17,null], t[-7:-6] = array['m17',null]; -select * from arrtest1; -update arrtest1 set i[-12:-10] = array[-22,null,-20], t[-12:-10] = array['m22',null,'m20']; -select * from arrtest1; -delete from arrtest1; -insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); -select * from arrtest1; -update arrtest1 set i[0:5] = array[0,1,2,null,4,5], t[0:5] = array['z','p1','p2',null,'p4','p5']; -select * from arrtest1; +--@ CREATE TEMP TABLE arrtest1 (i int[], t text[]); +--@ insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); +--@ select * from arrtest1; +--@ update arrtest1 set i[2] = 22, t[2] = 'twenty-two'; +--@ select * from arrtest1; +--@ update arrtest1 set i[5] = 5, t[5] = 'five'; +--@ select * from arrtest1; +--@ update arrtest1 set i[8] = 8, t[8] = 'eight'; +--@ select * from arrtest1; +--@ update arrtest1 set i[0] = 0, t[0] = 'zero'; +--@ select * from arrtest1; +--@ update arrtest1 set i[-3] = -3, t[-3] = 'minus-three'; +--@ select * from arrtest1; +--@ update arrtest1 set i[0:2] = array[10,11,12], t[0:2] = array['ten','eleven','twelve']; +--@ select * from arrtest1; +--@ update arrtest1 set i[8:10] = array[18,null,20], t[8:10] = array['p18',null,'p20']; +--@ select * from arrtest1; +--@ update arrtest1 set i[11:12] = array[null,22], t[11:12] = array[null,'p22']; +--@ select * from arrtest1; +--@ update arrtest1 set i[15:16] = array[null,26], t[15:16] = array[null,'p26']; +--@ select * from arrtest1; +--@ update arrtest1 set i[-5:-3] = array[-15,-14,-13], t[-5:-3] = array['m15','m14','m13']; +--@ select * from arrtest1; +--@ update arrtest1 set i[-7:-6] = array[-17,null], t[-7:-6] = array['m17',null]; +--@ select * from arrtest1; +--@ update arrtest1 set i[-12:-10] = array[-22,null,-20], t[-12:-10] = array['m22',null,'m20']; +--@ select * from arrtest1; +--@ delete from arrtest1; +--@ insert into arrtest1 values(array[1,2,null,4], array['one','two',null,'four']); +--@ select * from arrtest1; +--@ update arrtest1 set i[0:5] = array[0,1,2,null,4,5], t[0:5] = array['z','p1','p2',null,'p4','p5']; +--@ select * from arrtest1; -- -- array expressions and operators -- -- table creation and INSERTs -CREATE TEMP TABLE arrtest2 (i integer ARRAY[4], f float8[], n numeric[], t text[], d timestamp[]); -INSERT INTO arrtest2 VALUES( - ARRAY[[[113,142],[1,147]]], - ARRAY[1.1,1.2,1.3]::float8[], - ARRAY[1.1,1.2,1.3], - ARRAY[[['aaa','aab'],['aba','abb'],['aca','acb']],[['baa','bab'],['bba','bbb'],['bca','bcb']]], - ARRAY['19620326','19931223','19970117']::timestamp[] -); +--@ CREATE TEMP TABLE arrtest2 (i integer ARRAY[4], f float8[], n numeric[], t text[], d timestamp[]); +--@ INSERT INTO arrtest2 VALUES( +--@ ARRAY[[[113,142],[1,147]]], +--@ ARRAY[1.1,1.2,1.3]::float8[], +--@ ARRAY[1.1,1.2,1.3], +--@ ARRAY[[['aaa','aab'],['aba','abb'],['aca','acb']],[['baa','bab'],['bba','bbb'],['bca','bcb']]], +--@ ARRAY['19620326','19931223','19970117']::timestamp[] +--@ ); -- some more test data -CREATE TEMP TABLE arrtest_f (f0 int, f1 text, f2 float8); -insert into arrtest_f values(1,'cat1',1.21); -insert into arrtest_f values(2,'cat1',1.24); -insert into arrtest_f values(3,'cat1',1.18); -insert into arrtest_f values(4,'cat1',1.26); -insert into arrtest_f values(5,'cat1',1.15); -insert into arrtest_f values(6,'cat2',1.15); -insert into arrtest_f values(7,'cat2',1.26); -insert into arrtest_f values(8,'cat2',1.32); -insert into arrtest_f values(9,'cat2',1.30); - -CREATE TEMP TABLE arrtest_i (f0 int, f1 text, f2 int); -insert into arrtest_i values(1,'cat1',21); -insert into arrtest_i values(2,'cat1',24); -insert into arrtest_i values(3,'cat1',18); -insert into arrtest_i values(4,'cat1',26); -insert into arrtest_i values(5,'cat1',15); -insert into arrtest_i values(6,'cat2',15); -insert into arrtest_i values(7,'cat2',26); -insert into arrtest_i values(8,'cat2',32); -insert into arrtest_i values(9,'cat2',30); +--@ CREATE TEMP TABLE arrtest_f (f0 int, f1 text, f2 float8); +--@ insert into arrtest_f values(1,'cat1',1.21); +--@ insert into arrtest_f values(2,'cat1',1.24); +--@ insert into arrtest_f values(3,'cat1',1.18); +--@ insert into arrtest_f values(4,'cat1',1.26); +--@ insert into arrtest_f values(5,'cat1',1.15); +--@ insert into arrtest_f values(6,'cat2',1.15); +--@ insert into arrtest_f values(7,'cat2',1.26); +--@ insert into arrtest_f values(8,'cat2',1.32); +--@ insert into arrtest_f values(9,'cat2',1.30); +--@ +--@ CREATE TEMP TABLE arrtest_i (f0 int, f1 text, f2 int); +--@ insert into arrtest_i values(1,'cat1',21); +--@ insert into arrtest_i values(2,'cat1',24); +--@ insert into arrtest_i values(3,'cat1',18); +--@ insert into arrtest_i values(4,'cat1',26); +--@ insert into arrtest_i values(5,'cat1',15); +--@ insert into arrtest_i values(6,'cat2',15); +--@ insert into arrtest_i values(7,'cat2',26); +--@ insert into arrtest_i values(8,'cat2',32); +--@ insert into arrtest_i values(9,'cat2',30); -- expressions SELECT t.f[1][3][1] AS "131", t.f[2][2][1] AS "221" FROM ( @@ -248,10 +248,10 @@ SELECT t.f[1][3][1] AS "131", t.f[2][2][1] AS "221" FROM ( ) AS t; SELECT ARRAY[[[[[['hello'],['world']]]]]]; SELECT ARRAY[ARRAY['hello'],ARRAY['world']]; -SELECT ARRAY(select f2 from arrtest_f order by f2) AS "ARRAY"; +--@ SELECT ARRAY(select f2 from arrtest_f order by f2) AS "ARRAY"; -- with nulls -SELECT '{1,null,3}'::int[]; +--@ SELECT '{1,null,3}'::int[]; SELECT ARRAY[1,NULL,3]; -- functions @@ -261,53 +261,53 @@ SELECT array_cat(ARRAY[1,2], ARRAY[3,4]) AS "{1,2,3,4}"; SELECT array_cat(ARRAY[1,2], ARRAY[[3,4],[5,6]]) AS "{{1,2},{3,4},{5,6}}"; SELECT array_cat(ARRAY[[3,4],[5,6]], ARRAY[1,2]) AS "{{3,4},{5,6},{1,2}}"; -SELECT array_position(ARRAY[1,2,3,4,5], 4); -SELECT array_position(ARRAY[5,3,4,2,1], 4); -SELECT array_position(ARRAY[[1,2],[3,4]], 3); -SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon'); -SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'sat'); -SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], NULL); -SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], NULL); -SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], 'sat'); - -SELECT array_positions(NULL, 10); -SELECT array_positions(NULL, NULL::int); -SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], 4); -SELECT array_positions(ARRAY[[1,2],[3,4]], 4); -SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], NULL); -SELECT array_positions(ARRAY[1,2,3,NULL,5,6,1,2,3,NULL,5,6], NULL); -SELECT array_length(array_positions(ARRAY(SELECT 'AAAAAAAAAAAAAAAAAAAAAAAAA'::text || i % 10 - FROM generate_series(1,100) g(i)), - 'AAAAAAAAAAAAAAAAAAAAAAAAA5'), 1); - -DO $$ -DECLARE - o int; - a int[] := ARRAY[1,2,3,2,3,1,2]; -BEGIN - o := array_position(a, 2); - WHILE o IS NOT NULL - LOOP - RAISE NOTICE '%', o; - o := array_position(a, 2, o + 1); - END LOOP; -END -$$ LANGUAGE plpgsql; - -SELECT array_position('[2:4]={1,2,3}'::int[], 1); -SELECT array_positions('[2:4]={1,2,3}'::int[], 1); - -SELECT - array_position(ids, (1, 1)), - array_positions(ids, (1, 1)) - FROM -(VALUES - (ARRAY[(0, 0), (1, 1)]), - (ARRAY[(1, 1)]) -) AS f (ids); +--@ SELECT array_position(ARRAY[1,2,3,4,5], 4); +--@ SELECT array_position(ARRAY[5,3,4,2,1], 4); +--@ SELECT array_position(ARRAY[[1,2],[3,4]], 3); +--@ SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon'); +--@ SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'sat'); +--@ SELECT array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], NULL); +--@ SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], NULL); +--@ SELECT array_position(ARRAY['sun','mon','tue','wed','thu',NULL,'fri','sat'], 'sat'); +--@ +--@ SELECT array_positions(NULL, 10); +--@ SELECT array_positions(NULL, NULL::int); +--@ SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], 4); +--@ SELECT array_positions(ARRAY[[1,2],[3,4]], 4); +--@ SELECT array_positions(ARRAY[1,2,3,4,5,6,1,2,3,4,5,6], NULL); +--@ SELECT array_positions(ARRAY[1,2,3,NULL,5,6,1,2,3,NULL,5,6], NULL); +--@ SELECT array_length(array_positions(ARRAY(SELECT 'AAAAAAAAAAAAAAAAAAAAAAAAA'::text || i % 10 +--@ FROM generate_series(1,100) g(i)), +--@ 'AAAAAAAAAAAAAAAAAAAAAAAAA5'), 1); + +--@ DO $$ +--@ DECLARE +--@ o int; +--@ a int[] := ARRAY[1,2,3,2,3,1,2]; +--@ BEGIN +--@ o := array_position(a, 2); +--@ WHILE o IS NOT NULL +--@ LOOP +--@ RAISE NOTICE '%', o; +--@ o := array_position(a, 2, o + 1); +--@ END LOOP; +--@ END +--@ $$ LANGUAGE plpgsql; + +--@ SELECT array_position('[2:4]={1,2,3}'::int[], 1); +--@ SELECT array_positions('[2:4]={1,2,3}'::int[], 1); +--@ +--@ SELECT +--@ array_position(ids, (1, 1)), +--@ array_positions(ids, (1, 1)) +--@ FROM +--@ (VALUES +--@ (ARRAY[(0, 0), (1, 1)]), +--@ (ARRAY[(1, 1)]) +--@ ) AS f (ids); -- operators -SELECT a FROM arrtest WHERE b = ARRAY[[[113,142],[1,147]]]; +--@ SELECT a FROM arrtest WHERE b = ARRAY[[[113,142],[1,147]]]; SELECT NOT ARRAY[1.1,1.2,1.3] = ARRAY[1.1,1.2,1.3] AS "FALSE"; SELECT ARRAY[1,2] || 3 AS "{1,2,3}"; SELECT 0 || ARRAY[1,2] AS "{0,1,2}"; @@ -318,40 +318,40 @@ SELECT ARRAY[0,0] || ARRAY[1,1] || ARRAY[2,2] AS "{0,0,1,1,2,2}"; SELECT 0 || ARRAY[1,2] || 3 AS "{0,1,2,3}"; SELECT ARRAY[1.1] || ARRAY[2,3,4]; -SELECT * FROM array_op_test WHERE i @> '{32}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i && '{32}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i @> '{17}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i && '{17}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i @> '{32,17}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i && '{32,17}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i = '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i @> '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i && '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i <@ '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i = '{NULL}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i @> '{NULL}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i && '{NULL}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE i <@ '{NULL}' ORDER BY seqno; - -SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t @> '{AAAAAAAAAA646}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t && '{AAAAAAAAAA646}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t <@ '{AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t = '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t @> '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t && '{}' ORDER BY seqno; -SELECT * FROM array_op_test WHERE t <@ '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i @> '{32}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i && '{32}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i @> '{17}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i && '{17}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i @> '{32,17}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i && '{32,17}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i = '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i @> '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i && '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i <@ '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i = '{NULL}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i @> '{NULL}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i && '{NULL}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE i <@ '{NULL}' ORDER BY seqno; +--@ +--@ SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t @> '{AAAAAAAAAA646}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t && '{AAAAAAAAAA646}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t @> '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t && '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t <@ '{AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t = '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t @> '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t && '{}' ORDER BY seqno; +--@ SELECT * FROM array_op_test WHERE t <@ '{}' ORDER BY seqno; -- array casts SELECT ARRAY[1,2,3]::text[]::int[]::float8[] AS "{1,2,3}"; SELECT pg_typeof(ARRAY[1,2,3]::text[]::int[]::float8[]) AS "double precision[]"; -SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] AS "{{a,bc},{def,hijk}}"; -SELECT pg_typeof(ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[]) AS "character varying[]"; -SELECT CAST(ARRAY[[[[[['a','bb','ccc']]]]]] as text[]) as "{{{{{{a,bb,ccc}}}}}}"; +--@ SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] AS "{{a,bc},{def,hijk}}"; +--@ SELECT pg_typeof(ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[]) AS "character varying[]"; +--@ SELECT CAST(ARRAY[[[[[['a','bb','ccc']]]]]] as text[]) as "{{{{{{a,bb,ccc}}}}}}"; SELECT NULL::text[]::int[] AS "NULL"; -- scalar op any/all (array) @@ -372,46 +372,46 @@ select 33 * any (44); -- nulls select 33 = any (null::int[]); select null::int = any ('{1,2,3}'); -select 33 = any ('{1,null,3}'); -select 33 = any ('{1,null,33}'); +--@ select 33 = any ('{1,null,3}'); +--@ select 33 = any ('{1,null,33}'); select 33 = all (null::int[]); select null::int = all ('{1,2,3}'); -select 33 = all ('{1,null,3}'); -select 33 = all ('{33,null,33}'); +--@ select 33 = all ('{1,null,3}'); +--@ select 33 = all ('{33,null,33}'); -- nulls later in the bitmap -SELECT -1 != ALL(ARRAY(SELECT NULLIF(g.i, 900) FROM generate_series(1,1000) g(i))); +--@ SELECT -1 != ALL(ARRAY(SELECT NULLIF(g.i, 900) FROM generate_series(1,1000) g(i))); -- test indexes on arrays -create temp table arr_tbl (f1 int[] unique); -insert into arr_tbl values ('{1,2,3}'); -insert into arr_tbl values ('{1,2}'); +--@ create temp table arr_tbl (f1 int[] unique); +--@ insert into arr_tbl values ('{1,2,3}'); +--@ insert into arr_tbl values ('{1,2}'); -- failure expected: -insert into arr_tbl values ('{1,2,3}'); -insert into arr_tbl values ('{2,3,4}'); -insert into arr_tbl values ('{1,5,3}'); -insert into arr_tbl values ('{1,2,10}'); - -set enable_seqscan to off; -set enable_bitmapscan to off; -select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}'; -select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}'; +--@ insert into arr_tbl values ('{1,2,3}'); +--@ insert into arr_tbl values ('{2,3,4}'); +--@ insert into arr_tbl values ('{1,5,3}'); +--@ insert into arr_tbl values ('{1,2,10}'); +--@ +--@ set enable_seqscan to off; +--@ set enable_bitmapscan to off; +--@ select * from arr_tbl where f1 > '{1,2,3}' and f1 <= '{1,5,3}'; +--@ select * from arr_tbl where f1 >= '{1,2,3}' and f1 < '{1,5,3}'; -- test ON CONFLICT DO UPDATE with arrays -create temp table arr_pk_tbl (pk int4 primary key, f1 int[]); -insert into arr_pk_tbl values (1, '{1,2,3}'); -insert into arr_pk_tbl values (1, '{3,4,5}') on conflict (pk) - do update set f1[1] = excluded.f1[1], f1[3] = excluded.f1[3] - returning pk, f1; -insert into arr_pk_tbl(pk, f1[1:2]) values (1, '{6,7,8}') on conflict (pk) - do update set f1[1] = excluded.f1[1], - f1[2] = excluded.f1[2], - f1[3] = excluded.f1[3] - returning pk, f1; +--@ create temp table arr_pk_tbl (pk int4 primary key, f1 int[]); +--@ insert into arr_pk_tbl values (1, '{1,2,3}'); +--@ insert into arr_pk_tbl values (1, '{3,4,5}') on conflict (pk) +--@ do update set f1[1] = excluded.f1[1], f1[3] = excluded.f1[3] +--@ returning pk, f1; +--@ insert into arr_pk_tbl(pk, f1[1:2]) values (1, '{6,7,8}') on conflict (pk) +--@ do update set f1[1] = excluded.f1[1], +--@ f1[2] = excluded.f1[2], +--@ f1[3] = excluded.f1[3] +--@ returning pk, f1; -- note: if above selects don't produce the expected tuple order, -- then you didn't get an indexscan plan, and something is busted. -reset enable_seqscan; -reset enable_bitmapscan; +--@ reset enable_seqscan; +--@ reset enable_bitmapscan; -- test [not] (like|ilike) (any|all) (...) select 'foo' like any (array['%a', '%o']); -- t @@ -420,18 +420,18 @@ select 'foo' like all (array['f%', '%o']); -- t select 'foo' like all (array['f%', '%b']); -- f select 'foo' not like any (array['%a', '%b']); -- t select 'foo' not like all (array['%a', '%o']); -- f -select 'foo' ilike any (array['%A', '%O']); -- t -select 'foo' ilike all (array['F%', '%O']); -- t +--@ select 'foo' ilike any (array['%A', '%O']); -- t +--@ select 'foo' ilike all (array['F%', '%O']); -- t -- -- General array parser tests -- -- none of the following should be accepted -select '{{1,{2}},{2,3}}'::text[]; -select '{{},{}}'::text[]; -select E'{{1,2},\\{2,3}}'::text[]; -select '{{"1 2" x},{3}}'::text[]; +--@ select '{{1,{2}},{2,3}}'::text[]; +--@ select '{{},{}}'::text[]; +--@ select E'{{1,2},\\{2,3}}'::text[]; +--@ select '{{"1 2" x},{3}}'::text[]; select '{}}'::text[]; select '{ }}'::text[]; select array[]; @@ -439,177 +439,177 @@ select array[]; -- all of the following should be accepted select '{}'::text[]; -select '{{{1,2,3,4},{2,3,4,5}},{{3,4,5,6},{4,5,6,7}}}'::text[]; -select '{0 second ,0 second}'::interval[]; -select '{ { "," } , { 3 } }'::text[]; -select ' { { " 0 second " , 0 second } }'::text[]; -select '{ - 0 second, - @ 1 hour @ 42 minutes @ 20 seconds - }'::interval[]; +--@ select '{{{1,2,3,4},{2,3,4,5}},{{3,4,5,6},{4,5,6,7}}}'::text[]; +--@ select '{0 second ,0 second}'::interval[]; +--@ select '{ { "," } , { 3 } }'::text[]; +--@ select ' { { " 0 second " , 0 second } }'::text[]; +--@ select '{ +--@ 0 second, +--@ @ 1 hour @ 42 minutes @ 20 seconds +--@ }'::interval[]; select array[]::text[]; -select '[0:1]={1.1,2.2}'::float8[]; +--@ select '[0:1]={1.1,2.2}'::float8[]; -- all of the above should be accepted -- tests for array aggregates -CREATE TEMP TABLE arraggtest ( f1 INT[], f2 TEXT[][], f3 FLOAT[]); - -INSERT INTO arraggtest (f1, f2, f3) VALUES -('{1,2,3,4}','{{grey,red},{blue,blue}}','{1.6, 0.0}'); -INSERT INTO arraggtest (f1, f2, f3) VALUES -('{1,2,3}','{{grey,red},{grey,blue}}','{1.6}'); -SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; - -INSERT INTO arraggtest (f1, f2, f3) VALUES -('{3,3,2,4,5,6}','{{white,yellow},{pink,orange}}','{2.1,3.3,1.8,1.7,1.6}'); -SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; - -INSERT INTO arraggtest (f1, f2, f3) VALUES -('{2}','{{black,red},{green,orange}}','{1.6,2.2,2.6,0.4}'); -SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; - -INSERT INTO arraggtest (f1, f2, f3) VALUES -('{4,2,6,7,8,1}','{{red},{black},{purple},{blue},{blue}}',NULL); -SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; - -INSERT INTO arraggtest (f1, f2, f3) VALUES -('{}','{{pink,white,blue,red,grey,orange}}','{2.1,1.87,1.4,2.2}'); -SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; +--@ CREATE TEMP TABLE arraggtest ( f1 INT[], f2 TEXT[][], f3 FLOAT[]); +--@ +--@ INSERT INTO arraggtest (f1, f2, f3) VALUES +--@ ('{1,2,3,4}','{{grey,red},{blue,blue}}','{1.6, 0.0}'); +--@ INSERT INTO arraggtest (f1, f2, f3) VALUES +--@ ('{1,2,3}','{{grey,red},{grey,blue}}','{1.6}'); +--@ SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; +--@ +--@ INSERT INTO arraggtest (f1, f2, f3) VALUES +--@ ('{3,3,2,4,5,6}','{{white,yellow},{pink,orange}}','{2.1,3.3,1.8,1.7,1.6}'); +--@ SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; +--@ +--@ INSERT INTO arraggtest (f1, f2, f3) VALUES +--@ ('{2}','{{black,red},{green,orange}}','{1.6,2.2,2.6,0.4}'); +--@ SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; +--@ +--@ INSERT INTO arraggtest (f1, f2, f3) VALUES +--@ ('{4,2,6,7,8,1}','{{red},{black},{purple},{blue},{blue}}',NULL); +--@ SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; +--@ +--@ INSERT INTO arraggtest (f1, f2, f3) VALUES +--@ ('{}','{{pink,white,blue,red,grey,orange}}','{2.1,1.87,1.4,2.2}'); +--@ SELECT max(f1), min(f1), max(f2), min(f2), max(f3), min(f3) FROM arraggtest; -- A few simple tests for arrays of composite types -create type comptype as (f1 int, f2 text); - -create table comptable (c1 comptype, c2 comptype[]); +--@ create type comptype as (f1 int, f2 text); +--@ +--@ create table comptable (c1 comptype, c2 comptype[]); -- XXX would like to not have to specify row() construct types here ... -insert into comptable - values (row(1,'foo'), array[row(2,'bar')::comptype, row(3,'baz')::comptype]); +--@ insert into comptable +--@ values (row(1,'foo'), array[row(2,'bar')::comptype, row(3,'baz')::comptype]); -- check that implicitly named array type _comptype isn't a problem -create type _comptype as enum('fooey'); - -select * from comptable; -select c2[2].f2 from comptable; - -drop type _comptype; -drop table comptable; -drop type comptype; - -create or replace function unnest1(anyarray) -returns setof anyelement as $$ -select $1[s] from generate_subscripts($1,1) g(s); -$$ language sql immutable; - -create or replace function unnest2(anyarray) -returns setof anyelement as $$ -select $1[s1][s2] from generate_subscripts($1,1) g1(s1), - generate_subscripts($1,2) g2(s2); -$$ language sql immutable; - -select * from unnest1(array[1,2,3]); -select * from unnest2(array[[1,2,3],[4,5,6]]); - -drop function unnest1(anyarray); -drop function unnest2(anyarray); - -select array_fill(null::integer, array[3,3],array[2,2]); -select array_fill(null::integer, array[3,3]); -select array_fill(null::text, array[3,3],array[2,2]); -select array_fill(null::text, array[3,3]); -select array_fill(7, array[3,3],array[2,2]); -select array_fill(7, array[3,3]); -select array_fill('juhu'::text, array[3,3],array[2,2]); -select array_fill('juhu'::text, array[3,3]); -select a, a = '{}' as is_eq, array_dims(a) - from (select array_fill(42, array[0]) as a) ss; -select a, a = '{}' as is_eq, array_dims(a) - from (select array_fill(42, '{}') as a) ss; -select a, a = '{}' as is_eq, array_dims(a) - from (select array_fill(42, '{}', '{}') as a) ss; --- raise exception -select array_fill(1, null, array[2,2]); -select array_fill(1, array[2,2], null); -select array_fill(1, array[2,2], '{}'); -select array_fill(1, array[3,3], array[1,1,1]); -select array_fill(1, array[1,2,null]); -select array_fill(1, array[[1,2],[3,4]]); - -select string_to_array('1|2|3', '|'); -select string_to_array('1|2|3|', '|'); -select string_to_array('1||2|3||', '||'); -select string_to_array('1|2|3', ''); -select string_to_array('', '|'); -select string_to_array('1|2|3', NULL); -select string_to_array(NULL, '|') IS NULL; -select string_to_array('abc', ''); -select string_to_array('abc', '', 'abc'); -select string_to_array('abc', ','); -select string_to_array('abc', ',', 'abc'); -select string_to_array('1,2,3,4,,6', ','); -select string_to_array('1,2,3,4,,6', ',', ''); -select string_to_array('1,2,3,4,*,6', ',', '*'); - -select v, v is null as "is null" from string_to_table('1|2|3', '|') g(v); -select v, v is null as "is null" from string_to_table('1|2|3|', '|') g(v); -select v, v is null as "is null" from string_to_table('1||2|3||', '||') g(v); -select v, v is null as "is null" from string_to_table('1|2|3', '') g(v); -select v, v is null as "is null" from string_to_table('', '|') g(v); -select v, v is null as "is null" from string_to_table('1|2|3', NULL) g(v); -select v, v is null as "is null" from string_to_table(NULL, '|') g(v); -select v, v is null as "is null" from string_to_table('abc', '') g(v); -select v, v is null as "is null" from string_to_table('abc', '', 'abc') g(v); -select v, v is null as "is null" from string_to_table('abc', ',') g(v); -select v, v is null as "is null" from string_to_table('abc', ',', 'abc') g(v); -select v, v is null as "is null" from string_to_table('1,2,3,4,,6', ',') g(v); -select v, v is null as "is null" from string_to_table('1,2,3,4,,6', ',', '') g(v); -select v, v is null as "is null" from string_to_table('1,2,3,4,*,6', ',', '*') g(v); +--@ create type _comptype as enum('fooey'); +--@ +--@ select * from comptable; +--@ select c2[2].f2 from comptable; +--@ +--@ drop type _comptype; +--@ drop table comptable; +--@ drop type comptype; +--@ +--@ create or replace function unnest1(anyarray) +--@ returns setof anyelement as $$ +--@ select $1[s] from generate_subscripts($1,1) g(s); +--@ $$ language sql immutable; +--@ +--@ create or replace function unnest2(anyarray) +--@ returns setof anyelement as $$ +--@ select $1[s1][s2] from generate_subscripts($1,1) g1(s1), +--@ generate_subscripts($1,2) g2(s2); +--@ $$ language sql immutable; +--@ +--@ select * from unnest1(array[1,2,3]); +--@ select * from unnest2(array[[1,2,3],[4,5,6]]); +--@ +--@ drop function unnest1(anyarray); +--@ drop function unnest2(anyarray); + +--@ select array_fill(null::integer, array[3,3],array[2,2]); +--@ select array_fill(null::integer, array[3,3]); +--@ select array_fill(null::text, array[3,3],array[2,2]); +--@ select array_fill(null::text, array[3,3]); +--@ select array_fill(7, array[3,3],array[2,2]); +--@ select array_fill(7, array[3,3]); +--@ select array_fill('juhu'::text, array[3,3],array[2,2]); +--@ select array_fill('juhu'::text, array[3,3]); +--@ select a, a = '{}' as is_eq, array_dims(a) +--@ from (select array_fill(42, array[0]) as a) ss; +--@ select a, a = '{}' as is_eq, array_dims(a) +--@ from (select array_fill(42, '{}') as a) ss; +--@ select a, a = '{}' as is_eq, array_dims(a) +--@ from (select array_fill(42, '{}', '{}') as a) ss; +--@ -- raise exception +--@ select array_fill(1, null, array[2,2]); +--@ select array_fill(1, array[2,2], null); +--@ select array_fill(1, array[2,2], '{}'); +--@ select array_fill(1, array[3,3], array[1,1,1]); +--@ select array_fill(1, array[1,2,null]); +--@ select array_fill(1, array[[1,2],[3,4]]); + +--@ select string_to_array('1|2|3', '|'); +--@ select string_to_array('1|2|3|', '|'); +--@ select string_to_array('1||2|3||', '||'); +--@ select string_to_array('1|2|3', ''); +--@ select string_to_array('', '|'); +--@ select string_to_array('1|2|3', NULL); +--@ select string_to_array(NULL, '|') IS NULL; +--@ select string_to_array('abc', ''); +--@ select string_to_array('abc', '', 'abc'); +--@ select string_to_array('abc', ','); +--@ select string_to_array('abc', ',', 'abc'); +--@ select string_to_array('1,2,3,4,,6', ','); +--@ select string_to_array('1,2,3,4,,6', ',', ''); +--@ select string_to_array('1,2,3,4,*,6', ',', '*'); + +--@ select v, v is null as "is null" from string_to_table('1|2|3', '|') g(v); +--@ select v, v is null as "is null" from string_to_table('1|2|3|', '|') g(v); +--@ select v, v is null as "is null" from string_to_table('1||2|3||', '||') g(v); +--@ select v, v is null as "is null" from string_to_table('1|2|3', '') g(v); +--@ select v, v is null as "is null" from string_to_table('', '|') g(v); +--@ select v, v is null as "is null" from string_to_table('1|2|3', NULL) g(v); +--@ select v, v is null as "is null" from string_to_table(NULL, '|') g(v); +--@ select v, v is null as "is null" from string_to_table('abc', '') g(v); +--@ select v, v is null as "is null" from string_to_table('abc', '', 'abc') g(v); +--@ select v, v is null as "is null" from string_to_table('abc', ',') g(v); +--@ select v, v is null as "is null" from string_to_table('abc', ',', 'abc') g(v); +--@ select v, v is null as "is null" from string_to_table('1,2,3,4,,6', ',') g(v); +--@ select v, v is null as "is null" from string_to_table('1,2,3,4,,6', ',', '') g(v); +--@ select v, v is null as "is null" from string_to_table('1,2,3,4,*,6', ',', '*') g(v); select array_to_string(NULL::int4[], ',') IS NULL; select array_to_string('{}'::int4[], ','); select array_to_string(array[1,2,3,4,NULL,6], ','); select array_to_string(array[1,2,3,4,NULL,6], ',', '*'); select array_to_string(array[1,2,3,4,NULL,6], NULL); -select array_to_string(array[1,2,3,4,NULL,6], ',', NULL); +--@ select array_to_string(array[1,2,3,4,NULL,6], ',', NULL); -select array_to_string(string_to_array('1|2|3', '|'), '|'); +--@ select array_to_string(string_to_array('1|2|3', '|'), '|'); -select array_length(array[1,2,3], 1); -select array_length(array[[1,2,3], [4,5,6]], 0); -select array_length(array[[1,2,3], [4,5,6]], 1); -select array_length(array[[1,2,3], [4,5,6]], 2); -select array_length(array[[1,2,3], [4,5,6]], 3); +--@ select array_length(array[1,2,3], 1); +--@ select array_length(array[[1,2,3], [4,5,6]], 0); +--@ select array_length(array[[1,2,3], [4,5,6]], 1); +--@ select array_length(array[[1,2,3], [4,5,6]], 2); +--@ select array_length(array[[1,2,3], [4,5,6]], 3); -select cardinality(NULL::int[]); -select cardinality('{}'::int[]); -select cardinality(array[1,2,3]); -select cardinality('[2:4]={5,6,7}'::int[]); -select cardinality('{{1,2}}'::int[]); -select cardinality('{{1,2},{3,4},{5,6}}'::int[]); -select cardinality('{{{1,9},{5,6}},{{2,3},{3,4}}}'::int[]); +--@ select cardinality(NULL::int[]); +--@ select cardinality('{}'::int[]); +--@ select cardinality(array[1,2,3]); +--@ select cardinality('[2:4]={5,6,7}'::int[]); +--@ select cardinality('{{1,2}}'::int[]); +--@ select cardinality('{{1,2},{3,4},{5,6}}'::int[]); +--@ select cardinality('{{{1,9},{5,6}},{{2,3},{3,4}}}'::int[]); -- array_agg(anynonarray) -select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss; -select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; -select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; -select array_agg(unique1) from tenk1 where unique1 < -15; +--@ select array_agg(unique1) from (select unique1 from tenk1 where unique1 < 15 order by unique1) ss; +--@ select array_agg(ten) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; +--@ select array_agg(nullif(ten, 4)) from (select ten from tenk1 where unique1 < 15 order by unique1) ss; +--@ select array_agg(unique1) from tenk1 where unique1 < -15; -- array_agg(anyarray) select array_agg(ar) from (values ('{1,2}'::int[]), ('{3,4}'::int[])) v(ar); -select array_agg(distinct ar order by ar desc) - from (select array[i / 2] from generate_series(1,10) a(i)) b(ar); -select array_agg(ar) - from (select array_agg(array[i, i+1, i-1]) - from generate_series(1,2) a(i)) b(ar); -select array_agg(array[i+1.2, i+1.3, i+1.4]) from generate_series(1,3) g(i); -select array_agg(array['Hello', i::text]) from generate_series(9,11) g(i); -select array_agg(array[i, nullif(i, 3), i+1]) from generate_series(1,4) g(i); +--@ select array_agg(distinct ar order by ar desc) +--@ from (select array[i / 2] from generate_series(1,10) a(i)) b(ar); +--@ select array_agg(ar) +--@ from (select array_agg(array[i, i+1, i-1]) +--@ from generate_series(1,2) a(i)) b(ar); +--@ select array_agg(array[i+1.2, i+1.3, i+1.4]) from generate_series(1,3) g(i); +--@ select array_agg(array['Hello', i::text]) from generate_series(9,11) g(i); +--@ select array_agg(array[i, nullif(i, 3), i+1]) from generate_series(1,4) g(i); -- errors -select array_agg('{}'::int[]) from generate_series(1,2); -select array_agg(null::int[]) from generate_series(1,2); -select array_agg(ar) - from (values ('{1,2}'::int[]), ('{3}'::int[])) v(ar); +--@ select array_agg('{}'::int[]) from generate_series(1,2); +--@ select array_agg(null::int[]) from generate_series(1,2); +--@ select array_agg(ar) +--@ from (values ('{1,2}'::int[]), ('{3}'::int[])) v(ar); select unnest(array[1,2,3]); select * from unnest(array[1,2,3]); @@ -618,120 +618,120 @@ select unnest(array[1,2,3,4.5]::numeric[]); select unnest(array[1,2,3,null,4,null,null,5,6]); select unnest(array[1,2,3,null,4,null,null,5,6]::text[]); select abs(unnest(array[1,2,null,-3])); -select array_remove(array[1,2,2,3], 2); -select array_remove(array[1,2,2,3], 5); -select array_remove(array[1,NULL,NULL,3], NULL); -select array_remove(array['A','CC','D','C','RR'], 'RR'); -select array_remove(array[1.0, 2.1, 3.3], 1); -select array_remove('{{1,2,2},{1,4,3}}', 2); -- not allowed -select array_remove(array['X','X','X'], 'X') = '{}'; -select array_replace(array[1,2,5,4],5,3); -select array_replace(array[1,2,5,4],5,NULL); -select array_replace(array[1,2,NULL,4,NULL],NULL,5); -select array_replace(array['A','B','DD','B'],'B','CC'); -select array_replace(array[1,NULL,3],NULL,NULL); -select array_replace(array['AB',NULL,'CDE'],NULL,'12'); +--@ select array_remove(array[1,2,2,3], 2); +--@ select array_remove(array[1,2,2,3], 5); +--@ select array_remove(array[1,NULL,NULL,3], NULL); +--@ select array_remove(array['A','CC','D','C','RR'], 'RR'); +--@ select array_remove(array[1.0, 2.1, 3.3], 1); +--@ select array_remove('{{1,2,2},{1,4,3}}', 2); -- not allowed +--@ select array_remove(array['X','X','X'], 'X') = '{}'; +--@ select array_replace(array[1,2,5,4],5,3); +--@ select array_replace(array[1,2,5,4],5,NULL); +--@ select array_replace(array[1,2,NULL,4,NULL],NULL,5); +--@ select array_replace(array['A','B','DD','B'],'B','CC'); +--@ select array_replace(array[1,NULL,3],NULL,NULL); +--@ select array_replace(array['AB',NULL,'CDE'],NULL,'12'); -- array(select array-value ...) -select array(select array[i,i/2] from generate_series(1,5) i); -select array(select array['Hello', i::text] from generate_series(9,11) i); +--@ select array(select array[i,i/2] from generate_series(1,5) i); +--@ select array(select array['Hello', i::text] from generate_series(9,11) i); -- Insert/update on a column that is array of composite -create temp table t1 (f1 int8_tbl[]); -insert into t1 (f1[5].q1) values(42); -select * from t1; -update t1 set f1[5].q2 = 43; -select * from t1; +--@ create temp table t1 (f1 int8_tbl[]); +--@ insert into t1 (f1[5].q1) values(42); +--@ select * from t1; +--@ update t1 set f1[5].q2 = 43; +--@ select * from t1; -- Check that arrays of composites are safely detoasted when needed -create temp table src (f1 text); -insert into src - select string_agg(random()::text,'') from generate_series(1,10000); -create type textandtext as (c1 text, c2 text); -create temp table dest (f1 textandtext[]); -insert into dest select array[row(f1,f1)::textandtext] from src; -select length(md5((f1[1]).c2)) from dest; -delete from src; -select length(md5((f1[1]).c2)) from dest; -truncate table src; -drop table src; -select length(md5((f1[1]).c2)) from dest; -drop table dest; -drop type textandtext; +--@ create temp table src (f1 text); +--@ insert into src +--@ select string_agg(random()::text,'') from generate_series(1,10000); +--@ create type textandtext as (c1 text, c2 text); +--@ create temp table dest (f1 textandtext[]); +--@ insert into dest select array[row(f1,f1)::textandtext] from src; +--@ select length(md5((f1[1]).c2)) from dest; +--@ delete from src; +--@ select length(md5((f1[1]).c2)) from dest; +--@ truncate table src; +--@ drop table src; +--@ select length(md5((f1[1]).c2)) from dest; +--@ drop table dest; +--@ drop type textandtext; -- Tests for polymorphic-array form of width_bucket() -- this exercises the varwidth and float8 code paths -SELECT - op, - width_bucket(op::numeric, ARRAY[1, 3, 5, 10.0]::numeric[]) AS wb_n1, - width_bucket(op::numeric, ARRAY[0, 5.5, 9.99]::numeric[]) AS wb_n2, - width_bucket(op::numeric, ARRAY[-6, -5, 2.0]::numeric[]) AS wb_n3, - width_bucket(op::float8, ARRAY[1, 3, 5, 10.0]::float8[]) AS wb_f1, - width_bucket(op::float8, ARRAY[0, 5.5, 9.99]::float8[]) AS wb_f2, - width_bucket(op::float8, ARRAY[-6, -5, 2.0]::float8[]) AS wb_f3 -FROM (VALUES - (-5.2), - (-0.0000000001), - (0.000000000001), - (1), - (1.99999999999999), - (2), - (2.00000000000001), - (3), - (4), - (4.5), - (5), - (5.5), - (6), - (7), - (8), - (9), - (9.99999999999999), - (10), - (10.0000000000001) -) v(op); +--@ SELECT +--@ op, +--@ width_bucket(op::numeric, ARRAY[1, 3, 5, 10.0]::numeric[]) AS wb_n1, +--@ width_bucket(op::numeric, ARRAY[0, 5.5, 9.99]::numeric[]) AS wb_n2, +--@ width_bucket(op::numeric, ARRAY[-6, -5, 2.0]::numeric[]) AS wb_n3, +--@ width_bucket(op::float8, ARRAY[1, 3, 5, 10.0]::float8[]) AS wb_f1, +--@ width_bucket(op::float8, ARRAY[0, 5.5, 9.99]::float8[]) AS wb_f2, +--@ width_bucket(op::float8, ARRAY[-6, -5, 2.0]::float8[]) AS wb_f3 +--@ FROM (VALUES +--@ (-5.2), +--@ (-0.0000000001), +--@ (0.000000000001), +--@ (1), +--@ (1.99999999999999), +--@ (2), +--@ (2.00000000000001), +--@ (3), +--@ (4), +--@ (4.5), +--@ (5), +--@ (5.5), +--@ (6), +--@ (7), +--@ (8), +--@ (9), +--@ (9.99999999999999), +--@ (10), +--@ (10.0000000000001) +--@ ) v(op); -- ensure float8 path handles NaN properly -SELECT - op, - width_bucket(op, ARRAY[1, 3, 9, 'NaN', 'NaN']::float8[]) AS wb -FROM (VALUES - (-5.2::float8), - (4::float8), - (77::float8), - ('NaN'::float8) -) v(op); +--@ SELECT +--@ op, +--@ width_bucket(op, ARRAY[1, 3, 9, 'NaN', 'NaN']::float8[]) AS wb +--@ FROM (VALUES +--@ (-5.2::float8), +--@ (4::float8), +--@ (77::float8), +--@ ('NaN'::float8) +--@ ) v(op); -- these exercise the generic fixed-width code path -SELECT - op, - width_bucket(op, ARRAY[1, 3, 5, 10]) AS wb_1 -FROM generate_series(0,11) as op; - -SELECT width_bucket(now(), - array['yesterday', 'today', 'tomorrow']::timestamptz[]); +--@ SELECT +--@ op, +--@ width_bucket(op, ARRAY[1, 3, 5, 10]) AS wb_1 +--@ FROM generate_series(0,11) as op; +--@ +--@ SELECT width_bucket(now(), +--@ array['yesterday', 'today', 'tomorrow']::timestamptz[]); -- corner cases -SELECT width_bucket(5, ARRAY[3]); -SELECT width_bucket(5, '{}'); +--@ SELECT width_bucket(5, ARRAY[3]); +--@ SELECT width_bucket(5, '{}'); -- error cases -SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]); -SELECT width_bucket(5, ARRAY[3, 4, NULL]); -SELECT width_bucket(5, ARRAY[ARRAY[1, 2], ARRAY[3, 4]]); +--@ SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]); +--@ SELECT width_bucket(5, ARRAY[3, 4, NULL]); +--@ SELECT width_bucket(5, ARRAY[ARRAY[1, 2], ARRAY[3, 4]]); -- trim_array -SELECT arr, trim_array(arr, 2) -FROM -(VALUES ('{1,2,3,4,5,6}'::bigint[]), - ('{1,2}'), - ('[10:16]={1,2,3,4,5,6,7}'), - ('[-15:-10]={1,2,3,4,5,6}'), - ('{{1,10},{2,20},{3,30},{4,40}}')) v(arr); - -SELECT trim_array(ARRAY[1, 2, 3], -1); -- fail -SELECT trim_array(ARRAY[1, 2, 3], 10); -- fail +--@ SELECT arr, trim_array(arr, 2) +--@ FROM +--@ (VALUES ('{1,2,3,4,5,6}'::bigint[]), +--@ ('{1,2}'), +--@ ('[10:16]={1,2,3,4,5,6,7}'), +--@ ('[-15:-10]={1,2,3,4,5,6}'), +--@ ('{{1,10},{2,20},{3,30},{4,40}}')) v(arr); +--@ +--@ SELECT trim_array(ARRAY[1, 2, 3], -1); -- fail +--@ SELECT trim_array(ARRAY[1, 2, 3], 10); -- fail diff --git a/src/tests/regress/data/sql/interval.sql b/src/tests/regress/data/sql/interval.sql index b0c22dcb25159..fd8fbcf14c502 100644 --- a/src/tests/regress/data/sql/interval.sql +++ b/src/tests/regress/data/sql/interval.sql @@ -111,17 +111,17 @@ INSERT INTO INTERVAL_MULDIV_TBL VALUES ('14 mon'), ('999 mon 999 days'); ---@ SELECT span * 0.3 AS product ---@ FROM INTERVAL_MULDIV_TBL; ---@ ---@ SELECT span * 8.2 AS product ---@ FROM INTERVAL_MULDIV_TBL; ---@ ---@ SELECT span / 10 AS quotient ---@ FROM INTERVAL_MULDIV_TBL; ---@ ---@ SELECT span / 100 AS quotient ---@ FROM INTERVAL_MULDIV_TBL; +SELECT span * 0.3 AS product +FROM INTERVAL_MULDIV_TBL; + +SELECT span * 8.2 AS product +FROM INTERVAL_MULDIV_TBL; + +SELECT span / 10 AS quotient +FROM INTERVAL_MULDIV_TBL; + +SELECT span / 100 AS quotient +FROM INTERVAL_MULDIV_TBL; DROP TABLE INTERVAL_MULDIV_TBL; diff --git a/src/tests/simulation/Cargo.toml b/src/tests/simulation/Cargo.toml index 55e1c6ba4fd73..6fd353dfb56c5 100644 --- a/src/tests/simulation/Cargo.toml +++ b/src/tests/simulation/Cargo.toml @@ -23,6 +23,7 @@ itertools = "0.10" lru = { git = "https://github.com/risingwavelabs/lru-rs.git", branch = "evict_by_timestamp" } madsim = "0.2.17" paste = "1" +pin-project = "1.0" pretty_assertions = "1" rand = "0.8" rdkafka = { package = "madsim-rdkafka", version = "=0.2.14-alpha", features = ["cmake-build"] } diff --git a/src/tests/simulation/src/cluster.rs b/src/tests/simulation/src/cluster.rs index 5224f389e1b67..78d2a03902858 100644 --- a/src/tests/simulation/src/cluster.rs +++ b/src/tests/simulation/src/cluster.rs @@ -16,19 +16,30 @@ use std::collections::HashMap; use std::future::Future; use std::io::Write; use std::path::PathBuf; -use std::sync::LazyLock; +use std::sync::{Arc, LazyLock}; use std::time::Duration; use anyhow::{bail, Result}; use clap::Parser; +use futures::channel::{mpsc, oneshot}; use futures::future::join_all; +use futures::{SinkExt, StreamExt}; use madsim::net::ipvs::*; use madsim::runtime::{Handle, NodeHandle}; +use madsim::task::JoinHandle; use rand::Rng; use sqllogictest::AsyncDB; use crate::client::RisingWave; +/// Embed the config file and create a temporary file at runtime. +static CONFIG_PATH: LazyLock = LazyLock::new(|| { + let mut file = tempfile::NamedTempFile::new().expect("failed to create temp config file"); + file.write_all(include_bytes!("risingwave.toml")) + .expect("failed to write config file"); + file.into_temp_path() +}); + /// RisingWave cluster configuration. #[derive(Debug, Clone)] pub struct Configuration { @@ -46,9 +57,6 @@ pub struct Configuration { /// The number of meta nodes. pub meta_nodes: usize, - /// Extra CLI arguments for meta nodes. - pub meta_node_extra_args: Vec<&'static str>, - /// The number of compactor nodes. pub compactor_nodes: usize, @@ -68,16 +76,10 @@ impl Configuration { /// Returns the config for scale test. pub fn for_scale() -> Self { Configuration { - config_path: "".to_string(), + config_path: CONFIG_PATH.as_os_str().to_string_lossy().into(), frontend_nodes: 2, compute_nodes: 3, meta_nodes: 1, - meta_node_extra_args: vec![ - "--barrier-interval-ms", - "250", - "--checkpoint-frequency", - "4", - ], compactor_nodes: 2, compute_node_cores: 2, etcd_timeout_rate: 0.0, @@ -196,25 +198,21 @@ impl Cluster { // meta node for i in 1..=conf.meta_nodes { - let opts = risingwave_meta::MetaNodeOpts::parse_from( - [ - vec![ - "meta-node", - "--config-path", - &conf.config_path, - "--listen-addr", - "0.0.0.0:5690", - "--advertise-addr", - &format!("meta-{i}:5690"), - "--backend", - "etcd", - "--etcd-endpoints", - "etcd:2388", - ], - conf.meta_node_extra_args.clone(), - ] - .concat(), - ); + let opts = risingwave_meta::MetaNodeOpts::parse_from([ + "meta-node", + "--config-path", + &conf.config_path, + "--listen-addr", + "0.0.0.0:5690", + "--advertise-addr", + &format!("meta-{i}:5690"), + "--backend", + "etcd", + "--etcd-endpoints", + "etcd:2388", + "--state-store", + "hummock+minio://hummockadmin:hummockadmin@192.168.12.1:9301/hummock001", + ]); handle .create_node() .name(format!("meta-{i}")) @@ -255,8 +253,8 @@ impl Cluster { "0.0.0.0:5688", "--advertise-addr", &format!("192.168.3.{i}:5688"), - "--state-store", - "hummock+minio://hummockadmin:hummockadmin@192.168.12.1:9301/hummock001", + "--total-memory-bytes", + "6979321856", "--parallelism", &conf.compute_node_cores.to_string(), ]); @@ -279,8 +277,6 @@ impl Cluster { "0.0.0.0:6660", "--advertise-addr", &format!("192.168.4.{i}:6660"), - "--state-store", - "hummock+minio://hummockadmin:hummockadmin@192.168.12.1:9301/hummock001", ]); handle .create_node() @@ -315,35 +311,47 @@ impl Cluster { }) } - /// Run a SQL query from the client. - pub async fn run(&mut self, sql: impl Into) -> Result { - let sql = sql.into(); + /// Start a SQL session on the client node. + pub fn start_session(&mut self) -> Session { + let (query_tx, mut query_rx) = mpsc::channel::(0); - let result = self - .client - .spawn(async move { - // TODO: reuse session - let mut session = RisingWave::connect("frontend".into(), "dev".into()) + self.client.spawn(async move { + let mut client = RisingWave::connect("frontend".into(), "dev".into()).await?; + + while let Some((sql, tx)) = query_rx.next().await { + let result = client + .run(&sql) .await - .expect("failed to connect to RisingWave"); - let result = session.run(&sql).await?; - Ok::<_, anyhow::Error>(result) - }) - .await??; - - match result { - sqllogictest::DBOutput::Rows { rows, .. } => Ok(rows - .into_iter() - .map(|row| { - row.into_iter() - .map(|v| v.to_string()) - .collect::>() - .join(" ") - }) - .collect::>() - .join("\n")), - _ => Ok("".to_string()), - } + .map(|output| match output { + sqllogictest::DBOutput::Rows { rows, .. } => rows + .into_iter() + .map(|row| { + row.into_iter() + .map(|v| v.to_string()) + .collect::>() + .join(" ") + }) + .collect::>() + .join("\n"), + _ => "".to_string(), + }) + .map_err(Into::into); + + let _ = tx.send(result); + } + + Ok::<_, anyhow::Error>(()) + }); + + Session { query_tx } + } + + /// Run a SQL query on a **new** session of the client node. + /// + /// This is a convenience method that creates a new session and runs the query on it. If you + /// want to run multiple queries on the same session, use `start_session` and `Session::run`. + pub async fn run(&mut self, sql: impl Into) -> Result { + self.start_session().run(sql).await } /// Run a future on the client node. @@ -524,6 +532,26 @@ impl Cluster { } } +type SessionRequest = ( + String, // query sql + oneshot::Sender>, // channel to send result back +); + +/// A SQL session on the simulated client node. +#[derive(Debug, Clone)] +pub struct Session { + query_tx: mpsc::Sender, +} + +impl Session { + /// Run the given SQL query on the session. + pub async fn run(&mut self, sql: impl Into) -> Result { + let (tx, rx) = oneshot::channel(); + self.query_tx.send((sql.into(), tx)).await?; + rx.await? + } +} + /// Options for killing nodes. #[derive(Debug, Clone, Copy, PartialEq)] pub struct KillOpts { diff --git a/src/tests/simulation/src/ctl_ext.rs b/src/tests/simulation/src/ctl_ext.rs index 562ee1345737b..769a331f5f1b6 100644 --- a/src/tests/simulation/src/ctl_ext.rs +++ b/src/tests/simulation/src/ctl_ext.rs @@ -24,7 +24,7 @@ use rand::seq::{IteratorRandom, SliceRandom}; use rand::Rng; use risingwave_common::hash::ParallelUnitId; use risingwave_pb::meta::table_fragments::fragment::FragmentDistributionType; -use risingwave_pb::meta::table_fragments::Fragment as ProstFragment; +use risingwave_pb::meta::table_fragments::PbFragment; use risingwave_pb::meta::GetClusterInfoResponse; use risingwave_pb::stream_plan::StreamNode; @@ -35,10 +35,10 @@ use crate::cluster::Cluster; pub mod predicate { use super::*; - trait Predicate = Fn(&ProstFragment) -> bool + Send + 'static; + trait Predicate = Fn(&PbFragment) -> bool + Send + 'static; pub type BoxedPredicate = Box; - fn root(fragment: &ProstFragment) -> &StreamNode { + fn root(fragment: &PbFragment) -> &StreamNode { fragment.actors.first().unwrap().nodes.as_ref().unwrap() } @@ -58,7 +58,7 @@ pub mod predicate { /// There're exactly `n` operators whose identity contains `s` in the fragment. pub fn identity_contains_n(n: usize, s: impl Into) -> BoxedPredicate { let s: String = s.into(); - let p = move |f: &ProstFragment| { + let p = move |f: &PbFragment| { count(root(f), &|n| { n.identity.to_lowercase().contains(&s.to_lowercase()) }) == n @@ -69,7 +69,7 @@ pub mod predicate { /// There exists operators whose identity contains `s` in the fragment. pub fn identity_contains(s: impl Into) -> BoxedPredicate { let s: String = s.into(); - let p = move |f: &ProstFragment| { + let p = move |f: &PbFragment| { any(root(f), &|n| { n.identity.to_lowercase().contains(&s.to_lowercase()) }) @@ -80,7 +80,7 @@ pub mod predicate { /// There does not exist any operator whose identity contains `s` in the fragment. pub fn no_identity_contains(s: impl Into) -> BoxedPredicate { let s: String = s.into(); - let p = move |f: &ProstFragment| { + let p = move |f: &PbFragment| { all(root(f), &|n| { !n.identity.to_lowercase().contains(&s.to_lowercase()) }) @@ -90,20 +90,22 @@ pub mod predicate { /// There're `n` upstream fragments of the fragment. pub fn upstream_fragment_count(n: usize) -> BoxedPredicate { - let p = move |f: &ProstFragment| f.upstream_fragment_ids.len() == n; + let p = move |f: &PbFragment| f.upstream_fragment_ids.len() == n; Box::new(p) } /// The fragment is able to be rescheduled. Used for locating random fragment. pub fn can_reschedule() -> BoxedPredicate { - // The rescheduling of `Chain` must be derived from the upstream `Materialize`, not - // specified by the user. - no_identity_contains("StreamTableScan") + // The rescheduling of no-shuffle downstreams must be derived from the upstream + // `Materialize`, not specified by the user. + let p = + |f: &PbFragment| no_identity_contains("Chain")(f) && no_identity_contains("Lookup")(f); + Box::new(p) } /// The fragment with the given id. pub fn id(id: u32) -> BoxedPredicate { - let p = move |f: &ProstFragment| f.fragment_id == id; + let p = move |f: &PbFragment| f.fragment_id == id; Box::new(p) } } diff --git a/src/tests/simulation/src/main.rs b/src/tests/simulation/src/main.rs index 92607c205b8f0..219db2ae4844c 100644 --- a/src/tests/simulation/src/main.rs +++ b/src/tests/simulation/src/main.rs @@ -159,7 +159,6 @@ async fn main() { compactor_nodes: args.compactor_nodes, compute_node_cores: args.compute_node_cores, meta_nodes: args.meta_nodes, - meta_node_extra_args: vec![], etcd_timeout_rate: args.etcd_timeout_rate, etcd_data_path: args.etcd_data, }; diff --git a/src/tests/simulation/src/nexmark/create_source.sql b/src/tests/simulation/src/nexmark/create_source.sql index b2676f0c597df..e2624e6a716c6 100644 --- a/src/tests/simulation/src/nexmark/create_source.sql +++ b/src/tests/simulation/src/nexmark/create_source.sql @@ -1,14 +1,14 @@ create source auction ( id BIGINT, - "item_name" VARCHAR, + item_name VARCHAR, description VARCHAR, - "initial_bid" BIGINT, + initial_bid BIGINT, reserve BIGINT, - "date_time" TIMESTAMP, + date_time TIMESTAMP, expires TIMESTAMP, seller BIGINT, category BIGINT, - "extra" VARCHAR + extra VARCHAR {watermark_column}) with ( connector = 'nexmark', @@ -20,10 +20,10 @@ create source bid ( auction BIGINT, bidder BIGINT, price BIGINT, - "channel" VARCHAR, - "url" VARCHAR, - "date_time" TIMESTAMP, - "extra" VARCHAR + channel VARCHAR, + url VARCHAR, + date_time TIMESTAMP, + extra VARCHAR {watermark_column}) with ( connector = 'nexmark', @@ -34,12 +34,12 @@ with ( create source person ( id BIGINT, name VARCHAR, - "email_address" VARCHAR, - "credit_card" VARCHAR, + email_address VARCHAR, + credit_card VARCHAR, city VARCHAR, state VARCHAR, - "date_time" TIMESTAMP, - "extra" VARCHAR + date_time TIMESTAMP, + extra VARCHAR {watermark_column}) with ( connector = 'nexmark', diff --git a/src/tests/simulation/src/risingwave.toml b/src/tests/simulation/src/risingwave.toml new file mode 100644 index 0000000000000..b88e8a0644f7c --- /dev/null +++ b/src/tests/simulation/src/risingwave.toml @@ -0,0 +1,10 @@ +# The configuration for scaling simulation test. +# +# Note: this file is embedded in the binary and cannot be changed without recompiling. + +[system] +barrier_interval_ms = 250 +checkpoint_frequency = 4 + +[server] +telemetry_enabled = false diff --git a/src/tests/simulation/src/slt.rs b/src/tests/simulation/src/slt.rs index d85d1d6bf7b3e..9dc83472b98e6 100644 --- a/src/tests/simulation/src/slt.rs +++ b/src/tests/simulation/src/slt.rs @@ -21,6 +21,7 @@ use sqllogictest::ParallelTestError; use crate::client::RisingWave; use crate::cluster::{Cluster, KillOpts}; +use crate::utils::TimedExt; fn is_create_table_as(sql: &str) -> bool { let parts: Vec = sql @@ -112,7 +113,13 @@ pub async fn run_slt_task(cluster: Arc, glob: &str, opts: &KillOpts) { // For normal records. if !kill { - match tester.run_async(record).await { + match tester + .run_async(record.clone()) + .timed(|_res, elapsed| { + tracing::debug!("Record {:?} finished in {:?}", record, elapsed) + }) + .await + { Ok(_) => continue, Err(e) => panic!("{}", e), } @@ -128,7 +135,13 @@ pub async fn run_slt_task(cluster: Arc, glob: &str, opts: &KillOpts) { if cmd.ignore_kill() { for i in 0usize.. { let delay = Duration::from_secs(1 << i); - if let Err(err) = tester.run_async(record.clone()).await { + if let Err(err) = tester + .run_async(record.clone()) + .timed(|_res, elapsed| { + tracing::debug!("Record {:?} finished in {:?}", record, elapsed) + }) + .await + { // cluster could be still under recovering if killed before, retry if // meets `no reader for dml in table with id {}`. let should_retry = @@ -162,7 +175,13 @@ pub async fn run_slt_task(cluster: Arc, glob: &str, opts: &KillOpts) { // retry up to 5 times until it succeed for i in 0usize.. { let delay = Duration::from_secs(1 << i); - match tester.run_async(record.clone()).await { + match tester + .run_async(record.clone()) + .timed(|_res, elapsed| { + tracing::debug!("Record {:?} finished in {:?}", record, elapsed) + }) + .await + { Ok(_) => break, // allow 'table exists' error when retry CREATE statement Err(e) diff --git a/src/tests/simulation/src/utils.rs b/src/tests/simulation/src/utils/assert_result.rs similarity index 100% rename from src/tests/simulation/src/utils.rs rename to src/tests/simulation/src/utils/assert_result.rs diff --git a/src/tests/simulation/src/utils/mod.rs b/src/tests/simulation/src/utils/mod.rs new file mode 100644 index 0000000000000..b3b726467e613 --- /dev/null +++ b/src/tests/simulation/src/utils/mod.rs @@ -0,0 +1,19 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +mod assert_result; +pub use assert_result::*; + +mod timed_future; +pub use timed_future::*; diff --git a/src/tests/simulation/src/utils/timed_future.rs b/src/tests/simulation/src/utils/timed_future.rs new file mode 100644 index 0000000000000..b9003552a0ac8 --- /dev/null +++ b/src/tests/simulation/src/utils/timed_future.rs @@ -0,0 +1,76 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use std::future::Future; +use std::pin::{pin, Pin}; +use std::task::{Context, Poll}; +use std::time::{Duration, Instant}; + +use pin_project::pin_project; + +/// Inspired by https://stackoverflow.com/a/59935743/2990323 +/// A wrapper around a Future which adds timing data. +#[pin_project] +pub struct Timed +where + Fut: Future, + F: Fn(&Fut::Output, Duration), +{ + #[pin] + inner: Fut, + f: F, + start: Option, +} + +impl Future for Timed +where + Fut: Future, + F: Fn(&Fut::Output, Duration), +{ + type Output = Fut::Output; + + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { + let this = self.project(); + let start = this.start.get_or_insert_with(Instant::now); + + match this.inner.poll(cx) { + // If the inner future is still pending, this wrapper is still pending. + Poll::Pending => Poll::Pending, + + // If the inner future is done, measure the elapsed time and finish this wrapper future. + Poll::Ready(v) => { + let elapsed = start.elapsed(); + (this.f)(&v, elapsed); + + Poll::Ready(v) + } + } + } +} + +pub trait TimedExt: Sized + Future { + fn timed(self, f: F) -> Timed + where + F: Fn(&Self::Output, Duration), + { + Timed { + inner: self, + f, + start: None, + } + } +} + +// All futures can use the `.timed` method defined above +impl TimedExt for F {} diff --git a/src/tests/simulation/tests/it/cascade_materialized_view.rs b/src/tests/simulation/tests/it/cascade_materialized_view.rs index f3bcaf7c82283..4e3dd4a2695de 100644 --- a/src/tests/simulation/tests/it/cascade_materialized_view.rs +++ b/src/tests/simulation/tests/it/cascade_materialized_view.rs @@ -33,9 +33,10 @@ const MV5: &str = "create materialized view m5 as select * from m4;"; #[madsim::test] async fn test_simple_cascade_materialized_view() -> Result<()> { let mut cluster = Cluster::start(Configuration::for_scale()).await?; + let mut session = cluster.start_session(); - cluster.run(ROOT_TABLE_CREATE).await?; - cluster.run(MV1).await?; + session.run(ROOT_TABLE_CREATE).await?; + session.run(MV1).await?; let fragment = cluster .locate_one_fragment([ @@ -62,17 +63,17 @@ async fn test_simple_cascade_materialized_view() -> Result<()> { fragment.inner.actors.len() ); - cluster + session .run(&format!( "insert into t1 values {}", (1..=10).map(|x| format!("({x})")).join(",") )) .await?; - cluster.run("flush").await?; + session.run("flush").await?; // v1 > 5, result is [6, 7, 8, 9, 10] - cluster + session .run("select count(*) from m1") .await? .assert_result_eq("5"); @@ -92,21 +93,21 @@ async fn test_simple_cascade_materialized_view() -> Result<()> { fragment.inner.actors.len() ); - cluster + session .run("select count(*) from m1") .await? .assert_result_eq("5"); - cluster + session .run(&format!( "insert into t1 values {}", (11..=20).map(|x| format!("({x})")).join(",") )) .await?; - cluster.run("flush").await?; + session.run("flush").await?; // 10 < v1 < 15, result is [11, 12, 13, 14] - cluster + session .run("select count(*) from m1") .await? .assert_result_eq("15"); @@ -117,13 +118,14 @@ async fn test_simple_cascade_materialized_view() -> Result<()> { #[madsim::test] async fn test_diamond_cascade_materialized_view() -> Result<()> { let mut cluster = Cluster::start(Configuration::for_scale()).await?; + let mut session = cluster.start_session(); - cluster.run(ROOT_TABLE_CREATE).await?; - cluster.run(MV1).await?; - cluster.run(MV2).await?; - cluster.run(MV3).await?; - cluster.run(MV4).await?; - cluster.run(MV5).await?; + session.run(ROOT_TABLE_CREATE).await?; + session.run(MV1).await?; + session.run(MV2).await?; + session.run(MV3).await?; + session.run(MV4).await?; + session.run(MV5).await?; let fragment = cluster .locate_one_fragment([ @@ -141,15 +143,15 @@ async fn test_diamond_cascade_materialized_view() -> Result<()> { let fragment = cluster.locate_fragment_by_id(id).await?; assert_eq!(fragment.inner.actors.len(), 1); - cluster + session .run(&format!( "insert into t1 values {}", (1..=10).map(|x| format!("({x})")).join(",") )) .await?; - cluster.run("flush").await?; - cluster + session.run("flush").await?; + session .run("select count(*) from m5") .await? .assert_result_eq("0"); @@ -160,20 +162,20 @@ async fn test_diamond_cascade_materialized_view() -> Result<()> { let fragment = cluster.locate_fragment_by_id(id).await?; assert_eq!(fragment.inner.actors.len(), 6); - cluster + session .run("select count(*) from m5") .await? .assert_result_eq("0"); - cluster + session .run(&format!( "insert into t1 values {}", (11..=20).map(|x| format!("({x})")).join(",") )) .await?; - cluster.run("flush").await?; - cluster + session.run("flush").await?; + session .run("select count(*) from m5") .await? .assert_result_eq("4"); diff --git a/src/tests/simulation/tests/it/delta_join.rs b/src/tests/simulation/tests/it/delta_join.rs new file mode 100644 index 0000000000000..7f109e7db3126 --- /dev/null +++ b/src/tests/simulation/tests/it/delta_join.rs @@ -0,0 +1,123 @@ +// Copyright 2023 RisingWave Labs +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![cfg(madsim)] + +use anyhow::Result; +use itertools::Itertools; +use risingwave_simulation::cluster::{Cluster, Configuration}; +use risingwave_simulation::ctl_ext::predicate::identity_contains; +use risingwave_simulation::utils::AssertResult; + +#[madsim::test] +async fn test_delta_join() -> Result<()> { + let mut cluster = Cluster::start(Configuration::for_scale()).await?; + let mut session = cluster.start_session(); + + session.run("set rw_implicit_flush = true;").await?; + session + .run("set rw_streaming_enable_delta_join = true;") + .await?; + + session + .run("create table a (a1 int primary key, a2 int);") + .await?; + session + .run("create table b (b1 int primary key, b2 int);") + .await?; + let [t1, t2]: [_; 2] = cluster + .locate_fragments([identity_contains("materialize")]) + .await? + .try_into() + .unwrap(); + + session + .run("create materialized view v as select * from a join b on a.a1 = b.b1;") + .await?; + let lookup_fragments = cluster + .locate_fragments([identity_contains("lookup")]) + .await?; + assert_eq!(lookup_fragments.len(), 2, "failed to plan delta join"); + let union_fragment = cluster + .locate_one_fragment([identity_contains("union")]) + .await?; + + let mut test_times = 0; + macro_rules! test_works { + () => { + let keys = || (0..100).map(|i| test_times * 100 + i); + + for key in keys() { + session + .run(format!("insert into a values ({key}, 233)")) + .await?; + session + .run(format!("insert into b values ({key}, 666)")) + .await?; + } + session.run("flush").await?; + + let result = keys() + .rev() + .map(|key| format!("{key} 233 {key} 666")) + .join("\n"); + + session + .run("select * from v order by a1 desc limit 100;") + .await? + .assert_result_eq(result); + + #[allow(unused_assignments)] + test_times += 1; + }; + } + + test_works!(); + + // Scale-in one side + cluster.reschedule(format!("{}-[0]", t1.id())).await?; + test_works!(); + + // Scale-in both sides together + cluster + .reschedule(format!("{}-[2];{}-[0,2]", t1.id(), t2.id())) + .await?; + test_works!(); + + // Scale-out one side + cluster.reschedule(format!("{}+[0]", t2.id())).await?; + test_works!(); + + // Scale-out both sides together + cluster + .reschedule(format!("{}+[0,2];{}+[2]", t1.id(), t2.id())) + .await?; + test_works!(); + + // Scale-in join with union + cluster + .reschedule(format!("{}-[5];{}-[5]", t1.id(), union_fragment.id())) + .await?; + test_works!(); + + let result = cluster + .reschedule(format!("{}-[0]", lookup_fragments[0].id())) + .await; + assert!( + result.is_err(), + "directly scale-in lookup (downstream) should fail" + ); + + Ok(()) +} diff --git a/src/tests/simulation/tests/it/dynamic_filter.rs b/src/tests/simulation/tests/it/dynamic_filter.rs index e03432498d5dc..4736a2cdcfd1d 100644 --- a/src/tests/simulation/tests/it/dynamic_filter.rs +++ b/src/tests/simulation/tests/it/dynamic_filter.rs @@ -28,12 +28,13 @@ const SELECT: &str = "select * from mv1 order by v1;"; #[madsim::test] async fn test_dynamic_filter() -> Result<()> { let mut cluster = Cluster::start(Configuration::for_scale()).await?; + let mut session = cluster.start_session(); - cluster.run("create table t1 (v1 int);").await?; - cluster.run("create table t2 (v2 int);").await?; - cluster.run("create materialized view mv1 as with max_v2 as (select max(v2) max from t2) select v1 from t1, max_v2 where v1 > max;").await?; - cluster.run("insert into t1 values (1), (2), (3)").await?; - cluster.run("flush").await?; + session.run("create table t1 (v1 int);").await?; + session.run("create table t2 (v2 int);").await?; + session.run("create materialized view mv1 as with max_v2 as (select max(v2) max from t2) select v1 from t1, max_v2 where v1 > max;").await?; + session.run("insert into t1 values (1), (2), (3)").await?; + session.run("flush").await?; sleep(Duration::from_secs(5)).await; let dynamic_filter_fragment = cluster @@ -60,53 +61,53 @@ async fn test_dynamic_filter() -> Result<()> { cluster.reschedule(format!("{id}-[1,2,3]")).await?; sleep(Duration::from_secs(3)).await; - cluster.run(SELECT).await?.assert_result_eq(""); - cluster.run("insert into t2 values (0)").await?; - cluster.run("flush").await?; + session.run(SELECT).await?.assert_result_eq(""); + session.run("insert into t2 values (0)").await?; + session.run("flush").await?; sleep(Duration::from_secs(5)).await; - cluster.run(SELECT).await?.assert_result_eq("1\n2\n3"); + session.run(SELECT).await?.assert_result_eq("1\n2\n3"); // 1 // 2 // 3 cluster.reschedule(format!("{id}-[4,5]+[1,2,3]")).await?; sleep(Duration::from_secs(3)).await; - cluster.run(SELECT).await?.assert_result_eq("1\n2\n3"); + session.run(SELECT).await?.assert_result_eq("1\n2\n3"); - cluster.run("insert into t2 values (2)").await?; - cluster.run("flush").await?; + session.run("insert into t2 values (2)").await?; + session.run("flush").await?; sleep(Duration::from_secs(5)).await; - cluster.run(SELECT).await?.assert_result_eq("3"); + session.run(SELECT).await?.assert_result_eq("3"); // 3 cluster.reschedule(format!("{id}-[1,2,3]+[4,5]")).await?; sleep(Duration::from_secs(3)).await; - cluster.run(SELECT).await?.assert_result_eq("3"); + session.run(SELECT).await?.assert_result_eq("3"); - cluster.run("update t2 set v2 = 1 where v2 = 2").await?; - cluster.run("flush").await?; + session.run("update t2 set v2 = 1 where v2 = 2").await?; + session.run("flush").await?; sleep(Duration::from_secs(5)).await; - cluster.run(SELECT).await?.assert_result_eq("2\n3"); + session.run(SELECT).await?.assert_result_eq("2\n3"); // 2 // 3 // cluster.reschedule(format!("{id}+[1,2,3]")).await?; sleep(Duration::from_secs(3)).await; - cluster.run(SELECT).await?.assert_result_eq("2\n3"); + session.run(SELECT).await?.assert_result_eq("2\n3"); - cluster.run("delete from t2 where true").await?; - cluster.run("flush").await?; + session.run("delete from t2 where true").await?; + session.run("flush").await?; sleep(Duration::from_secs(5)).await; - cluster.run(SELECT).await?.assert_result_eq(""); + session.run(SELECT).await?.assert_result_eq(""); cluster.reschedule(format!("{id}-[1]")).await?; sleep(Duration::from_secs(3)).await; - cluster.run(SELECT).await?.assert_result_eq(""); + session.run(SELECT).await?.assert_result_eq(""); - cluster.run("insert into t2 values (1)").await?; - cluster.run("flush").await?; + session.run("insert into t2 values (1)").await?; + session.run("flush").await?; sleep(Duration::from_secs(5)).await; - cluster.run(SELECT).await?.assert_result_eq("2\n3"); + session.run(SELECT).await?.assert_result_eq("2\n3"); Ok(()) } diff --git a/src/tests/simulation/tests/it/main.rs b/src/tests/simulation/tests/it/main.rs index 6fed15c83f22c..ee2f7f003b535 100644 --- a/src/tests/simulation/tests/it/main.rs +++ b/src/tests/simulation/tests/it/main.rs @@ -17,7 +17,10 @@ //! See [this post](https://matklad.github.io/2021/02/27/delete-cargo-integration-tests.html) //! for the rationale behind this approach. +#![feature(stmt_expr_attributes)] + mod cascade_materialized_view; +mod delta_join; mod dynamic_filter; mod hello; mod nexmark_chaos; diff --git a/src/tests/simulation/tests/it/nexmark_chaos.rs b/src/tests/simulation/tests/it/nexmark_chaos.rs index f800b8ade7034..34905b5e2f199 100644 --- a/src/tests/simulation/tests/it/nexmark_chaos.rs +++ b/src/tests/simulation/tests/it/nexmark_chaos.rs @@ -41,15 +41,17 @@ async fn nexmark_chaos_common_inner( ) -> Result<()> { let mut cluster = NexmarkCluster::new(Configuration::for_scale(), 6, Some(20 * THROUGHPUT), false).await?; - cluster.run(create).await?; + let mut session = cluster.start_session(); + session.run(create).await?; sleep(Duration::from_secs(30)).await; - let final_result = cluster.run(select).await?; - cluster.run(drop).await?; + let final_result = session.run(select).await?; + session.run(drop).await?; sleep(Duration::from_secs(5)).await; println!("Reference run done."); - - cluster.run(create).await?; + // Create a new session for the chaos run. + let mut session = cluster.start_session(); + session.run(create).await?; let _initial_result = cluster .wait_until_non_empty(select, initial_interval, initial_timeout) @@ -68,7 +70,7 @@ async fn nexmark_chaos_common_inner( cluster.reschedule(join_plans(fragments)).await?; sleep(after_scale_duration).await; - cluster.run(select).await?.assert_result_ne(&final_result); + session.run(select).await?.assert_result_ne(&final_result); let fragments = cluster.locate_random_fragments().await?; cluster.reschedule(join_plans(fragments)).await?; @@ -78,7 +80,7 @@ async fn nexmark_chaos_common_inner( cluster.reschedule(fragment.random_reschedule()).await?; sleep(after_scale_duration).await; - cluster.run(select).await?.assert_result_ne(&final_result); + session.run(select).await?.assert_result_ne(&final_result); let fragment = cluster.locate_fragment_by_id(id).await?; cluster.reschedule(fragment.random_reschedule()).await?; @@ -86,7 +88,7 @@ async fn nexmark_chaos_common_inner( sleep(Duration::from_secs(50)).await; - cluster.run(select).await?.assert_result_eq(&final_result); + session.run(select).await?.assert_result_eq(&final_result); Ok(()) } diff --git a/src/tests/simulation/tests/it/singleton_migration.rs b/src/tests/simulation/tests/it/singleton_migration.rs index e480b7aedb555..7b4482de26c1a 100644 --- a/src/tests/simulation/tests/it/singleton_migration.rs +++ b/src/tests/simulation/tests/it/singleton_migration.rs @@ -32,10 +32,11 @@ const CASCADE_MV: &str = "create materialized view m2 as select * from m1;"; #[madsim::test] async fn test_singleton_migration() -> Result<()> { let mut cluster = Cluster::start(Configuration::for_scale()).await?; + let mut session = cluster.start_session(); - cluster.run(ROOT_TABLE_CREATE).await?; - cluster.run(ROOT_MV).await?; - cluster.run(CASCADE_MV).await?; + session.run(ROOT_TABLE_CREATE).await?; + session.run(ROOT_MV).await?; + session.run(CASCADE_MV).await?; let fragment = cluster .locate_one_fragment(vec![ @@ -69,16 +70,16 @@ async fn test_singleton_migration() -> Result<()> { sleep(Duration::from_secs(3)).await; - cluster + session .run(&format!( "insert into t values {}", (1..=10).map(|x| format!("({x})")).join(",") )) .await?; - cluster.run("flush").await?; + session.run("flush").await?; - cluster + session .run("select * from m2") .await? .assert_result_eq("10"); @@ -94,16 +95,16 @@ async fn test_singleton_migration() -> Result<()> { sleep(Duration::from_secs(3)).await; - cluster + session .run(&format!( "insert into t values {}", (11..=20).map(|x| format!("({x})")).join(",") )) .await?; - cluster.run("flush").await?; + session.run("flush").await?; - cluster + session .run("select * from m2") .await? .assert_result_eq("20"); diff --git a/src/tests/simulation/tests/it/sink.rs b/src/tests/simulation/tests/it/sink.rs index a92043c3c5a90..ac95d98cffade 100644 --- a/src/tests/simulation/tests/it/sink.rs +++ b/src/tests/simulation/tests/it/sink.rs @@ -28,9 +28,9 @@ use risingwave_simulation::cluster::{Cluster, Configuration}; use risingwave_simulation::ctl_ext::predicate::{identity_contains, no_identity_contains}; const ROOT_TABLE_CREATE: &str = "create table t (v1 int) append only;"; -const APPEND_ONLY_SINK_CREATE: &str = "create sink s1 from t with (connector='kafka', properties.bootstrap.server='192.168.11.1:29092', topic='t_sink_append_only', format='append_only');"; +const APPEND_ONLY_SINK_CREATE: &str = "create sink s1 from t with (connector='kafka', properties.bootstrap.server='192.168.11.1:29092', topic='t_sink_append_only', type='append-only');"; const MV_CREATE: &str = "create materialized view m as select count(*) from t;"; -const DEBEZIUM_SINK_CREATE: &str = "create sink s2 from m with (connector='kafka', properties.bootstrap.server='192.168.11.1:29092', topic='t_sink_debezium', format='debezium');"; +const DEBEZIUM_SINK_CREATE: &str = "create sink s2 from m with (connector='kafka', properties.bootstrap.server='192.168.11.1:29092', topic='t_sink_debezium', type='debezium');"; const APPEND_ONLY_TOPIC: &str = "t_sink_append_only"; const DEBEZIUM_TOPIC: &str = "t_sink_debezium"; diff --git a/src/tests/simulation/tests/it/streaming_parallelism.rs b/src/tests/simulation/tests/it/streaming_parallelism.rs index 24d678eb7234b..38c074aeeed2a 100644 --- a/src/tests/simulation/tests/it/streaming_parallelism.rs +++ b/src/tests/simulation/tests/it/streaming_parallelism.rs @@ -15,10 +15,8 @@ #![cfg(madsim)] use anyhow::Result; -use risingwave_simulation::client::RisingWave; use risingwave_simulation::cluster::{Cluster, Configuration}; use risingwave_simulation::ctl_ext::predicate::identity_contains; -use sqllogictest::runner::AsyncDB; #[madsim::test] async fn test_streaming_parallelism_default() -> Result<()> { @@ -32,33 +30,19 @@ async fn test_streaming_parallelism_default() -> Result<()> { Ok(()) } -async fn run_sqls_in_session(cluster: &Cluster, sqls: Vec) { - cluster - .run_on_client(async move { - let mut session = RisingWave::connect("frontend".into(), "dev".into()) - .await - .expect("failed to connect to RisingWave"); - for sql in sqls { - session.run(&sql).await.unwrap(); - } - }) - .await; -} - #[madsim::test] async fn test_streaming_parallelism_set_some() -> Result<()> { let mut cluster = Cluster::start(Configuration::for_scale()).await?; let default_parallelism = cluster.config().compute_nodes * cluster.config().compute_node_cores; let target_parallelism = default_parallelism - 1; assert!(target_parallelism > 0); - run_sqls_in_session( - &cluster, - vec![ - format!("set streaming_parallelism={};", target_parallelism), - "create table t1 (c1 int, c2 int);".to_string(), - ], - ) - .await; + + let mut session = cluster.start_session(); + session + .run(format!("set streaming_parallelism={};", target_parallelism)) + .await?; + session.run("create table t1 (c1 int, c2 int);").await?; + let materialize_fragment = cluster .locate_one_fragment([identity_contains("materialize")]) .await?; @@ -70,14 +54,11 @@ async fn test_streaming_parallelism_set_some() -> Result<()> { async fn test_streaming_parallelism_set_zero() -> Result<()> { let mut cluster = Cluster::start(Configuration::for_scale()).await?; let default_parallelism = cluster.config().compute_nodes * cluster.config().compute_node_cores; - run_sqls_in_session( - &cluster, - vec![ - "set streaming_parallelism=0;".to_string(), - "create table t1 (c1 int, c2 int);".to_string(), - ], - ) - .await; + + let mut session = cluster.start_session(); + session.run("set streaming_parallelism=0;").await?; + session.run("create table t1 (c1 int, c2 int);").await?; + let materialize_fragment = cluster .locate_one_fragment([identity_contains("materialize")]) .await?; @@ -91,17 +72,22 @@ async fn test_streaming_parallelism_mv_on_mv() -> Result<()> { let default_parallelism = cluster.config().compute_nodes * cluster.config().compute_node_cores; let target_parallelism = default_parallelism - 1; assert!(target_parallelism - 1 > 0); - run_sqls_in_session( - &cluster, - vec![ - format!("set streaming_parallelism={};", target_parallelism), - "create table t1 (c1 int, c2 int);".to_string(), - format!("set streaming_parallelism={};", target_parallelism - 1), - "create materialized view mv3 as select c1,count(*) as cc from t1 group by c1;" - .to_string(), - ], - ) - .await; + + let mut session = cluster.start_session(); + session + .run(format!("set streaming_parallelism={};", target_parallelism)) + .await?; + session.run("create table t1 (c1 int, c2 int);").await?; + session + .run(format!( + "set streaming_parallelism={};", + target_parallelism - 1 + )) + .await?; + session + .run("create materialized view mv1 as select c1,count(*) as cc from t1 group by c1;") + .await?; + let materialize_fragments = cluster .locate_fragments([identity_contains("materialize")]) .await?; @@ -123,16 +109,20 @@ async fn test_streaming_parallelism_index() -> Result<()> { let default_parallelism = cluster.config().compute_nodes * cluster.config().compute_node_cores; let target_parallelism = default_parallelism - 1; assert!(target_parallelism - 1 > 0); - run_sqls_in_session( - &cluster, - vec![ - format!("set streaming_parallelism={};", target_parallelism), - "create table t1 (c1 int, c2 int);".to_string(), - format!("set streaming_parallelism={};", target_parallelism - 1), - "create index idx1 on t1(c2);".to_string(), - ], - ) - .await; + + let mut session = cluster.start_session(); + session + .run(format!("set streaming_parallelism={};", target_parallelism)) + .await?; + session.run("create table t1 (c1 int, c2 int);").await?; + session + .run(format!( + "set streaming_parallelism={};", + target_parallelism - 1 + )) + .await?; + session.run("create index idx1 on t1(c2);").await?; + let materialize_fragments = cluster .locate_fragments([identity_contains("materialize")]) .await?; diff --git a/src/tests/state_cleaning_test/Cargo.toml b/src/tests/state_cleaning_test/Cargo.toml index 9129a282ecf99..738b4108b82ec 100644 --- a/src/tests/state_cleaning_test/Cargo.toml +++ b/src/tests/state_cleaning_test/Cargo.toml @@ -26,7 +26,7 @@ serde_with = "2" tokio = { version = "0.2", package = "madsim-tokio" } tokio-postgres = "0.7.7" tokio-stream = { version = "0.1", features = ["fs"] } -toml = "0.4" +toml = "0.7" tracing = "0.1" [target.'cfg(not(madsim))'.dependencies] diff --git a/src/udf/python/example.py b/src/udf/python/example.py index 86c4b8716d794..9b57315b6880a 100644 --- a/src/udf/python/example.py +++ b/src/udf/python/example.py @@ -1,6 +1,8 @@ +import socket from typing import Iterator from risingwave.udf import udf, udtf, UdfServer import random +import struct @udf(input_types=[], result_type='INT') @@ -32,6 +34,15 @@ def series2(n: int) -> Iterator[tuple[int, str]]: yield i, str(i) +@udf(input_types=['BINARY'], result_type='STRUCT') +def extract_tcp_info(tcp_packet: bytes): + src_addr, dst_addr = struct.unpack('!4s4s', tcp_packet[12:20]) + src_port, dst_port = struct.unpack('!HH', tcp_packet[20:24]) + src_addr = socket.inet_ntoa(src_addr) + dst_addr = socket.inet_ntoa(dst_addr) + return src_addr, dst_addr, src_port, dst_port + + if __name__ == '__main__': server = UdfServer(location="0.0.0.0:8815") server.add_function(random_int) @@ -39,4 +50,5 @@ def series2(n: int) -> Iterator[tuple[int, str]]: server.add_function(gcd3) server.add_function(series) server.add_function(series2) + server.add_function(extract_tcp_info) server.serve() diff --git a/src/udf/python/risingwave/udf.py b/src/udf/python/risingwave/udf.py index 55ff4bb99d2cd..c2d617d1068cb 100644 --- a/src/udf/python/risingwave/udf.py +++ b/src/udf/python/risingwave/udf.py @@ -3,6 +3,7 @@ import pyarrow.flight import pyarrow.parquet import inspect +import traceback class UserDefinedFunction: @@ -26,17 +27,17 @@ class ScalarFunction(UserDefinedFunction): or multiple scalar values to a new scalar value. """ - def eval(self, *args): + def eval(self, *args) -> Any: """ Method which defines the logic of the scalar function. """ pass def eval_batch(self, batch: pa.RecordBatch) -> pa.RecordBatch: - result = pa.array([self.eval(*[col[i].as_py() for col in batch]) - for i in range(batch.num_rows)], - type=self._result_schema.types[0]) - return pa.RecordBatch.from_arrays([result], schema=self._result_schema) + column = [self.eval(*[col[i].as_py() for col in batch]) + for i in range(batch.num_rows)] + array = pa.array(column, type=self._result_schema.types[0]) + return pa.RecordBatch.from_arrays([array], schema=self._result_schema) class TableFunction(UserDefinedFunction): @@ -45,18 +46,26 @@ class TableFunction(UserDefinedFunction): or multiple table values to a new table value. """ - def eval(self, *args): + def eval(self, *args) -> Iterator: """ Method which defines the logic of the table function. """ - pass + yield def eval_batch(self, batch: pa.RecordBatch) -> pa.RecordBatch: - # only the first row from batch is used - res = self.eval(*[col[0].as_py() for col in batch]) - columns = zip(*res) if len(self._result_schema) > 1 else [res] - arrays = [pa.array(col, type) - for col, type in zip(columns, self._result_schema.types)] + result_rows = [] + # Iterate through rows in the input RecordBatch + for row_index in range(batch.num_rows): + row = tuple(column[row_index].as_py() for column in batch) + result_rows.extend(self.eval(*row)) + + result_columns = zip( + *result_rows) if len(self._result_schema) > 1 else [result_rows] + + # Convert the result columns to arrow arrays + arrays = [ + pa.array(col, type) for col, type in zip(result_columns, self._result_schema.types) + ] return pa.RecordBatch.from_arrays(arrays, schema=self._result_schema) @@ -205,7 +214,11 @@ def do_exchange(self, context, descriptor, reader, writer): writer.begin(udf._result_schema) for chunk in reader: # print(pa.Table.from_batches([chunk.data])) - result = udf.eval_batch(chunk.data) + try: + result = udf.eval_batch(chunk.data) + except Exception as e: + print(traceback.print_exc()) + raise e writer.write_batch(result) def serve(self): @@ -253,5 +266,15 @@ def _string_to_data_type(type_str: str): return pa.string() case 'BINARY' | 'VARBINARY': return pa.binary() - case _: - raise ValueError(f'Unsupported type: {type_str}') + + # extract 'STRUCT' + if type_str.startswith('STRUCT'): + type_str = type_str[6:].strip('<>') + fields = [] + for field in type_str.split(','): + field = field.strip() + name, type_str = field.split(' ') + fields.append(pa.field(name, _string_to_data_type(type_str))) + return pa.struct(fields) + + raise ValueError(f'Unsupported type: {type_str}') diff --git a/src/udf/python/setup.py b/src/udf/python/setup.py index 934d4c1078eae..09b65766853f6 100644 --- a/src/udf/python/setup.py +++ b/src/udf/python/setup.py @@ -5,7 +5,7 @@ setup( name="risingwave", - version="0.0.2", + version="0.0.3", author="RisingWave Labs", description="RisingWave Python API", long_description=long_description, diff --git a/src/utils/pgwire/Cargo.toml b/src/utils/pgwire/Cargo.toml index 381aa8e84d20e..58170963f716c 100644 --- a/src/utils/pgwire/Cargo.toml +++ b/src/utils/pgwire/Cargo.toml @@ -22,7 +22,7 @@ bytes = "1" chrono = { version = "0.4", default-features = false, features = ["clock", "std"] } futures = { version = "0.3", default-features = false, features = ["alloc"] } itertools = "0.10" -openssl = "0.10.3" +openssl = "0.10.48" pg_interval = "0.4" postgres-types = { version = "0.2.4", features = ["derive","with-chrono-0_4"] } regex = "1.5" diff --git a/src/utils/pgwire/src/pg_extended.rs b/src/utils/pgwire/src/pg_extended.rs index 32471659ff9f4..4e2b8a509bd76 100644 --- a/src/utils/pgwire/src/pg_extended.rs +++ b/src/utils/pgwire/src/pg_extended.rs @@ -625,9 +625,7 @@ mod tests { use pg_interval::Interval; // Note this useful idiom: importing names from outer (for mod tests) scope. use postgres_types::private::BytesMut; - use risingwave_common::types::{ - DataType, NaiveDateTimeWrapper, NaiveDateWrapper, NaiveTimeWrapper, - }; + use risingwave_common::types::{DataType, Date, Time, Timestamp}; use tokio_postgres::types::{ToSql, Type}; use crate::pg_extended::PreparedStatement; @@ -815,15 +813,9 @@ mod tests { ); let raw_params = vec![ - NaiveDateWrapper::from_ymd_uncheck(2021, 1, 1) - .0 - .to_string() - .into(), - NaiveTimeWrapper::from_hms_uncheck(12, 0, 0) - .0 - .to_string() - .into(), - NaiveDateTimeWrapper::from_timestamp_uncheck(1610000000, 0) + Date::from_ymd_uncheck(2021, 1, 1).0.to_string().into(), + Time::from_hms_uncheck(12, 0, 0).0.to_string().into(), + Timestamp::from_timestamp_uncheck(1610000000, 0) .0 .to_string() .into(), @@ -922,15 +914,15 @@ mod tests { // Test DATE, TIME, TIMESTAMP type. let mut raw_params = vec![BytesMut::new(); 3]; - NaiveDateWrapper::from_ymd_uncheck(2021, 1, 1) + Date::from_ymd_uncheck(2021, 1, 1) .0 .to_sql(&place_hodler, &mut raw_params[0]) .unwrap(); - NaiveTimeWrapper::from_hms_uncheck(12, 0, 0) + Time::from_hms_uncheck(12, 0, 0) .0 .to_sql(&place_hodler, &mut raw_params[1]) .unwrap(); - NaiveDateTimeWrapper::from_timestamp_uncheck(1610000000, 0) + Timestamp::from_timestamp_uncheck(1610000000, 0) .0 .to_sql(&place_hodler, &mut raw_params[2]) .unwrap(); @@ -953,7 +945,7 @@ mod tests { // Test TIMESTAMPTZ, INTERVAL type. let mut raw_params = vec![BytesMut::new(); 2]; - DateTime::::from_utc(NaiveDateTimeWrapper::from_timestamp_uncheck(1200, 0).0, Utc) + DateTime::::from_utc(Timestamp::from_timestamp_uncheck(1200, 0).0, Utc) .to_sql(&place_hodler, &mut raw_params[0]) .unwrap(); let interval = Interval::new(1, 1, 24000000); diff --git a/src/utils/pgwire/src/pg_response.rs b/src/utils/pgwire/src/pg_response.rs index 14e9c989fb6c6..cc2abfd9900dd 100644 --- a/src/utils/pgwire/src/pg_response.rs +++ b/src/utils/pgwire/src/pg_response.rs @@ -63,7 +63,12 @@ pub enum StatementType { DROP_SCHEMA, DROP_DATABASE, DROP_USER, + ALTER_INDEX, + ALTER_VIEW, ALTER_TABLE, + ALTER_MATERIALIZED_VIEW, + ALTER_SINK, + ALTER_SOURCE, ALTER_SYSTEM, REVOKE_PRIVILEGE, // Introduce ORDER_BY statement type cuz Calcite unvalidated AST has SqlKind.ORDER_BY. Note diff --git a/src/workspace-hack/Cargo.toml b/src/workspace-hack/Cargo.toml index 5c82906fbe736..4b425b9fbe8b8 100644 --- a/src/workspace-hack/Cargo.toml +++ b/src/workspace-hack/Cargo.toml @@ -21,7 +21,6 @@ publish = false ahash = { version = "0.8" } anyhow = { version = "1", features = ["backtrace"] } arrayvec = { version = "0.7", default-features = false, features = ["std"] } -auto_enums = { version = "0.7", features = ["futures"] } aws-sdk-s3 = { version = "0.21", features = ["native-tls"] } aws-smithy-client = { version = "0.51", default-features = false, features = ["native-tls", "rustls"] } aws-types = { version = "0.51", default-features = false, features = ["hardcoded-credentials"] } @@ -84,6 +83,7 @@ regex = { version = "1" } regex-syntax = { version = "0.6" } reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"] } ring = { version = "0.16", features = ["std"] } +rust_decimal = { version = "1", features = ["db-postgres", "db-tokio-postgres"] } scopeguard = { version = "1" } serde = { version = "1", features = ["alloc", "derive", "rc"] } serde_json = { version = "1", features = ["alloc"] } @@ -94,11 +94,11 @@ strum = { version = "0.24", features = ["derive"] } subtle = { version = "2" } time = { version = "0.3", features = ["formatting", "local-offset", "macros", "parsing"] } tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "net", "parking_lot", "process", "rt-multi-thread", "signal", "stats", "sync", "time", "tracing"] } +tokio-postgres = { git = "https://github.com/madsim-rs/rust-postgres.git", rev = "87ca1dc", features = ["with-chrono-0_4"] } tokio-stream = { git = "https://github.com/madsim-rs/tokio.git", rev = "0c25710", features = ["fs", "net"] } tokio-util = { version = "0.7", features = ["codec", "io"] } tonic = { version = "0.8", features = ["gzip", "tls-webpki-roots"] } tower = { version = "0.4", features = ["balance", "buffer", "filter", "limit", "load-shed", "retry", "timeout", "util"] } -tower-http = { version = "0.3", features = ["add-extension", "cors", "map-response-body", "util"] } tracing = { version = "0.1", features = ["log", "release_max_level_trace"] } tracing-core = { version = "0.1" } tracing-futures = { version = "0.2" } @@ -113,8 +113,7 @@ zstd-sys = { version = "2", default-features = false, features = ["legacy", "std ahash = { version = "0.8" } anyhow = { version = "1", features = ["backtrace"] } arrayvec = { version = "0.7", default-features = false, features = ["std"] } -auto_enums = { version = "0.7", features = ["futures"] } -auto_enums_derive = { version = "0.7", default-features = false, features = ["futures", "std"] } +auto_enums = { version = "0.8", features = ["futures03"] } aws-sdk-s3 = { version = "0.21", features = ["native-tls"] } aws-smithy-client = { version = "0.51", default-features = false, features = ["native-tls", "rustls"] } aws-types = { version = "0.51", default-features = false, features = ["hardcoded-credentials"] } @@ -179,6 +178,7 @@ regex = { version = "1" } regex-syntax = { version = "0.6" } reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"] } ring = { version = "0.16", features = ["std"] } +rust_decimal = { version = "1", features = ["db-postgres", "db-tokio-postgres"] } scopeguard = { version = "1" } serde = { version = "1", features = ["alloc", "derive", "rc"] } serde_json = { version = "1", features = ["alloc"] } @@ -190,12 +190,12 @@ subtle = { version = "2" } syn = { version = "1", features = ["extra-traits", "full", "visit", "visit-mut"] } time = { version = "0.3", features = ["formatting", "local-offset", "macros", "parsing"] } tokio = { version = "1", features = ["fs", "io-std", "io-util", "macros", "net", "parking_lot", "process", "rt-multi-thread", "signal", "stats", "sync", "time", "tracing"] } +tokio-postgres = { git = "https://github.com/madsim-rs/rust-postgres.git", rev = "87ca1dc", features = ["with-chrono-0_4"] } tokio-stream = { git = "https://github.com/madsim-rs/tokio.git", rev = "0c25710", features = ["fs", "net"] } tokio-util = { version = "0.7", features = ["codec", "io"] } tonic = { version = "0.8", features = ["gzip", "tls-webpki-roots"] } tonic-build = { version = "0.8" } tower = { version = "0.4", features = ["balance", "buffer", "filter", "limit", "load-shed", "retry", "timeout", "util"] } -tower-http = { version = "0.3", features = ["add-extension", "cors", "map-response-body", "util"] } tracing = { version = "0.1", features = ["log", "release_max_level_trace"] } tracing-core = { version = "0.1" } tracing-futures = { version = "0.2" }