Skip to content

Commit

Permalink
HBASE-27039 Some methods of MasterRegion should be annotated for test…
Browse files Browse the repository at this point in the history
…ing only (apache#4433)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit 15002fc)
Change-Id: I44188f67e3a7f44d8ef54099b375023a6a821641
  • Loading branch information
2005hithlj authored and Stephen Wu committed Jun 28, 2022
1 parent 889cab3 commit 1fe4d1b
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import static org.apache.hadoop.hbase.HConstants.HREGION_LOGDIR_NAME;

import com.google.errorprone.annotations.RestrictedApi;
import java.io.IOException;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -141,6 +142,12 @@ public void update(UpdateMasterRegion action) throws IOException {
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);
}
Expand All @@ -149,14 +156,20 @@ public RegionScanner getScanner(Scan scan) throws IOException {
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();
}
Expand Down

0 comments on commit 1fe4d1b

Please sign in to comment.