40.days.from_now could potentially put us _2_ months from now, and
we won't have partitions pre-created that far in advance. so use the
more accurate 1 month from now
Change-Id: Ieab5b1b95cacaf83c18cbc55270c8422f36b6872
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/343503
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
we no longer need to migrate them from cassandra
Change-Id: Ia83c8b925d7b338287660fdf0b0665d385c8e142
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/342826
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
(and `remove_replica_identity`) in favor of `replica_identity_index`
and `set_replica_identity`. `add_replica_identity` required a model, not
just tables, and was written for migrating old tables to adding a replica
identity, instead of for new tables, where you can assume the column is
already null
Change-Id: Ie2db8b1e6859fc30a58c1e474c27f4d11e866f18
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/342497
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
it can lead to strange results where more rows were updated than were expected
also make sure to lock rows from the appropriate table when doing a subquery
update with a join in it
Change-Id: I16d0fee65a1d2b31ef72fd1933737b3715c441db
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/340620
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
make sure that switchman's extension is still active
Change-Id: I8d9d06103f1eb4b09f529b634fba758c72da371a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/339249
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
flag=none
Previously, the method would only return a hash with indifferent access
when include_root was false. When include_root was true, it would return
a plain-old hash. This change makes the return value type consistent, so
that it always returns a hash with indifferent access.
Test Plan:
- specs pass
Change-Id: I8fbc23523f1476a45a592cd02884d84d7c5a85e3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334369
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
region helpers have been hoisted into switchman proper, so
remove them locally
Change-Id: I1eda64fd64eda61b7647b15ec2ba62db986d19bd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/329655
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
and apply Rails/SelectMap and Rails/RedundantActiveRecordAllMethod
the offenses in User were manually fixed to maintain sharding
correctness
[skip-stages=Flakey]
[skip-crystalball]
Change-Id: I96f877ee8474655bd62a149f3aa54b312d38a5e4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327334
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
refs AE-380
a lot of these are APM style settings that would be okay to just turn
off while Consul is down. others are things that should just silently
not have any data, instead of failing the request
Change-Id: I34c553b089197f85b2d46029e5079851227090b6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/322239
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
manually done. the big one was the explicit locale assignment
in set_locale_with_localizer needs undone in a controller callback
then using with_locale everywhere, specs no longer need to be concerned
about being in an uncertain locale
Change-Id: I5a1d2c907a6f52ee4d8c2307b8c789a1f1ea436e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/320112
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
[skip-stages=Flakey]
Change-Id: I6abefdfa9fed6dd4525c8786e93efa548b3710f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/319603
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Isaac Moore <isaac.moore@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
refs AE-124
When running pre-deploy migrations that add a new column, if an application server loads the schema on a shard where the migration has already run, and tries to run queries on a shard where the migration has not already run, it can lead to errors. Fix this by allowing ignored_columns to append to its value dynamically through Consul.
Change-Id: I3b13e0fd2ac066e1439d3d314d71f2ebd8938e0c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/310561
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
When updating a course's availability settings, we touch all of the
users in the course. This causes locks in production when there's
lots of users enrolled in several large courses being updated. In
the case where we are updating availability settings, we'll skip
touching user objects if the row is locked - another process will
update the timestamp.
flag = none
closes LS-3018
Test plan:
- In a rails console, get a relation of courses doing something
like `relation = Course.where(id: [1, 2, 3])`
- Run `relation.touch_all_skip_locked`
- Expect the updated_at timestamp of each course to be updated
- Check out the SQL that was executed and expect to see
'FOR NO KEY UPDATE SKIP LOCKED'
- Now run `relation.touch_all`
- Expect the timestamps to be updated again, but the SQL should
not include 'SKIP LOCKED' lock type
Change-Id: If499982dc8fa368d312da7b8bcfc61a1f28b773b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286195
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Makes DueDateCacher and EffectiveDueDates handle being passed global
ids. Note that these IDs must still be for records on the same shard
as the provided course.
closes EVAL-2207
flag=none
Test Plan:
1. Create a course in an account in a cross-shard trust
2. Enroll at least one teacher and one student
3. Create an assignment in the course with a due date
4. As the teacher:
i. Log into the trusted account (not the one with the course)
ii. Go to the calendar and move the assignment to a different day
(drag and drop, or edit)
5. Check via api that the submission is not deleted
Change-Id: I3b450a959e660e2aa50428b419bfa0298e7c471b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285004
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
Reviewed-by: Dustin Cowles <dustin.cowles@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
Change-Id: I89129633731a68c38a5026b6b26318d1f3699a2a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284968
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
There was already a Setting to control the frontend error sample rate,
so this change adds one to control the backend sample rate, as well, and
removes the unnecessary `sentry_disabled` Setting.
flag=none
closes DE-1034
test plan:
- verify that the backend error sample rate defaults to `1.0` when unset
- verify that setting it to `0.0` results in no backend errors being
collected
- verify that changing the setting takes effect without server restart
when a SIGHUP is sent (test by calling `Canvas::Reloader.reload!`)
Change-Id: Ib8905ef4d18da7e1d2647ed9122218f56499670e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284796
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Otherwise, methods like `Sentry.set_tags` will be delegated to
`NilClass`, and will fail when called. We wrap the initialization in a
rescue block so we don't break the app if this default init fails.
flag=none
closes DE-1016
test plan:
- remove `sentry.yml`
- verify app starts correctly, calls to `Sentry.set_tags` don't raise
- verify that with `sentry.yml` present and `sentry_disabled` setting
false, Sentry captures errors
Change-Id: I93c6e65f8aa08d1e52c0a05b8ffd23fc7f3ef4fa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283868
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
new tables can be created in a transaction, but existing tables with
many rows need to have indexes added concurrently outside of a
transaction. adding a replica indentity requires the addition of an
index. let's peek the table and see if there are any rows to determine
how we need to have this index added.
Change-Id: Ieff6d8ad4d8d95b27b281ce2b96cacb2f390df48
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283508
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ben Rinaca <brinaca@instructure.com>
Product-Review: Ben Rinaca <brinaca@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
i wanted to make a change, and there weren't specs here to begin with.
Change-Id: I048e2d512df940607e47ea4add846da7ed876002
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283507
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Ben Rinaca <brinaca@instructure.com>
Product-Review: Ben Rinaca <brinaca@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
* respect truthiness of AR_QUERY_TRACE env var (setting it to
"0" or "false" turns it off)
* allow AR_QUERY_TRACE in test as well as development
* add AR_QUERY_TRACE_LEVEL option (valid values are "app", "rails",
and "full")
Change-Id: I398b800bb42b1bc7716cf322a6e6330bfaa8955b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278849
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
[skip-stages=Flakey]
auto-corrected, with post-review changing hashes that were meant
to be string keys in the first place
Change-Id: I877a365b9035bb62cea4d3b2f01f641f55b63281
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278676
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
flag=none
Test Plan:
- Set the "AR_QUERY_TRACE" env var to "true"
- Restart Canvas
- Load a Canvas page and verify query traces
are being logged
- Set the "AR_QUERY_TRACE_LINES" env var to some number
- Restart Canvas
- Load a Canvas page and verify the query traces
are limited to the number you chose
- Set the "AR_QUERY_TRACE_TYPE" env var to either
"write" or "read"
- Verify only queries of the chosen type are logged
- Verify query traces are not logged in in non-
development environments ("test", for example)
Change-Id: I2f5f7610a71e0bbfaa80327c422fc87162a5a78b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278634
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>