Copilot commented on code in PR #8155: URL: https://github.com/apache/hbase/pull/8155#discussion_r3150543540
########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopology.java: ########## @@ -0,0 +1,177 @@ +/* + * 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 java.util.List; +import java.util.Optional; +import org.apache.hadoop.hbase.io.hfile.BlockCacheKey; +import org.apache.hadoop.hbase.io.hfile.CacheStats; +import org.apache.hadoop.hbase.io.hfile.Cacheable; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Describes orchestration of one or more cache engines. + * + * <p>{@code CacheTopology} is responsible for the structural relationship between cache engines, + * for example a single-engine cache, a tiered exclusive L1/L2 cache, or a tiered inclusive L1/L2 + * cache.</p> Review Comment: The class-level Javadoc contains lines that look to exceed the 100-character Checkstyle limit (LineLength max=100), e.g. the wrapped sentence about tiered exclusive/inclusive caches here. Please reflow/wrap these lines to avoid Checkstyle failures. ```suggestion * <p>{@code CacheTopology} is responsible for the structural relationship between * cache engines, for example a single-engine cache, a tiered exclusive L1/L2 * cache, or a tiered inclusive L1/L2 cache.</p> ``` ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/SingleEngineTopology.java: ########## @@ -0,0 +1,87 @@ +/* + * 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 java.util.Collections; +import java.util.List; +import java.util.Optional; +import org.apache.hadoop.hbase.io.hfile.BlockCacheKey; +import org.apache.hadoop.hbase.io.hfile.CacheStats; +import org.apache.hadoop.hbase.io.hfile.Cacheable; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Single-engine cache topology. + * + * <p>This topology wraps a single {@link CacheEngine}. It is primarily useful as a baseline + * topology and as a simple bridge for cache configurations that do not use L1/L2 tiering.</p> Review Comment: The class Javadoc here looks to exceed the 100-character Checkstyle LineLength limit (max=100), especially the sentence on the second line of this paragraph. Please wrap/reflow to avoid Checkstyle failures. ```suggestion * <p>This topology wraps a single {@link CacheEngine}. It is primarily useful as a * baseline topology and as a simple bridge for cache configurations that do not use * L1/L2 tiering.</p> ``` ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopologyView.java: ########## @@ -0,0 +1,87 @@ +/* + * 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 java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Default immutable-style read-only view over a {@link CacheTopology}. + * + * <p>This view delegates to the topology and exposes only read-only engine views.</p> + */ [email protected] +final class CacheTopologyView { + + private final CacheTopology topology; + + /** + * Constructs a CacheTopologyView for the given CacheTopology. + */ + CacheTopologyView(CacheTopology topology) { + this.topology = topology; + } + + /** + * Delegating getters for topology properties and read-only engine views. + */ + + public String getName() { + return topology.getName(); + } + /** + * Returns the cache topology type, which can be SINGLE, L1_L2, or CUSTOM. + * @return the cache topology type + */ + public CacheTopologyType getType() { + return topology.getType(); + } + + /** + * Returns the list of cache tiers in this topology. For a single-tier topology, it returns a list + * containing only CacheTier.SINGLE. For a multi-tier topology, it returns a list containing + * CacheTier.L1 and CacheTier.L2. + * @return the list of cache tiers in this topology + */ + public List<CacheTier> getTiers() { + return topology.getEngines().size() == 1 + ? List.of(CacheTier.SINGLE) + : List.of(CacheTier.L1, CacheTier.L2); Review Comment: `CacheTopologyView#getTiers()` infers tiers solely from `topology.getEngines().size()`. This will misreport tiers for `CUSTOM` topologies (or any topology with >2 engines, or with only L1 defined, etc.). Consider deriving the tier list based on `topology.getEngine(CacheTier.*).isPresent()` (or adding an explicit `getTiers()`/`getDefinedTiers()` API on `CacheTopology`). ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopologyView.java: ########## @@ -0,0 +1,87 @@ +/* + * 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 java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Default immutable-style read-only view over a {@link CacheTopology}. + * + * <p>This view delegates to the topology and exposes only read-only engine views.</p> + */ [email protected] +final class CacheTopologyView { + + private final CacheTopology topology; + + /** + * Constructs a CacheTopologyView for the given CacheTopology. + */ + CacheTopologyView(CacheTopology topology) { + this.topology = topology; + } + + /** + * Delegating getters for topology properties and read-only engine views. + */ + + public String getName() { + return topology.getName(); + } + /** + * Returns the cache topology type, which can be SINGLE, L1_L2, or CUSTOM. + * @return the cache topology type + */ + public CacheTopologyType getType() { + return topology.getType(); Review Comment: The Javadoc for `getType()` mentions `L1_L2`, but `CacheTopologyType` defines `TIERED_EXCLUSIVE` / `TIERED_INCLUSIVE` instead. Please update the comment so it matches the actual enum values (and avoids documenting a non-existent type). ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopologyView.java: ########## @@ -0,0 +1,87 @@ +/* + * 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 java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Default immutable-style read-only view over a {@link CacheTopology}. + * + * <p>This view delegates to the topology and exposes only read-only engine views.</p> + */ [email protected] +final class CacheTopologyView { + + private final CacheTopology topology; + + /** + * Constructs a CacheTopologyView for the given CacheTopology. + */ + CacheTopologyView(CacheTopology topology) { + this.topology = topology; + } + + /** + * Delegating getters for topology properties and read-only engine views. + */ + + public String getName() { + return topology.getName(); + } + /** + * Returns the cache topology type, which can be SINGLE, L1_L2, or CUSTOM. + * @return the cache topology type + */ + public CacheTopologyType getType() { + return topology.getType(); + } + + /** + * Returns the list of cache tiers in this topology. For a single-tier topology, it returns a list + * containing only CacheTier.SINGLE. For a multi-tier topology, it returns a list containing + * CacheTier.L1 and CacheTier.L2. Review Comment: This Javadoc line exceeds the repository's 100-character Checkstyle limit (see `hbase-checkstyle/.../checkstyle.xml` LineLength max=100). Please wrap it to avoid Checkstyle failures. ```suggestion * Returns the list of cache tiers in this topology. For a single-tier topology, it * returns a list containing only CacheTier.SINGLE. For a multi-tier topology, it * returns a list containing CacheTier.L1 and CacheTier.L2. ``` ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopologyView.java: ########## @@ -0,0 +1,87 @@ +/* + * 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 java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Default immutable-style read-only view over a {@link CacheTopology}. + * + * <p>This view delegates to the topology and exposes only read-only engine views.</p> + */ [email protected] +final class CacheTopologyView { + + private final CacheTopology topology; + + /** + * Constructs a CacheTopologyView for the given CacheTopology. + */ + CacheTopologyView(CacheTopology topology) { + this.topology = topology; + } + + /** + * Delegating getters for topology properties and read-only engine views. + */ + + public String getName() { + return topology.getName(); + } + /** + * Returns the cache topology type, which can be SINGLE, L1_L2, or CUSTOM. + * @return the cache topology type + */ + public CacheTopologyType getType() { + return topology.getType(); + } + + /** + * Returns the list of cache tiers in this topology. For a single-tier topology, it returns a list + * containing only CacheTier.SINGLE. For a multi-tier topology, it returns a list containing + * CacheTier.L1 and CacheTier.L2. + * @return the list of cache tiers in this topology + */ + public List<CacheTier> getTiers() { + return topology.getEngines().size() == 1 + ? List.of(CacheTier.SINGLE) + : List.of(CacheTier.L1, CacheTier.L2); + } + + /** + * Returns an Optional containing a CacheEngineView for the specified cache tier if it exists in + * the topology, or an empty Optional if the tier is not present. + * @param tier the cache tier for which to retrieve the engine view + * @return an Optional containing the CacheEngineView for the specified tier, or empty if not present Review Comment: This `@return` Javadoc line appears to exceed the 100-character Checkstyle limit (LineLength max=100). Please wrap it to avoid Checkstyle failures. ```suggestion * @return an Optional containing the CacheEngineView for the specified tier, * or empty if not present ``` ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/TieredExclusiveTopology.java: ########## @@ -0,0 +1,119 @@ +/* + * 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 java.util.Arrays; +import java.util.List; +import java.util.Optional; +import org.apache.hadoop.hbase.io.hfile.BlockCacheKey; +import org.apache.hadoop.hbase.io.hfile.CacheStats; +import org.apache.hadoop.hbase.io.hfile.Cacheable; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Tiered exclusive cache topology. + * + * <p>In an exclusive topology, a block should normally reside in only one tier at a time. + * Promotion from L2 to L1 is therefore modeled as a move: insert into L1 and evict from L2.</p> + * + * <p>This class is introduced as a topology foundation. Production wiring and policy-driven + * routing are handled in later migration phases.</p> Review Comment: This Javadoc line appears to exceed the 100-character Checkstyle LineLength limit (max=100). Please wrap/reflow it to avoid Checkstyle failures. ```suggestion * <p>In an exclusive topology, a block should normally reside in only one tier * at a time. Promotion from L2 to L1 is therefore modeled as a move: insert * into L1 and evict from L2.</p> * * <p>This class is introduced as a topology foundation. Production wiring and * policy-driven routing are handled in later migration phases.</p> ``` ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopology.java: ########## @@ -0,0 +1,177 @@ +/* + * 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 java.util.List; +import java.util.Optional; +import org.apache.hadoop.hbase.io.hfile.BlockCacheKey; +import org.apache.hadoop.hbase.io.hfile.CacheStats; +import org.apache.hadoop.hbase.io.hfile.Cacheable; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Describes orchestration of one or more cache engines. + * + * <p>{@code CacheTopology} is responsible for the structural relationship between cache engines, + * for example a single-engine cache, a tiered exclusive L1/L2 cache, or a tiered inclusive L1/L2 + * cache.</p> + * + * <p>This abstraction does not own storage. Storage belongs to {@link CacheEngine}. This + * abstraction also does not decide admission or write placement. Admission, placement, + * representation, and promotion decisions belong to the policy layer.</p> + * + * <p>Responsibilities of a cache topology include:</p> + * <ul> + * <li>exposing participating cache engines</li> + * <li>mapping engines to logical tiers such as L1 and L2</li> + * <li>providing aggregate cache statistics</li> + * <li>performing topology-specific promotion when requested by policy</li> + * <li>optionally performing topology-specific demotion</li> + * <li>coordinating shutdown of participating engines</li> + * </ul> + * + * <p>Non-responsibilities include:</p> + * <ul> + * <li>block storage</li> + * <li>local eviction algorithms</li> + * <li>cache admission control</li> + * <li>write routing / target tier selection</li> + * <li>HFile read/write path integration</li> + * </ul> + */ [email protected] +public interface CacheTopology { + + /** + * Returns a human-readable topology name. + * + * <p>The name is intended for logging, metrics, diagnostics, and configuration reporting. It + * should be stable for the lifetime of this topology instance.</p> + * + * @return topology name + */ + String getName(); + + /** + * Returns the topology type. + * + * <p>The type identifies the topology family, such as single-engine, tiered exclusive, or tiered + * inclusive.</p> + * + * @return topology type + */ + CacheTopologyType getType(); + + /** + * Returns the cache engines participating in this topology. + * + * <p>The returned list is primarily intended for diagnostics, metrics, and topology inspection. + * Callers should not use it to bypass topology and policy logic for normal cache operations.</p> + * + * @return participating cache engines + */ + List<CacheEngine> getEngines(); + + /** + * Returns the cache engine associated with the given logical tier, if one exists. + * + * <p>For example, a tiered topology may expose an L1 and L2 engine. A single-engine topology may + * return an engine for {@link CacheTier#SINGLE} and an empty result for L1/L2.</p> + * + * @param tier logical cache tier + * @return cache engine for the tier, or empty if this topology does not define that tier + */ + Optional<CacheEngine> getEngine(CacheTier tier); + + /** + * Returns aggregate topology-level cache statistics. + * + * <p>For a single-engine topology, this may simply return the underlying engine statistics. For a + * multi-engine topology, this should represent an aggregate view suitable for compatibility with + * existing HBase block cache metrics.</p> + * + * @return aggregate cache statistics + */ + CacheStats getStats(); + + /** + * Promotes a cached block from one engine to another. + * + * <p>This method performs the topology-specific mechanics of promotion. The decision whether a + * block should be promoted belongs to the placement/admission policy layer. For example, a policy + * may decide that an index block found in L2 should be promoted to L1, and then call this method + * to perform the promotion.</p> + * + * <p>Implementations may either copy or move the block depending on topology semantics. For + * example:</p> + * <ul> + * <li>inclusive topology may copy the block into the target tier while retaining it in source</li> + * <li>exclusive topology may move the block into the target tier and remove it from source</li> + * </ul> + * + * @param cacheKey block cache key + * @param block cached block to promote + * @param sourceEngine engine where the block was found + * @param targetEngine engine where the block should be promoted + * @return {@code true} if promotion was performed, {@code false} otherwise + */ + boolean promote(BlockCacheKey cacheKey, Cacheable block, CacheEngine sourceEngine, + CacheEngine targetEngine); + + /** + * Demotes a cached block from one engine to another. + * + * <p>Demotion is optional because not all topologies or cache engines can support it efficiently. + * In many implementations, eviction does not expose the evicted block in a form that can be + * cheaply demoted. The default implementation therefore performs no action.</p> + * + * <p>The decision whether demotion should happen belongs to the policy layer or to a + * topology-specific eviction callback mechanism. This method only provides a standard hook for + * topologies that support demotion.</p> + * + * @param cacheKey block cache key + * @param block cached block to demote + * @param sourceEngine engine from which the block is being demoted + * @param targetEngine engine where the block should be demoted + * @return {@code true} if demotion was performed, {@code false} otherwise + */ + default boolean demote(BlockCacheKey cacheKey, Cacheable block, CacheEngine sourceEngine, + CacheEngine targetEngine) { + return false; + } + + /** + * Shuts down this topology and any cache engines owned by it. + * + * <p>If the topology does not own the lifecycle of its engines, the implementation should document + * that behavior. The default expectation is that shutting down a topology shuts down participating + * engines.</p> + */ + void shutdown(); + + /** + * Returns a read-only view of this topology. + * + * <p>The returned view is intended for policy implementations, diagnostics, and metrics. It should + * expose topology and engine state without allowing callers to mutate cache contents or bypass + * topology behavior.</p> + * + * @return read-only topology view + */ + CacheTopologyView getView(); Review Comment: `CacheTopology#getView()` returns `CacheTopologyView`, but `CacheTopologyView` is package-private. Exposing a non-public type in a public interface makes this method unusable (and the interface hard to implement/use) from outside `org.apache.hadoop.hbase.io.hfile.cache`. Consider making `CacheTopologyView` (and `CacheEngineView`) `public` (still `@InterfaceAudience.Private`), or changing `getView()` to return a public interface/type that does not leak package-private classes. ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheEngineView.java: ########## @@ -0,0 +1,97 @@ +/* + * 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.Cacheable; +import org.apache.hadoop.hbase.io.hfile.HFileBlock; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Default read-only view over a {@link CacheEngine}. + */ [email protected] +class CacheEngineView { + + private final CacheEngine engine; + + /** Create a new view over the given cache engine. */ + + CacheEngineView(CacheEngine engine) { + this.engine = engine; + } + + /* Getters for cache engine properties. */ + /** + * Returns the name of the cache engine. + * @return the name of the cache engine + */ + public String getName() { + return engine.getName(); + } + + /** + * Returns the type of the cache engine. + * @return the type of the cache engine + */ + public CacheEngineType getType() { + return engine.getType(); + } + + /** + * Returns the maximum size of the cache in bytes. + * @return the maximum size of the cache in bytes + */ + public long getMaxSize() { + return engine.getMaxSize(); + } + + /** + * Returns the current size of the cache in bytes. + * @return the current size of the cache in bytes + */ + public long getCurrentSize() { + return engine.getCurrentSize(); + } + + /** + * Returns the free size of the cache in bytes. + * @return the free size of the cache in bytes + */ + public long getFreeSize() { + return engine.getFreeSize(); + } + + /** + * Returns the number of blocks currently stored in the cache. + * @return the number of blocks currently stored in the cache + */ + public long getBlockCount() { + return engine.getBlockCount(); + } + + /** + * Returns the number of blocks currently stored in the cache. + * @return the number of blocks currently stored in the cache + */ + public boolean canStore(Cacheable block) { + if (block instanceof HFileBlock) { + return engine.blockFitsIntoTheCache((HFileBlock) block).orElse(true); + } + return true; Review Comment: The Javadoc for `canStore` currently says it returns “the number of blocks currently stored in the cache”, which is incorrect and duplicates the `getBlockCount()` description. Please update the Javadoc to describe the actual behavior (whether a given block can fit / be stored). ########## hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheEngine.java: ########## @@ -0,0 +1,319 @@ +/* + * 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 java.util.Optional; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.io.hfile.BlockCacheKey; +import org.apache.hadoop.hbase.io.hfile.BlockType; +import org.apache.hadoop.hbase.io.hfile.CacheStats; +import org.apache.hadoop.hbase.io.hfile.Cacheable; +import org.apache.hadoop.hbase.io.hfile.HFileBlock; +import org.apache.yetus.audience.InterfaceAudience; + +/** + * Storage abstraction for a concrete HBase block cache backend. + * + * <p>A {@code CacheEngine} represents the storage layer only. It is responsible for storing, + * retrieving, invalidating, and reporting statistics for cached blocks. It does not perform + * tier orchestration, admission control, placement decisions, or promotion/demotion across + * cache levels.</p> + * + * <p>This interface is intentionally aligned with the storage-oriented subset of the current + * {@code BlockCache} contract so that existing implementations such as LruBlockCache and + * BucketCache can be migrated incrementally with minimal behavioral risk.</p> Review Comment: Several Javadoc lines in this file appear to exceed the 100-character Checkstyle limit (LineLength max=100). For example, the paragraph starting here should be wrapped to avoid Checkstyle failures during the build. -- 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]
