refactor(sql,core): centralize journal persistence, dedupe SQL journal code - #957
Open
davidfrigolet wants to merge 1 commit into
Open
davidfrigolet wants to merge 1 commit into
davidfrigolet wants to merge 1 commit into
Conversation
…l code Extracts SQL-specific Journal Event DDL/DML generation into the sibling flamingock-sql-util module, deletes the "flamingockJournalEvents" literal duplicated three times (SQL, DynamoDB, MongoDB stores) in favor of the new CommunityPersistenceConstants.DEFAULT_JOURNAL_STORE_NAME, and centralizes the per-stage journal initialization each community audit store was reimplementing. - SqlAuditStore/DynamoDBAuditStore/MongoDBSyncAuditStore no longer carry local copies of SqlJournalDialectHelper/JournalEventConstants or the default journal-store-name literal; they consume the shared versions from flamingock-sql-util and flamingock-general-util instead - JournalEventSequencerFactory (core) gains initializeForStage(stageId, autoCreate): feature-flag-gates, initializes the journal store, and returns the stage sequencer in one call, replacing the near-duplicated three-way copy of this logic - JournalEventStore.initialize(boolean) is now part of the interface contract rather than an implementation-specific method - fixes MongoDBSyncAuditStore never calling journalEventStore.initialize() per stage: its initialize method was protected in a different package and unreachable from the store, so the call was silently skipped; it is now public and wired through the new centralized init path - bumps generalUtilVersion/sqlVersion to the versions carrying the moved code (pending release of the two companion PRs below)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third and final part of centralizing Journal Event persistence across audit stores. Companion PRs:
CommunityPersistenceConstants.DEFAULT_JOURNAL_STORE_NAMESqlJournalDialectHelperintoflamingock-sql-utilgeneralUtilVersion/sqlVersionat local-SNAPSHOTbuilds so it could be built and tested end-to-end; before merge, bump both to the real released versions once those PRs land.What changed
SqlJournalDialectHelper,JournalEventConstants, and the audit-column-name list that lived incommunity/flamingock-sql-auditstoreare deleted here and now consumed fromflamingock-sql-util, matching how the siblingSqlAuditorDialectHelper/SqlLockDialectHelperalready work."flamingockJournalEvents"literal in separate local constants classes. All three now readCommunityPersistenceConstants.DEFAULT_JOURNAL_STORE_NAME; the two now-redundant local constant classes are deleted.JournalEventSequencerFactory(core) gainedinitializeForStage(stageId, autoCreate)— checks the journal-events feature flag, initializes the journal store, and returns the stage's sequencer in one call. SQL/DynamoDB/MongoDB stores'getPersistenceFactory()all delegate to it instead of each hand-rolling the same three steps slightly differently.MongoDBSyncAuditStorewas never actually callingjournalEventStore.initialize()per stage — the method wasprotectedin a different package (...sync.internal) than the store itself (...sync), so the call was inaccessible and silently never happened. It's nowpublic, part of theJournalEventStoreinterface contract, and wired through the shared init path along with the other two stores.Not included — separate follow-up work
feat/couchbase-journal-eventsandfeat/mongodb-reactive-journal-eventswere rebased onto master (both predated the SQL journal refactor already on master and would've conflicted otherwise) and compile clean, but are not wired into this centralization. Once this PR merges,CouchbaseAuditStoreandMongoDBReactiveAuditStorestill need:CommunityPersistenceConstants.DEFAULT_JOURNAL_STORE_NAMEswap (MongoDBReactiveAuditStorecurrently uses the now-deletedJournalEventPersistenceConstantsfrommongodb-utiland will fail to compile once rebased on top of this branch)JournalEventSequencerFactory.initializeForStage(...)the same way Sql/DynamoDB/MongoSync now areTest plan
./gradlew clean build— full repo, greengeneralUtilVersion/sqlVersionto released versions once the companion PRs are merged and released