Merge remote-tracking branch 'origin/release-v1.78' into matrix-org-hotfixes
This commit is contained in:
commit
b67e4b6015
|
@ -9,7 +9,7 @@ Features
|
|||
- Implement [MSC3873](https://github.com/matrix-org/matrix-spec-proposals/pull/3873) to disambiguate push rule keys with dots in them. ([\#15004](https://github.com/matrix-org/synapse/issues/15004))
|
||||
- Allow Synapse to use a specific Redis [logical database](https://redis.io/commands/select/) in worker-mode deployments. ([\#15034](https://github.com/matrix-org/synapse/issues/15034))
|
||||
- Tag opentracing spans for federation requests with the name of the worker serving the request. ([\#15042](https://github.com/matrix-org/synapse/issues/15042))
|
||||
- Experimental support for [MSC3966](https://github.com/matrix-org/matrix-spec-proposals/pull/3966): the `exact_event_property_contains` push rule condition. ([\#15045](https://github.com/matrix-org/synapse/issues/15045))
|
||||
- Implement the experimental `exact_event_property_contains` push rule condition from [MSC3966](https://github.com/matrix-org/matrix-spec-proposals/pull/3966). ([\#15045](https://github.com/matrix-org/synapse/issues/15045))
|
||||
- Remove spurious `dont_notify` action from the defaults for the `.m.rule.reaction` pushrule. ([\#15073](https://github.com/matrix-org/synapse/issues/15073))
|
||||
- Update the error code returned when user sends a duplicate annotation. ([\#15075](https://github.com/matrix-org/synapse/issues/15075))
|
||||
|
||||
|
@ -31,9 +31,8 @@ Bugfixes
|
|||
Improved Documentation
|
||||
----------------------
|
||||
|
||||
- Document how to start Synapse with Poetry. Contributed by @thezaidbintariq. ([\#14892](https://github.com/matrix-org/synapse/issues/14892))
|
||||
- Document how to start Synapse with Poetry. Contributed by @thezaidbintariq. ([\#14892](https://github.com/matrix-org/synapse/issues/14892), [\#15022](https://github.com/matrix-org/synapse/issues/15022))
|
||||
- Update delegation documentation to clarify that SRV DNS delegation does not eliminate all needs to serve files from .well-known locations. Contributed by @williamkray. ([\#14959](https://github.com/matrix-org/synapse/issues/14959))
|
||||
- Document how to start Synapse in the contributing guide. ([\#15022](https://github.com/matrix-org/synapse/issues/15022))
|
||||
- Fix a mistake in registration_shared_secret_path docs. ([\#15078](https://github.com/matrix-org/synapse/issues/15078))
|
||||
- Refer to a more recent blog post on the [Database Maintenance Tools](https://matrix-org.github.io/synapse/latest/usage/administration/database_maintenance_tools.html) page. Contributed by @jahway603. ([\#15083](https://github.com/matrix-org/synapse/issues/15083))
|
||||
|
||||
|
@ -46,7 +45,7 @@ Internal Changes
|
|||
- Add a class `UnpersistedEventContext` to allow for the batching up of storing state groups. ([\#14675](https://github.com/matrix-org/synapse/issues/14675))
|
||||
- Add a check to ensure that locked dependencies have source distributions available. ([\#14742](https://github.com/matrix-org/synapse/issues/14742))
|
||||
- Tweak comment on `_is_local_room_accessible` as part of room visibility in `/hierarchy` to clarify the condition for a room being visible. ([\#14834](https://github.com/matrix-org/synapse/issues/14834))
|
||||
- Prevent 'WARNING: there is already a transaction in progress' lines appearing in PostgreSQL's logs on some occasions. ([\#14840](https://github.com/matrix-org/synapse/issues/14840))
|
||||
- Prevent `WARNING: there is already a transaction in progress` lines appearing in PostgreSQL's logs on some occasions. ([\#14840](https://github.com/matrix-org/synapse/issues/14840))
|
||||
- Use `StrCollection` to avoid potential bugs with `Collection[str]`. ([\#14929](https://github.com/matrix-org/synapse/issues/14929))
|
||||
- Improve performance of `/sync` in a few situations. ([\#14973](https://github.com/matrix-org/synapse/issues/14973))
|
||||
- Limit concurrent event creation for a room to avoid state resolution when sending bursts of events to a local room. ([\#14977](https://github.com/matrix-org/synapse/issues/14977))
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix a bug introduced in Synapse 1.76 where 5s delays would occasionally occur in deployments using workers.
|
|
@ -238,6 +238,24 @@ class ReplicationStreamer:
|
|||
except Exception:
|
||||
logger.exception("Failed to replicate")
|
||||
|
||||
# The last token we send may not match the current
|
||||
# token, in which case we want to send out a `POSITION`
|
||||
# to tell other workers the actual current position.
|
||||
if updates[-1][0] < current_token:
|
||||
logger.info(
|
||||
"Sending position: %s -> %s",
|
||||
stream.NAME,
|
||||
current_token,
|
||||
)
|
||||
self.command_handler.send_command(
|
||||
PositionCommand(
|
||||
stream.NAME,
|
||||
self._instance_name,
|
||||
updates[-1][0],
|
||||
current_token,
|
||||
)
|
||||
)
|
||||
|
||||
logger.debug("No more pending updates, breaking poke loop")
|
||||
finally:
|
||||
self.pending_updates = False
|
||||
|
|
|
@ -141,3 +141,64 @@ class ChannelsTestCase(BaseMultiWorkerStreamTestCase):
|
|||
self.get_success(ctx_worker1.__aexit__(None, None, None))
|
||||
|
||||
self.assertTrue(d.called)
|
||||
|
||||
def test_wait_for_stream_position_rdata(self) -> None:
|
||||
"""Check that wait for stream position correctly waits for an update
|
||||
from the correct instance, when RDATA is sent.
|
||||
"""
|
||||
store = self.hs.get_datastores().main
|
||||
cmd_handler = self.hs.get_replication_command_handler()
|
||||
data_handler = self.hs.get_replication_data_handler()
|
||||
|
||||
worker1 = self.make_worker_hs(
|
||||
"synapse.app.generic_worker",
|
||||
extra_config={
|
||||
"worker_name": "worker1",
|
||||
"run_background_tasks_on": "worker1",
|
||||
"redis": {"enabled": True},
|
||||
},
|
||||
)
|
||||
|
||||
cache_id_gen = worker1.get_datastores().main._cache_id_gen
|
||||
assert cache_id_gen is not None
|
||||
|
||||
self.replicate()
|
||||
|
||||
# First, make sure the master knows that `worker1` exists.
|
||||
initial_token = cache_id_gen.get_current_token()
|
||||
cmd_handler.send_command(
|
||||
PositionCommand("caches", "worker1", initial_token, initial_token)
|
||||
)
|
||||
self.replicate()
|
||||
|
||||
# `wait_for_stream_position` should only return once master receives a
|
||||
# notification that `next_token2` has persisted.
|
||||
ctx_worker1 = cache_id_gen.get_next_mult(2)
|
||||
next_token1, next_token2 = self.get_success(ctx_worker1.__aenter__())
|
||||
|
||||
d = defer.ensureDeferred(
|
||||
data_handler.wait_for_stream_position("worker1", "caches", next_token2)
|
||||
)
|
||||
self.assertFalse(d.called)
|
||||
|
||||
# Insert an entry into the cache stream with token `next_token1`, but
|
||||
# not `next_token2`.
|
||||
self.get_success(
|
||||
store.db_pool.simple_insert(
|
||||
table="cache_invalidation_stream_by_instance",
|
||||
values={
|
||||
"stream_id": next_token1,
|
||||
"instance_name": "worker1",
|
||||
"cache_func": "foo",
|
||||
"keys": [],
|
||||
"invalidation_ts": 0,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
# Finish the context manager, triggering the data to be sent to master.
|
||||
self.get_success(ctx_worker1.__aexit__(None, None, None))
|
||||
|
||||
# Master should get told about `next_token2`, so the deferred should
|
||||
# resolve.
|
||||
self.assertTrue(d.called)
|
||||
|
|
Loading…
Reference in New Issue