Skip to content

Inject LogConsumer directly to Partition

Sami Hiltunen requested to merge smh-log-consumer into master

WAL archiver setup is quite complex at the moment.

  • It's injected through the node and storage managers to the transaction managaer that ultimately is the only one needing it. This couples the types, and brings concerns into the other types that are in no way relevant to them.
  • The responsibilty of building a LogConsumer is left to the node manager by passing a factory function to it. This appears to be done as there's sort of a cyclic dependency between the WAL archiver the node manager. The partition factory passed into node manager builds the TransactionManager that needs a WAL archiver. The WAL archiver on the other hand needs a handle to the node manager as it uses it as the LogManagerAccessor.

Simplify this by skipping the node and storage managers in the chain, and injecting the WAL archiver directly into the partition factory which build the TransactionManager with it. This removes the unnecessary coupling to the two other types.

We also remove the consumer factory and just build the WAL archiver directly in place. The LogManagerAccessor handle is only available after the node manager has been setup. We solve this problem by injecting a pointer to the LogManagerAccessor interface which is populated with the node manager once it is set up. This keeps the cycle better isolated in the type that has it without leaking the handling into the other types. The cycle still exists though and should be solved separately later.

Closes Use PartitionManager to route consumer notifica... (#5929 - closed)

Edited by Sami Hiltunen

Merge request reports

Loading