Files
spring-framework/spring-jdbc
lejuho fe1c2d7826 Avoid serving stale values after failed identity cache refill
`AbstractIdentityColumnMaxValueIncrementer` replaces its value cache and
resets the cache index before it inserts into the sequence table. If an
insert, the identity query, or the cleanup statement fails, the exception
is propagated but the partially populated cache remains in place. The
next call then serves values from that cache without accessing the
database, so it may return `0` for slots that were never filled.

This commit populates a local array and only exposes it once the entire
range has been obtained and the cleanup statement has succeeded, so the
next call after a failure refills the cache again. This aligns with the
handling of a failed refill in `MySQLMaxValueIncrementer`.

See gh-37322
Closes gh-37402

Signed-off-by: lejuho <52308082+lejuho@users.noreply.github.com>
2026-10-07 14:26:00 +02:00
..