-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow use of the /filter
Client-Server APIs on workers.
#15134
Changes from 6 commits
1bdcd17
4960619
5a84e78
29a4ef4
124c0e9
88b9086
3d18341
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Allow use of the `/filter` Client-Server APIs on workers. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,6 +232,7 @@ information. | |
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$ | ||
^/_matrix/client/v1/rooms/.*/timestamp_to_event$ | ||
^/_matrix/client/(api/v1|r0|v3|unstable)/search$ | ||
^/_matrix/client/(r0|v3|unstable)/user/.*/filter(/|$) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Just starting a thread somewhere). The REST servlet to add a filter:
I think this change might break step 1 -- if we have two requests to insert a filter, they can both race and return no known filter in step 1, then both insert the filter with different IDs? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Note the only index is UNIQUE across There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You were almost right (I think) that there was a phantom write here. But funnily enough, step 1 won't be broken because step 2 will fix it. The reason I say this is:
When trying in
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes good call with the isolation level we're using. 👍 I think we don't retry that, but I'm not sure. I guess using a sequence here would have been better? (Would that have solved our issues?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (to be fair, this exact same issue already existed if the user made two requests at once! A single worker can still run two transactions concurrently) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes using a SEQUENCE or a SERIAL field would have saved this effort. I guess the original author really liked the idea of a user's filters starting at 1 and then incrementing by 1, rather than having the same space of IDs shared by all users. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another way of thinking of this would have been randomly generating them, like we do in a few other spots. (Incrementing IDs are usually a API smell.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (what's wrong with incrementing IDs?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If they're scoped by user it is likely fine. If they're not then it can (potentially) leak information about other users (or your service as a whole). It also makes it easier to guess IDs. |
||
|
||
# Encryption requests | ||
^/_matrix/client/(r0|v3|unstable)/keys/query$ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also need to update:
docker/configure_workers_and_start.py
so complement uses thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yes this is annoying, see #12139.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→ matrix-org/sytest#1331