ctubbsii commented on code in PR #5357: URL: https://github.com/apache/accumulo/pull/5357#discussion_r1970706357
########## server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeProgressTracker.java: ########## @@ -0,0 +1,162 @@ +/* + * 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 + * + * https://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.manager.upgrade; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.apache.accumulo.core.util.LazySingletons.GSON; + +import java.util.Objects; + +import org.apache.accumulo.core.Constants; +import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter; +import org.apache.accumulo.core.fate.zookeeper.ZooUtil.NodeExistsPolicy; +import org.apache.accumulo.core.fate.zookeeper.ZooUtil.NodeMissingPolicy; +import org.apache.accumulo.server.AccumuloDataVersion; +import org.apache.accumulo.server.ServerContext; +import org.apache.zookeeper.KeeperException; + +import com.google.common.base.Preconditions; + +/** + * Methods in this class are public **only** for UpgradeProgressTrackerIT + */ +public class UpgradeProgressTracker { + + public static class ComponentVersions { + private int zooKeeperVersion; + private int rootVersion; + private int metadataVersion; + + public int getZooKeeperVersion() { + return zooKeeperVersion; + } Review Comment: There's a lot of synchronization on writing these versions, but none on the reads, and the fields are not volatile or atomic, so they could be out of date in some threads. EDIT: after looking at this more, I think the synchronization seems to be more about protecting collision on interacting with ZooKeeper than it is about thread safety/concurrency in this tracker class. I made suggestions about that using Zookeeper primitives for read-modify-write in my other comments. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
