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 @@ -57,8 +57,6 @@
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
import org.apache.hadoop.hbase.ipc.controller.InterRegionServerIndexRpcControllerFactory;
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
import org.apache.hadoop.hbase.regionserver.Region;
Expand Down Expand Up @@ -167,10 +165,7 @@ public class UngroupedAggregateRegionObserver extends BaseScannerRegionObserver
private boolean isRegionClosingOrSplitting = false;
private static final Logger LOGGER =
LoggerFactory.getLogger(UngroupedAggregateRegionObserver.class);
private Configuration upsertSelectConfig;
private Configuration compactionConfig;
private Configuration indexWriteConfig;
private ReadOnlyProps indexWriteProps;
private Configuration envConfig;

@Override
public Optional<RegionObserver> getRegionObserver() {
Expand All @@ -180,31 +175,20 @@ public Optional<RegionObserver> getRegionObserver() {
@Override
public void start(CoprocessorEnvironment e) throws IOException {
/*
* We need to create a copy of region's configuration since we don't want any side effect of
* setting the RpcControllerFactory.
* Each open region has an instance of this coprocessor. A full configuration copy is large.
* Thus we keep only a reference to the environment configuration. Compaction and index write
* failure handling make their copy when they start, and they do not keep it.
*/
upsertSelectConfig = PropertiesUtil.cloneConfig(e.getConfiguration());
/*
* Till PHOENIX-3995 is fixed, we need to use the InterRegionServerIndexRpcControllerFactory.
* Although this would cause remote RPCs to use index handlers on the destination region
* servers, it is better than using the regular priority handlers which could result in a
* deadlock.
*/
upsertSelectConfig.setClass(RpcControllerFactory.CUSTOM_CONTROLLER_CONF_KEY,
InterRegionServerIndexRpcControllerFactory.class, RpcControllerFactory.class);

compactionConfig = ServerUtil.getCompactionConfig(e.getConfiguration());
envConfig = e.getConfiguration();
}

private Configuration getIndexWriteConfig() {
// For retries of index write failures, use the same # of retries as the rebuilder
indexWriteConfig = PropertiesUtil.cloneConfig(e.getConfiguration());
Configuration indexWriteConfig = PropertiesUtil.cloneConfig(envConfig);
indexWriteConfig.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
e.getConfiguration().getInt(QueryServices.INDEX_REBUILD_RPC_RETRIES_COUNTER,
envConfig.getInt(QueryServices.INDEX_REBUILD_RPC_RETRIES_COUNTER,
QueryServicesOptions.DEFAULT_INDEX_REBUILD_RPC_RETRIES_COUNTER));
indexWriteProps = new ReadOnlyProps(indexWriteConfig.iterator());
}

Configuration getUpsertSelectConfig() {
return upsertSelectConfig;
return indexWriteConfig;
}

void incrementScansReferenceCount() throws IOException {
Expand Down Expand Up @@ -582,10 +566,11 @@ private void handleIndexWriteException(final List<Mutation> localRegionMutations
PhoenixKeyValueUtil.setTimestamp(mutation, serverTimestamp);
}
IndexWriteException iwe = PhoenixIndexFailurePolicyHelper.getIndexWriteException(inferredE);
Configuration indexWriteConfig = getIndexWriteConfig();
try (PhoenixConnection conn =
QueryUtil.getConnectionOnServer(indexWriteConfig).unwrap(PhoenixConnection.class)) {
PhoenixIndexFailurePolicyHelper.doBatchWithRetries(mutateCommand, iwe, conn,
indexWriteProps);
new ReadOnlyProps(indexWriteConfig.iterator()));
} catch (Exception e) {
throw new DoNotRetryIOException(e);
}
Expand Down Expand Up @@ -646,6 +631,7 @@ public InternalScanner run() throws Exception {
: tableName.getNameAsString();
PTable table = null;
Long maxLookbackAge = null;
Configuration compactionConfig = ServerUtil.getCompactionConfig(envConfig);
try (PhoenixConnection conn =
QueryUtil.getConnectionOnServer(compactionConfig).unwrap(PhoenixConnection.class)) {
table = conn.getTableNoCache(fullTableName);
Expand Down
Loading