-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Primary key issues with MySQL #3308
Comments
I have also tried paimon-flink-action-0.8, specifically paimon-flink-action-0.8-20240507.002037-81.jar from https://repository.apache.org/content/groups/snapshots/org/apache/paimon/paimon-flink-action/0.8-SNAPSHOT/paimon-flink-action-0.8-20240507.002037-81.jar but it just have the same effects. Maybe its something to do with table's metadata? Just guessing at this point |
Does the ignored table have a schema change? You can set --ignore-incompatible false to check whether the table has schema changes, or check the log for "This table will be ignored". |
@MOBIN-F Thanks for the reply, this is my first try loading this database, so I guess it wouldn't matter if any of the tables has a schema change? I am not sure, in any case those table's schema haven't been touched since they were created. But I set the And just to give more background, initially I was doing this with Flink and sinking into Iceberg, which would be able to get all the tables required, thus leading me to think it might be a Paimon issue either than Flink |
On futher investigation, using the query But on those who got filtered out, for example Even tho when we query Turns out, when the tables were created, it didn't specify the primary key, but was instead later added using the query With that said, althought the tables clearly have a primary key, it might appares as it does not depending on how we are checking for its existence, and of course Paimon only synchronizes tables with primary keys. So I think this is a bug in the wording of the documents, but would be a really nice feature if it would include tables that have a primary key no matter if its created with or altered later on. |
I reproduced the problem, and the reason is as stated in the official documentation: If you do not have a PRIMARY KEY and an application asks for the PRIMARY KEY in your tables, MySQL returns the first UNIQUE index that has no NULL columns as the PRIMARY KEY. CREATE TABLE
In this case, the primary key information cannot be obtained using metaData.getPrimaryKeys. Instead, we need to use metaData.getIndexInfo and metaData.getColumns to determine the primary key |
Thanks for your suggestion @MOBIN-F , I will check it later. |
Search before asking
Paimon version
0.7.0
Compute Engine
Flink 1.17.2
Minimal reproduce step
Not sure. The problem is inconsistent, on some MySQL server it won't happen, on some it will filter out most of the tables
What doesn't meet your expectations?
To load all the tables mentioned in the argument 'including_tables'
Anything else?
Some details:
I have checked and tried most of the results online, check for database permission, table permission, etc.
I have also tried loading all tables, but it will also says it 'filtered out of table capturing'. I have looked into Flink, Ververica, and Paimon's code but I still have no idea. And I don't seem to be able to find anyone else with this problem.
Below I am trying to access some tables from the database 'littlemall', those tables are:
But the end result is that Flink was only able to capture two tables, namely sku_list and user
I have cropped some logs and screenshots to provide more information, please let me know if you need anything additional or if you have any idea at all!
Args:
2024-05-08 08:44:25,714 INFO org.apache.paimon.flink.action.ActionFactory [] - mysql_sync_database job args: --warehouse hdfs://hktv-cluster/core/data-stream/flink/data/paimon/warehouse --database littlemall --ignore_incompatible true --mysql_conf hostname=<hostname> --mysql_conf port=3306 --mysql_conf username=flink-cdc --mysql_conf password=**** --mysql_conf database-name=littlemall --mysql_conf start-server-id=7400 --mysql_conf server-time-zone=Asia/Hong_Kong --including_tables order|order_detail|payment_record|store|user|order_detail_product_item|order_detail_delivery_fee_item|order_audit_log|order_detail_promotion_item|sku_list|payment_refund_record|mall_category|store_category --catalog_conf metastore=filesystem --catalog_conf case-sensitive=false --table_conf bucket=4 --table_conf changelog-producer=input
MySQL CLI to confirm user have permission to read and are base table:
Tables being filtered out:
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: