feat: sync operator app skeleton - #16
Conversation
dea0d60 to
bf74782
Compare
moritzkiefer-da
left a comment
There was a problem hiding this comment.
thanks, this looks mostly reasonable. I left a few comments. I would also suggest adding an integration test directly in this PR that tests that you can at least start and stop the app successfully.
bc2b835 to
36c2ce1
Compare
36c2ce1 to
681ff2f
Compare
Adds the apps/syncoperator module: config, store, automation host and health, ingesting the MemberTraffic purchases the operator observes for its own synchronizer and holding the sequencer admin connection the reconciliation will grant on. Ingestion is deliberately not filtered by the node's own migration id, since a registered synchronizer is pinned to migration id 0. Signed-off-by: sadiq1971 <sadiqurr8@gmail.com>
Drop the synchronizer id and sequencer list from the config and take the synchronizer id from the sequencer instead. Share the MemberTraffic sum query with the DSO store. Also fixes the store test, which never ran: the operator was missing as an observer on the ingested contracts, and the suite was absent from the non-integration test list. Signed-off-by: sadiq1971 <sadiqurr8@gmail.com>
681ff2f to
75cbcb9
Compare
Add package_name to the sync_operator_acs_store index, matching the shape V049 rebuilt the dso and scan indexes into; the shared MemberTraffic query filters on it. Drop trafficBalanceReconciliationDelay, which nothing reads, and the scalapb runtime deps, which the module has no generated code for. Add the module to clean-splice. Signed-off-by: sadiq1971 <sadiqurr8@gmail.com>
I have addressed the comments. For integration test I have added it on PR #17 to keep this PR clean and less changes. |
| ) extends SpliceAppAutomationService( | ||
| automationConfig, | ||
| clock, | ||
| // Nothing registered here depends on domain time yet. |
There was a problem hiding this comment.
| // Nothing registered here depends on domain time yet. | |
| // Nothing registered here depends on domain time. |
| } | ||
| // Only used to partition the store's ingestion offsets; purchases are ingested regardless | ||
| // of it, see SyncOperatorStore.contractFilter. | ||
| domainMigrationId <- appInitStep(s"Resolving domain migration id") { |
There was a problem hiding this comment.
I don't understand why you need this here, there is no migration id for dedicated synchronizers/it's always zero?
| config.automation.ingestion, | ||
| config.parameters.defaultLimit, | ||
| ) | ||
| globalSynchronizerId <- appInitStep("Get the decentralized synchronizer id") { |
There was a problem hiding this comment.
| globalSynchronizerId <- appInitStep("Get the decentralized synchronizer id") { | |
| globalSynchronizerId <- appInitStep("Get the global synchronizer id") { |
| metrics.grpcClientMetrics, | ||
| retryProvider, | ||
| ) | ||
| synchronizerId <- appInitStep("Get the synchronizer id from the sequencer") { |
There was a problem hiding this comment.
probably a good idea to log the synchronizer id. If you use retryProvider.getValue it does that for you and you get retries for this
| ), | ||
| ) | ||
|
|
||
| lazy val `apps-syncoperator` = |
There was a problem hiding this comment.
add it to the list of things that cleaned out by splice-clean
What this does
apps/syncoperatormodule, modelled onapps/splitwell: config, store, automation host, metrics, bootstrap, health.SyncOperatorStoreingestsMemberTrafficwhere this operator is the observer, and exposesgetTotalPurchasedMemberTraffic(member)off an indexed column. The query itself is now shared withDbSvDsoStoreviaMemberTrafficQueries.SyncOperatorAppconnects to Scan and its own sequencer, and takes its synchronizer id from that sequencer rather than from config, so there is nothing to keep in sync at bootstrap.sync_operator_acs_storetable and twoSpliceDbLockCounters.How it's verified
compile,Test/compileandscalafmtCheckAllpass across the tree.SyncOperatorStoreTestcovers the filter: sums across purchases, keeps members apart, and ignores purchases for another synchronizer, another operator, no operator, and a non-zero migration id. 7/7 pass locally against Postgres, and it is now listed intest-full-class-names-non-integration.logso CI runs it.Not covered: that the store survives a decentralized-synchronizer migration without dropping records. That is part of the acceptance for canton-network#35 and needs a fixture that changes the migration id mid-test.
Tracked in
Implements P2-E5.2. Unblocks P2-E5.3, which also needs P2-E5.1 (#15 here). Relies on the migration-id policy in P2-E1.5.