wchevreuil commented on code in PR #8184: URL: https://github.com/apache/hbase/pull/8184#discussion_r3191554313
########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/RepresentationDecision.java: ########## @@ -0,0 +1,63 @@ +/* + * 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; + +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Decision describing the cached representation for an admitted block. + */ [email protected] +public final class RepresentationDecision { + + private static final RepresentationDecision CURRENT_HBASE_DEFAULT = + new RepresentationDecision(RepresentationKind.CURRENT_HBASE_DEFAULT); + + private final RepresentationKind kind; + + private RepresentationDecision(RepresentationKind kind) { + this.kind = kind; + } + + /** + * Preserves the representation currently produced by existing HBase code paths. + * @return current HBase default representation decision + */ + public static RepresentationDecision currentHBaseDefault() { + return CURRENT_HBASE_DEFAULT; + } + + /** + * Returns a representation decision for the supplied representation kind. + * @param kind representation kind + * @return representation decision + */ + public static RepresentationDecision of(RepresentationKind kind) { + return kind == RepresentationKind.CURRENT_HBASE_DEFAULT + ? CURRENT_HBASE_DEFAULT + : new RepresentationDecision(kind); + } Review Comment: This class seems redundant with RepresentationKind, is it planned to implement any additional logic in the future? Otherwise, can these two just be merged? ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheWriteContext.java: ########## @@ -0,0 +1,187 @@ +/* + * 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; + +import org.apache.hadoop.hbase.io.hfile.BlockType.BlockCategory; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Context for cache insertion. + * <p> + * This object carries insertion intent from read-miss population, write path population, prefetch, + * compaction, or promotion. It is intentionally small and immutable. + * </p> + */ [email protected] +public final class CacheWriteContext { + + private final boolean inMemory; + private final boolean waitWhenCache; + private final boolean cacheCompressed; + private final boolean cacheOnWrite; + private final BlockCategory blockCategory; + private final CacheWriteSource source; + + private CacheWriteContext(Builder builder) { Review Comment: Currently, we have also a separate "cacheCompactedDataOnWrite", which governs cache on write behaviour separately for compaction writes. Should we keep that behaviour here? -- 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]
