Prevent stale symbol table children from replacing newer root tables - #1655
Prevent stale symbol table children from replacing newer root tables#1655Dongnyoung wants to merge 6 commits into
Conversation
|
I don't know about this one -- is there an actual real problem resolved here? |
|
@cowtowncoder The regression is reproducible through normal With a synthetic document containing 1,024 unique field names, I observed: I also ran a small JMH benchmark with So in this synthetic workload, the stale root causes the following parse to re-canonicalize field names that had already been learned, with a clear allocation and parsing-time cost. The fix prevents that backwards transition. I wouldn't characterize this as a parsing correctness bug, but the cache regression is measurable and can result from normal parser lifecycle. |
|
@Dongnyoung Isn't there concern that |
Fixes #1654
Summary
Prevent stale child symbol tables from replacing newer, larger root symbol tables when parsers are closed out of creation order.
Previously,
mergeChild()compared the child state against the root state observed at release time. This made the update atomic, but did not detect that the child itself could have been created from an older parent state. As a result, an older, smaller child could replace a root table that had already been updated by another child.Child symbol tables now retain the parent table state they were created from. During release, a stale child no longer replaces the root if another child has already advanced it to a newer, larger state.
This applies to both
CharsToNameCanonicalizerandByteQuadsCanonicalizer. The existing reset behavior for oversized symbol tables is preserved.Tests
Added coverage to
SymbolTableMergingTestfor out-of-order stale child release with:Ran:
.\mvnw.cmd -Dtest=SymbolTableMergingTest '-Dsurefire.useModulePath=false' test.\mvnw.cmd '-Dtest=SymbolTableMergingTest,TestSymbolTables,TestByteBasedSymbols,TestHashCollisionChars,PlaceholderSymbolTableTest,TestSymbolsWithMediaItem' '-Dsurefire.useModulePath=false' test