Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1711,22 +1711,18 @@ public CompactRegionResponse compactRegion(final RpcController controller,
@Override
public CompactionSwitchResponse compactionSwitch(RpcController controller,
CompactionSwitchRequest request) throws ServiceException {
rpcPreCheck("compactionSwitch");
final CompactSplit compactSplitThread = regionServer.getCompactSplitThread();
try {
checkOpen();
requestCount.increment();
boolean prevState = compactSplitThread.isCompactionsEnabled();
CompactionSwitchResponse response =
CompactionSwitchResponse.newBuilder().setPrevState(prevState).build();
if (prevState == request.getEnabled()) {
// passed in requested state is same as current state. No action required
return response;
}
compactSplitThread.switchCompaction(request.getEnabled());
requestCount.increment();
boolean prevState = compactSplitThread.isCompactionsEnabled();
CompactionSwitchResponse response =
CompactionSwitchResponse.newBuilder().setPrevState(prevState).build();
if (prevState == request.getEnabled()) {
// passed in requested state is same as current state. No action required
return response;
} catch (IOException ie) {
throw new ServiceException(ie);
}
compactSplitThread.switchCompaction(request.getEnabled());
return response;
}

/**
Expand Down