-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: root page was falsely deleted (#1464)
* fix: root page was falsely deleted * feat: cleaner db query fix: root page was marked as immutable too soon * fix: broken file name reference
- Loading branch information
Showing
20 changed files
with
224 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...-postgres/postgres-liquibase/src/main/resources/db/changelog/3_6_1/add_is_root_column.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | ||
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
|
||
<changeSet id="add_is_root_column" author="vsds"> | ||
<preConditions onError="MARK_RAN"> | ||
<not> | ||
<columnExists tableName="pages" columnName="is_root" /> | ||
</not> | ||
</preConditions> | ||
<addColumn tableName="pages"> | ||
<column name="is_root" type="BOOLEAN" defaultValueBoolean="false"> | ||
<constraints nullable="false" /> | ||
</column> | ||
</addColumn> | ||
<sqlFile path="add_is_root_values.sql" relativeToChangelogFile="true" /> | ||
</changeSet> | ||
</databaseChangeLog> |
7 changes: 7 additions & 0 deletions
7
...-postgres/postgres-liquibase/src/main/resources/db/changelog/3_6_1/add_is_root_values.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
WITH root_page_partial_urls AS ( | ||
SELECT CONCAT('/', c.name, '/', v.name) AS partial_url | ||
FROM collections c | ||
JOIN views v ON c.collection_id = v.collection_id | ||
) | ||
UPDATE pages SET is_root = true, immutable = false | ||
WHERE partial_url IN (SELECT partial_url FROM root_page_partial_urls); |
16 changes: 16 additions & 0 deletions
16
...stgres/postgres-liquibase/src/main/resources/db/changelog/3_6_1/alter_open_pages_view.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
DROP VIEW IF EXISTS open_pages; | ||
|
||
CREATE VIEW open_pages AS | ||
SELECT DISTINCT ON (p.bucket_id) p.page_id, | ||
p.bucket_id, | ||
p.partial_url, | ||
v.page_size, | ||
count(pm.member_id) AS assigned_members | ||
FROM pages p | ||
JOIN buckets b ON b.bucket_id = p.bucket_id | ||
JOIN views v ON v.view_id = b.view_id | ||
LEFT JOIN page_members pm ON pm.page_id = p.page_id | ||
WHERE NOT p.immutable | ||
GROUP BY p.page_id, v.page_size, p.bucket_id, p.is_root | ||
ORDER BY p.bucket_id, p.is_root | ||
; |
9 changes: 9 additions & 0 deletions
9
...server-infra-postgres/postgres-liquibase/src/main/resources/db/changelog/3_6_1/master.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | ||
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
|
||
<include relativeToChangelogFile="true" file="add_is_root_column.xml"/> | ||
<include relativeToChangelogFile="true" file="alter_open_pages_view.sql"/> | ||
</databaseChangeLog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
ldes-server-integration-test/src/test/resources/application-postgres-test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...r-integration-test/src/test/resources/data/input/eventstreams/compaction/observations.ttl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@prefix ldes: <https://w3id.org/ldes#> . | ||
@prefix tree: <https://w3id.org/tree#>. | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix ex: <http://example.org#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix dcterms: <http://purl.org/dc/terms/> . | ||
|
||
</observations> a ldes:EventStream ; | ||
ldes:timestampPath dcterms:created ; | ||
ldes:versionOfPath dcterms:isVersionOf ; | ||
tree:shape [ a sh:NodeShape ] ; | ||
tree:view </observations/time-based> ; | ||
ldes:eventSource [ | ||
a ldes:EventSource ; | ||
ldes:retentionPolicy [ | ||
a ldes:DurationAgoPolicy ; | ||
tree:value "PT2M"^^xsd:duration | ||
] ; | ||
] . | ||
|
||
</observations/time-based> a tree:Node ; | ||
tree:viewDescription [ | ||
a tree:ViewDescription ; | ||
tree:fragmentationStrategy () ; | ||
tree:pageSize "7"^^xsd:integer ; | ||
ldes:retentionPolicy [ | ||
a ldes:DurationAgoPolicy ; | ||
tree:value "PT90S"^^xsd:duration | ||
] | ||
] | ||
. |
20 changes: 20 additions & 0 deletions
20
ldes-server-integration-test/src/test/resources/data/input/members/observation.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"@context": { | ||
"@base": "http://example.org/id/", | ||
"@vocab": "http://purl.org/dc/terms/", | ||
"isVersionOf": { | ||
"@type": "@id" | ||
} | ||
}, | ||
"@id": "ID#DATETIME", | ||
"@type": [ | ||
"something" | ||
], | ||
"created": [ | ||
{ | ||
"@value": "DATETIME", | ||
"@type": "http://www.w3.org/2001/XMLSchema#dateTime" | ||
} | ||
], | ||
"isVersionOf": "http://example.org/id/ID" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters