Commit Graph

29 Commits

Author SHA1 Message Date
Yorick Peterse 0395c47193
Migrate events into a new format
This commit migrates events data in such a way that push events are
stored much more efficiently. This is done by creating a shadow table
called "events_for_migration", and a table called "push_event_payloads"
which is used for storing push data of push events. The background
migration in this commit will copy events from the "events" table into
the "events_for_migration" table, push events in will also have a row
created in "push_event_payloads".

This approach allows us to reclaim space in the next release by simply
swapping the "events" and "events_for_migration" tables, then dropping
the old events (now "events_for_migration") table.

The new table structure is also optimised for storage space, and does
not include the unused "title" column nor the "data" column (since this
data is moved to "push_event_payloads").

== Newly Created Events

Newly created events are inserted into both "events" and
"events_for_migration", both using the exact same primary key value. The
table "push_event_payloads" in turn has a foreign key to the _shadow_
table. This removes the need for recreating and validating the foreign
key after swapping the tables. Since the shadow table also has a foreign
key to "projects.id" we also don't have to worry about orphaned rows.

This approach however does require some additional storage as we're
duplicating a portion of the events data for at least 1 release. The
exact amount is hard to estimate, but for GitLab.com this is expected to
be between 10 and 20 GB at most. The background migration in this commit
deliberately does _not_ update the "events" table as doing so would put
a lot of pressure on PostgreSQL's auto vacuuming system.

== Supporting Both Old And New Events

Application code has also been adjusted to support push events using
both the old and new data formats. This is done by creating a PushEvent
class which extends the regular Event class. Using Rails' Single Table
Inheritance system we can ensure the right class is used for the right
data, which in this case is based on the value of `events.action`. To
support displaying old and new data at the same time the PushEvent class
re-defines a few methods of the Event class, falling back to their
original implementations for push events in the old format.

Once all existing events have been migrated the various push event
related methods can be removed from the Event model, and the calls to
`super` can be removed from the methods in the PushEvent model.

The UI and event atom feed have also been slightly changed to better
handle this new setup, fortunately only a few changes were necessary to
make this work.

== API Changes

The API only displays push data of events in the new format. Supporting
both formats in the API is a bit more difficult compared to the UI.
Since the old push data was not really well documented (apart from one
example that used an incorrect "action" nmae) I decided that supporting
both was not worth the effort, especially since events will be migrated
in a few days _and_ new events are created in the correct format.
2017-08-10 17:45:44 +02:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Douwe Maan ff82acf343 Consistently use monospace font for commit SHAs and branch and tag names 2017-05-12 09:55:25 -05:00
Yorick Peterse 25c08d11bb
Added author to various Markdown calls in views
This ensures all these calls have an author set, allowing the use of
"all" mentions where possible.
2016-05-26 17:14:06 +02:00
Josh Frye 52c934a8eb Title attributes for activity feed 2016-03-11 10:16:44 -05:00
Douwe Maan ed41333a6e Use Gitlab::Markdown.render with :pipeline option rather than different methods 2015-10-14 19:28:09 +02:00
Dmitriy Zaporozhets 1d6a65a2ab
Improve paddings and set new colors for links
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-09-03 14:43:31 +02:00
Douwe Maan ac3d472ff4 Fix push event. 2015-05-15 12:11:16 +02:00
Vinnie Okada 76aad9b76e Upgrade to Rails 4.1.9
Make the following changes to deal with new behavior in Rails 4.1.2:

* Use nested resources to avoid slashes in arguments to path helpers.
2015-02-14 11:09:23 -07:00
Dmitriy Zaporozhets 0189be0831
Use short_id instead of [0..N] for short version of commit sha
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-10-10 15:39:48 +03:00
skv 9c046fea67 links to issues on main dashboard 2014-05-26 13:24:21 +00:00
Dmitriy Zaporozhets 844f8fd213
Show only first line of commit message on dashboard
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-01 09:36:59 +02:00
Dmitriy Zaporozhets 94d364e8cc UI fixes for commits lists 2013-09-10 13:15:49 +03:00
Izaak Alpert c1b05e7b86 Gravatar image fixes when gravatar unavailable
-Alt text to image was set to hash, which would make the page display hashes if the image/gravatar  wasn't available, set the alt text to '', and made the main tool bar image follow the same or similar constraints as the other images (.avatar, .s26)

Conflicts:
	app/assets/stylesheets/themes/ui_bb.scss
	app/views/snippets/_snippet.html.haml

Change-Id: I42e1e86f535486fd2556d4b3e4591f3676eea033
2013-06-26 08:53:03 -04:00
Dmitriy Zaporozhets cd6280f4fe Use data[:commits] hash from event to render push info on dashboard 2013-04-05 19:47:45 +03:00
Dmitriy Zaporozhets b53557aca6 Remove decorator calls and methods from views. Repalace with helper calls when needed 2013-03-31 23:47:26 +03:00
Robert Speicher b389247c02 Use Commit#show instead of Commits#show to view a single commit
Commits#show (plural) is going to be for showing commit history on a
specific path.
2012-09-26 16:32:21 -04:00
Dmitriy Zaporozhets d23022c6f6 Working on dashboard restyle and events refactoring 2012-09-24 12:32:51 +03:00
Robert Speicher ba72c6f683 Escape text passed directly to gfm 2012-09-19 20:21:12 -04:00
Dmitriy Zaporozhets 6ebd360cf2 Modern theme restyled. Better Profile -> Ui page 2012-08-13 08:52:10 +03:00
randx bd0c971aa9 Merge branch 'fix_commits_dashboard' of https://github.com/jouve/gitlabhq into jouve-fix_commits_dashboard
Conflicts:
	app/views/events/_commit.html.haml
2012-08-12 00:33:32 +03:00
Robert Speicher 7754189187 Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
2012-08-10 18:25:15 -04:00
Cyril 15fc0f0c10 fix commit events on dashboard 2012-08-10 21:23:54 +02:00
Riyad Preukschas eb06dd79f8 Update views for GFM 2012-08-02 02:54:57 +02:00
randx bc7897180d Better visibility of event commit links & commits ids 2012-07-28 00:27:54 +03:00
Riyad Preukschas f6a67ef207 Update links in events 2012-07-25 22:27:25 +03:00
Riyad Preukschas cbce4528d0 Update links to commits 2012-07-25 21:11:58 +02:00
Riyad Preukschas 34cea1cb63 Update views to use CommitDecorator 2012-07-22 13:08:24 +02:00
Dmitriy Zaporozhets b57faf9282 Push events polished 2012-03-20 23:59:35 +02:00