Skip to content

Instantly share code, notes, and snippets.

@JanHalozan
Last active July 12, 2018 11:42
Show Gist options
  • Save JanHalozan/8957041a1024a4a90c49dadcf1de09a1 to your computer and use it in GitHub Desktop.
Save JanHalozan/8957041a1024a4a90c49dadcf1de09a1 to your computer and use it in GitHub Desktop.
Release WH lookup tables Backend
  1. 146 schema migration (spaces cluster) safe to run

  2. 147 schema migration (metric_key_id) safe to run took 10min on stage

  3. 148 schema migration (metric_key_name_id, also metric_key_id FK) safe to run took 1528s on stage

Per space part:

  1. 036 data migration (metric_key_names metric_key_id) run per space took 1536s on stage for 5147 for 75836 records make index and then it will be faster

  2. 037 data migration run per space took 2.4s on stage for 5147 for 75836 records that was with index

All of the above were already done. Now the actual per space release part:

  1. Create new space on anita cluster using https://databox.slack.com/archives/CB05GH33R/p1531226404000265
  2. Enable maintenance mode on push API
  3. Enable maintenance mode on calculations
  4. Switch cluster to anita in spaces prod database
  5. Clear redis cache for that space (https://github.com/databox/calculations/blob/develop/README.md) curl -H "Content-Type: application/json" -X DELETE http://localhost:8001/spaces/cache/{id}
  6. Disable maintenance mode on calculations
  7. Disable maintenance mode on push API

KEEP AN EYE OUT

  • trigere treba skreirat na WH tabeli ko se prek kopira
  • cascade delete na metric_key_names (boris more še vse v migracijo dodat kot sma se zmenla)
  • ENV variabla na kalkulacije ko se deployajo (LOOKUP_SCHEMA)
  • pray

Important as fuck:

  • FK constraint on metric_key_names was dropped after migration finished. It will (and must) be added when all metric_key_names have their respective metric_key_id. And then cascade delete must be added. So

ALTER TABLE metric_key_names ADD CONSTRAINT fk_metric_key_names FOREIGN KEY (metric_key_id) REFERENCES metric_keys(metric_key_id);

Must also include on delete cascade.

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