ExternalDefinitionLookupCache: invalidate on Transport bundle import and on the peer central node (ScadaBridge#65 residual) #83

Closed
opened 2026-11-09 12:24:27 -05:00 by dohertj2 · 2 comments
Owner

Follow-up from ScadaBridge#65, closed by e1734675.

That fix drops ExternalDefinitionLookupCache through the AfterConfigurationCommit seam on all 9 ManagementActor handlers that create, update or delete an external system, method or database connection. Two paths still rely only on the cache TTL (DefinitionCacheTtl, 10 s), so they can serve a stale definition for up to 10 s:

  1. The other central node. The cache is per node, so an edit made through central-a is not invalidated on central-b.
  2. Transport bundle import. The bundle importer writes the same definitions without going through the ManagementActor handlers, so it does not invalidate even the local node's cache.

Do: decide whether 10 s of staleness is acceptable. If it isn't:

  • Invalidate from the bundle importer's commit.
  • Broadcast an invalidation to the peer central node, for example over Akka DistributedPubSub.

Add tests for both.

Follow-up from ScadaBridge#65, closed by e1734675. That fix drops `ExternalDefinitionLookupCache` through the `AfterConfigurationCommit` seam on all 9 ManagementActor handlers that create, update or delete an external system, method or database connection. Two paths still rely only on the cache TTL (`DefinitionCacheTtl`, 10 s), so they can serve a stale definition for up to 10 s: 1. **The other central node.** The cache is per node, so an edit made through central-a is not invalidated on central-b. 2. **Transport bundle import.** The bundle importer writes the same definitions without going through the ManagementActor handlers, so it does not invalidate even the local node's cache. **Do:** decide whether 10 s of staleness is acceptable. If it isn't: - Invalidate from the bundle importer's commit. - Broadcast an invalidation to the peer central node, for example over Akka DistributedPubSub. Add tests for both.
dohertj2 added the type:followuppriority:p3 labels 2026-11-09 12:24:27 -05:00
Author
Owner

Partly fixed on main 03de3dcc: new Commons IExternalDefinitionCacheInvalidator (resolves to the ExternalDefinitionLookupCache singleton); BundleImporter invalidates once after each committed import (never after rollback). Evidence: ExternalSystemGateway 146, Transport.IntegrationTests 137, Transport 198 passed; 2 tests fail without the fix.

Remaining (open): peer central node invalidation — needs the decision whether the 10 s TTL bound is acceptable on the peer. Recommendation: accept the 10 s bound and document it unless an operator flow does edit-on-A / use-on-B within seconds; otherwise publish an invalidation over the existing central cluster pub-sub.

Partly fixed on main 03de3dcc: new Commons `IExternalDefinitionCacheInvalidator` (resolves to the ExternalDefinitionLookupCache singleton); BundleImporter invalidates once after each **committed** import (never after rollback). Evidence: ExternalSystemGateway 146, Transport.IntegrationTests 137, Transport 198 passed; 2 tests fail without the fix. Remaining (open): peer central node invalidation — needs the decision whether the 10 s TTL bound is acceptable on the peer. Recommendation: accept the 10 s bound and document it unless an operator flow does edit-on-A / use-on-B within seconds; otherwise publish an invalidation over the existing central cluster pub-sub.
Author
Owner

Peer half fixed on main 153609ef: ExternalDefinitionLookupCache is now invalidated on the other central node too, via the new central central-cache-invalidation topic (typed messages, sender-id filter) — management edits and bundle import publish it; the local import half landed earlier (03de3dcc). TTL kept as fallback. Two-node test (TwoNodeClusterFixture, production config + serializer) shows the message crossing and not re-applying on the sender. Evidence (after rebase): slnx 0 warnings/0 errors; ManagementService 752, CLI 571, CentralUI 1533, InboundAPI 373, Security 199, ExternalSystemGateway 146, TemplateEngine 617, Transport.IntegrationTests 145, Host 623, Commons 915 passed; key projects re-run green on the pushed tip.

Peer half fixed on main 153609ef: ExternalDefinitionLookupCache is now invalidated on the other central node too, via the new central `central-cache-invalidation` topic (typed messages, sender-id filter) — management edits and bundle import publish it; the local import half landed earlier (03de3dcc). TTL kept as fallback. Two-node test (TwoNodeClusterFixture, production config + serializer) shows the message crossing and not re-applying on the sender. Evidence (after rebase): slnx 0 warnings/0 errors; ManagementService 752, CLI 571, CentralUI 1533, InboundAPI 373, Security 199, ExternalSystemGateway 146, TemplateEngine 617, Transport.IntegrationTests 145, Host 623, Commons 915 passed; key projects re-run green on the pushed tip.
Sign in to join this conversation.