Skip to content

[core] Support lock for postgres catalog (#4836)#5005

Merged
JingsongLi merged 1 commit intoapache:masterfrom
pratikd650:add-postgres-lock
Feb 10, 2025
Merged

[core] Support lock for postgres catalog (#4836)#5005
JingsongLi merged 1 commit intoapache:masterfrom
pratikd650:add-postgres-lock

Conversation

@pratikd650
Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #4836

Currently lock.enabled is only supported my SQLLite and MySQL. Adding support for Postgres.
The only difference between MySQL and Postgres is the TIMESTAMPDIFF function

In MySQL
DELETE FROM paimon_distributed_locks WHERE TIMESTAMPDIFF(SECOND, acquired_at, NOW()) > expire_time_seconds and lock_id = ?

In Postgres
DELETE FROM paimon_distributed_locks WHERE EXTRACT(EPOCH FROM AGE(NOW(), acquired_at)) > expire_time_seconds and lock_id = ?

Tests

PostgresqlCatalogTest.java. This uses TestContainers with postgres:13-alpine to run postgres inside docker.

API and Format

No

Documentation

Yes ,The doc at https://paimon.apache.org/docs/master/flink/sql-ddl/#creating-jdbc-catalog says

Currently, lock configuration is only supported for MySQL and SQLite. If you are using a different type of database for catalog storage, please do not configure lock.enabled.

This needs to updated to include Postgres

Copy link
Copy Markdown
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@JingsongLi JingsongLi merged commit 5135d15 into apache:master Feb 10, 2025
JackeyLee007 pushed a commit to JackeyLee007/paimon that referenced this pull request Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] support lock.enabled for jdbc postgres catalog

3 participants