-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DuplicateKeyException check in JdbcTemplateStorageAccessor is Insufficient #1
Comments
Thanks for feedback, will fix it ASAP. |
Released as 0.4.1, will take few minutes to propagate to central repo |
Thanks for the incredibly swift response! Great work! |
lukas-krecan
pushed a commit
that referenced
this issue
May 29, 2020
Fix syntax used in annotation attribute value
lukas-krecan
pushed a commit
that referenced
this issue
Apr 10, 2021
Implemented granular control on CAS consistency.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The insertRecord method in JdbcTemplateStorageAccessor catches only the DuplicateKeyException to ascertain whether the lock already exists. With Vertica DB this poses a problem as it throws a org.springframework.dao.DataIntegrityViolationException instead.
Note that this is the parent class of DuplicateKeyException. As such the catch block is skipped entirely and the exception is propagated to spring framework rendering ShedLock unusable.
I would like to propose that the DataIntegrityViolationException be caught instead so that this can work with Vertica.
IMHO maybe the base Exception class can be caught? Not sure if you have any other constraints around this so would leave that to you.
If you like, I can submit a pull request for this as well.
Exception encountered as below:
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO SHEDLOCK(name, lock_until, locked_at, locked_by) VALUES(?, ?, ?, ?)]; [Vertica]VJDBC ERROR: Duplicate key values: 'name=batchStatusEmailTask' -- violates constraint 'SHEDLOCK.C_PRIMARY'; nested exception is java.sql.SQLIntegrityConstraintViolationException: [Vertica]VJDBC ERROR: Duplicate key values: 'name=batchStatusEmailTask' -- violates constraint 'SHEDLOCK.C_PRIMARY'
The text was updated successfully, but these errors were encountered: