VladRodionov commented on code in PR #8739: URL: https://github.com/apache/hbase/pull/8739#discussion_r4251471048
########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/persistence/HadoopFsCachePersistenceStorage.java: ########## @@ -0,0 +1,419 @@ +/* + * 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.hbase.io.hfile.cache.persistence; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FSDataOutputStream; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * {@link CachePersistenceStorage} implementation backed by a Hadoop {@link FileSystem}. + * <p> + * This implementation works with filesystems available through Hadoop's filesystem abstraction, + * including HDFS and the local filesystem. + * </p> + * <p> + * Every persistence storage key is represented as a file below a configured root directory. Keys + * may contain relative path components separated by {@code /}, allowing higher-level persistence + * infrastructure to organize state by component role. + * </p> + * <p> + * Persistence writes are first written to a temporary file. The temporary file is promoted to the + * committed state path only after the caller explicitly commits the write. An abandoned write + * deletes its temporary file and leaves previously committed state unchanged. + * </p> + * <p> + * Publication uses filesystem rename operations. Rename atomicity and implementation details are + * determined by the underlying Hadoop filesystem. For filesystems where rename is implemented as + * copy-and-delete, publication has the corresponding filesystem semantics. + * </p> + * <p> + * This class does not own the supplied {@link FileSystem} and does not close it. + * </p> + */ [email protected] +public class HadoopFsCachePersistenceStorage implements CachePersistenceStorage { Review Comment: This is the specific Hadoop FS implementation. I designed the API itself to be generic, and this first storage implementation is not intended to be the only one. Hadoop FileSystem supports the local filesystem as well as HDFS and other Hadoop-compatible storage systems, so a single implementation can already cover multiple storage types, including local persistent storage. If we find in the future that a dedicated local-filesystem implementation provides meaningful performance or behavioral advantages, we can certainly add one. -- 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]
