As Krinkle points out, it always writes to DB_MASTER, so it doesn't make
much sense to offer an option to read from DB_REPLICA. This also
resolves the race condition that I believe arises from the one caller
that passes in DB_REPLICA.
Change-Id: I6976e5479debc3f4a8f28d53b1616c01475772be
We almost always call it with DB_MASTER, and I'm pretty sure that the
one call that uses DB_REPLICA introduces a race condition. I didn't want
to change that quite yet, though, so I left it in for now.
Change-Id: Ia5a59fdda357b799e327b8ed224f3ccb09509a8a
When notifications are being moderated, the unread count
for affected users has to be recalculated.
It was initially done using DB_SLAVE but it was leading
to inconsistent data since that database did not know
about recently deleted notifications.
It was changed to DB_MASTER but it potentially led
to too many queries on master.
This patch tries to wait for the replica to have
caught up with those changes and use it to update
the unread count for the affected users.
Bug: T93673
Change-Id: Ib4a845e82f686dd7ed807ab21a28490014b56604
At the time that resetNotificationCount() is called, we've only
just moderated something, so the slave won't have those changes yet,
and the computed notification count will be wrong.
Change-Id: Ia83f2b9cf7f4bbaee25e03f7bc8f73bcd4d345f9
To allow individual notifications to be
marked as read/unread or moderated,
bundles are created by grouping associated
notifications when they are fetched for display
instead of when they are created.
From a product perspective, this change doesn't
introduce moderation or expandable bundles but
it counts each individual notifications.
For instance, the bundled notification
"3 new topics on PageA" now counts as 3
notifications.
Bug: T93673
Bug: T120153
Change-Id: Iacd098573efd92bb1e3fcd7da4cd40cea9522f15