feat(couchbase): add journal event persistence - #949
Open
davidfrigolet wants to merge 3 commits into
Open
Conversation
dieppa
approved these changes
Aug 16, 2026
dieppa
left a comment
Member
There was a problem hiding this comment.
LGTM , but I would @osantana85 to take a look. He is more familiar with couchebase
There was a problem hiding this comment.
Pull request overview
Adds feature-flagged Couchbase journal event persistence with transactional audit synchronization and integration coverage.
Changes:
- Added journal mapping, constants, indexing, storage, and acknowledgement support.
- Integrated journal writes with Couchbase transactions and stage sequencing.
- Added feature-flag, rollback, and end-to-end tests.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Summary | Review notes |
|---|---|---|
utils/couchbase-util/src/main/java/io/flamingock/internal/common/couchbase/journal/JournalEventPersistenceConstants.java |
Defines journal collection defaults. | — |
utils/couchbase-util/src/main/java/io/flamingock/internal/common/couchbase/journal/JournalEventFieldConstants.java |
Defines persisted journal fields. | — |
utils/couchbase-util/src/main/java/io/flamingock/internal/common/couchbase/CouchbaseJournalEventMapper.java |
Maps journal events to Couchbase documents. | — |
utils/couchbase-util/src/main/java/io/flamingock/internal/common/couchbase/CouchbaseCollectionHelper.java |
Adds secondary-index creation support. | — |
core/target-systems/flamingock-couchbase-externalsystem-api/src/main/java/io/flamingock/externalsystem/couchbase/api/CouchbaseExternalSystem.java |
Exposes transactional Couchbase behavior. | Critical, 1 vote: New abstract API breaks existing implementations; preserve compatibility or explicitly version the breaking change. |
core/target-systems/flamingock-couchbase-externalsystem-api/build.gradle.kts |
Adds the transactional API dependency. | — |
community/flamingock-couchbase-auditstore/src/test/java/io/flamingock/store/couchbase/internal/CouchbaseAuditPersistenceJournalTest.java |
Tests transactional persistence and rollback. | — |
community/flamingock-couchbase-auditstore/src/test/java/io/flamingock/store/couchbase/CouchbaseJournalFeatureFlagE2ETest.java |
Tests feature-flagged end-to-end behavior. | — |
community/flamingock-couchbase-auditstore/src/main/java/io/flamingock/store/couchbase/internal/CouchbaseJournalEventStore.java |
Implements journal storage and acknowledgement. | Moderate, 4 votes: Acknowledgement updates should exclude already acknowledged events to avoid overcounting retries. |
community/flamingock-couchbase-auditstore/src/main/java/io/flamingock/store/couchbase/internal/CouchbaseAuditPersistence.java |
Coordinates atomic audit and journal writes. | — |
community/flamingock-couchbase-auditstore/src/main/java/io/flamingock/store/couchbase/internal/CouchbaseAuditor.java |
Supports append and current-state persistence. | — |
community/flamingock-couchbase-auditstore/src/main/java/io/flamingock/store/couchbase/CouchbaseAuditStore.java |
Wires journal-aware persistence. | Critical, 1 vote: Deprecated getPersistence() now throws unconditionally, breaking existing callers when journaling is disabled. |
Suppressed comments (1)
community/flamingock-couchbase-auditstore/src/main/java/io/flamingock/store/couchbase/internal/CouchbaseJournalEventStore.java:212
- Couchbase KV document keys are limited to 250 UTF-8 bytes, but
JournalEventpermits any non-blank stream ID and this concatenation has no size check. A sufficiently long stage/stream ID will therefore make a journal-enabled audit write fail with a key-length error and roll back its audit entry. Validate the encoded key length (with a useful configuration error) or use a bounded deterministic key representation before inserting.
private static String toKey(String streamId, long streamSequence) {
return KEY_PREFIX + "::" + streamId + "::" + streamSequence;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+159
to
+160
| public CommunityAuditPersistence getPersistence() { | ||
| throw new UnsupportedOperationException("getPersistence shouldn't be called at Couchbase audit store; use getPersistenceFactory(stageId)"); |
Comment on lines
+202
to
+204
| String query = String.format( | ||
| "UPDATE `%s`.`%s`.`%s` SET %s = true WHERE %s IN $eventIds RETURNING META().id", | ||
| collection.bucketName(), collection.scopeName(), collection.name(), KEY_ACKNOWLEDGED, KEY_EVENT_ID); |
| import io.flamingock.internal.common.core.transaction.TransactionalExternalSystem; | ||
|
|
||
| public interface CouchbaseExternalSystem extends ExternalSystem { | ||
| public interface CouchbaseExternalSystem extends TransactionalExternalSystem { |
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.
feat(couchbase): add journal event persistence