|
| 1 | +-- apply changes |
| 2 | +-- |
| 3 | +-- One-shot data reset for the v1 -> v2 metric-model transition. |
| 4 | +-- |
| 5 | +-- Background: a metric's identity is its hash (orm queries supply it from the |
| 6 | +-- SQL, independent of the metric name). On ingest an existing app_metric row is |
| 7 | +-- matched by hash and reused as-is; its name/tags are never refreshed. So when a |
| 8 | +-- v2 client begins reporting an already-seen hash, the server keeps the stale v1 |
| 9 | +-- name (e.g. orm.DMessage.findMessages) instead of the v2 family name |
| 10 | +-- (ebean.query + label tag). The app_metric catalog has no retention, so those |
| 11 | +-- stale rows never age out on their own. |
| 12 | +-- |
| 13 | +-- This migration empties all metric data and the catalog so the next ingest |
| 14 | +-- recreates rows with their current (v2) name/tags. It deliberately does NOT |
| 15 | +-- drop the schema: the Ebean db_migration history table lives in this schema, |
| 16 | +-- and dropping it would break the migration run and leave the tables un-rebuilt. |
| 17 | +-- Truncating keeps the schema, partitions and migration history intact while |
| 18 | +-- clearing every row. |
| 19 | +-- |
| 20 | +-- PRECONDITION: only deploy once the forwarding apps emit v2 for ALL queries |
| 21 | +-- (insight top --by name shows only ebean.txn / ebean.query, no orm.* rows). |
| 22 | +-- Otherwise v1 forwarders immediately refill the old-semantic rows. |
| 23 | +-- |
| 24 | +-- Runs exactly once per database via migration.run (dev/test/na/apac), so no |
| 25 | +-- kubectl/DB access is required and there is nothing to remove afterwards. |
| 26 | +-- Truncating a partitioned parent truncates all of its partitions; cascade |
| 27 | +-- handles foreign-key order; restart identity resets the id sequences. |
| 28 | +-- The job control table is intentionally left alone (managed by DJob.initRollup). |
| 29 | + |
| 30 | +truncate table |
| 31 | + ebean_insight.timed_entry, |
| 32 | + ebean_insight.timed_m1, |
| 33 | + ebean_insight.timed_m10, |
| 34 | + ebean_insight.timed_m60, |
| 35 | + ebean_insight.timed_d1, |
| 36 | + ebean_insight.gauge_entry, |
| 37 | + ebean_insight.gauge_m1, |
| 38 | + ebean_insight.gauge_m10, |
| 39 | + ebean_insight.gauge_m60, |
| 40 | + ebean_insight.gauge_d1, |
| 41 | + ebean_insight.rollup_job, |
| 42 | + ebean_insight.query_plan_change, |
| 43 | + ebean_insight.query_plan, |
| 44 | + ebean_insight.capture_request, |
| 45 | + ebean_insight.app_metric, |
| 46 | + ebean_insight.app_pod, |
| 47 | + ebean_insight.app_db, |
| 48 | + ebean_insight.app, |
| 49 | + ebean_insight.env |
| 50 | + restart identity cascade; |
0 commit comments