Open wanghongzhou opened 1 month ago
The undo_log table should not be handed over to the ORM framework to manage, but should be pre-created in the database.
@slievrly
I have initialized the undo_log table through Flyway, and used Hibernate's hibernate.hbm2ddl.auto=validate to check if the undo_log table exists. However, the new existence check for the undo_log table in Seata has caused the Spring datasource and Flyway initialization scripts to become ineffective. In our team, development provides the images, while operations is responsible for deployment, and asking operations to execute additional initialization scripts complicates the deployment process. There is also a discussion regarding this issue on https://github.com/apache/incubator-seata/issues/6871.
Ⅰ. Issue Description
After upgrading my project to Seata-Spring 2.1, I encountered an issue during startup. My Spring Boot project, which uses Spring Data JPA and Flyway, fails to start when the database schema is not pre-existing. The error message indicates that both entityManagerFactory and Flyway depend on DataSourceProxy during their initialization. However, Seata’s DataSourceProxy checks for the existence of the undo_log table, and when it’s not present, the application fails to proceed.
In my project:
However, despite these configurations, Seata’s DataSourceProxy performs an early check for the undo_log table during its initialization. This interferes with the normal flow of Hibernate and Flyway table creation, causing a startup failure even though the schema would normally be created by Hibernate or Flyway during initialization.
Ⅱ. Describe what happened
Ⅲ. Describe what you expected to happen
The project should start successfully, and Flyway or Hibernate should be able to create the necessary tables, including undo_log.
Ⅵ. Environment:
java -version
): JDK 17uname -a
): Windows 11