Skip to content

Progressive inconsistencies between Dependency Track database and lucene indexes #2235

Closed

Description

@syalioune

Current Behavior

Overtime, the content of dependency track lucene drift from the database because of several factors :

Steps to Reproduce

1.Create a project
2.Upload a SBOM
3.Check that lucene component index is updated using API /api/v1/search/component
4.Recursively delete the project
5.Check that lucene component index is untouched using API /api/v1/search/component (Same results as in step 3)

Expected Behavior

Dependency Track database is as consistent as possible with Dependency Track Lucene index without resorting to multiple index rebuild

Dependency-Track Version

4.7.0-SNAPSHOT

Dependency-Track Distribution

Container Image, Executable WAR

Database Server

PostgreSQL

Database Server Version

No response

Browser

Google Chrome

Checklist

Activity

  1. added
    defect
    on Dec 5, 2022
  2. nscuro commented on Dec 6, 2022

    @nscuro
    Member

    Thanks for reporting @syalioune!

    Is this something that can be fixed entirely, or do we just have to accept that there will always be a certain drift / lag? I reckon #2200 reduces the drift for the most part (depending on portfolio activity, the drift could still be significant).

    Even if we add more index update operations, the point you made here will still be true:

    Lucene indexes are updated asynchronously and can thus fail due to a lot of reasons (apiserver restart, I/O issues,...) whereas DB is correctly updated

    Just wondering if we can assume this issue to be fixed once #2200 is merged, or whether we need to go harder on properly maintaining the indexes in order to resolve it.

  3. added
    p2
    on Dec 6, 2022
  4. syalioune commented on Dec 6, 2022

    @syalioune
    ContributorAuthor

    By design, there will always be an unwanted drift. However, I feel like we can spend some time reviewing the database update flow to identifiy trivial gaps to fill like the example given in the description.
    Maybe also improve the implementation to make indexing easier, straightforward and oversight resistant. I'm thinking about DN Lifecycle listeners and Transaction synchronization to automatically hook into entities update and DN commit/rollback.

  5. nscuro commented on Sep 16, 2024

    @nscuro
    Member

    We started using lifecycle listeners as recommended in a few places:

  6. github-actions commented on Oct 18, 2024

    @github-actions
    Contributor

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked as resolved and limited conversation to collaborators on Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions