Skip to content

Commit

Permalink
PHOENIX-2586 Pass cloned BaseResultIterators mutationState through Ta…
Browse files Browse the repository at this point in the history
…bleResultIteratorFactory
  • Loading branch information
jtaylor-sfdc committed Jan 10, 2016
1 parent 150a50e commit 4273697
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;


import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Scan;
import org.apache.phoenix.compile.StatementContext; import org.apache.phoenix.execute.MutationState;
import org.apache.phoenix.monitoring.CombinableMetric; import org.apache.phoenix.monitoring.CombinableMetric;
import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.TableRef;
import org.apache.phoenix.schema.tuple.Tuple; import org.apache.phoenix.schema.tuple.Tuple;
Expand All @@ -36,14 +36,14 @@ public DelayedTableResultIteratorFactory(long delay) {
} }


@Override @Override
public TableResultIterator newIterator(StatementContext context, TableRef tableRef, Scan scan, public TableResultIterator newIterator(MutationState mutationState, TableRef tableRef, Scan scan,
CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException { CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException {
return new DelayedTableResultIterator(context, tableRef, scan, scanMetrics, renewLeaseThreshold); return new DelayedTableResultIterator(mutationState, tableRef, scan, scanMetrics, renewLeaseThreshold);
} }


private class DelayedTableResultIterator extends TableResultIterator { private class DelayedTableResultIterator extends TableResultIterator {
public DelayedTableResultIterator (StatementContext context, TableRef tableRef, Scan scan, CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException { public DelayedTableResultIterator (MutationState mutationState, TableRef tableRef, Scan scan, CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException {
super(context.getConnection().getMutationState(), tableRef, scan, scanMetrics, renewLeaseThreshold); super(mutationState, tableRef, scan, scanMetrics, renewLeaseThreshold);
} }


@Override @Override
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
import java.sql.SQLException; import java.sql.SQLException;


import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Scan;
import org.apache.phoenix.compile.StatementContext; import org.apache.phoenix.execute.MutationState;
import org.apache.phoenix.monitoring.CombinableMetric; import org.apache.phoenix.monitoring.CombinableMetric;
import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.TableRef;


public class DefaultTableResultIteratorFactory implements TableResultIteratorFactory { public class DefaultTableResultIteratorFactory implements TableResultIteratorFactory {


@Override @Override
public TableResultIterator newIterator(StatementContext context, TableRef tableRef, Scan scan, public TableResultIterator newIterator(MutationState mutationState, TableRef tableRef, Scan scan,
CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException { CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException {
return new TableResultIterator(context.getConnection().getMutationState(), tableRef, scan, scanMetrics, renewLeaseThreshold); return new TableResultIterator(mutationState, tableRef, scan, scanMetrics, renewLeaseThreshold);
} }


} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected void submitWork(List<List<Scan>> nestedScans, List<List<Pair<Scan,Futu
final Scan scan = scanLocation.getScan(); final Scan scan = scanLocation.getScan();
final CombinableMetric scanMetrics = readMetrics.allotMetric(MetricType.SCAN_BYTES, physicalTableName); final CombinableMetric scanMetrics = readMetrics.allotMetric(MetricType.SCAN_BYTES, physicalTableName);
final TaskExecutionMetricsHolder taskMetrics = new TaskExecutionMetricsHolder(readMetrics, physicalTableName); final TaskExecutionMetricsHolder taskMetrics = new TaskExecutionMetricsHolder(readMetrics, physicalTableName);
final TableResultIterator tableResultItr = context.getConnection().getTableResultIteratorFactory().newIterator(context, tableRef, scan, scanMetrics, renewLeaseThreshold); final TableResultIterator tableResultItr = context.getConnection().getTableResultIteratorFactory().newIterator(mutationState, tableRef, scan, scanMetrics, renewLeaseThreshold);
context.getConnection().addIterator(tableResultItr); context.getConnection().addIterator(tableResultItr);
Future<PeekingResultIterator> future = executor.submit(Tracing.wrap(new JobCallable<PeekingResultIterator>() { Future<PeekingResultIterator> future = executor.submit(Tracing.wrap(new JobCallable<PeekingResultIterator>() {


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import java.sql.SQLException; import java.sql.SQLException;


import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Scan;
import org.apache.phoenix.compile.StatementContext; import org.apache.phoenix.execute.MutationState;
import org.apache.phoenix.monitoring.CombinableMetric; import org.apache.phoenix.monitoring.CombinableMetric;
import org.apache.phoenix.schema.TableRef; import org.apache.phoenix.schema.TableRef;


public interface TableResultIteratorFactory { public interface TableResultIteratorFactory {
public TableResultIterator newIterator(StatementContext context, TableRef tableRef, Scan scan, CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException; public TableResultIterator newIterator(MutationState mutationState, TableRef tableRef, Scan scan, CombinableMetric scanMetrics, long renewLeaseThreshold) throws SQLException;
} }

0 comments on commit 4273697

Please sign in to comment.