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

Improve terminology sync logic #7482

Closed
nijel opened this issue Apr 8, 2022 · 1 comment
Closed

Improve terminology sync logic #7482

nijel opened this issue Apr 8, 2022 · 1 comment
Assignees
Labels
enhancement Adding or requesting a new feature.
Milestone

Comments

@nijel
Copy link
Member

nijel commented Apr 8, 2022

The terminology sync can be currently very verbose in PostgreSQL logs - it tries to insert all the terminology entries and ignores the resulting error:

Just tried it, and it's same as here - #7382 - Postgres spams into its output the same error after I made a commit on remote repo on one component.

2022-02-28 08:24:15.730 UTC [13284] ERROR:  duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
2022-02-28 08:24:15.730 UTC [13284] DETAIL:  Key (translation_id, id_hash)=(22249, -4609853089055109701) already exists.
2022-02-28 08:24:15.730 UTC [13284] STATEMENT:  INSERT INTO "trans_unit" ("translation_id", "id_hash", "location", "context", "note", "flags", "source", "previous_source", "target", "state", "original_state", "details", "position", "num_words", "priority", "pending", "timestamp", "extra_flags", "explanation", "variant_id", "source_unit_id") VALUES (22249,  -4609853089055109701, '', '', '', '', 'white mage', '', '', 0, 0, '{"add_unit": true}', 563, 2, 100, true, '2022-02-28T08:24:15.729933+00:00'::timestamptz, '', '', NULL, 4422961) RETURNING "trans_unit"."id"
2022-02-28 08:24:15.734 UTC [13284] ERROR:  duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
2022-02-28 08:24:15.734 UTC [13284] DETAIL:  Key (translation_id, id_hash)=(237, -3035173709074540976) already exists.
2022-02-28 08:24:15.734 UTC [13284] STATEMENT:  INSERT INTO "trans_unit" ("translation_id", "id_hash", "location", "context", "note", "flags", "source", "previous_source", "target", "state", "original_state", "details", "position", "num_words", "priority", "pending", "timestamp", "extra_flags", "explanation", "variant_id", "source_unit_id") VALUES (237,  -3035173709074540976, '', '', '', '', 'black mage', '', '', 0, 0, '{"add_unit": true}', 557, 2, 100, true, '2022-02-28T08:24:15.734304+00:00'::timestamptz, '', '', NULL, 4423423) RETURNING "trans_unit"."id"
2022-02-28 08:24:15.736 UTC [13284] ERROR:  duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
2022-02-28 08:24:15.736 UTC [13284] DETAIL:  Key (translation_id, id_hash)=(239, -3035173709074540976) already exists.
2022-02-28 08:24:15.736 UTC [13284] STATEMENT:  INSERT INTO "trans_unit" ("translation_id", "id_hash", "location", "context", "note", "flags", "source", "previous_source", "target", "state", "original_state", "details", "position", "num_words", "priority", "pending", "timestamp", "extra_flags", "explanation", "variant_id", "source_unit_id") VALUES (239,  -3035173709074540976, '', '', '', '', 'black mage', '', '', 0, 0, '{"add_unit": true}', 557, 2, 100, true, '2022-02-28T08:24:15.736381+00:00'::timestamptz, '', '', NULL, 4423423) RETURNING "trans_unit"."id"
2022-02-28 08:24:15.738 UTC [13284] ERROR:  duplicate key value violates unique constraint "trans_unit_translation_id_id_hash_ab945589_uniq"
2022-02-28 08:24:15.738 UTC [13284] DETAIL:  Key (translation_id, id_hash)=(240, -3035173709074540976) already exists.
2022-02-28 08:24:15.738 UTC [13284] STATEMENT:  INSERT INTO "trans_unit" ("translation_id", "id_hash", "location", "context", "note", "flags", "source", "previous_source", "target", "state", "original_state", "details", "position", "num_words", "priority", "pending", "timestamp", "extra_flags", "explanation", "variant_id", "source_unit_id") VALUES (240,  -3035173709074540976, '', '', '', '', 'black mage', '', '', 0, 0, '{"add_unit": true}', 557, 2, 100, true, '2022-02-28T08:24:15.738461+00:00'::timestamptz, '', '', NULL, 4423423) RETURNING "trans_unit"."id"

Originally posted by @endervad in #7383 (comment)

The code should look at the number of existing translations and try to add only the missing ones.

@nijel nijel added the enhancement Adding or requesting a new feature. label Apr 8, 2022
@nijel nijel added this to the 4.12 milestone Apr 8, 2022
@nijel nijel self-assigned this Apr 14, 2022
@nijel nijel closed this as completed in 4ccb7f4 Apr 14, 2022
@github-actions
Copy link

Thank you for your report; the issue you have reported has just been fixed.

  • In case you see a problem with the fix, please comment on this issue.
  • In case you see a similar problem, please open a separate issue.
  • If you are happy with the outcome, don’t hesitate to support Weblate by making a donation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding or requesting a new feature.
Projects
None yet
Development

No branches or pull requests

1 participant