Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Conversation

@brianlovin
Copy link
Contributor

Status

  • WIP
  • Ready for review
  • Needs testing

Deploy after merge (delete what needn't be deployed)

  • api
  • hyperion (frontend)
  • athena
  • vulcan
  • mercury
  • hermes
  • chronos
  • analytics

Run database migrations (delete if no migration was added)
YES

brianlovin and others added 30 commits November 20, 2018 23:41
This was leftover behavior from the move to create-query, but is
actually unnecessary.
This adds two new indexes to `usersChannels` and rewrites all queries to
use them:

- `userIdAndRole`
- `channelIdAndRole`

"Role" is one of the roles a user can have in a channel, and is based on
the `is{Role}` fields, i.e. "Role" can be one of "blocked", "pending",
"owner", "moderator", "owner".

Note that the index prefers roles in that order, so even if a write
query is inconsistent and a member has `isMember: true` but also
`isBlocked: true` the user will be counted as blocked.

----

This is modeled after the same thing we did for `usersCommunities`, but
I realized that adding 5 indexes to a table as big as `usersCommunities`
and `usersChannels` is pretty expensive storage-wise. (I could've also
implemented the same indexes as `usersCommunities`, i.e.
`userIdAndIsMember`, `userIdAndIsBlocked`, etc.)

This achieves the same thing and makes all queries be indexed, but
requires a lot less storage. We should probably also move the
usersCommunities indexes to this `*AndRole` system...
@spectrum-bot
Copy link

spectrum-bot bot commented Nov 27, 2018

Warnings
⚠️

These modified files do not have Flow enabled:

  • athena/models/notification.js
  • athena/queues/new-message-in-thread/group-replies.js
  • src/components/listItems/style.js
  • src/reducers/connectionStatus.js
  • src/reducers/newUserOnboarding.js
  • src/views/dashboard/components/threadFeed.js
  • src/views/newCommunity/components/createCommunityForm/index.js
  • src/views/newUserOnboarding/components/setUsername/index.js
  • src/views/pages/view.js
  • src/views/status/index.js
  • src/views/thread/container.js

Generated by 🚫 dangerJS

@brianlovin
Copy link
Contributor Author

Didn't have time to ship this today, but I put everything on alpha for some usage testing - happy to ship tomorrow @mxstbr :)

mxstbr and others added 16 commits November 27, 2018 09:21
Add analytics as server option in PR template
Should alleviate some load on the communities table, rather than having to go through all of them this is now mostly
instantaneous!
…l-plugin-styled-components-1.9.0

[api] Update babel-plugin-styled-components: 1.8.0 → 1.9.0 (minor)
…ex-chronos

Add communities "memberCount" index, rewrite chronos queries
Use message threadIdAndTimestamp index for getNewMessageCount query
Use threadIdAndTimestamp index in mercury db query
@brianlovin brianlovin merged commit 8f94b73 into production Nov 27, 2018
@brianlovin brianlovin deleted the 2.4.78 branch November 27, 2018 18:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants