Skip to content

UBERF-11178 Migrate datalake workspace id #9092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion services/datalake/pod-datalake/src/datalake/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export function escape (value: any): string {
}

function getMigrations (): [string, string][] {
return [migrationV1()]
return [migrationV1(), migrationV2()]
}

function migrationV1 (): [string, string] {
Expand Down Expand Up @@ -599,3 +599,22 @@ function migrationV1 (): [string, string] {
`
return ['init_tables_01', sql]
}

function migrationV2 (): [string, string] {
const sql = `
ALTER TABLE blob.meta DROP CONSTRAINT IF EXISTS fk_blob;

UPDATE blob.blob
SET workspace = w.uuid
FROM global_account.workspace w
WHERE workspace = w.data_id;

UPDATE blob.meta
SET workspace = w.uuid
FROM global_account.workspace w
WHERE workspace = w.data_id;

ALTER TABLE blob.meta ADD CONSTRAINT fk_blob_meta FOREIGN KEY (workspace, name) REFERENCES blob.blob (workspace, name);
`
return ['migrate_workspaces_02', sql]
}
3 changes: 2 additions & 1 deletion tests/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
STORAGE_CONFIG="datalake|http://datalake:4031"
STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin"
DATALAKE_STORAGE_CONFIG="datalake|http://datalake:4031"
BACKUP_STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin"
BACKUP_BUCKET_NAME=dev-backups

Expand Down
35 changes: 35 additions & 0 deletions tests/docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,47 @@ services:
environment:
- DB_URL=${DB_PG_URL}
- PROCEED_V7_MONGO=false
- STORAGE_CONFIG=${DATALAKE_STORAGE_CONFIG}
transactor:
environment:
- DB_URL=${DB_PG_URL}
- STORAGE_CONFIG=${DATALAKE_STORAGE_CONFIG}
workspace:
environment:
- DB_URL=${DB_PG_URL}
- STORAGE_CONFIG=${DATALAKE_STORAGE_CONFIG}
fulltext:
environment:
- DB_URL=${DB_PG_URL}
- STORAGE_CONFIG=${DATALAKE_STORAGE_CONFIG}
front:
environment:
- STORAGE_CONFIG=${DATALAKE_STORAGE_CONFIG}
- FILES_URL=http://localhost:4031/blob/:workspace/:blobId/:filename
- UPLOAD_URL=http://localhost:4031/upload/form-data/:workspace
- PREVIEW_CONFIG=http://localhost:4031/image/fit=cover,width=:width,height=:height,dpr=:dpr/:workspace/:blobId
collaborator:
environment:
- STORAGE_CONFIG=${DATALAKE_STORAGE_CONFIG}
datalake:
image: hardcoreeng/datalake
depends_on:
minio:
condition: service_healthy
cockroach:
condition: service_started
stats:
condition: service_started
account:
condition: service_started
ports:
- 4031:4031
environment:
- PORT=4031
- SECRET=secret
- ACCOUNTS_URL=http://account:3003
- STATS_URL=http://stats:4901
- STREAM_URL=http://localhost:1081/recording
- DB_URL=${DB_PG_URL}
- BUCKETS=blobs,eu|http://minio:9000?accessKey=minioadmin&secretKey=minioadmin
restart: unless-stopped
26 changes: 1 addition & 25 deletions tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ services:
- SERVER_SECRET=secret
- ACCOUNTS_URL_INTERNAL=http://account:3003
- ACCOUNTS_URL=http://localhost:3003
- FILES_URL=http://localhost:4031/blob/:workspace/:blobId/:filename
- UPLOAD_URL=http://localhost:4031/upload/form-data/:workspace
- PREVIEW_CONFIG=http://localhost:4031/image/fit=cover,width=:width,height=:height,dpr=:dpr/:workspace/:blobId
- UPLOAD_URL=/files
- ELASTIC_URL=http://elastic:9200
- GMAIL_URL=http://localhost:8088
- CALENDAR_URL=http://localhost:8095
Expand Down Expand Up @@ -278,28 +276,6 @@ services:
- REKONI_URL=http://rekoni:4007
- ACCOUNTS_URL=http://account:3003
- STATS_URL=http://stats:4901
datalake:
image: hardcoreeng/datalake
depends_on:
minio:
condition: service_healthy
cockroach:
condition: service_started
stats:
condition: service_started
account:
condition: service_started
ports:
- 4031:4031
environment:
- PORT=4031
- SECRET=secret
- ACCOUNTS_URL=http://account:3003
- STATS_URL=http://stats:4901
- STREAM_URL=http://localhost:1081/recording
- DB_URL=${DB_PG_URL}
- BUCKETS=blobs,eu|http://minio:9000?accessKey=minioadmin&secretKey=minioadmin
restart: unless-stopped
stats:
image: hardcoreeng/stats
ports:
Expand Down
2 changes: 1 addition & 1 deletion tests/tool.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

export MODEL_VERSION=$(node ../common/scripts/show_version.js)
export STORAGE_CONFIG="datalake|http://localhost:4031"
export STORAGE_CONFIG="minio|minio?accessKey=minioadmin&secretKey=minioadmin"
export ACCOUNTS_URL=http://localhost:3003
export TRANSACTOR_URL=ws://localhost:3334
export ACCOUNT_DB_URL=mongodb://localhost:27018
Expand Down
Loading