mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 21:09:25 -05:00
Stop writing to event_reference_hashes
(#12679)
This table is never read, since #11794. We stop writing to it; in future we can drop it altogether.
This commit is contained in:
parent
dbb12a0b54
commit
147f098fb4
1
changelog.d/12679.misc
Normal file
1
changelog.d/12679.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Preparation for database schema simplifications: stop writing to `event_reference_hashes`.
|
@ -36,7 +36,6 @@ from prometheus_client import Counter
|
|||||||
import synapse.metrics
|
import synapse.metrics
|
||||||
from synapse.api.constants import EventContentFields, EventTypes, RelationTypes
|
from synapse.api.constants import EventContentFields, EventTypes, RelationTypes
|
||||||
from synapse.api.room_versions import RoomVersions
|
from synapse.api.room_versions import RoomVersions
|
||||||
from synapse.crypto.event_signing import compute_event_reference_hash
|
|
||||||
from synapse.events import EventBase # noqa: F401
|
from synapse.events import EventBase # noqa: F401
|
||||||
from synapse.events.snapshot import EventContext # noqa: F401
|
from synapse.events.snapshot import EventContext # noqa: F401
|
||||||
from synapse.storage._base import db_to_json, make_in_list_sql_clause
|
from synapse.storage._base import db_to_json, make_in_list_sql_clause
|
||||||
@ -1600,11 +1599,6 @@ class PersistEventsStore:
|
|||||||
inhibit_local_membership_updates=inhibit_local_membership_updates,
|
inhibit_local_membership_updates=inhibit_local_membership_updates,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Insert event_reference_hashes table.
|
|
||||||
self._store_event_reference_hashes_txn(
|
|
||||||
txn, [event for event, _ in events_and_contexts]
|
|
||||||
)
|
|
||||||
|
|
||||||
# Prefill the event cache
|
# Prefill the event cache
|
||||||
self._add_to_cache(txn, events_and_contexts)
|
self._add_to_cache(txn, events_and_contexts)
|
||||||
|
|
||||||
@ -1704,25 +1698,6 @@ class PersistEventsStore:
|
|||||||
values={"event_id": event_id, "expiry_ts": expiry_ts},
|
values={"event_id": event_id, "expiry_ts": expiry_ts},
|
||||||
)
|
)
|
||||||
|
|
||||||
def _store_event_reference_hashes_txn(self, txn, events):
|
|
||||||
"""Store a hash for a PDU
|
|
||||||
Args:
|
|
||||||
txn (cursor):
|
|
||||||
events (list): list of Events.
|
|
||||||
"""
|
|
||||||
|
|
||||||
vals = []
|
|
||||||
for event in events:
|
|
||||||
ref_alg, ref_hash_bytes = compute_event_reference_hash(event)
|
|
||||||
vals.append((event.event_id, ref_alg, memoryview(ref_hash_bytes)))
|
|
||||||
|
|
||||||
self.db_pool.simple_insert_many_txn(
|
|
||||||
txn,
|
|
||||||
table="event_reference_hashes",
|
|
||||||
keys=("event_id", "algorithm", "hash"),
|
|
||||||
values=vals,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _store_room_members_txn(
|
def _store_room_members_txn(
|
||||||
self, txn, events, *, inhibit_local_membership_updates: bool = False
|
self, txn, events, *, inhibit_local_membership_updates: bool = False
|
||||||
):
|
):
|
||||||
|
@ -69,7 +69,6 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
|
|||||||
# event_forward_extremities
|
# event_forward_extremities
|
||||||
# event_json
|
# event_json
|
||||||
# event_push_actions
|
# event_push_actions
|
||||||
# event_reference_hashes
|
|
||||||
# event_relations
|
# event_relations
|
||||||
# event_search
|
# event_search
|
||||||
# event_to_state_groups
|
# event_to_state_groups
|
||||||
@ -220,7 +219,6 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
|
|||||||
"event_auth",
|
"event_auth",
|
||||||
"event_edges",
|
"event_edges",
|
||||||
"event_forward_extremities",
|
"event_forward_extremities",
|
||||||
"event_reference_hashes",
|
|
||||||
"event_relations",
|
"event_relations",
|
||||||
"event_search",
|
"event_search",
|
||||||
"rejections",
|
"rejections",
|
||||||
@ -369,7 +367,6 @@ class PurgeEventsStore(StateGroupWorkerStore, CacheInvalidationWorkerStore):
|
|||||||
"event_edges",
|
"event_edges",
|
||||||
"event_json",
|
"event_json",
|
||||||
"event_push_actions_staging",
|
"event_push_actions_staging",
|
||||||
"event_reference_hashes",
|
|
||||||
"event_relations",
|
"event_relations",
|
||||||
"event_to_state_groups",
|
"event_to_state_groups",
|
||||||
"event_auth_chains",
|
"event_auth_chains",
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
SCHEMA_VERSION = 69 # remember to update the list below when updating
|
SCHEMA_VERSION = 70 # remember to update the list below when updating
|
||||||
"""Represents the expectations made by the codebase about the database schema
|
"""Represents the expectations made by the codebase about the database schema
|
||||||
|
|
||||||
This should be incremented whenever the codebase changes its requirements on the
|
This should be incremented whenever the codebase changes its requirements on the
|
||||||
@ -62,6 +62,9 @@ Changes in SCHEMA_VERSION = 68:
|
|||||||
Changes in SCHEMA_VERSION = 69:
|
Changes in SCHEMA_VERSION = 69:
|
||||||
- We now write to `device_lists_changes_in_room` table.
|
- We now write to `device_lists_changes_in_room` table.
|
||||||
- Use sequence to generate future `application_services_txns.txn_id`s
|
- Use sequence to generate future `application_services_txns.txn_id`s
|
||||||
|
|
||||||
|
Changes in SCHEMA_VERSION = 70:
|
||||||
|
- event_reference_hashes is no longer written to.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,15 +58,6 @@ class EventFederationWorkerStoreTestCase(tests.unittest.HomeserverTestCase):
|
|||||||
(room_id, event_id),
|
(room_id, event_id),
|
||||||
)
|
)
|
||||||
|
|
||||||
txn.execute(
|
|
||||||
(
|
|
||||||
"INSERT INTO event_reference_hashes "
|
|
||||||
"(event_id, algorithm, hash) "
|
|
||||||
"VALUES (?, 'sha256', ?)"
|
|
||||||
),
|
|
||||||
(event_id, bytearray(b"ffff")),
|
|
||||||
)
|
|
||||||
|
|
||||||
for i in range(0, 20):
|
for i in range(0, 20):
|
||||||
self.get_success(
|
self.get_success(
|
||||||
self.store.db_pool.runInteraction("insert", insert_event, i)
|
self.store.db_pool.runInteraction("insert", insert_event, i)
|
||||||
|
Loading…
Reference in New Issue
Block a user