Skip to content

Commit 3f19508

Browse files
Postgres 14 (#2607)
* Postgres 14 Signed-off-by: wslulciuc <willy@datakin.com> * fix migration backfill for psql14 Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> --------- Signed-off-by: wslulciuc <willy@datakin.com> Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> Co-authored-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
1 parent 8d954d6 commit 3f19508

7 files changed

Lines changed: 18 additions & 6 deletions

File tree

.circleci/db-migration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# Usage: $ ./db-migration.sh
1212

1313
# Version of PostgreSQL
14-
readonly POSTGRES_VERSION="12.1"
14+
readonly POSTGRES_VERSION="14"
1515
# Version of Marquez
1616
readonly MARQUEZ_VERSION=0.40.0
1717
# Build version of Marquez

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Marquez uses a _multi_-project structure and contains the following modules:
100100
## Requirements
101101

102102
* [Java 17](https://adoptium.net)
103-
* [PostgreSQL 12.1](https://www.postgresql.org/download)
103+
* [PostgreSQL 14](https://www.postgresql.org/download)
104104

105105
> **Note:** To connect to your running PostgreSQL instance, you will need the standard [`psql`](https://www.postgresql.org/docs/9.6/app-psql.html) tool.
106106

api/src/main/java/marquez/db/migrations/V57_1__BackfillFacets.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ public void migrate(Context context) throws Exception {
128128
}
129129

130130
int estimatedEventsCount = estimateCountLineageEvents();
131+
132+
if (estimatedEventsCount < 0) {
133+
// https://www.postgresql.org/docs/current/catalog-pg-class.html
134+
// -1 indicating that the row count is unknown.
135+
// This happens when lineage_events table is empty.
136+
log.info("Vacuuming lineage_events table");
137+
jdbi.withHandle(h -> h.execute("VACUUM lineage_events;"));
138+
log.info("Vacuuming lineage_events table finished");
139+
140+
estimatedEventsCount = estimateCountLineageEvents();
141+
}
142+
131143
log.info("Estimating {} events in lineage_events table", estimatedEventsCount);
132144
if (estimatedEventsCount == 0 && countLineageEvents() == 0) {
133145
// lineage_events table is empty -> no need to run migration

api/src/test/java/marquez/PostgresContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.testcontainers.utility.DockerImageName;
1212

1313
public final class PostgresContainer extends PostgreSQLContainer<PostgresContainer> {
14-
private static final DockerImageName POSTGRES = DockerImageName.parse("postgres:12.12");
14+
private static final DockerImageName POSTGRES = DockerImageName.parse("postgres:14");
1515
private static final int JDBC = 5;
1616

1717
private static final Map<String, PostgresContainer> containers = new HashMap<>();

api/src/test/java/marquez/db/DbTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
@Tag("DataAccessTests")
3434
@Testcontainers
3535
class DbTest {
36-
private static final DockerImageName POSTGRES_12_1 = DockerImageName.parse("postgres:12.1");
36+
private static final DockerImageName POSTGRES_12_1 = DockerImageName.parse("postgres:14");
3737

3838
@Container
3939
private static final PostgreSQLContainer<?> DB_CONTAINER =

docker-compose.db.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "3.7"
22
services:
33
db:
4-
image: postgres:12.1
4+
image: postgres:14
55
container_name: marquez-db
66
ports:
77
- "5432:5432"

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
entrypoint: ["/opt/marquez/wait-for-it.sh", "db:5432", "--", "./entrypoint.sh"]
1919

2020
db:
21-
image: postgres:12.1
21+
image: postgres:14
2222
container_name: marquez-db
2323
ports:
2424
- "5432:5432"

0 commit comments

Comments
 (0)