hibernate / hibernate-reactive

A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.
https://hibernate.org/reactive
Apache License 2.0
435 stars 90 forks source link

SchemaMigrator/SchemaValidator support for Db2 #911

Open DavideD opened 3 years ago

DavideD commented 3 years ago

Follows #536

See #903 for an example with PostgreSQL

Requires a fix from Vert.x SQL Client: https://github.com/eclipse-vertx/vertx-sql-client/issues/1033

See SchemaArrayValidationTestBase

blafond commented 3 years ago

@gbadner When I run the 3 tests for DB2 with GROUPED schema option I get an AIOOB in vertx

Caused by: java.lang.IndexOutOfBoundsException: readerIndex(32741) + length(17) exceeds writerIndex(32757): ReadOnlyByteBuf(ridx: 32741, widx: 32757, cap: 32757/32757, unwrapped: PooledSlicedByteBuf(ridx: 0, widx: 32757, cap: 32757/32757, unwrapped: PooledUnsafeDirectByteBuf(ridx: 32860, widx: 32860, cap: 65536)))
    at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1442) ~[netty-buffer-4.1.67.Final.jar:4.1.67.Final]
    at io.netty.buffer.AbstractByteBuf.checkReadableBytes(AbstractByteBuf.java:1428) ~[netty-buffer-4.1.67.Final.jar:4.1.67.Final]
    at io.netty.buffer.AbstractByteBuf.skipBytes(AbstractByteBuf.java:971) ~[netty-buffer-4.1.67.Final.jar:4.1.67.Final]
    at io.vertx.db2client.impl.drda.Cursor.skipFdocaBytes(Cursor.java:1669) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.drda.Cursor.calculateColumnOffsetsForRow_(Cursor.java:1488) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.drda.Cursor.stepNext(Cursor.java:220) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.drda.Cursor.next(Cursor.java:232) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.codec.RowResultDecoder.next(RowResultDecoder.java:52) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.codec.ExtendedQueryCommandBaseCodec.decodePreparedQuery(ExtendedQueryCommandBaseCodec.java:81) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.codec.ExtendedQueryCommandCodec.decodeQuery(ExtendedQueryCommandCodec.java:49) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.codec.QueryCommandBaseCodec.decodePayload(QueryCommandBaseCodec.java:69) ~[vertx-db2-client-4.1.3.jar:4.1.3]
    at io.vertx.db2client.impl.codec.DB2Decoder.decodePayload(DB2Decoder.java:79) ~[vertx-db2-client-4.1.3.jar:4.1.3]
blafond commented 3 years ago

Failing on this SQL

select table_name as TABLE_NAME, column_name as COLUMN_NAME,  case when data_type = 'CHARACTER VARYING' then 'VARCHAR' else data_type end as TYPE_NAME, null as COLUMN_SIZE, null as DECIMAL_DIGITS, is_nullable as IS_NULLABLE, null as DATA_TYPE from sysibm.columns where true and table_catalog = ? order by table_catalog, table_schema, table_name, column_name, ordinal_position
gbadner commented 3 years ago

Thanks. @blafond, it's basically the same SQL as is failing for SQL Server.

gbadner commented 3 years ago

I've added a comment about failing on DB2 at https://github.com/eclipse-vertx/vertx-sql-client/issues/1032#issuecomment-910535315 .

gbadner commented 3 years ago

I've been asked to create a separate issue for DB2: https://github.com/eclipse-vertx/vertx-sql-client/issues/1033

blafond commented 3 years ago

@gbadner Pushed my latest: https://github.com/blafond/hibernate-reactive/commits/911-db2-schema-update-validation

DavideD commented 2 years ago

We will also need to update the documentation: https://github.com/hibernate/hibernate-reactive/commit/ffa7215e5004b3040815fc191f151935eb69fa17

blafond commented 2 years ago

Revisiting this... SchemaUpdateDB2TestBase is working with the internal individual schema class, but tests fail with GroupedSchemaUpdateDB2TestBase class

blafond commented 1 year ago

No movement on DB2 vertx client, so tests still failing.