Repository navigation
Conversation
758a2d5 to
b5a47fa
Compare
|
We need this... |
|
Maybe another day ... |
|
We need this. |
|
Continued in #101027 |
|
The mentioned PR is about a function that obfuscates an SQL query. This PR implements a table function that obfuscates the result of a certain query. |
|
Workflow [PR], commit [055ddb9] AI ReviewSummaryThis PR adds the Findings
Final VerdictChanges requested. |
|
Yes, that's true. Didn't notice that. The feature is still needed! |
|
The flaky check failure is fixed in #102148, let's update the branch. |
f1eaf7b to
53ed445
Compare
# Conflicts: # programs/obfuscator/Obfuscator.cpp # src/Parsers/ExpressionListParsers.cpp
|
🕵 Both reds on the superseded head
This pass also merged |
…rithmetic On Darwin and Wasm, `size_t` is `unsigned long` while `UInt64` is `unsigned long long`, so template deduction for `common::addOverflow` failed with conflicting types when mixing `params.frequency_add` (`size_t`) with the `UInt64` histogram counters. Use an explicit `UInt64` copy of the parameter in `MarkovModel::finalize`. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=42701&sha=9cd895fe6428bb4c3f7e8b03951b7071ceb5ffaf&name_0=PR Co-Authored-By: Claude Fable 5 <[email protected]>
|
🕵 The three build reds on The |
…obfuscate` in AST JSON `obfuscate` has the same bare-`SELECT` table-function form as `view` (`ObfuscateLayer` pushes exactly one `ASTSelectWithUnionQuery` argument, never parameters, and always emits the canonical lowercase name), but `ASTFunction::readJSON` applied the matching shape validation and name canonicalization only to `view` and `viewIfPermitted`. As a result, a handcrafted `clickhouse_json` payload could build a parameterized `obfuscate(<SelectWithUnionQuery>)`, which `ASTFunction::formatImplWithoutAlias` formats through `tryGetQueryArgument`, silently dropping the parameters on round-trip; and a non-canonical spelling such as `Obfuscate` survived deserialization even though `TableFunctionFactory` resolves `obfuscate` case-sensitively. Extend the existing `view` checks to `obfuscate`: reject any bare-select shape the parser cannot produce, and canonicalize the name the way the parser does. New test `04893_obfuscate_ast_json_shape.sql` mirrors `04828_view_table_function_ast_json_shape.sql`.
Persist `ASTSetQuery::default_settings` in `QueryNode` so remote execution and query-cache decisions retain explicit setting resets. ClickHouse#42701
|
🕵 Pushed |
|
🕵 Pushed |
|
🕵 Superseded by #115004 from the main repository. It preserves this PR’s implementation, review fixes, and credits @evillique; please continue review there. |
|
🕵 Closing as superseded by #115004. |
On an ASan build, a stateless run that aborts on the hung check records no
stack of the hung server anywhere:
Hung check failed: server is not responding
Cannot collect C stacktraces under ASan: debugger attach is disabled.
Two things combine to produce that. print_c_stacktraces declines to attach
lldb on ASan builds, because a ptrace attach disables LeakSanitizer for the
rest of the process; that refusal is correct and stays. And
print_sql_stacktraces, the collector that needs no debugger at all, was
unreachable in this state: its availability pre-check went through
check_server_liveness, which probes HTTP on http_port (default 8123), while
the collector itself shells out to args.client on the native TCP port
(default 9000). Those are different listeners on different ports served by
different code paths, so a server whose HTTP endpoint is wedged or whose
handler pool is exhausted while TCP still answers queries failed the gate and
was never asked. That is precisely the reported signature: the process alive,
not responding. The hung-check abort site did not call the SQL collector in
the first place, and neither did the FailureReason.SERVER_DIED site.
Drop the pre-check and let the bounded TCP query be its own liveness test.
The reason the pre-check existed was to keep "Code: 210 Connection refused"
tracebacks out of every failed run, and that concern is now covered where it
belongs: get_stacktraces_from_clickhouse runs under shell_get_output with
timeout=30, which caps a dead or wedged socket at 30 seconds and reduces a
failure to a single trim_for_log-bounded stderr line with no traceback. The
existing "if bt:" guard still means nothing is written and nothing is claimed
when nothing was collected; an else branch now records that the attempt was
made, so "tried and got nothing" is distinguishable from "never tried".
Then add the SQL dump to the two abort sites that had only the C path. It
goes before the C dump for the reason the per-test timeout handler documents:
dump while the client connections are still up, because once they drop the
server cancels the wedged queries and their threads disappear.
A server-side alternative was considered and rejected. Sending SIGTSTP so the
server logs its own stacks would work mechanically, but onFault emits its
report at LOG_FATAL, check_fatal_messages_in_logs greps for any <Fatal> line
and appends a result carrying Result.Label.BLOCKER, and FuzzerLogParser
classifies "Received signal" as a signal failure. The diagnostic would have
manufactured a merge-blocking failure out of itself, which is worse than the
present silence. Teaching those scanners a benign exception was rejected too:
six independent consumers key on those strings, so it would weaken real-crash
detection in six places for a diagnostic gain. Nothing in this change writes
to the server log.
This does not fix any hang, and it does not restore C++ stacks on ASan
builds. What it changes is that a server alive but not answering HTTP now
yields the full system.stack_trace view with per-thread thread_name and
query_id, which identifies the query that wedged the server.
Measured on a live server, with HTTP dead and TCP live: master skips and
writes nothing, this change writes a 357 KB sql_stacktraces.log carrying
thread_name and query_id. An abort with HTTP wedged rather than closed gets
9.7 seconds faster, because the pre-check itself blocked for 10 seconds and
then collected nothing; the worst case is 20 seconds slower when both
transports are wedged, bounded by timeout=30. Green runs are unaffected,
since no caller runs on a passing test.
Regression coverage goes in the existing ci/tests/test_print_stacktraces.py.
The oracles key on the sql_stacktraces.log artifact and its columns, or on
per-site call order, never on stdout: the unfixed code, the rejected
call-site-only variant, and print_c_stacktraces all print lines, so a test
asserting that some output appeared would pass in every case and measure
nothing. The two abort sites are asserted independently, because the per-test
timeout handler and the end-of-run hung-query check already called both
collectors and would otherwise mask a revert of either new site.
Related: ClickHouse#42701
Related: ClickHouse#112265
The second-pass vector search optimization (`vector_search_with_rescoring = 0`) removed the distance function from the `ExpressionStep` outputs and re-appended the rewritten `_distance` alias at the end, changing the header column order. Steps created above the `Sorting` before the rewrite runs - the local top-N `Limit` and the exchange steps of a distributed plan - kept the original order, and `makeDistributedPlan` failed to rebuild the plan fragments with a logical error: "Cannot add step Limit to QueryPlan because it has incompatible header with root step Sorting". Reinsert the rewritten output at the original position instead. Found by AST fuzzer: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=42701&sha=019244e0d46b4d9029fc261a549e1c5cd79b1bbb&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29 ClickHouse#42701 Co-Authored-By: Claude Fable 5 <[email protected]>
Closes: #39067
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add table function
obfuscatewhich applies the same transformation as theclickhouse-obfuscatortool to the result of an arbitrary query, e.g.SELECT * FROM obfuscate(SELECT * FROM table). The seed can be controlled with theobfuscate_seedsetting; with an empty seed a fresh random one is derived per execution.