Commit Graph

196 Commits

Author SHA1 Message Date
Cody Cutrer 88e6974374 spec: fix timebomb with partitions
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>
2024-03-22 16:42:36 +00:00
Cody Cutrer c0ce6e3ff5 migrations: don't precreate historic auditor tables
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>
2024-03-13 18:44:11 +00:00
Cody Cutrer 7399e78b35 remove `add_replica_identity`
(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>
2024-03-08 20:36:36 +00:00
Cody Cutrer 920dd72906 avoid STI conditions when updating/deleting with subqueries
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>
2024-02-20 17:51:20 +00:00
Cody Cutrer 237a13820c rails 7.1: spec/initializers
Change-Id: I8a39eec0bbe29139139b0b29eeed6dbac9c1466d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/339719
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>
2024-02-05 21:04:44 +00:00
Cody Cutrer b525c0f700 fix order of update/delete_all extensions interacting with sharding
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>
2024-01-30 18:59:56 +00:00
Jacob Burroughs 3d7aa546d3 Remove more settings
Change-Id: Ibefe77b3ba1ec7e74e6e2af168f49ce06d6f49a9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/337253
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2024-01-29 16:21:38 +00:00
jake.oeding 2392c54242 make dynamic settings writable in dev/oss
closes AE-567
flag=none

test plan:
-specs pass

Change-Id: I1a0309d14c195053a04662e72ecb13a65efb74ce
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/337226
QA-Review: Jake Oeding <jake.oeding@instructure.com>
Product-Review: Jake Oeding <jake.oeding@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: Jacob Burroughs <jburroughs@instructure.com>
2024-01-23 15:20:56 +00:00
Cody Cutrer c32d30f662 bundle update rubocop
[skip-stages=Flakey]
[skip-crystalball]

and apply corrections from new/updated cops:

 * Layout
 * Lint/AmbiguousRange
 * Lint/RedundantSafeNavigation
 * Style/HashEachMethods
 * Style/HashSyntax
 * Style/InverseMethods
 * Style/RedundantLineContinuation
 * Style/RedundantParentheses
 * Style/RedundantReturn
 * Style/SuperWithArgsParentheses
 * Style/SymbolProc

Change-Id: I787e46f5b1c89e0fedebd5452ba74567d66954c1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/334291
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Build-Review: Aaron Ogata <aogata@instructure.com>
Migration-Review: Aaron Ogata <aogata@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-12-06 14:25:02 +00:00
Spencer Olson cd41464f8a make serializable_hash always return a hash with indifferent access
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>
2023-12-04 17:38:48 +00:00
Cody Cutrer d0abf493cc bundle update switchman
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>
2023-10-12 20:31:19 +00:00
Cody Cutrer c32ccde352 bundle update rubocop
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>
2023-09-13 13:31:05 +00:00
Cody Cutrer eed5b38eee remove unused LinkedIn gem
Change-Id: I797580b2b9e9e65831984db8c5946cfa4e590a55
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/326106
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>
2023-08-28 15:59:01 +00:00
Cody Cutrer 8f8f6f7313 bump rubocop gems and apply changes
[skip-stages=Flakey]

Change-Id: I5f080be6efb64351b4a89e6bd6040bc6f0432e82
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/323854
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>
2023-08-07 20:13:35 +00:00
Cody Cutrer 09a6b94036 add reasonable failsafes for several usages of Consul
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>
2023-07-12 14:51:15 +00:00
Cody Cutrer 5431d47758 rubocop: Rails/I18nLocaleAssignment
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>
2023-06-13 21:59:50 +00:00
Jacob Burroughs 7dcc507d0a Rubocop for ruby 3.1
[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>
2023-06-06 16:44:26 +00:00
Cody Cutrer 502aa068da rubocop: Layout/Multiline*LineBreaks
[skip-stages=Flakey]

Change-Id: I24912809267088bc19a4082c49bc5f78ca7b76bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/317302
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Build-Review: 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>
2023-05-01 19:31:42 +00:00
Cody Cutrer 7c37aa5f64 rubocop: prep for updating rubocop-rails
auto-correctable cops applied

[skip-stages=Flakey]

Change-Id: Ie80bdfd170d9233d4a750edce6be467c93f3493f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315835
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>
2023-04-14 14:07:22 +00:00
Cody Cutrer 62fc5c033d rubocop: prep for updating rubocop-rspec
auto-correctable cops applied

[skip-stages=Flakey]

Change-Id: I17e18e2e1a230ef7b27f01ddb7e587045eabf97f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315809
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>
2023-04-12 19:30:10 +00:00
Cody Cutrer 1d3d9ed499 rubocop: fix miscelleneuos violations in prep of bumping rubocop
Change-Id: I9d37303737f00d6e022cb8fc08726e293a7336ab
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315166
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>
2023-04-12 19:26:13 +00:00
Cody Cutrer c101827780 rubocop: Style/RedundantConstantBase
[skip-stages=Flakey]

Change-Id: Ie18389de5b45f433aa82a13f62daa2a5a9d44b80
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315120
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>
2023-04-10 20:56:27 +00:00
Jacob Burroughs 5d09941973 Fix some bulk update violations
refs AE-158

Change-Id: I1c805f91e417ce5f1afd99107ef4cc050d9c0353
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/314575
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2023-03-30 17:05:43 +00:00
Aaron Ogata 87fb1ffdab improve caching of ignored_columns
refs AE-124

Change-Id: Ia458e233a64a9d4fbd878537d39418a1349660db
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/311728
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2023-02-24 15:18:29 +00:00
Aaron Ogata 0aca0be810 allow additional columns to be ignored through Consul
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>
2023-02-08 17:05:57 +00:00
Jacob Burroughs 686ff49035 Fix initializers for ruby 3.0
Change-Id: I91f1cad1486ce7a9695f9e7eaefd54a1b24e772b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/307223
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-12-13 14:29:18 +00:00
Jacob Burroughs db8f6fbb12 Bump rspec
Change-Id: I40e3383cabadd55ca9a8d1777ffebe437491e285
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/304563
Reviewed-by: Aaron Ogata <aogata@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-11-02 16:51:50 +00:00
Jacob Burroughs c7bf5fba48 Remove rails 6.0 support
Change-Id: I0df8f625c119b2622e358a5d663c158e2d7d7cb8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292904
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-05-31 22:13:22 +00:00
Aaron Ogata 72e3428da7 add job context to short log format
refs DE-1125

Change-Id: I606f8d3ff61f27f658c744287b43183205469a9f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288950
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-04-05 19:48:54 +00:00
Aaron Ogata 1e06451833 only queue jobs for each job cluster instead of all app clusters in region
refs DE-1120

Change-Id: Ia3b9496ae8f780966d783cd0df0eed654f7e8389
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288647
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2022-03-31 22:45:11 +00:00
Aaron Ogata 9098145ff5 use Rails.version check instead of CANVAS_RAILS variable
refs DE-523

Change-Id: I7baff2f4a6dee7beb518c6d1151a3027a7572f57
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287809
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>
2022-03-23 20:33:24 +00:00
Jackson Howe 3f54dcdd3e touch_all with "skip locked" lock sometimes
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>
2022-03-07 17:47:46 +00:00
Aaron Ogata f1b30a785e derive expected shard for union activerecord method
refs CNVS-54909

Change-Id: I9cda340f43a99386198cd94f4c285f05ad6d2997
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285942
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>
2022-02-25 17:11:14 +00:00
Spencer Olson 279e1899e8 make due_date_cacher handle global assignment ids
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>
2022-02-23 23:50:46 +00:00
Jacob Burroughs 209cea8027 Rails 6.1 basic spec functionality
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>
2022-02-16 17:31:11 +00:00
Isaac Moore add505bc4a Remove `sentry_disabled` kill switch setting
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>
2022-02-14 16:19:02 +00:00
Isaac Moore 36a5390ce0 Initialize Sentry with empty config even when disabled
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>
2022-02-08 19:53:52 +00:00
Ben Rinaca 7f3d80234a support replica identity for new tables
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>
2022-01-26 17:23:37 +00:00
Ben Rinaca 2687301c9d spec: add specs to add_replica_identity
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>
2022-01-26 17:22:33 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer e73cf9ddf4 RuboCop: Style/HashSyntax
[skip-stages=Flakey]

auto-corrected

Change-Id: I9371a61046aee6b148f89dd434114a8ba2b1188c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279533
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:02:35 +00:00
Cody Cutrer eaca556b81 RuboCop: Style/NumericLiterals
[skip-stages=Flakey]

auto-corrected

Change-Id: I88363d87d5a70be941aa81b4ffe5306ce7506b98
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279207
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-24 23:31:34 +00:00
Cody Cutrer 8c37fa9ac3 RuboCop: RSpec/LetBeforeExamples, RSpec/LeadingSubject
[skip-stages=Flakey]

auto-corrected

Change-Id: Ia794667280669652b7da12f8e351f25bed25e32b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279460
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>
2021-11-24 23:30:52 +00:00
Cody Cutrer 9b71ed2054 RuboCop: Style/BlockDelimiters, Style/Lambda
[skip-stages=Flakey]

auto-corrected

Change-Id: I642f868d75c079e698f1fe4161bbbe419dbe1827
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279374
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 21:30:47 +00:00
Cody Cutrer c302dd8bc1 RuboCop: Style/SymbolArray, Style/WordArray
[skip-stages=Flakey]

auto-corrected

Change-Id: Id187ed60c5590025e780d81b85b5212f51368f27
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279196
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:30:08 +00:00
Jeremy Stanley 5e8d200f39 tweak AR_QUERY_TRACE options
* 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>
2021-11-19 22:14:42 +00:00
Cody Cutrer c4bc112611 RuboCop: Style/MethodCallWithoutArgsParentheses
[skip-stages=Flakey]

auto-corrected

Change-Id: Idcbd419ab2196101398715e6b8cdd8d70ae5c587
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278698
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-18 23:07:30 +00:00
Cody Cutrer 4d43809cae RuboCop: Style/PercentLiteralDelimiters
[skip-stages=Flakey]

auto-corrected, with a post-review looking for multiline strings
to convert to heredocs

Change-Id: I7f7afb11edd63415cde10866822dd2ac5ba0d8be
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278669
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-18 23:05:50 +00:00
Cody Cutrer 0c585e3278 RuboCop: Style/QuotedSymbols
[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>
2021-11-18 21:36:10 +00:00
Weston Dransfield 50eb12b386 Allow AR query trace in development
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>
2021-11-18 15:59:24 +00:00