-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
How to handle DDL when using MaterializedPostgreSQL #29535
Comments
Also recently there is a second, but not-automatic option, you can remove table from replication and add it back (it will have updated structure) via |
I just tried setting this option to 1 when creating database using command
Altered a table in postgres, inserted some rows into it and nothing changes in CH maybe I'm doing something wrong? |
It takes some time to update. The table is reloaded in the background. |
Think I've found a problem. |
Thank you. It is a result of setting this setting to 1 or not? |
It happens after a while. But yeah, it fails only when it is set to 1.
|
hm, ok, thank you, I'll see. There are tests with the same steps in our integration tests and also I remember some person also wrote that he used this setting to 1 as default, so I thought it should be ok, I'll make more tests. |
I'm also having this issues, CH dies after sometime running. |
|
Just complaining that something does not work will not make any difference. You could attach some information about how it broke (what value failed to be converted), some error logs, stack traces...
Because DDL cannot be fully replicated by the postgresql logical replication protocol. Only changes which can break replication are detected. Column renaming does not break replication because insertion is done by position, not by column name. Positional insertion is ok because addition/removal of column is always detected and passed by the protocol and as a result full update is performed.
It says the error reason in the exception message... It is expected behaviour. But now I see that it is better to ignore exception if table does not exist, I'll make a fix. |
Yea, sorry @kssenii , i was testing the PGMaterializeEngine locally, and there're so many errors, and i forgot to capture the logs for everything.
Btw, could you advise what's the current recommended way to replicate data from PG into Clickhouse in near realtime manner ? |
I managed to extract some logs for conversion error. Just doing some data editing, alter column name, adding column at source.
|
Does the table have non-default schema? Actually just detach should also work, but I tested only with default schema. Support for non-default schema was added very recently, so I might have missed it for detach, will check.
Ok, if you send them all, some example / error logs (so I can reproduce), then I promise to fix them all this weekend.
Now there is exponential check for update (up to 10 sec). So if there are no changes for replication, then it reschedules with 1 second, then if still no changes - with 2 seconds, 4, 8, 10. (10 seconds is maximum delay). I think I can make this behaviour configurable by setting if it is useful (like min_delay, max_delay, delay_factor). |
I don't know if it's help, but i'll attach the full error logs and and my local setup here for reference:
Hardware: Test case: |
The log file are too big, so i had to upload to google drive: |
@singggum3b @kartaris ddl related issue should be fixed after #33200. |
Thanks @kssenii , we planned to use this feature extensively in the near future ❤️ |
Hi @kssenii , i've did some simple test on 22.1 version.
|
It seems like |
FYI anyone trying to use this engine. I've ended up writing a custom ETL to read PG logical replication and stream to Clickhouse instead, and it's working quite well in production after several iteration (around 5000 logical update item/sec) |
There is a statement "DDL is not replicated, but can be handled (described below)." in documentation but it is not described there.
How can it be handled?
The text was updated successfully, but these errors were encountered: