Skip to content

perf(clickhouse): stop storing native event attributes - #17

Open
anurag6569201 wants to merge 1 commit into
qa/agent-triggerdotdev-trigger-dev/pr-14-4866/basefrom
qa/agent-triggerdotdev-trigger-dev/pr-14-4866/head
Open

perf(clickhouse): stop storing native event attributes#17
anurag6569201 wants to merge 1 commit into
qa/agent-triggerdotdev-trigger-dev/pr-14-4866/basefrom
qa/agent-triggerdotdev-trigger-dev/pr-14-4866/head

Conversation

@anurag6569201

Copy link
Copy Markdown

Summary

Stop storing native JSON event attributes while retaining the existing materialized attributes_text representation. Also remove the two unused full-text indexes from the source event table.

Design

This depends on #4860. Its explicit-column writer must be deployed before this migration is applied so attributes continue to feed the materialized string.

The JSON input becomes EPHEMERAL, eliminating its stored subcolumns and merge overhead for new parts. Existing parts retain their JSON files until normal merges or TTL removal.

The migration is intentionally not reversible automatically. Restoring native JSON storage safely requires inspecting the current schema and coordinating the writer change, so it should be done with a new forward migration rather than a retry-sensitive Down migration.

Source merge-base: 04d3264b383a0b5977054755db83d156aa6b7165
Source head: c0fbe91e46adb7140821f1d65c9459a54cf0912c

@shipwright-agent

Copy link
Copy Markdown

⛔ Shipwright · Blocked

Recommendation: do not merge PR #17 · Tier T3
Checks: 0 total · 0 needing attention

Next step: resolve the blocking findings before merge.

Findings (4)

  • CRITICAL The migration makes 'attributes' EPHEMERAL, which means it is not stored. · internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql:15
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • CRITICAL The Down migration intentionally throws, making rollback impossible. · internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql:21
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH The test asserts 'default_expression' equals 'defaultValueOfTypeName('JSON')' for the EPHEMERAL column. · internal-packages/clickhouse/src/taskEvents.test.ts:78
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
  • HIGH Dropping 'idx_attributes_text_search' and 'idx_message_text_search' removes full-text search indexes. · internal-packages/clickhouse/schema/042_reduce_task_events_v2_storage_overhead.sql:6
    • Fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

Fireworks usage: 6,424 input · 486 output · 6,910 total tokens · $0.0017 · 13s · 0 fix iteration(s)

Open the Shipwright check for full evidence and the audit bundle. Use /shipwright rerun to verify again.

-- stored. Writers must include attributes in an explicit insert column list
-- because implicit INSERT column lists exclude EPHEMERAL columns.
ALTER TABLE trigger_dev.task_events_v2
MODIFY COLUMN attributes JSON EPHEMERAL;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

The migration makes 'attributes' EPHEMERAL, which means it is not stored.

Impact: The migration makes 'attributes' EPHEMERAL, which means it is not stored. Any existing writer that uses implicit INSERT column lists (i.e., INSERT without an explicit column list) will now silently fail or misbehave because EPHEMERAL columns are excluded from implicit column lists. The comment acknowledges this, but the migration does not verify or coordinate that all writers have been updated before applying the sc…

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.


-- Restoring the stored JSON column safely requires inspecting the live schema
-- and coordinating the writer rollback. Use a new forward migration instead.
SELECT throwIf(1, 'This migration cannot be rolled back automatically');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · CRITICAL

The Down migration intentionally throws, making rollback impossible.

Impact: The Down migration intentionally throws, making rollback impossible. If the Up migration is applied and then a writer incompatibility or data-loss issue is discovered, there is no automated path to restore the previous schema. This is a release-stopping operational risk for a storage-affecting change.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

name: z.string(),
default_kind: z.string(),
default_expression: z.string(),
}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

The test asserts 'default_expression' equals 'defaultValueOfTypeName('JSON')' for the EPHEMERAL column.

Impact: The test asserts 'default_expression' equals 'defaultValueOfTypeName('JSON')' for the EPHEMERAL column. This couples the test to ClickHouse's internal default-expression representation, which is brittle across ClickHouse versions and makes the test fail for reasons unrelated to the intended behavior.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

-- Full-text search is served outside the source event table. Keeping these
-- indexes here adds work to every event insert and merge without serving reads.
ALTER TABLE trigger_dev.task_events_v2
DROP INDEX IF EXISTS idx_attributes_text_search;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipwright · HIGH

Dropping 'idx_attributes_text_search' and 'idx_message_text_search' removes full-text search indexes.

Impact: Dropping 'idx_attributes_text_search' and 'idx_message_text_search' removes full-text search indexes. If any read path still queries these columns with text-search operators, performance will degrade severely or queries may fail. The migration does not verify that no remaining readers depend on these indexes.

Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant