ctubbsii commented on a change in pull request #1851: URL: https://github.com/apache/accumulo/pull/1851#discussion_r552181654
########## File path: test/src/main/java/org/apache/accumulo/test/functional/ZooMutatorIT.java ########## @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.accumulo.test.functional; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +import org.apache.accumulo.core.client.Accumulo; +import org.apache.accumulo.core.clientImpl.ClientContext; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.fate.zookeeper.ZooReaderWriter; +import org.apache.accumulo.harness.AccumuloClusterHarness; +import org.apache.commons.codec.digest.DigestUtils; +import org.junit.Test; + +public class ZooMutatorIT extends AccumuloClusterHarness { + /** + * A simple stress test that looks for race conditions in + * {@link ZooReaderWriter#mutateOrCreate(String, byte[], org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator)} + */ + @Test + public void concurrentMutatorTest() throws Exception { + try (var client = Accumulo.newClient().from(getClientProps()).build()) { + + @SuppressWarnings("resource") + var context = (ClientContext) client; + var secret = cluster.getSiteConfiguration().get(Property.INSTANCE_SECRET); + + ZooReaderWriter zk = new ZooReaderWriter(context.getZooKeepers(), + context.getZooKeepersSessionTimeOut(), secret); + + var execServ = Executors.newFixedThreadPool(16); + + String initialData = DigestUtils.sha1Hex("Accumulo Zookeeper Mutator test 1/4/21") + " 0"; Review comment: Or if it's stored in ZK and manually inspected while troubleshooting... or even just editing the code later, it could create confusion and raise questions over whether that date is important to preserve or not. It doesn't matter, though... I see you've already changed it. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org