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]>
  • Loading branch information
2005hithlj authored Jun 2, 2022
1 parent db99208 commit 15002fc
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 @@ -142,6 +143,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 @@ -154,14 +161,20 @@ public RegionScanner getRegionScanner(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 15002fc

Please sign in to comment.