Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-592

Always get ConflictingModificationException when writing

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • mdsal
    • None
    • Operating System: Linux
      Platform: PC

    • 1280

    Description

      I'm trying to write to the operational store from an RPC method. The problem is that even though there's only one write happening anywhere and no deletes, nonetheless I always get back:

      org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException: errors: [error-type: application, error-tag: operation-failed, error-message: The operation encountered an unexpected error while executing.error-info: org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException: Node was deleted by other transaction.

      A slightly simplified version of the code is below. This was working with the old API.

      Function<RpcResult<TransactionStatus>, RpcResult<Void>> futureTrans =
      new Function<RpcResult<TransactionStatus>,RpcResult<Void>>() {
      @Override
      public RpcResult<Void> apply(RpcResult<TransactionStatus> input)

      { return Rpcs.<Void>getRpcResult(input.isSuccessful(), input.getErrors()); }

      };

      public Future<RpcResult<Void>>
      registerEndpoint(RegisterEndpointInput input) {
      WriteTransaction t = dataProvider.newWriteOnlyTransaction();

      Endpoint ep = buildEndpoint(input)
      .setTimestamp(timestamp)
      .build();

      EndpointKey key =
      new EndpointKey(ep.getL2Context(), ep.getMacAddress());
      InstanceIdentifier<Endpoint> iid =
      InstanceIdentifier.builder(Endpoints.class)
      .child(Endpoint.class, key)
      .build();

      t.put(LogicalDatastoreType.OPERATIONAL, iid, ep);

      ListenableFuture<RpcResult<TransactionStatus>> r = t.commit();
      return Futures.transform(r, futureTrans, executor);
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tony.tkacik@gmail.com Tony Tkacik
            readams Rob Adams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: