COLDMANYU opened a new pull request, #11398:
URL: https://github.com/apache/paimon/pull/11398

   ### Purpose
   
   Linked issue: close #11096
   
   Since 1.4.0 (#7423), the JDBC catalog creates `paimon_table_properties` at 
startup. Its primary key has four `VARCHAR(255)` columns, which take 4080 bytes 
on MySQL with `utf8mb4`, above InnoDB's 3072-byte limit, so the catalog fails 
to start with `Specified key was too long`.
   
   The table is only used to sync table properties: every read and write of it 
is already behind `sync-all-properties`, and the catalog reads table options 
from the schema files, not from this table. This PR:
   
   - creates the table only when `sync-all-properties` is true, so a catalog 
with the sync disabled starts on MySQL `utf8mb4`;
   - wraps a failure to create the table in a message that names the table and 
points to the two ways out: set `sync-all-properties` to false, or create the 
table before the catalog starts (for example with shorter key columns). The 
default stays `true`, so the default setup on MySQL `utf8mb4` still needs one 
of them.
   
   As discussed in the issue, a length option like `lock-key-max-length` is 
left out: it would have to shorten all four key columns, including the database 
and table names that `paimon_tables` keeps at 255. Happy to change the approach 
if you prefer something else.
   
   ### Tests
   
   `JdbcCatalogTest`:
   
   - `testTablePropertiesTableCreatedOnlyWhenSyncEnabled`: with the sync 
disabled the table is not created; enabling it later on the same database 
creates it.
   - `testTablePropertiesTableCreationFailure`: when creating the table fails, 
the error names the table and `sync-all-properties`, and the catalog still 
starts with the sync disabled.
   - `testTablePropertiesSyncDisabled` now checks that the table does not 
exist, instead of reading it.
   
   All 86 tests in `JdbcCatalogTest` pass. I also ran the catalog against MySQL 
8.0.46 with a `utf8mb4` database:
   
   | Setup | Result |
   | --- | --- |
   | Default (`sync-all-properties` = true) | Fails with the new message, 
caused by `Specified key was too long` |
   | `sync-all-properties` = false | Starts; `paimon_table_properties` is not 
created |
   | Default, table created beforehand with shorter `catalog_key` and 
`property_key` | Starts |
   
   ### API and Format
   
   No API or storage format change. With `sync-all-properties` = false, the 
JDBC catalog no longer creates `paimon_table_properties`.
   
   ### Documentation
   
   No.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to