Skip to content
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

PGsql ERROR: duplicate key value violates unique constraint "UQE_jfs_xattr_name" #1683

Closed
solracsf opened this issue Mar 30, 2022 · 3 comments · Fixed by #1825
Closed

PGsql ERROR: duplicate key value violates unique constraint "UQE_jfs_xattr_name" #1683

solracsf opened this issue Mar 30, 2022 · 3 comments · Fixed by #1825
Assignees

Comments

@solracsf
Copy link
Contributor

solracsf commented Mar 30, 2022

On the server (postgres 14.2) log, multiple entries:

ERROR:  duplicate key value violates unique constraint "UQE_jfs_xattr_name"
DETAIL:  Key (inode, name)=(1, lastBackup) already exists.
STATEMENT:  INSERT INTO "jfs_xattr" ("inode","name","value") VALUES ($1,$2,$3)
@solracsf solracsf added the kind/bug Something isn't working label Mar 30, 2022
@zhijian-pro
Copy link
Contributor

What is the way to reproduce, I cannot reproduce this problem by setting extended attributes when I use the postgres database as meta

@zhijian-pro zhijian-pro self-assigned this Apr 2, 2022
@solracsf
Copy link
Contributor Author

solracsf commented Apr 2, 2022

These are my settings:

juicefs format \
    --compress zstd \
    --trash-days 3 \
    --storage s3 \
    --shards 32 \
    --encrypt-rsa-key jfs.pem \
    --bucket https://jfs-sharder%d.s3.com \
    --access-key xxxxxxxxxx \
    --secret-key xxxxxxxx \
    postgres://jfs:[email protected]:5432/jfs \
    data
juicefs mount \
    --no-usage-report \
    --background \
    --max-uploads 256 \
    --cache-size 8192 \
    --cache-dir /var/cache/jfs-sharder \
    --log /var/log/jfs-sharder.log \
    postgres://jfs:[email protected]:5432/jfs \
    data

This has something to do with automatic metadata because if --backup-meta 0 is set on mount, error is no longer logged.

@davies davies removed the kind/bug Something isn't working label Apr 19, 2022
@davies
Copy link
Contributor

davies commented Apr 19, 2022

@solracsf When we create a xattr with XattrCreateOrReplace flag, it's normal to insert it first (fail with duplicated key), then it will update it.

It's better to use upsert for PG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants