Repository navigation
Commit 32aa75a
authored
fix: let read-only users query Recall on ClickHouse and read each table once (#1218)
* fix: read the Recall invocations view in one pass
The ClickHouse invocations view read recall_events three times and
joined four subqueries, so every lookup paid for three event reads and
hash-join preallocation. It is now one UNION ALL of the context rows,
heartbeats and lifecycle events folded by invocation, without joins.
Rows and column types are unchanged; the Recall schema version rises to
3 so writers replace the view through the existing upgrade path.
Refs: CHI-773
* fix: read recall_events once in the Recall statements view
The statements view read the events twice, once for statement facts
and once for resource names. It now folds one read by resource, which
names the resource and gathers its statement events, then by statement.
sql_available stays a lookup of the stored SQL, which is shared across
invocations.
Refs: CHI-773
* fix: let readonly = 1 users read Recall history on ClickHouse
A read connection sent SQLBuild's session settings and every recall
query set readonly = 2, which a readonly = 1 user may not do. A read
connection now applies the pinned session settings only when the
session may change settings; a query sets readonly = 2 only when the
session is not already read-only, sends the row limit only when the
user may set it and otherwise stops reading at the cap, and a setting
the user may not change fails with an error naming it and readonly = 2.
output_invocations is folded without joins and artifacts makes its
stored side nullable before the join, so no view depends on
join_use_nulls or sets SETTINGS.
Refs: CHI-772
* fix: read Recall tables without FINAL where folds ignore copies
Copies of a Recall key hold the same content, since a write with other
content is refused as a conflict. The invocations and statements views
only take the first, last, smallest or largest value of a key's copies,
so they read without FINAL, as do the delivery and context branches of
output_invocations. Views that list or count rows keep FINAL.
Refs: CHI-777
* fix: batch ClickHouse Recall writes over five seconds
A long command wrote about one small part per table every second.
ClickHouse batches now wait up to five seconds; heartbeats still go out
at once and a closing command sends everything it holds. A batch is
also sent early once a quarter of the queue's byte capacity is ready,
so a byte-heavy command fills the queue no sooner than before.
Refs: CHI-777
* docs: describe when a Recall reader skips session settings1 parent 60091c6 commit 32aa75a
26 files changed
Lines changed: 1665 additions & 245 deletions
File tree
- crates
- sqlbuild-python/src/bindings/_helpers/recall
- sqlbuild-recall/src
- clickhouse
- schema
- _helpers
- tests
- writer
- _helpers
- tests
- src/sqlbuild
- .agents/skills/sqlbuild/references/docs/concepts
- adapters
- observability
- adapters/clickhouse
- _helpers
- classes
- adapter/contract/_helpers
- tests/e2e/src/sqlbuild/cli/commands/main/clickhouse
- website/src/content/docs/docs/concepts
- adapters
- observability
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
89 | 96 | | |
90 | 97 | | |
91 | | - | |
| 98 | + | |
92 | 99 | | |
93 | 100 | | |
94 | 101 | | |
| |||
104 | 111 | | |
105 | 112 | | |
106 | 113 | | |
107 | | - | |
| 114 | + | |
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
113 | 126 | | |
114 | 127 | | |
115 | 128 | | |
| |||
132 | 145 | | |
133 | 146 | | |
134 | 147 | | |
135 | | - | |
| 148 | + | |
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
139 | | - | |
| 152 | + | |
140 | 153 | | |
141 | 154 | | |
142 | 155 | | |
| |||
152 | 165 | | |
153 | 166 | | |
154 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
155 | 175 | | |
156 | 176 | | |
157 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | | - | |
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| |||
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
146 | | - | |
| 148 | + | |
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
| |||
591 | 593 | | |
592 | 594 | | |
593 | 595 | | |
594 | | - | |
| 596 | + | |
595 | 597 | | |
596 | 598 | | |
597 | 599 | | |
| |||
645 | 647 | | |
646 | 648 | | |
647 | 649 | | |
648 | | - | |
| 650 | + | |
649 | 651 | | |
650 | 652 | | |
651 | 653 | | |
| |||
683 | 685 | | |
684 | 686 | | |
685 | 687 | | |
686 | | - | |
| 688 | + | |
687 | 689 | | |
688 | 690 | | |
689 | 691 | | |
| |||
719 | 721 | | |
720 | 722 | | |
721 | 723 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
| 724 | + | |
| 725 | + | |
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
| 730 | + | |
731 | 731 | | |
732 | 732 | | |
733 | 733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
0 commit comments