Agniva De Sarker 021c90f29f MM-30882: Fix read-after-write issue for demoting user (#16911)
* MM-30882: Fix read-after-write issue for demoting user

In (*App).DemoteUserToGuest, we would demote a user, and then immediately
read it back to do future operations from the user. This reading back
of the user had the effect of sticking the old value into the cache
after which it would never be updated.

There was another issue along with this, which was when the invalidation
message would broadcast across the cluster, it would hit the cache invalidation
problem where an unrelated store call would miss the cache because
it was invalidated, and then again read from replica and stick the old value.

To fix all these, we return the new value directly from the store method
to avoid having the app to read it again.

And we add a map in the localcache layer which tracks invalidations made,
and then switch to use master if it's true.

The core change is fairly limited, but due to changing the store method signatures,
a lot of code needed to be updated to pass "context.Background". Therefore the PR
just "appears" to be big, but the main changes are limited to app/user.go,
sqlstore/user_store.go and user_layer.go

https://mattermost.atlassian.net/browse/MM-30882

```release-note
Fix an issue where demoting a user to guest would not take effect in
an environment with read replicas.
```

* Fix concurrent map access

* Fixing mistakes

* fix tests
2021-02-12 19:04:05 +05:30
2021-01-12 13:20:47 -05:00
2021-01-04 15:21:01 +01:00
2021-01-07 22:42:43 +05:30
2020-01-23 12:34:29 +01:00
2021-01-28 13:15:17 +01:00
2021-02-12 10:22:27 +01:00
2021-02-04 11:08:05 +05:30
2021-02-09 18:52:27 +01:00
2021-02-09 18:52:27 +01:00
2021-01-27 19:58:24 +01:00
2020-03-13 18:35:31 +01:00
2019-04-04 09:49:07 -04:00
2021-01-14 18:21:21 +01:00
2021-02-09 18:52:27 +01:00
2018-05-30 10:23:25 -04:00
2021-01-21 22:17:05 +05:30
2021-01-21 22:17:05 +05:30
2021-02-09 18:52:27 +01:00
2021-02-09 18:52:27 +01:00
2021-01-22 19:40:37 +01:00

Mattermost

Mattermost is an open source, private cloud, Slack-alternative from https://mattermost.com.

It's written in Golang and React and runs as a single Linux binary with MySQL or PostgreSQL. Every month on the 16th a new compiled version is released under an MIT license.

screenshot at nov 29 14-11-32

Table of Contents

Try out Mattermost

Deploy on Heroku

Deploy a Preview

Note: Heroku preview does not include email or persistent storage

Deploy on a Cloud Platform via Bitnami

Auto-deploy Mattermost to Amazon Web Services, Azure, Google Cloud Platform, or Oracle Cloud Platform via Bitnami.

Install on Your Own Machine

Native Mobile and Desktop Apps

In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, Mac OSX, and Linux.

Google Play App Store Windows PC Mac OSX Linux

Get Security Bulletins

Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you are deploying Mattermost it is highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.

Get Involved

Learn More

License

See the LICENSE file for license rights and limitations.

Get the Latest News

Contributing

Please see CONTRIBUTING.md.

Any other questions, mail us at info@mattermost.com. Wed love to meet you!

Описание
No description provided
Readme 636 MiB
Languages
TypeScript 47%
Go 40.2%
JavaScript 8.6%
SCSS 2.8%
HTML 1.1%
Разное 0.2%