1

I am getting below error from Postgres 10.3 logical replication.

Setup

  • In master, postgresql used 12.3
  • In logical, postgres 10.3

Logs

2021-03-22 13:06:57.332 IST @ 25929 LOG:  checkpoints are occurring too frequently (22 seconds apart)
2021-03-22 13:06:57.332 IST @ 25929 HINT:  Consider increasing the configuration parameter "max_wal_size".
2021-03-22 14:34:21.263 IST @ 21461 ERROR:  invalid logical replication message type "T"
2021-03-22 14:34:21.315 IST @ 3184 LOG:  logical replication apply worker for subscription "elk_subscription_133" has started
2021-03-22 14:34:21.367 IST @ 3184 ERROR:  invalid logical replication message type "T"
2021-03-22 14:34:21.369 IST @ 25921 LOG:  worker process: logical replication worker for subscription 84627 (PID 3184) exited with exit code 1
2021-03-22 14:34:22.259 IST @ 25921 LOG:  worker process: logical replication worker for subscription 84627 (PID 21461) exited with exit code 1
2021-03-22 14:34:27.281 IST @ 3187 LOG:  logical replication apply worker for subscription "elk_subscription_133" has started
2021-03-22 14:34:27.311 IST @ 3187 ERROR:  invalid logical replication message type "T"
2021-03-22 14:34:27.313 IST @ 25921 LOG:  worker process: logical replication worker for subscription 84627 (PID 3187) exited with exit code 1
2021-03-22 14:34:32.336 IST @ 3188 LOG:  logical replication apply worker for subscription "elk_subscription_133" has started
2021-03-22 14:34:32.362 IST @ 3188 ERROR:  invalid logical replication message type "T"
  • 1
    If I'm following you are replicating from 12.3 --> 10.3. This is going backwards and as I understand it not supported. The error message `invalid logical replication message type "T"` bears that out. `T` is present in [12.3](https://www.postgresql.org/docs/12/protocol-logicalrep-message-formats.htm) Truncate Byte1('T'), but not in [10.3](https://www.postgresql.org/docs/10/protocol-logicalrep-message-formats.html). – Adrian Klaver Mar 22 '21 at 18:29
  • Replication was going smooth before this error. – user3710949 Mar 22 '21 at 18:31
  • I didn't find any solution to resolve ERROR: invalid logical replication message type "T" – user3710949 Mar 22 '21 at 18:33
  • 1
    The correct solution is don't replicate from newer to older version. The error is occurring because a `TRUNCATE` is being issued on the 12.3 server and the 10.3 server does not understand the message as it's protocol does not have the `'T'` message. – Adrian Klaver Mar 22 '21 at 19:05

1 Answers1

0

The documentation describes message T:

Truncate

      Byte1('T')

              Identifies the message as a truncate message.

Support for TRUNCATE was added in v11, so the primary server must be v11 or better.

You will have to remove the table from the publication, refresh the subscription, truncate the table manually, add it to the publication and refresh the subscription again.

Avoid TRUNCATE and change the publication:

ALTER PUBLICATION name SET (publish = 'insert, update, delete');
Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263