cast errorcount to string for batchjob failure message (#5230) (#5233)

Co-authored-by: Emre Dincturk <emre.dincturk@smilecdr.com>
This commit is contained in:
Emre Dincturk 2023-08-24 10:41:01 -04:00 committed by GitHub
parent ed616f7a6d
commit 8d39e3466c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
type: fix
issue: 5230
title: "batch2 jobs on MS SQL Server were failing to transition to FAILED state after max retrials
for the job are exhausted. This is now fixed."

View File

@ -300,7 +300,7 @@ public class JpaJobPersistenceImpl implements IJobPersistence {
Validate.isTrue(changeCount > 0, "changed chunk matching %s", chunkId);
Query query = myEntityManager.createQuery("update Batch2WorkChunkEntity " + "set myStatus = :failed "
+ ",myErrorMessage = CONCAT('Too many errors: ', myErrorCount, '. Last error msg was ', myErrorMessage) "
+ ",myErrorMessage = CONCAT('Too many errors: ', CAST(myErrorCount as string), '. Last error msg was ', myErrorMessage) "
+ "where myId = :chunkId and myErrorCount > :maxCount");
query.setParameter("chunkId", chunkId);
query.setParameter("failed", WorkChunkStatusEnum.FAILED);