apache / apache/incubator-seata

集成flyway 显示 Could not found any index in the table

Open
#2,181 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
seata and flyway show Could not found any index in the table

### Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

```
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is io.seata.common.exception.ShouldNeverHappenException: [xid:null]get tablemeta failed
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1803)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140)
at com.freesun.weijia.user.UserServiceApplication.main(UserServiceApplication.java:30)
Caused by: io.seata.common.exception.ShouldNeverHappenException: [xid:null]get tablemeta failed
at io.seata.rm.datasource.sql.struct.cache.AbstractTableMetaCache.getTableMeta(AbstractTableMetaCache.java:78)
at io.seata.rm.datasource.AbstractConnectionProxy.prepareStatement(AbstractConnectionProxy.java:113)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.bull.javamelody.JdbcWrapper$ConnectionInvocationHandler.invoke(JdbcWrapper.java:202)
at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:299)
at com.sun.proxy.$Proxy144.prepareStatement(Unknown Source)
at org.flywaydb.core.internal.jdbc.JdbcTemplate.prepareStatement(JdbcTemplate.java:325)
at org.flywaydb.core.internal.jdbc.JdbcTemplate.update(JdbcTemplate.java:309)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.doAddAppliedMigration(JdbcTableSchemaHistory.java:173)
at org.flywaydb.core.internal.schemahistory.SchemaHistory.addAppliedMigration(SchemaHistory.java:170)
at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:301)
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:246)
at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54)
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:164)
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:161)
at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:60)
at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(MySQLConnection.java:81)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:155)
at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:161)
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:139)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:1380)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:1341)
at org.flywaydb.core.Flyway.execute(Flyway.java:1696)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1341)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799)
... 17 common frames omitted

```

### Ⅲ. Describe what you expected to happen

### Ⅳ. How to reproduce it (as minimally and precisely as possible)

find code:
ResultSet rsIndex = dbmd.getIndexInfo(catalogName, schemaName, tableName, false, true);

tableName is 'user'.'flyway_schema_history'
find index is null
but update tableName flyway_schema_history
find index is two

### Ⅴ. Anything else we need to know?

### Ⅵ. Environment:

- JDK version : open jdk8
- OS : windows
- Others: seata 0.9.0

Contributor guide

Open the contributing guide

Research direction

Start at AbstractTableMetaCache.getTableMeta and inspect the dbmd.getIndexInfo call described in the report for the user.flyway_schema_history table. Reproduce the Flyway migration with Seata 0.9.0, JDK 8, and the reported Windows environment, then verify that the migration completes without the get tablemeta failed exception and that index metadata is handled consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.