Skip to content

[#4799] Align the autoconfigured JPA gap defaults with the core defaults - #4821

Merged
smcvb merged 1 commit into
mainfrom
bug/4799/jpa-gap-settings-default-swap
Aug 6, 2026
Merged

[#4799] Align the autoconfigured JPA gap defaults with the core defaults#4821
smcvb merged 1 commit into
mainfrom
bug/4799/jpa-gap-settings-default-swap

Conversation

@schananas

@schananas schananas commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #4799

What changed

The two @DefaultValue annotations on JpaEventStorageEngineConfigurationProperties carried each other's value:

Setting Was autoconfigured Core default
gapTimeout 10000 ms 60000 ms
maxGapOffset 60000 10000

The short timeout is the harmful direction. It is the window a not-yet-committed event has to become visible before a streaming consumer gives up on it, and nearly every production JPA application reaches the engine through Spring Boot.

The swap always won: JpaEventStoreAutoConfiguration.AggregateBasedJpaEventStorageEngineConfigurationEnhancer:103-110 copies every property onto the core configuration unconditionally, so an application could not fall through to the correct core default even by setting nothing.

Docs are in the commit on purpose

The same swapped pair is published as the documented defaults:

  • migration/pages/paths/event-store.adoc:453,458 states gap-timeout=10000 and max-gap-offset=60000 as "the default".
  • The included sample customconfig/AxonConfig.java:37,40 repeats those numbers against the core builder, where they are not the defaults either.

Tests

JpaEventStorageEngineConfigurationPropertiesTest, 4 testcases, 0 failures. Plus JpaAutoConfigurationTest (2), the class that exercises the autoconfig path.

Reverting just the two @DefaultValue swaps fails with expected: 60000 but was: 10000 and expected: 10000 but was: 60000.

The test asserts against AggregateBasedJpaEventStorageEngineConfiguration.DEFAULT rather than literals, so the two paths cannot drift apart again silently, and a third case covers all five shared settings.

For the reviewer

The effective default moves for every Spring Boot JPA application that never set these properties: tokens get smaller and gaps live longer. Worth checking whether any downstream test or benchmark depended on the 10000 ms timeout.

No behaviour change for anyone who set either property explicitly, which the new test also pins.

Related: this is the same gapTimeout mechanism as the event-skipping problem, so the two interact.

Not a pure safety win in both directions

gapTimeout 10000 to 60000 is safer: gaps survive longer, so fewer committed events are skipped. It costs bigger tracking tokens and more gap re-querying.

maxGapOffset 60000 to 10000 is less forgiving: a token now abandons gaps more than 10000 behind the highest index instead of 60000. Aligning with the core record is still the right call, but only one half of this change is strictly safer.

This is an upgrade-time behaviour change for every Spring Boot JPA application that never set these properties, so it needs a release note.

The two @DefaultValue annotations carried each other's value, so a Spring Boot application
that set no axon.eventstorage.jpa.* property got a 10000 ms gapTimeout and a 60000-entry
maxGapOffset where AggregateBasedJpaEventStorageEngineConfiguration.DEFAULT uses 60000 ms
and 10000. The enhancer copies every property onto the core configuration unconditionally,
so the swap always won over the core default.

The short timeout is the harmful direction: it is the window a not-yet-committed event has
to become visible before a streaming consumer gives up on it, and nearly every production
JPA application reaches the engine through this path.

The migration guide restated the same swapped pair as the documented defaults, and its
included sample repeated those numbers against the core builder where they are not the
defaults either, so both are corrected with it.

Fixes #4799
@schananas
schananas requested a review from a team as a code owner July 29, 2026 15:46
@schananas
schananas requested review from hjohn, jangalinski and smcvb and removed request for a team July 29, 2026 15:46
@schananas schananas self-assigned this Jul 29, 2026
@smcvb smcvb added Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Type: Bug Use to signal issues that describe a bug within the system. labels Aug 6, 2026
@smcvb smcvb added this to the Release 5.3.1 milestone Aug 6, 2026

@smcvb smcvb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a catch...Looks good to me 👍

@smcvb smcvb modified the milestones: Release 5.3.1, Release 5.4.0 Aug 6, 2026
@smcvb
smcvb merged commit cb83fe2 into main Aug 6, 2026
10 checks passed
@smcvb
smcvb deleted the bug/4799/jpa-gap-settings-default-swap branch August 6, 2026 12:14
@smcvb

smcvb commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

/backport axon-5.3.x

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Type: Bug Use to signal issues that describe a bug within the system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spring Boot autoconfigure swaps the JPA event store gapTimeout and maxGapOffset defaults

2 participants