You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In examples 8-9 in Chapter 8,
Doesn't the saved state of UniqueLastNameValidator's lastNames Set not be synchronized accordingly even if the chunk is rolled back?
Hello.
In examples 8-9 in Chapter 8,
Doesn't the saved state of UniqueLastNameValidator's lastNames Set not be synchronized accordingly even if the chunk is rolled back?
def-guide-spring-batch/Chapter08/src/main/java/com/example/Chapter08/domain/UniqueLastNameValidator.java
Lines 29 to 40 in 7db62ca
When I tested the example, it looked like this:
(To make the changes easier to see, I changed HashSet to LinkedHashset.)
1st Run
BATCH_STEP_EXECUTION_CONTEXT.SHORT_CONTEXTThe first chunk ends normally, and the second chunk fails (chunk unit 5).
Failure cause:
Duplicate last name was found: Darrow- line 6 (based on original file)Warren,L,Darrow,4686 Mt. Lee Drive,St. Louis,NY,949352nd Run
Remove line 6 with duplicate lastName from input file and run again
Warren,L,Darrow,4686 Mt. Lee Drive,St. Louis,NY,94935BATCH_STEP_EXECUTION_CONTEXT.SHORT_CONTEXT❌ Execution of the 3rd chunk fails, but at this time,
Gilbertis saved when it should not have been saved.Failure cause:
Duplicate last name was found: Darrow- line 13 (based on original file)3rd Run
Remove line 13 with duplicate LastName from input file
Regan,M,Darrow,4851 Nec Av.,Gulfport,MS,33193BATCH_STEP_EXECUTION_CONTEXT.SHORT_CONTEXTCause of failure:
Duplicate last name was found: Gilbert- BecauseGilbertwas incorrectly saved in the 2nd run, it will continue to fail from now on.Regarding this issue, shouldn't there be some kind of processing for the lastNames Set, or shouldn't the chunk be 1 for it to work properly?
Thanks. Have a nice day. 👍