Repository navigation
Adding storage pulsar - #64184
Adding storage pulsar#64184SteveBalayanAKAMedian wants to merge 173 commits into
Conversation
This reverts commit b0c7d58.
|
Please sign CLA. |
|
Dear @nikitamikhaylov, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
…rly with `lazy_load_tables` `isPushSourceEngine` lists the engines whose ingestion only starts in `startup`, which a lazily loaded stand-in never calls. `Pulsar` was missing, so after a server restart or `DETACH DATABASE` / `ATTACH DATABASE` a `Pulsar` source of a materialized view in a database with `lazy_load_tables = 1` silently stopped ingesting. Add a broker test that reloads such a database and publishes externally, without touching the source table. It fails without the fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ze-mismatched zlib output `CompressionCodecZLib::decode` accepted a decoded payload of any size and a finished stream without its checksum trailer. Now the decoded size must match the declared size, and the stream must either end properly or (for the sync-flushed output of the Java client) be fully consumed at a block boundary. Regression tests are in the fork. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A table with a physical column named like an ephemeral virtual column, e.g. `_topic String` or `_timestamp DateTime`, passes `CREATE`, but `PulsarSource` appended the virtual column to the block next to the physical one, so `Block::insert` threw `AMBIGUOUS_COLUMN_NAME` and nothing could be read. Use `insertUnique`, so the physical column takes precedence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/configure_config.cmake
Build fixes after merging master: - `StreamingFormatExecutor` now takes a format creator instead of a format. - `MessageQueueSink` now takes the full sample block as the input header and the non-materialized one as the format header (as for `NATS` and `RabbitMQ`). - `PulsarProducer.cpp` includes `Common/Exception.h` explicitly. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=64184&sha=add310501e2e609d5dbbb75465f7896ac81ec9f2&name_0=PR&name_1=Build%20%28arm_tidy%2C%203%2F4%29 PR: ClickHouse#64184 Address review: with `pulsar_max_wait_ms = 0`, `popConsumer` waited for a free consumer without a bound and could not be cancelled. With `SELECT ... FROM t UNION ALL SELECT ... FROM t` over a one-consumer table the second source waited forever, because the first one keeps the consumer until the pipeline is destroyed, and `KILL QUERY` did not wake the wait. Now a zero timeout does not wait at all, and a positive timeout is waited in short slices that check the query and `SYSTEM STOP STREAMING` cancellation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e decompression runs out of memory `Z_MEM_ERROR` from zlib and `ZSTD_error_memory_allocation` from zstd were treated as corrupted input, so the message was acknowledged and lost. The codecs now throw `std::bad_alloc`, which makes the consumer close the connection without acknowledging, so the message is redelivered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # tests/queries/0_stateless/01271_show_privileges.reference
The `Pulsar` contrib selected the native-build `protoc` when cross-compiling or when `USE_MUSL`, but the `native/` sub-build is only produced when host and target differ. With musl now the default, the native `arm_tidy` build had a dangling ninja dependency: `native/contrib/google-protobuf-cmake/protoc`, needed by `PulsarApi.pb.cc`, missing and no known rule to make it. Use the same condition as `protobuf_generate.cmake` (changed on master in 1411c0c): a statically linked musl `protoc` runs on the host. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=64184&sha=latest&name_0=PR&name_1=Build%20(arm_tidy%2C%204%2F4) PR: ClickHouse#64184 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Let's send these PRs to our fork as well and merge them. If it is akin to the Apache ORC library or rdkafka in terms of quality, we should not use it. |
|
Acknowledged. I'm checking which of the six upstream PRs still differ from the |
|
Fork. apache/pulsar-client-cpp#626, apache/pulsar-client-cpp#627 and apache/pulsar-client-cpp#629 are already on Quality. Measured against the points of #127470, it is in the same class as rdkafka:
12 of the 18 fork-only commits fix defects like these (the rdkafka fork: 9 of 20). Two of the 12 are backports of upstream fixes (apache/pulsar-client-cpp#438, apache/pulsar-client-cpp#441). The other ten fix defects that are still on upstream My recommendation is not to use it. The engine calls only Either way, the size-validation fixes still need a private report to [email protected] (upstream |
|
🕵 Both requests from #64184 (comment). 1. Fork pull requests
All three are The six upstream pull requests 2. Sanity of
|
|
My assessment: pulsar-cpp is trash and has no place in ClickHouse. Let's rewrite the library entirely. |
In what century do they live? Should we even consider integration with Pulsar if they allow such low-quality libraries? |
This is 🤣. Instead of increasing the chances of finding bugs, they hide them. |
It is already out of the bag, thanks to the trivial automatic analysis. So we can draft it here and then send an email. |
I think yes, but only with our own client. The C++ client is a separate repository, split out of apache/pulsar in 2022: 54 commits on I'll write the client: a ClickHouse-native implementation of only what I'll post the draft of the security report here next. |
|
Draft for [email protected], with a copy to [email protected] (upstream Subject: Heap buffer overflows and process aborts in the Pulsar C++ client, reachable by any producer or broker Affected: apache/pulsar-client-cpp v4.2.0 (latest release) and Summary. The client trusts the lengths and sizes it receives from the network. Controlled by a producer (message metadata and payload, which the broker forwards unchanged):
Controlled by the broker, or by the network without TLS:
Fixes. Items 1 and 3-5 and 8 are fixed by five patches against Disclosure. These issues are already public in #64184 and in the fix commits above. They are easy to find independently: fuzzing the frame parser finds most of them within minutes. Reproducers for items 1, 2 and 6 (compile with the codec or
|
|
Continued in #133430 |
|
The client is in #133490: only the part of the binary protocol the engine uses, with no threads, every size from the network checked, memory-tracked buffers and a libFuzzer target over the frame parser. Switching this PR's engine to it took 10 files locally (+88 -264), and 49 of its 50 integration tests pass with it; the 50th fails in the engine before any client call. The engine continues in #133430, whose head still uses |
…lsar client `src/Storages/Pulsar/Client/Proto/PulsarApi.proto` is a verbatim copy of `proto/PulsarApi.proto` of apache/pulsar-client-cpp at f71d7e99019d (Apache-2.0, the ASF header kept), except one line: `package pulsar.proto;` is `package DB.PulsarProto;`. The package does not affect the wire format, and it avoids duplicate `pulsar::proto` symbols while the `Pulsar` engine of ClickHouse#64184 still links `contrib/pulsar-client-cpp`. `MetadataViews.proto` declares views of `MessageMetadata` and `SingleMessageMetadata` with only the singular fields the client reads (same field numbers and wire types): these messages are written by producers, and parsing their repeated fields into the full classes would allocate one object per element. `USE_PULSAR` and `CANNOT_CONNECT_PULSAR` (788) are byte-identical to the lines ClickHouse#64184 adds, so that the engine can switch to the native client without conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category:
Changelog entry:
Added the experimental
Pulsartable engine for reading from and writing to Apache Pulsar topics. Creating tables with the engine requires enabling theenable_pulsarsetting.Closes: #4226
Workflow [PR]
Sync PR [sync-upstream/pr/64184]