dengzhhu653 commented on code in PR #4194: URL: https://github.com/apache/hive/pull/4194#discussion_r1205101054
########## standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/properties/PropertyMap.java: ########## @@ -0,0 +1,477 @@ +/* + * 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.hadoop.hive.metastore.properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; +import java.io.ObjectStreamException; +import java.io.Serializable; +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.TreeMap; +import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.function.Function; + +/** + * A property map pertaining to a given object type (cluster, database, table). + * <p> + * Maps follow a copy-on-write scheme gated by a dirty flag (avoid copy of a dirty map). This allows + * sharing their content (the inner properties map) with guaranteed isolation and thread safety. + * </p> + */ +public class PropertyMap implements Serializable { + // Vital immutable serialization information. + static { + SerializationProxy.registerType(0, PropertyMap.class); + } + + /** + * The logger. + */ + public static final Logger LOGGER = LoggerFactory.getLogger(PropertyMap.class); + /** + * Serial version. + */ + private static final long serialVersionUID = 202212291759L; + /** + * The owning store. + */ + protected final transient PropertyStore store; + /** + * The schema for this map, describes allowed properties and their types. + */ + protected final transient PropertySchema schema; + /** + * The uuid. + */ + protected transient volatile UUID digest; + /** + * The properties and their values; the map is cow-once. + */ + protected transient Map<String, Object> properties; + /** + * Whether this map is dirty which also reflects its copy-on-write state. + */ + protected transient boolean dirty; + + /** + * A digest for dropped maps. + */ + static final UUID DROPPED = new Digester().digest(PropertyMap.class.getName()).digest("dropped").getUUID(); + + /** + * The main ctor. + * + * @param store the store this map belongs to + * @param schema the schema this map adheres to + */ + PropertyMap(PropertyStore store, PropertySchema schema) { + this.store = store; Review Comment: nit: looks like we never use the variable `store`, can we remove 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
