• Icon: Sub-task Sub-task
    • Resolution: Unresolved
    • Icon: Medium Medium
    • New Delhi Release
    • None
    • CPS-Core, NCMP
    • None

      Investigate AlreadyDefinedException & batch error reporting:

      Expand on how below works

      1. Origin of exception (org.onap.cps.spi.impl.CpsDataPersistenceServiceImpl#addNewChildDataNode)
        The original exception is thrown in the cps-ri layer of the application in the addNewChildDataNode ** method.
        Then the exception is caught in the retrySavingEachChildIndividually method of the same class. 
        There the new node added to a list of failed registration attempts (the xPath of the new nodes are collected).
        Finally, if the above mentioned failedXpaths list is not empty the application throws a new AlredayDefinedException with the list of failed DataNodes.
        Later that exception is handled in the NCMP service layer and the response returns the failed cmHandle ids.
      2. How is retry performed from on remain cm handles in same batch
        During the registration NCMP creates batches of new CmHandles (An ArrayList of objects, each contains a 100 new cmHandles).
        Then in the cps-ri module CPS attempts to save all items in the list (addChildrenDataNodes  method). If a CmHandle was already registered with the same id a DataIntegrityViolationException is thrown.
        After that CPS tries to save all objects individually, one by one.
        When the application tries to register the CmHandle with the already existing id the above described algorithm gets executed.
        The problematic CmHandle gets reported as a failed registration attempt, but the rest of the objects are registered as new CmHandles.
      3. How is the error information amalgamated (for multiple failures in one batch in and in multiple batches)
        The collection of the error information is simple. In the response we do not have any information about the created CmHandles, only the failed registrations/updates are being reported.
        The collection of the failed registrations happens in the NetworkCmProxyDataServiceImpl#registerNewCmHandles method.
        In this example  two cmHandles were added in the first batch, one in the second.
      {    
      "failedCreatedCmHandles": [        
          { "cmHandle": "2f368987b343449181bf8bdc229ee53d", "errorCode": "109", "errorText": "cm-handle already exists"},        
          { "cmHandle": "fadf2cf4d85545eeb328041c35175aa8", "errorCode": "109", "errorText": "cm-handle already exists"},        
          { "cmHandle": "dc44c2f893f84b7e98acd41b2832836c", "errorCode": "109", "errorText": "cm-handle already exists"}    
       ],    
      "failedUpdatedCmHandles": [],    
      "failedRemovedCmHandles": [],    
      "failedUpgradeCmHandles": []
      } 

            leventecsanyi Levente Csanyi
            leventecsanyi Levente Csanyi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: