Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame^] | 1 | -- Copyright 2016 The Chromium Authors. All Rights Reserved. |
| 2 | -- |
| 3 | -- Use of this source code is governed by a BSD-style |
| 4 | -- license that can be found in the LICENSE file or at |
| 5 | -- https://developers.google.com/open-source/licenses/bsd |
| 6 | |
| 7 | |
| 8 | -- Create app framework tables in the monorail DB. |
| 9 | |
| 10 | ALTER DATABASE monorail CHARACTER SET = utf8 COLLATE = utf8_unicode_ci; |
| 11 | |
| 12 | -- This table allows frontends to selectively invalidate their RAM caches. |
| 13 | -- On each incoming request, the frontend queries this table to get all rows |
| 14 | -- that are newer than the last row that it saw. Then it processes each such |
| 15 | -- row by dropping entries from its RAM caches, and remembers the new highest |
| 16 | -- timestep that it has seen. |
| 17 | CREATE TABLE Invalidate ( |
| 18 | -- The time at which the invalidation took effect, by that time new data |
| 19 | -- should be available to retrieve to fill local caches as needed. |
| 20 | -- This is not a clock value, it is just an integer that counts up by one |
| 21 | -- on each change. |
| 22 | timestep BIGINT NOT NULL AUTO_INCREMENT, |
| 23 | |
| 24 | -- Which kind of entity was invalidated? Each kind is broad, e.g., |
| 25 | -- invalidating a project also invalidates all issue tracker config within |
| 26 | -- that project. But, they do not nest. E.g., invalidating a project does |
| 27 | -- not invalidate all issues in the project. |
| 28 | kind enum('user', 'usergroup', 'project', 'issue', 'issue_id', |
| 29 | 'hotlist', 'comment', 'template', 'hotlist_id') NOT NULL, |
| 30 | |
| 31 | -- Which cache entry should be invalidated? Special value 0 indicates |
| 32 | -- that all entries should be invalidated. |
| 33 | cache_key INT UNSIGNED, |
| 34 | |
| 35 | INDEX (timestep) |
| 36 | ) ENGINE=INNODB; |