ctubbsii commented on a change in pull request #1851: URL: https://github.com/apache/accumulo/pull/1851#discussion_r552339545
########## File path: test/src/main/java/org/apache/accumulo/test/functional/ZooMutatorIT.java ########## @@ -0,0 +1,150 @@ +/* + * 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.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +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.accumulo.test.categories.MiniClusterOnlyTests; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import com.google.common.io.BaseEncoding; + +@Category(MiniClusterOnlyTests.class) +public class ZooMutatorIT extends AccumuloClusterHarness { + /** + * This test uses multiple threads to update the data in a single zookeeper node using + * {@link ZooReaderWriter#mutateOrCreate(String, byte[], org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator)} + * and tries to detect errors and race conditions in that code. Each thread uses + * {@link #nextValue(String)} to compute a new value for the ZK node based on the current value, + * producing a new unique value. The test has sanity checks for the following conditions: + * + * <UL> + * <LI>All updates in the chain of updates were made, none were skipped. + * <LI>No update in the chain of updates is made twice. For example if two threads wrote the exact + * same value to the node this should be detected by the test. + * <LI>The updates in the chain of updates were made in the proper order. + * </UL> Review comment: Thanks. I think the description you added in the above comment helps bring it all together for me. The changes look good to me. ---------------------------------------------------------------- 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