Commit 6c826e76 authored by Jesse Hallam's avatar Jesse Hallam Committed by Christopher Speller

materialize PublicChannels without triggers (#9424)

Creating triggers requires SUPERUSER privileges, and is especially
painful on RDS. Pivot to maintaining this denormalized table in code.
parent 6c2a5555
......@@ -4914,10 +4914,34 @@
"id": "store.sql_channel.permanent_delete.app_error",
"translation": "Unable to delete the channel"
},
{
"id": "store.sql_channel.permanent_delete.commit_transaction.app_error",
"translation": "Unable to commit transaction"
},
{
"id": "store.sql_channel.permanent_delete.delete_public_channel.app_error",
"translation": "Unable to delete materialized public channel"
},
{
"id": "store.sql_channel.permanent_delete.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.permanent_delete_by_team.app_error",
"translation": "Unable to delete the channels"
},
{
"id": "store.sql_channel.permanent_delete_by_team.commit_transaction.app_error",
"translation": "Unable to commit transaction"
},
{
"id": "store.sql_channel.permanent_delete_by_team.delete_public_channels.app_error",
"translation": "Unable to delete materialized public channels"
},
{
"id": "store.sql_channel.permanent_delete_by_team.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.permanent_delete_members_by_user.app_error",
"translation": "Unable to remove the channel member"
......@@ -4934,10 +4958,26 @@
"id": "store.sql_channel.reset_all_channel_schemes.app_error",
"translation": "We could not reset the channel schemes"
},
{
"id": "store.sql_channel.reset_all_channel_schemes.commit_transaction.app_error",
"translation": "Unable to commit transaction"
},
{
"id": "store.sql_channel.reset_all_channel_schemes.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.reset_last_post_at.app_error",
"translation": "We could not reset the channel last post at date"
},
{
"id": "store.sql_channel.reset_last_post_at.commit_transaction.app_error",
"translation": "Unable to commit transaction"
},
{
"id": "store.sql_channel.reset_last_post_at.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.save.archived_channel.app_error",
"translation": "You can not modify an archived channel"
......@@ -4954,6 +4994,10 @@
"id": "store.sql_channel.save.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.save.upsert_public_channel.app_error",
"translation": "Unable to upsert materialized public channel"
},
{
"id": "store.sql_channel.save_channel.current_count.app_error",
"translation": "Failed to get current channel count"
......@@ -5014,6 +5058,18 @@
"id": "store.sql_channel.search.app_error",
"translation": "We encountered an error searching channels"
},
{
"id": "store.sql_channel.set_delete_at.commit_transaction.app_error",
"translation": "Unable to commit transaction"
},
{
"id": "store.sql_channel.set_delete_at.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.set_delete_at.update_public_channel.app_error",
"translation": "Unable to update the materialized public channel"
},
{
"id": "store.sql_channel.update.app_error",
"translation": "Unable to update the channel"
......@@ -5022,10 +5078,18 @@
"id": "store.sql_channel.update.archived_channel.app_error",
"translation": "You can not modify an archived channel"
},
{
"id": "store.sql_channel.update.commit_transaction.app_error",
"translation": "Unable to commit transaction"
},
{
"id": "store.sql_channel.update.exists.app_error",
"translation": "A channel with that handle already exists"
},
{
"id": "store.sql_channel.update.open_transaction.app_error",
"translation": "Unable to open transaction"
},
{
"id": "store.sql_channel.update.previously.app_error",
"translation": "A channel with that handle was previously created"
......@@ -5034,6 +5098,10 @@
"id": "store.sql_channel.update.updating.app_error",
"translation": "We encountered an error updating the channel"
},
{
"id": "store.sql_channel.update.upsert_public_channel.app_error",
"translation": "Unable to upsert materialized public channel"
},
{
"id": "store.sql_channel.update_last_viewed_at.app_error",
"translation": "Unable to update the last viewed at time"
......
This diff is collapsed.
......@@ -157,15 +157,6 @@ func NewSqlSupplier(settings model.SqlSettings, metrics einterfaces.MetricsInter
os.Exit(EXIT_CREATE_TABLE)
}
// This store's triggers should exist before the migration is run to ensure the
// corresponding tables stay in sync. Whether or not a trigger should be created before
// or after a migration is likely to be decided on a case-by-case basis.
if err := supplier.oldStores.channel.(*SqlChannelStoreExperimental).CreateTriggersIfNotExists(); err != nil {
mlog.Critical("Error creating triggers", mlog.Err(err))
time.Sleep(time.Second)
os.Exit(EXIT_GENERIC_FAILURE)
}
UpgradeDatabase(supplier)
supplier.oldStores.team.(*SqlTeamStore).CreateIndexesIfNotExists()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment