Commit Graph

15 Commits

Author SHA1 Message Date
Cody Cutrer 153c8a52c0 fix discussion topic materialized view for sharding
found by rails 3 specs

Change-Id: I32a8c4a63eb335fbccef05e2aac9988444b8acb7
Reviewed-on: https://gerrit.instructure.com/30836
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-26 15:17:44 +00:00
Braden Anderson 4b2c6771bb discussions: use strings for IDs in ENV and materialized view
fixes CNVS-10341

test plan:
  * before applying this commit, if possible:
    * create a discussion
    * add a reply as a student
  * after applying this commit:
    * open the discussion as the student
    * verify that you can edit the reply you added before, but not
        those from other users
    * add a new reply
    * without refreshing, verify that you can edit your new reply
    * refresh the page
    * verify that you can still edit your reply

  * test basic canvas functionality (sorry)

Change-Id: Ifa654f7d853fd167d5bfbaee6184657209d58272
Reviewed-on: https://gerrit.instructure.com/28413
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-01-16 17:31:32 +00:00
Jacob Fugal a888abbdf4 don't include ActionController::UrlWriter w/rails3
refs CNVS-9166

include Rails.application.routes.url_helpers instead

(in most of these, should be refactored to not include those either, but
not going down that rabbit hole in this commit.)

Change-Id: I3a7091ac604c811d9b7ad2777c289fc8c6477822
test-plan: N/A
Reviewed-on: https://gerrit.instructure.com/25725
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-10-29 15:50:39 +00:00
Braden Anderson 0614496271 discussions: delay materialized view job
fixes CNVS-8744

test plan:
* open a discussions thread
* open the API call for the thread in another tab
    (e.g. /api/v1/courses/2/discussion_topics/1/view?include_new_entries=1 )
* post a reply to the thread and immediately refresh your API call
    (within 10 seconds)
* verify that your reply is added to "new_entries" in the JSON response
* wait thirty seconds and refresh your API call again
* verify that your reply is now present in "view" with the other entries

Change-Id: If030627f0ee19a561ac9d513ca22abf609c72e87
Reviewed-on: https://gerrit.instructure.com/25517
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-10-25 19:21:25 +00:00
Cody Cutrer c3c60e8684 fix materialized views through pgbouncer
i.e. don't use find_each with an order outside of a transaction

test plan:
 * through pgbouncer
 * with jobs running
 * create a new discussion topic, and access it
 * it should not seem to hang

Change-Id: I1f83497fe482246520c0858f638218e895dfb9c7
Reviewed-on: https://gerrit.instructure.com/23077
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-08-06 22:10:32 +00:00
Cody Cutrer 6a08e9058b use the birth shard so that the default shard can be changed
Change-Id: Ia7684c0b50df9d5fae4608b7e8e3d8d6dea291cc
Reviewed-on: https://gerrit.instructure.com/19748
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-05-07 15:44:17 +00:00
Cody Cutrer d9111f5414 arel-ify models
closes CNVS-4707

Change-Id: I32c8ec5a53525f89cf232890eaac790fbc2b4744
Reviewed-on: https://gerrit.instructure.com/18745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 18:42:38 +00:00
Cody Cutrer 01f102fab1 handle concurrency problems with materialized views
fixes #CNVS-1554

test plan:
 * discussions should still work

Change-Id: I11e07e25c8e456e68acda519bcd412e9b25633f9
Reviewed-on: https://gerrit.instructure.com/16748
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-01-14 09:16:24 -07:00
Cody Cutrer 03424c9626 use ids relative to the default shard for strands refs #6886
test plan:
 * run existing specs

Change-Id: I3b84b15be828975e1c60f976232e3984ccd95a61
Reviewed-on: https://gerrit.instructure.com/9670
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-02 09:47:09 -06:00
Brian Palmer 9e93e80a1d update the topic materialized view after the entry save transaction commits
Fixes a race condition where the view might get generated by the job
without the new entry.

test plan: this is difficult to duplicate by hand, but you could put a
breakpoint in and verify the job doesn't get inserted before the
transaction commits.

Change-Id: I6c373553dfae409adab25dd9e3bafc7126169231
Reviewed-on: https://gerrit.instructure.com/9710
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-04-02 09:06:47 -06:00
Brian Palmer a2818dd9ea optionally include entries not in the view yet in /view response
consumers can use this to update the view client-side and ensure it's
always up-to-date even if the view is behind.

Change-Id: I1ff0cd80a758a113f8881ef74de78cc28e2fa16b
Reviewed-on: https://gerrit.instructure.com/9717
Reviewed-by: Ryan Florence <ryanf@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-03-30 15:33:54 -06:00
Brian Palmer 0a2e19fb8d store full message in materialized view, not summary
test plan: pull a materialized view from the /view api (making sure it
was generated with this changeset), verify you get the message back
rather than the summary

Change-Id: Ifd61218d40c67f43b85ed0171f3b90f8a20dd291
Reviewed-on: https://gerrit.instructure.com/9632
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2012-03-27 14:32:37 -06:00
Brian Palmer a74de66a33 fix attachments in discussion materialized view
test plan:

load a discussion that has entries with attachments, verify you don't
get an error and you can download the attachments

Change-Id: Ibd6f28cd936d85692dff1495870b2ebb69336b70
Reviewed-on: https://gerrit.instructure.com/9616
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
2012-03-27 08:23:47 -06:00
Brian Palmer df37f6da87 build the initial, empty materialized view synchronously
Change-Id: I65f0ae443cd70c10be3e57150751a6ade0d98c45
Reviewed-on: https://gerrit.instructure.com/9585
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-03-23 16:28:10 -06:00
Brian Palmer c9efb6cc72 materialized view of discussion topics, closes #7567
This is a cached-in-the-db view of the topic view json response, and
serialized arrays of participant ids and entry ids (for determining
unread entries). This is an optimization to make loading topics fast and
avoid a lot of db traffic.

test plan:

The UI for this new API is still under development, so this needs to
be tested via the API. With jobs turned off, hit the discussion view
endpoint and verify the 503 response. Then run the job to generate the
view, and verify the response json. Verify that any change to the
discussion that requires updating the view, properly updates the view.

Change-Id: I1eacace438a75a41b8b85ce6c42bfd042f27d1ea
Reviewed-on: https://gerrit.instructure.com/9443
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-03-23 14:23:11 -06:00