HBASE-25877 Add access check for compactionSwitch (#3253)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
ea439c652a
commit
f09924b650
|
@ -1708,21 +1708,18 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
|
||||||
@Override
|
@Override
|
||||||
public CompactionSwitchResponse compactionSwitch(RpcController controller,
|
public CompactionSwitchResponse compactionSwitch(RpcController controller,
|
||||||
CompactionSwitchRequest request) throws ServiceException {
|
CompactionSwitchRequest request) throws ServiceException {
|
||||||
try {
|
rpcPreCheck("compactionSwitch");
|
||||||
checkOpen();
|
final CompactSplit compactSplitThread = regionServer.getCompactSplitThread();
|
||||||
requestCount.increment();
|
requestCount.increment();
|
||||||
boolean prevState = regionServer.compactSplitThread.isCompactionsEnabled();
|
boolean prevState = compactSplitThread.isCompactionsEnabled();
|
||||||
CompactionSwitchResponse response =
|
CompactionSwitchResponse response =
|
||||||
CompactionSwitchResponse.newBuilder().setPrevState(prevState).build();
|
CompactionSwitchResponse.newBuilder().setPrevState(prevState).build();
|
||||||
if (prevState == request.getEnabled()) {
|
if (prevState == request.getEnabled()) {
|
||||||
// passed in requested state is same as current state. No action required
|
// passed in requested state is same as current state. No action required
|
||||||
return response;
|
|
||||||
}
|
|
||||||
regionServer.compactSplitThread.switchCompaction(request.getEnabled());
|
|
||||||
return response;
|
return response;
|
||||||
} catch (IOException ie) {
|
|
||||||
throw new ServiceException(ie);
|
|
||||||
}
|
}
|
||||||
|
compactSplitThread.switchCompaction(request.getEnabled());
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue