Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-13753

Refactor code that caches stale entity references

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.5.0
    • 2.2.0
    • ambari-server
    • None

    Description

      Problems:

      • Deleted hostcomponent rows re-appear
      • Inconsistencies in hostcomponentstate and hostcomponentdesiredstate tables

      Analysis:

      • Stale entity references cached that point to dettached entites and may get persisted in altogether different transaction
      • Cascaded persist annotation mixed with manual bi-directional persist operations. The manual persist was done since there are cached references in the object hierarchy at different levels. The Casade addition seems to have been an after thought added on even though manual bi-directional perist laways existed.

      Patch details:

      • Make sure cached references are refreshed on getter / setter methods
      • Remove Cascaded persist for only those relations that could result in un-intentional persist of the relationship with downstream objects. eg: ServiceComponentHostDesiredStateEntity
      • Marked HostRoleCommand and ExecutionCommand as non-Cacheable entites for JPA
      • Make sure bi-directional persist is present on non-Cascaded entities
      • Removed refresh() calls that were responsible for refreshing cached entity objects

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            swagle Siddharth Wagle
            swagle Siddharth Wagle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment