title: duplicate key given in txn request while trying to remove all keys by prefix and put them again
body: <p>Trying to use <a href="https://github.com/coreos/jetcd" rel="noreferrer"><code>coreos/jetcd</code></a> for updating haproxy settings in <code>etcd</code> from Java-code.</p>
  
  <p>What I want to achieve is: </p>
  
  <ol>
  <li>remove all endpoints for single host</li>
  <li>add an updated data for given host</li>
  </ol>
  
  <p>I want to remove all keys by prefix and put actual data in etcd as atomic operation.</p>
  
  <p>That's why I tried to use etcd transactions. My code is:</p>
  
  <pre><code>Op.DeleteOp deleteOp = Op.delete(
          fromString(prefix),
          DeleteOption.newBuilder().withPrefix(fromString(prefix)).build()
  );
  Txn tx = kvClient.txn().Else(deleteOp);
  newKvs.forEach((k,v) -&gt; {
      tx.Else(Op.put(fromString(k), fromString(v), DEFAULT));
  });
  try {
      tx.commit().get();
  } catch (InterruptedException | ExecutionException e) {
      log.error("ETCD transaction failed", e);
      throw new RuntimeException(e);
  }
  </code></pre>
  
  <p>ETCD v3 API is used (etcd v3.2.9). KVstore is initially empty and I want to add 3 records.
  <code>prefix</code> value is:</p>
  
  <pre><code>/proxy-service/hosts/example.com
  </code></pre>
  
  <p>and <code>kvs</code> is a Map:</p>
  
  <pre><code>"/proxy-service/hosts/example.com/FTP/0" -&gt; "localhost:10021"
  "/proxy-service/hosts/example.com/HTTPS/0" -&gt; "localhost:10443"
  "/proxy-service/hosts/example.com/HTTP/0" -&gt; "localhost:10080"
  </code></pre>
  
  <p>An Exception happens on <code>commit().get()</code> line with the following root cause:</p>
  
  <pre><code>Caused by: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: etcdserver: duplicate key given in txn request
      at io.grpc.Status.asRuntimeException(Status.java:526)
      at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:427)
      at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
      at com.coreos.jetcd.internal.impl.ClientConnectionManager$AuthTokenInterceptor$1$1.onClose(ClientConnectionManager.java:267)
      at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:419)
      at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:60)
      at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:493)
      at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$500(ClientCallImpl.java:422)
      at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:525)
      at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
      at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:102)
      ... 3 more
  </code></pre>
  
  <p>What am i doing wrong and how else can I complete several etcd changes as atomic operation?</p>