-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Migrations fail in upgrade from 4.x to 5.x with replicated database #4303
Comments
Hi @william00179 can you help me reproduce this? I've started with a docker-compose.yml file which I usually use for testing, modified it to use a replicated database, and configured Unleash to use v4 (image: unleashorg/unleash-server:4) to later upgrade it to v5, but failing to reproduce the issue: version: "3.9"
services:
unleash:
image: unleashorg/unleash-server:4
ports:
- "4242:4242"
environment:
DATABASE_URL: "postgres://postgres:unleash@db/unleash"
DATABASE_SSL: "false"
LOG_LEVEL: "debug"
INIT_ADMIN_API_TOKENS: "*:*.unleash-insecure-admin-api-token"
depends_on:
db:
condition: service_healthy
command: ["node", "index.js"]
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:4242/health || exit 1
interval: 1s
timeout: 1m
retries: 5
start_period: 15s
db:
expose:
- "5432"
image: bitnami/postgresql:15
environment:
# trust incoming connections blindly (DON'T DO THIS IN PRODUCTION!)
POSTGRES_HOST_AUTH_METHOD: "trust"
POSTGRESQL_PGAUDIT_LOG: READ,WRITE
POSTGRESQL_LOG_HOSTNAME: true
POSTGRESQL_REPLICATION_MODE: master
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_DATABASE: unleash
ALLOW_EMPTY_PASSWORD: yes
healthcheck:
test:
[
"CMD",
"pg_isready",
"--username=postgres",
"--host=127.0.0.1",
"--port=5432",
]
interval: 2s
timeout: 1m
retries: 5
start_period: 10s
db-replica:
image: bitnami/postgresql:15
ports:
- "5432"
depends_on:
- db
environment:
POSTGRESQL_MASTER_HOST: db
POSTGRESQL_PGAUDIT_LOG: READ,WRITE
POSTGRESQL_LOG_HOSTNAME: true
POSTGRESQL_REPLICATION_MODE: slave
POSTGRESQL_REPLICATION_USER: repl_user
POSTGRESQL_REPLICATION_PASSWORD: repl_password
POSTGRESQL_MASTER_PORT_NUMBER: 5432
ALLOW_EMPTY_PASSWORD: yes
I'm thinking maybe there are special conditions such as specific DB configuration, or specific unleash versions (notice I've used latest v4 and latest v5). If possible, try to provide more details or a step-by-step way for reproducing the issue. |
Closed due to inactivity. |
This is because there is no primary key on the We experience this issue with AWS Aurora Postgres with a writer / reader cluster. |
@william00179 do you have any advice on how this can be reproduced or solved? I've tried reproducing this in the past but didn't succeed |
This can be solved by supplying a primary key for this table. Postgres is unable to replicate the row without a primary key or replica identity being defined. |
I think we should add primary keys to all tables that have it missing.
I will handle it. |
Follow up of #4303 We are adding primary keys to all tables missing them, currently **role_permission**, **api_token_project**, and **project_stats**. By adding primary keys, the issue with migrations failing during upgrades in replicated database setups will be resolved.
This should be solved in next release |
Describe the bug
When the automatic migrations run on boot after upgrading from 4.x to 5.8.2 the following error is observed on startup.
When using replication with postgres all tables must have a PK or replica identity
Steps to reproduce the bug
No response
Expected behavior
The
role_permission
table should have a PK or replica identity.Logs, error output, etc.
No response
Screenshots
No response
Additional context
No response
Unleash version
No response
Subscription type
Open source
Hosting type
Self-hosted
SDK information (language and version)
No response
The text was updated successfully, but these errors were encountered: