You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2022/06/02 13:45:36 UTC

[hbase] branch branch-2.4 updated: HBASE-27039 Some methods of MasterRegion should be annotated for testing only (#4433)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 3ce6e1afe7e HBASE-27039 Some methods of MasterRegion should be annotated for testing only (#4433)
3ce6e1afe7e is described below

commit 3ce6e1afe7ed09b83b4ddd4d23f5ed5f25c3d192
Author: LiangJun He <20...@163.com>
AuthorDate: Thu Jun 2 21:27:25 2022 +0800

    HBASE-27039 Some methods of MasterRegion should be annotated for testing only (#4433)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
    (cherry picked from commit 15002fccb4abb187467a9355f436d533928da7ef)
---
 .../org/apache/hadoop/hbase/master/region/MasterRegion.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java
index b1381b7e118..3a31567a64f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.master.region;
 
 import static org.apache.hadoop.hbase.HConstants.HREGION_LOGDIR_NAME;
 
+import com.google.errorprone.annotations.RestrictedApi;
 import java.io.IOException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -130,6 +131,12 @@ public final class MasterRegion {
     flusherAndCompactor.onUpdate();
   }
 
+  /**
+   * The design for master region is to only load all the data to memory at once when starting, so
+   * typically you should not use the get method to get a single row of data at runtime.
+   */
+  @RestrictedApi(explanation = "Should only be called in tests", link = "",
+      allowedOnPath = ".*/src/test/.*")
   public Result get(Get get) throws IOException {
     return region.get(get);
   }
@@ -138,14 +145,20 @@ public final class MasterRegion {
     return region.getScanner(scan);
   }
 
+  @RestrictedApi(explanation = "Should only be called in tests", link = "",
+      allowedOnPath = ".*/src/test/.*")
   public FlushResult flush(boolean force) throws IOException {
     return region.flush(force);
   }
 
+  @RestrictedApi(explanation = "Should only be called in tests", link = "",
+      allowedOnPath = ".*/src/test/.*")
   public void requestRollAll() {
     walRoller.requestRollAll();
   }
 
+  @RestrictedApi(explanation = "Should only be called in tests", link = "",
+      allowedOnPath = ".*/src/test/.*")
   public void waitUntilWalRollFinished() throws InterruptedException {
     walRoller.waitUntilWalRollFinished();
   }