我們使用Spring Batch編寫我們的作業,並且它工作得很好。但是最近我們看到了一個截斷問題,這導致了一些關於spring batch如何存儲關於作業的元數據的問題。Spring批處理作業元數據持久性問題
- 每次作業運行時,spring批處理都會將有關作業的元數據存儲在數據庫中。有兩個表:batch_step_execution_context和batch_job_execution_context,它們將元數據保存在short_context和serialized_context兩列中。這兩列都保存了確切的數據,但short_context的限制爲2500個字符,因此數據被截斷。
爲什麼我們2列存儲的準確數據,如果我們擺脫short_context什麼影響可能它的工作
現在我們使用的內存HSQL數據庫爲我們的工作。我們的工作之一拋出以下異常:
org.springframework.dao.DataIntegrityViolationException:PreparedStatementCallback; SQL [UPDATE BATCH_JOB_EXECUTION_CONTEXT SET SHORT_CONTEXT =?,SERIALIZED_CONTEXT =? WHERE JOB_EXECUTION_ID =?];數據異常:字符串數據,右截斷;嵌套的例外是java.sql.SQLDataException:數據異常:字符串數據,右截斷
更多堆棧跟蹤:
Caused by: org.hsqldb.HsqlException: data exception: string data, right truncation
at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.error.Error.error(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.types.CharacterType.castOrConvertToType(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.types.CharacterType.convertToType(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.StatementDML.getUpdatedData(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.StatementDML.executeUpdateStatement(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.StatementDML.getResult(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.StatementDMQL.execute(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.Session.executeCompiledStatement(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
at org.hsqldb.Session.execute(Unknown Source) ~[hsqldb-2.3.3.jar!/:2.3.3]
這是特定於HSQL DB,因爲它工作正常進行的其他工作,即,它被適當地截斷它
感謝
serialized_context不是2500可變長度字符字段,short_context是serialized_context是文本字段 –