Commit Graph

30 Commits

Author SHA1 Message Date
Ethan Vizitei d32e875eb0 partman statement timeout
closes FOO-1159
flag=none

provides config in canvas
initializer

TEST PLAN:
  1) force partition manager query to take
     longer than timeout
  2) partition manager should abort (not holding
     transaction open forever)

Change-Id: I4e050233846f98833764d83983dce2ee121f0f49
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251839
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-11-04 20:10:43 +00:00
Cody Cutrer d6e044ff76 add # frozen_string_literal: true for embedded gems
Change-Id: Ib49bc8939cf1706e758429e531a87c57d0231a37
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251156
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2020-10-28 22:08:40 +00:00
Cody Cutrer dfc0fe5f6a ruby 2.7/rails 6: several deprecation warning and spec fixes
Change-Id: I6314b3f304e8befc18ee2f832993a0740690d786
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249956
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-14 16:13:04 +00:00
Ethan Vizitei be97356242 bulk_insert for partitioned models
fixes FOO-685
flag = none

TEST PLAN:
  1) bulk_insert a bunch of auditor records.
  2) they should not get sent to the root partition.

Change-Id: Ie9f6a3af8ba2a05c77ecec89742b651f3f00f7d8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242163
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-07-09 16:23:22 +00:00
Ethan Vizitei 43d07c19ae remove constraints before dropping table
refs CNVS-49070
flag = none

TEST PLAN:
 1) have a bunch of traffic modifying users
 2) try to drop a partition from a partman table
    with a FK on user
 3) it does not lock up forever and cause an outage

Change-Id: I2a3e2183e69aae8ab3959d6912d7b54def31d66c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/236067
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2020-05-04 18:28:08 +00:00
Ethan Vizitei 95aca3787c auditor models and migrations
refs CNVS-48876
flag = none

The only goal for this PS is to get the
tables and models in place to handle auditors
data being written to PG instead of cassanrda.

No actual new writing happens in this change.

create the first couple partitions as a migration
and the previous 12 to have room for backfilling

include partitions migrations for keeping indices
on individual partitions

cron-ify partitioner to keep pre-creating
new partitions for auditor tables

TEST PLAN:
  * migrate the database
  * do things that trigger auditor writes
    - login
    - change grades
    - publish courses
  * nothing should have changed or broken
  * auditors tables should be completely empty in PG
  * create the first few partitions as a migration

Change-Id: If4e2446a82fb1c91e992a28e62918ff8d8a8c73a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234064
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2020-04-16 20:02:49 +00:00
James Williams d641ac44e2 use versionable model ids in partition precreator
closes #CORE-3256

Change-Id: I88a21eb9c0b404ba843149d20cdd3e13b48bc313
Reviewed-on: https://gerrit.instructure.com/204647
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-08-20 16:51:20 +00:00
James Williams 12cc852cd0 add an endpoint to check upcoming partition validity
will return an error if the periodic jobs
haven't been running

closes #CORE-2717

Change-Id: If192f45c0e1f32f53d26287240a717517dcb8440
Reviewed-on: https://gerrit.instructure.com/187809
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2019-04-03 22:10:47 +00:00
James Williams 2d4b77a3d6 stop and requeue message migration job periodically
break it up into 5 minute chunks

refs #CORE-2558

Change-Id: I00b6d7ffb548a1543e56e6397aeff177a8724f76
Reviewed-on: https://gerrit.instructure.com/185084
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
2019-03-13 16:49:26 +00:00
Cody Cutrer 0364681e13 fix pruning week-based partitions
Change-Id: I8a8dd135b7da10bd2659251821cb0af0ede5726a
Reviewed-on: https://gerrit.instructure.com/178970
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
2019-01-23 16:20:31 +00:00
Cody Cutrer 0f5d186f8e create and drop partitions in a transaction
ensures the database server unshackles itself and hits the master

Change-Id: I7590b230be6a18588547442ca0a0e220b5093873
Reviewed-on: https://gerrit.instructure.com/178971
Tested-by: Jenkins
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-01-23 14:57:33 +00:00
James Williams 5c8a177118 create the last partition
otherwise can break when maximum is earlier in the
week/month/etc than the minimum

Change-Id: I70513097b18e7f22d6bc43ef28d44ae57e2bef41
Reviewed-on: https://gerrit.instructure.com/174850
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2018-12-10 19:58:10 +00:00
James Williams 3e161cb6e8 partition messages
test plan:
* run the migrations
* sending messages and viewing them as an admin
 should work as before

closes #COMMS-1327

Change-Id: If955b49d07fa68f8a5151984eb4d9c3b97b118ee
Reviewed-on: https://gerrit.instructure.com/170657
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2018-12-10 13:42:35 +00:00
James Williams 7423e4fb94 rails 5.2
closes #CORE-1301 #CORE-1302

Change-Id: I687132b066d12cf35e3c7a593dff9b2a91337f33
Reviewed-on: https://gerrit.instructure.com/147220
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-04-25 19:15:20 +00:00
Cody Cutrer 616b2dbb47 drop rails 5.0
Change-Id: Ic374d543a7ba00f660efccb287513c5f80232196
Reviewed-on: https://gerrit.instructure.com/144178
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-03-20 19:50:23 +00:00
Cody Cutrer 68f5e6065c prep for Rails 5.1
several gem bumps for versions compatible with rails 5.1, and loosening
requirements on in-repo gems.

Change-Id: I4849b053690527e812bb1042fde8142520452123
Reviewed-on: https://gerrit.instructure.com/115650
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-06-16 02:54:20 +00:00
Landon Wilkins c5b5cc786d da licença part 53
add consistent license headers to all source files

Change-Id: I405d2def01ad68c76533b9254983497485cd7073
Reviewed-on: https://gerrit.instructure.com/110160
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-05-01 21:06:11 +00:00
Jon Jensen de3d8e781d partitioning fixes, fixes SD-2358
* add foreign keys to new partitions moving forward
* don't create redundant indexes on initial partitions
* remove other migrations for partitions that are long gone

test plan:
specs

Change-Id: I5cbb50593b70db5f7ba79c846fda4efb11835212
Reviewed-on: https://gerrit.instructure.com/107900
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-07 21:01:36 +00:00
Cody Cutrer ce21af8ecf rails 5: find and fix lots of deprecation warnings [ci verbose]
refs CNVS-34843

Change-Id: Idd523c2a7c37325381d590f1ee70c406ace2a459
Reviewed-on: https://gerrit.instructure.com/105033
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-16 16:03:51 +00:00
Cody Cutrer 6158735840 rails 5: fix canvas_partman
refs CNVS-34862

Change-Id: I196adc8f6e103490f1589d206d4efff0bf94d5a0
Reviewed-on: https://gerrit.instructure.com/102245
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-02-15 20:42:37 +00:00
Cody Cutrer 6beba043bc fix some ruby 2.4 deprecations
the thread_safe gem has deprecations too, but they'll require Rails 5.1
until they're fixed (when both activesupport and tzinfo no longer
depend on it)

Change-Id: Ic53839d911ba8ed4d463d17f9dd7207673510f3a
Reviewed-on: https://gerrit.instructure.com/100499
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-01-25 21:53:37 +00:00
Cody Cutrer 58659f33e2 don't fail creating initial versions partitions if they already exist
refs OPS-3846

maybe somehow the periodic job ran first, and created some

Change-Id: I3be937be3a3c9b52d62f5f2f919b368ac2ea586e
Reviewed-on: https://gerrit.instructure.com/82702
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-06-16 21:22:25 +00:00
Cody Cutrer f71a829b47 partition versions
closes CNVS-29133

test plan:
 * run the migrations
 * inspect your database; there should be versions_0, versions_1,
   versions_2 tables.
 * drop versions_2 manually
 * run Versions::Partitioner.process
 * versions_2 should be created again, and have the proper indexes
 * use pieces of canvas that rely on versions; nothing should be broken

Change-Id: I3211fdd3fd1716b8a7e6c6f7553a6e49cc6e39bb
Reviewed-on: https://gerrit.instructure.com/80214
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-05-27 17:22:10 +00:00
Cody Cutrer bd9f0d3fa5 migrations fixes, especially for partitioned tables
* for PartitionManager, don't have your own migrations paths, just
   use ActiveRecord's
 * vendor/plugins is long gone; don't look for migrations there
   anymore

Change-Id: Ia4e2c91e59beb2d723cbdc5072b26cddd70638c9
Reviewed-on: https://gerrit.instructure.com/53267
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-02-25 21:21:15 +00:00
Cody Cutrer 2c2e687e59 qualified names fixes for migrations
refs CNVS-21900

Change-Id: I6b7e323e3c700aee3a7c86cb8f06fce78e5606df
Reviewed-on: https://gerrit.instructure.com/63384
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-09-17 22:03:28 +00:00
Cody Cutrer be8b9e0772 refactor and improve partition management
* move most of the logic into PartitionManager
 * use a setting for how many partitions to precreate/prune
 * enumerate existing tables for pruning, instead of assuming
   we can just roll off the last one
 * actually run the tests for partman from CI
 * simplify configuring partitioned migrations (just rely
   on the model to get the table name, instead of trying to
   guess the model from the table name, and sometimes having
   to provide both)

Change-Id: Ic8ac2b603a02f092b2f278d2b366b1cd9f942954
Reviewed-on: https://gerrit.instructure.com/53286
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-15 02:15:09 +00:00
Cody Cutrer 38672d76bf base partitioned check on module inclusion, not a method that is never called
Change-Id: I93308ca4fb65747f911d5c130968d1d6be6888ed
Reviewed-on: https://gerrit.instructure.com/53373
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-04 17:19:06 +00:00
Derek DeVries 65cd872f8e fix issue with event created at time not being set to utc time
fixes CNVS-17723

test plan:
  - as a teacher
    - create a OQAAT quiz with a few questions
    - publish the quiz

  - as a student
    - take the quiz
    - you should not get errors when answering questions

Change-Id: I5811e775112bd030d1ea3703985c7f3b194d4901
Reviewed-on: https://gerrit.instructure.com/46458
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Ahmad Amireh <ahmad@instructure.com>
2015-01-01 04:34:55 +00:00
Ahmad Amireh 6d1e53f608 canvas-partman - rolling partition migrations
Closes CNVS-16878

TEST PLAN
---- ----

Similar to g/44145 but no rake tasks needed.

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: Icfed777974269c344b5e1e1c2617ab2f3836f38f
Reviewed-on: https://gerrit.instructure.com/44405
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
2014-12-03 19:53:53 +00:00
Ahmad Amireh cb498b345f canvas-partman & quiz log auditing partitioning
A small gem for abstracting partitioning at the model layer, as well as
helpers for dynamically creating the partitions needed for quiz
submission events.

You can read more about the gem's API in its README file.

Closes CNVS-16795

TEST PLAN
---- ----

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run `bundle exec rake canvas:quizzes:create_event_partitions`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: I7d6b77c62db8510e09a54fbae00048a14b5366bb
Reviewed-on: https://gerrit.instructure.com/44145
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-11 19:06:00 +00:00