Skip to content

Commit 08e7ca6

Browse files
[source-postgres]: fix getLsn() utils function for read replicas (#45397)
Co-authored-by: Marcos Marx <[email protected]>
1 parent 4beba6c commit 08e7ca6

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

airbyte-cdk/java/airbyte-cdk/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ corresponds to that version.
174174

175175
| Version | Date | Pull Request | Subject |
176176
|:-----------|:-----------|:------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|
177+
| 0.47.1 | 2024-09-27 | [\#45397](https://github.com/airbytehq/airbyte/pull/45397) | Allow logical replication from Postgres 16 read-replicas|
177178
| 0.47.0 | 2024-09-26 | [\#42030](https://github.com/airbytehq/airbyte/pull/42030) | minor refactor |
178179
| 0.46.1 | 2024-09-20 | [\#45700](https://github.com/airbytehq/airbyte/pull/45700) | Destinations: Fix bug in parsing jsonschema |
179180
| 0.46.0 | 2024-09-18 | [\#45432](https://github.com/airbytehq/airbyte/pull/45432) | upgrade all libraries to latest version |
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=0.47.0
1+
0.47.1

airbyte-cdk/java/airbyte-cdk/datastore-postgres/src/main/kotlin/io/airbyte/cdk/db/PostgresUtils.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ object PostgresUtils {
1818
val jsonNodes =
1919
database.bufferedResultSetQuery(
2020
{ conn: Connection ->
21-
conn.createStatement().executeQuery("select * from pg_current_wal_lsn()")
21+
conn
22+
.createStatement()
23+
.executeQuery(
24+
"SELECT CASE WHEN pg_is_in_recovery() THEN pg_last_wal_receive_lsn() ELSE pg_current_wal_lsn() END AS pg_current_wal_lsn;"
25+
)
2226
},
2327
{ resultSet: ResultSet -> JdbcUtils.defaultSourceOperations.rowToJson(resultSet) }
2428
)

0 commit comments

Comments
 (0)