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

Parts not updated after resync via IRS #1082

Closed
2 tasks
ds-mwesener opened this issue Jun 20, 2024 · 9 comments · Fixed by #1181
Closed
2 tasks

Parts not updated after resync via IRS #1082

ds-mwesener opened this issue Jun 20, 2024 · 9 comments · Fixed by #1181
Assignees
Labels
bug Something isn't working

Comments

@ds-mwesener
Copy link
Contributor

ds-mwesener commented Jun 20, 2024

Description

When synchronizing parts, unsuccessful sync attempts lead to the creation of tombstones. A subsequent sync attempt works but does not convert the existing tombstone back into a normal part.

Current behaviour

  • Unsuccessful sync of parts results in tombstones.
  • Successful re-sync does not transform the tombstone into a regular part.

Expected behavior

  • Unsuccessful sync should create tombstones, (As-Is)
  • In case of a subsequent successful sync, the tombstone is removed, and the asset is imported as usual.
  • No sql errors in log for syncing assets with the irs.

Out of scope

  • Tombstone history for not successful syncs

Steps to reproduce the Bug

  1. AdminView -> Create a policy which is different to the default policy
  2. AdminView -> Import Data into Trace-X (Parts) -> choose policy which has been created in step 1)
  3. While the application has not restarted try to sync assets
  4. Trace-X will use the policy which was setup on startup which is not matching with the created one and therefore sync will fail.
    -> Parts are not synced correctly
  5. AdminView -> Delete All policies
  6. Restart trace-x -> now the policy should match
  7. Reload registry
  8. Parts should be updated and have data

Or easier:

  1. Login to db
  2. Change a field of a successful synced part
  3. Regtriy reload
  4. See attribute has not been updated
@github-project-automation github-project-automation bot moved this to inbox in Trace-X Jun 20, 2024
@ds-mwesener ds-mwesener moved this from inbox to backlog in Trace-X Jun 20, 2024
@mkanal mkanal added the bug Something isn't working label Jun 21, 2024
@mkanal mkanal moved this from backlog to next in Trace-X Jun 26, 2024
@ds-mwesener
Copy link
Contributor Author

Please find some logs about an initial registryReload, attached on the ticket.

@ds-mwesener
Copy link
Contributor Author

logs_after_sync.txt

@ds-lcapellino ds-lcapellino moved this from next to wip in Trace-X Jul 2, 2024
ds-lcapellino added a commit to ds-lcapellino/traceability-foss that referenced this issue Jul 2, 2024
ds-lcapellino added a commit to ds-lcapellino/traceability-foss that referenced this issue Jul 2, 2024
ds-mwesener added a commit that referenced this issue Jul 3, 2024
…d-after-sync

bug: #1082 fix parts synchronization
ds-lcapellino added a commit to ds-lcapellino/traceability-foss that referenced this issue Jul 3, 2024
ds-mwesener added a commit that referenced this issue Jul 3, 2024
…d-after-sync

bug: #1082 fix parts synchronization
@ds-lcapellino
Copy link
Contributor

Tested on dev environment together with @ds-mwesener. All assets got updated as expected, tombstones got overriden after successful sync. No SQL exceptions visible in logs.

@ds-lcapellino ds-lcapellino moved this from wip to test in Trace-X Jul 3, 2024
@ds-crehm
Copy link
Contributor

ds-crehm commented Jul 3, 2024

Tested on E2E:
After changing to a wrong policy, the part is replaced by a tombstone. When changing back to the correct policy and syncing again, the tombstone is again replaced with the correct data.

Ready for review.

@ds-crehm ds-crehm moved this from test to review in Trace-X Jul 3, 2024
@ds-crehm ds-crehm assigned mkanal and unassigned ds-crehm Jul 3, 2024
@ds-crehm
Copy link
Contributor

ds-crehm commented Jul 4, 2024

During testing of #884 we noticed some SQL errors in the logs, which must be fixed. Will move this ticket back to WIP.

@ds-crehm ds-crehm moved this from review to wip in Trace-X Jul 4, 2024
@ds-crehm ds-crehm assigned ds-mwesener and ds-lcapellino and unassigned mkanal Jul 4, 2024
ds-lcapellino added a commit that referenced this issue Jul 8, 2024
…or-for-assets-sync' into bug/#1082-fix-duplicate-key-error-for-assets-sync
ds-mwesener added a commit that referenced this issue Jul 8, 2024
…e-key-error-for-assets-sync

bug: 1082 use entity manager instead of repositories to fix duplicate…
@ds-lcapellino
Copy link
Contributor

After merging PR
No exceptions regarding duplicate key errors are thrown, However, error logs like:

2024-07-08T11:45:22.569Z ERROR 1 --- [nio-8080-exec-6] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: duplicate key value violates unique constraint "asset_pkey" Detail: Key (id)=(urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842) already exists.

might still be visible. The error is followed by a info log:

Asset with id urn:uuid:0733946c-59c6-41ae-9570-cb43a6e43842 already exists in the database. The record will be updated instead.

This indicates, that the error was handled properly.

To test the fix, simply delete all assets with:

truncate assets_as_built, assets_as_planned cascade;

and trigger the asset synchronization via the frontend.

No stack traces regarding SQL exceptions should be visible.

@ds-lcapellino ds-lcapellino moved this from wip to test in Trace-X Jul 8, 2024
@ds-crehm
Copy link
Contributor

ds-crehm commented Jul 8, 2024

Tested on dev:
Duplicate key error happens sometimes with the info log as mentioned by @ds-lcapellino.
Couldn't find any other SQL exceptions.

Ready for review.

@ds-crehm ds-crehm reopened this Jul 8, 2024
@ds-crehm ds-crehm moved this from test to review in Trace-X Jul 8, 2024
@ds-crehm ds-crehm assigned mkanal and unassigned ds-crehm Jul 8, 2024
@ds-lcapellino
Copy link
Contributor

Bug found during fixing in IRS: #755

@mkanal
Copy link
Contributor

mkanal commented Jul 9, 2024

LGFM. Shown dugin review. PO acceptance in behalf of @jzbmw.

@mkanal mkanal closed this as completed Jul 9, 2024
@mkanal mkanal moved this from review to done in Trace-X Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment