-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
81 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
-- Queue all known instances. | ||
insert into ms_queued_instance (instance_id) | ||
select id as instance_id | ||
from "instance" | ||
on conflict do nothing; | ||
/* | ||
* === Very important note === | ||
* This script uses unlogged writes which are NOT fail-safe! | ||
* Make sure to stop ModShark and Sharkey before executing. | ||
* Your instance data is not at risk, but ModShark's queues could be corrupted. | ||
* | ||
* Recommendation: increase checkpoint_segments to 32 or higher. | ||
* See https://stackoverflow.com/a/52271138 for details. | ||
* | ||
* https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-SET-LOGGED-UNLOGGED | ||
* https://www.postgresql.org/docs/current/sql-set-constraints.html | ||
*/ | ||
|
||
begin transaction; | ||
|
||
-- Queue all known instances. | ||
set constraints all deferred; | ||
alter table ms_queued_instance set unlogged; | ||
insert into ms_queued_instance (instance_id) | ||
select id as instance_id | ||
from "instance" | ||
on conflict do nothing; | ||
alter table ms_queued_instance set logged; | ||
set constraints all immediate; | ||
|
||
-- Reset flags to ensure new instances get processed. | ||
delete from ms_flagged_instance f | ||
using ms_queued_instance q | ||
where q.instance_id = f.instance_id; | ||
where q.instance_id = f.instance_id; | ||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
-- Queue all known notes. | ||
insert into ms_queued_note (note_id) | ||
select id as note_id | ||
from "note" | ||
on conflict do nothing; | ||
/* | ||
* === Very important note === | ||
* This script uses unlogged writes which are NOT fail-safe! | ||
* Make sure to stop ModShark and Sharkey before executing. | ||
* Your instance data is not at risk, but ModShark's queues could be corrupted. | ||
* | ||
* Recommendation: increase checkpoint_segments to 32 or higher. | ||
* See https://stackoverflow.com/a/52271138 for details. | ||
* | ||
* https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-SET-LOGGED-UNLOGGED | ||
* https://www.postgresql.org/docs/current/sql-set-constraints.html | ||
*/ | ||
|
||
begin transaction; | ||
|
||
-- Queue all known notes. | ||
set constraints all deferred; | ||
alter table ms_queued_note set unlogged; | ||
insert into ms_queued_note (note_id) | ||
select id as note_id | ||
from "note" | ||
on conflict do nothing; | ||
alter table ms_queued_note set logged; | ||
set constraints all immediate; | ||
|
||
-- Reset flags to ensure new notes get processed. | ||
delete from ms_flagged_note f | ||
using ms_queued_note q | ||
where q.note_id = f.note_id; | ||
where q.note_id = f.note_id; | ||
|
||
commit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
-- Queue all known users. | ||
insert into ms_queued_user (user_id) | ||
select id as user_id | ||
from "user" | ||
on conflict do nothing; | ||
/* | ||
* === Very important note === | ||
* This script uses unlogged writes which are NOT fail-safe! | ||
* Make sure to stop ModShark and Sharkey before executing. | ||
* Your instance data is not at risk, but ModShark's queues could be corrupted. | ||
* | ||
* Recommendation: increase checkpoint_segments to 32 or higher. | ||
* See https://stackoverflow.com/a/52271138 for details. | ||
* | ||
* https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-DESC-SET-LOGGED-UNLOGGED | ||
* https://www.postgresql.org/docs/current/sql-set-constraints.html | ||
*/ | ||
|
||
begin transaction; | ||
|
||
-- Queue all known users. | ||
set constraints all deferred; | ||
alter table ms_queued_user set unlogged; | ||
insert into ms_queued_user (user_id) | ||
select id as user_id | ||
from "user" | ||
on conflict do nothing; | ||
alter table ms_queued_user set logged; | ||
set constraints all immediate; | ||
|
||
-- Reset flags to ensure new users get processed. | ||
delete from ms_flagged_user f | ||
using ms_queued_user q | ||
where q.user_id = f.user_id; | ||
where q.user_id = f.user_id; | ||
|
||
commit; |