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

DMP-4858: ObjectOptimisticLockingFailureException when triggering findAndRemoveDuplicateEvent #2670

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ben-Edwards-cgi
Copy link
Contributor

Links

Jira

Change description

Summary of Git Diff

This Git Diff shows updates made to several Java files within the uk.gov.hmcts.darts package. The changes primarily involve modifying method signatures and implementations in repository classes and their corresponding tests to work with Integer IDs instead of entity objects, improving efficiency in database operations.

Highlights

  • CaseManagementRetentionRepositoryTest:

    • Updated getIdsForEvents method to accept a list of event IDs instead of event entities.
    • Modified the deleteAllByEventEntityIn method to delete by event IDs.
  • EventRepositoryTest:

    • Changed the return type of findDuplicateEventIds from a list of EventEntity to a list of Integer IDs.
    • Adjusted assertions to validate against event IDs.
  • CaseManagementRetentionRepository:

    • Updated the deleteAllByEventEntityIn method to use a custom query for deleting by event IDs.
    • Modified the getIdsForEvents method to select IDs based on event IDs.
  • EventLinkedCaseRepository:

    • Similar changes made to deleteAllByEventIn method to work with event IDs.
  • EventRepository:

    • Updated findDuplicateEventIds method to return a list of event IDs instead of entities.
  • RemoveDuplicateEventsProcessorImpl:

    • Refactored to use event IDs instead of event entity objects for duplicate event removal.
    • Simplified the method logic for handling duplicates.
  • RemoveDuplicateEventsProcessorImplTest:

    • Test cases updated to work with Integer IDs instead of EventEntity objects, ensuring consistency with the repository changes.

These changes enhance the efficiency of the application by reducing the overhead of entity management, allowing for direct operations on IDs when interacting with the database.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[X] No

… for using Ids to reduce the likelihood of ObjectOptimisticLockingFailureException
Copy link
Contributor

Plan Result (stg)

Plan: 0 to add, 3 to change, 0 to destroy.
  • Update
    • module.armsa.azurerm_storage_account.storage_account
    • module.postgresql_flexible.azurerm_log_analytics_workspace.pgsql_log_analytics_workspace[0]
    • module.postgresql_flexible.azurerm_monitor_diagnostic_setting.pgsql_diag[0]
Change Result (Click me)
  # module.armsa.azurerm_storage_account.storage_account will be updated in-place
  ~ resource "azurerm_storage_account" "storage_account" {
        id                                 = "/subscriptions/74dacd4f-a248-45bb-a2f0-af700dc4cf68/resourceGroups/darts-stg-rg/providers/Microsoft.Storage/storageAccounts/dartsarmstg"
        name                               = "dartsarmstg"
        tags                               = {
            "application"         = "darts"
            "autoShutdown"        = "true"
            "builtFrom"           = "https://github.com/HMCTS/darts-api.git"
            "businessArea"        = "Cross-Cutting"
            "contactSlackChannel" = "#darts-devs"
            "environment"         = "staging"
            "managedBy"           = "Darts Modernisation"
        }
        # (96 unchanged attributes hidden)

      + network_rules {
          + bypass         = [
              + "AzureServices",
            ]
          + default_action = "Allow"
        }

        # (3 unchanged blocks hidden)
    }

  # module.postgresql_flexible.azurerm_log_analytics_workspace.pgsql_log_analytics_workspace[0] will be updated in-place
  ~ resource "azurerm_log_analytics_workspace" "pgsql_log_analytics_workspace" {
        id                                      = "/subscriptions/74dacd4f-a248-45bb-a2f0-af700dc4cf68/resourceGroups/darts-stg-rg/providers/Microsoft.OperationalInsights/workspaces/darts-api-stg-workspace"
        name                                    = "darts-api-stg-workspace"
      ~ tags                                    = {
          - "application"  = "darts" -> null
          - "builtFrom"    = "https://github.com/HMCTS/darts-shared-infrastructure.git" -> null
          - "businessArea" = "Cross-Cutting" -> null
          - "environment"  = "staging" -> null
        }
        # (15 unchanged attributes hidden)
    }

  # module.postgresql_flexible.azurerm_monitor_diagnostic_setting.pgsql_diag[0] will be updated in-place
  ~ resource "azurerm_monitor_diagnostic_setting" "pgsql_diag" {
        id                             = "/subscriptions/74dacd4f-a248-45bb-a2f0-af700dc4cf68/resourceGroups/darts-stg-rg/providers/Microsoft.DBforPostgreSQL/flexibleServers/darts-api-stg|darts-api-stg-to-log-analytics"
        name                           = "darts-api-stg-to-log-analytics"
        # (5 unchanged attributes hidden)

      - metric {
          - category = "AllMetrics" -> null
          - enabled  = false -> null

          - retention_policy {
              - days    = 0 -> null
              - enabled = false -> null
            }
        }

        # (6 unchanged blocks hidden)
    }

Plan: 0 to add, 3 to change, 0 to destroy.

Copy link
Contributor

Plan Result (prod)

Plan: 0 to add, 3 to change, 0 to destroy.
  • Update
    • module.armsa.azurerm_storage_account.storage_account
    • module.postgresql_flexible.azurerm_log_analytics_workspace.pgsql_log_analytics_workspace[0]
    • module.postgresql_flexible.azurerm_monitor_diagnostic_setting.pgsql_diag[0]
Change Result (Click me)
  # module.armsa.azurerm_storage_account.storage_account will be updated in-place
  ~ resource "azurerm_storage_account" "storage_account" {
        id                                 = "/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-prod-rg/providers/Microsoft.Storage/storageAccounts/dartsarmprod"
        name                               = "dartsarmprod"
        tags                               = {
            "application"         = "darts"
            "builtFrom"           = "https://github.com/HMCTS/darts-api.git"
            "businessArea"        = "Cross-Cutting"
            "contactSlackChannel" = "#darts-devs"
            "environment"         = "production"
            "managedBy"           = "Darts Modernisation"
        }
        # (96 unchanged attributes hidden)

      + network_rules {
          + bypass         = [
              + "AzureServices",
            ]
          + default_action = "Allow"
        }

        # (3 unchanged blocks hidden)
    }

  # module.postgresql_flexible.azurerm_log_analytics_workspace.pgsql_log_analytics_workspace[0] will be updated in-place
  ~ resource "azurerm_log_analytics_workspace" "pgsql_log_analytics_workspace" {
        id                                      = "/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-prod-rg/providers/Microsoft.OperationalInsights/workspaces/darts-api-prod-workspace"
        name                                    = "darts-api-prod-workspace"
      ~ tags                                    = {
          - "application"  = "darts" -> null
          - "builtFrom"    = "https://github.com/HMCTS/darts-shared-infrastructure.git" -> null
          - "businessArea" = "Cross-Cutting" -> null
          - "environment"  = "production" -> null
        }
        # (15 unchanged attributes hidden)
    }

  # module.postgresql_flexible.azurerm_monitor_diagnostic_setting.pgsql_diag[0] will be updated in-place
  ~ resource "azurerm_monitor_diagnostic_setting" "pgsql_diag" {
        id                             = "/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-prod-rg/providers/Microsoft.DBforPostgreSQL/flexibleServers/darts-api-prod|darts-api-prod-to-log-analytics"
        name                           = "darts-api-prod-to-log-analytics"
        # (5 unchanged attributes hidden)

      - metric {
          - category = "AllMetrics" -> null
          - enabled  = false -> null

          - retention_policy {
              - days    = 0 -> null
              - enabled = false -> null
            }
        }

        # (6 unchanged blocks hidden)
    }

Plan: 0 to add, 3 to change, 0 to destroy.

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

Successfully merging this pull request may close these issues.

2 participants