Skip to content

Commit 15002fc

Browse files
authored
HBASE-27039 Some methods of MasterRegion should be annotated for testing only (#4433)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
1 parent db99208 commit 15002fc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

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

22+
import com.google.errorprone.annotations.RestrictedApi;
2223
import java.io.IOException;
2324
import java.util.List;
2425
import org.apache.hadoop.conf.Configuration;
@@ -142,6 +143,12 @@ public void update(UpdateMasterRegion action) throws IOException {
142143
flusherAndCompactor.onUpdate();
143144
}
144145

146+
/**
147+
* The design for master region is to only load all the data to memory at once when starting, so
148+
* typically you should not use the get method to get a single row of data at runtime.
149+
*/
150+
@RestrictedApi(explanation = "Should only be called in tests", link = "",
151+
allowedOnPath = ".*/src/test/.*")
145152
public Result get(Get get) throws IOException {
146153
return region.get(get);
147154
}
@@ -154,14 +161,20 @@ public RegionScanner getRegionScanner(Scan scan) throws IOException {
154161
return region.getScanner(scan);
155162
}
156163

164+
@RestrictedApi(explanation = "Should only be called in tests", link = "",
165+
allowedOnPath = ".*/src/test/.*")
157166
public FlushResult flush(boolean force) throws IOException {
158167
return region.flush(force);
159168
}
160169

170+
@RestrictedApi(explanation = "Should only be called in tests", link = "",
171+
allowedOnPath = ".*/src/test/.*")
161172
public void requestRollAll() {
162173
walRoller.requestRollAll();
163174
}
164175

176+
@RestrictedApi(explanation = "Should only be called in tests", link = "",
177+
allowedOnPath = ".*/src/test/.*")
165178
public void waitUntilWalRollFinished() throws InterruptedException {
166179
walRoller.waitUntilWalRollFinished();
167180
}

0 commit comments

Comments
 (0)