Skip to content
Open
Show file tree
Hide file tree
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
29 changes: 27 additions & 2 deletions dbms/src/Flash/Coprocessor/StorageTantivyInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <Common/TiFlashMetrics.h>
#include <Core/Names.h>
#include <Flash/Coprocessor/CoprocessorReader.h>
#include <Flash/Coprocessor/DAGContext.h>
Expand Down Expand Up @@ -40,8 +41,21 @@ void StorageTantivyIterpreter::execute(PipelineExecutorContext & exec_context, P
storage->splitRemoteReadAndLocalRead();
// local_read
storage->read(exec_context, group_builder, Names(), SelectQueryInfo(), context, 0, max_streams);

// remote_read
const auto & executor_id = tici_scan.getTiCIScan()->executor_id();
auto remote_shard_infos = storage->getRemoteShardInfos();
const auto total_shards = tici_scan.getShardInfos().shard_info_list.size();
const auto remote_shards = remote_shard_infos.size();
const auto local_shards = total_shards >= remote_shards ? (total_shards - remote_shards) : 0;
LOG_INFO(
log,
"tici split shards: executor_id={} total={} local={} remote={} local_concurrency={}",
executor_id,
total_shards,
local_shards,
remote_shards,
group_builder.concurrency());
if (!remote_shard_infos.empty())
{
if (context.getDAGContext()->isCop())
Expand All @@ -55,7 +69,16 @@ void StorageTantivyIterpreter::execute(PipelineExecutorContext & exec_context, P
auto remote_request = buildRemoteRequests(remote_shard_infos);
if (!remote_request.empty())
{
buildRemoteExec(exec_context, group_builder, remote_request);
PipelineExecGroupBuilder remote_builder;
buildRemoteExec(exec_context, remote_builder, remote_request);
if (!remote_builder.empty())
LOG_INFO(
log,
"tici remote sourceOps built: executor_id={} remote_requests={} concurrency={}",
executor_id,
remote_request.size(),
remote_builder.concurrency());
group_builder.merge(std::move(remote_builder));
}
}

Expand Down Expand Up @@ -174,12 +197,14 @@ std::vector<pingcap::coprocessor::CopTask> StorageTantivyIterpreter::buildCopTas
remote_request.connection_alias,
&Poco::Logger::get("pingcap/coprocessor"),
std::move(meta_data),
[&] {},
[&] { GET_METRIC(tiflash_coprocessor_request_count, type_remote_read_sent).Increment(); },
tici_scan.getTableId(),
tici_scan.getIndexId(),
tici_scan.getTiCIScan()->executor_id());
all_tasks.insert(all_tasks.end(), tasks.begin(), tasks.end());
}
GET_METRIC(tiflash_coprocessor_request_count, type_remote_read_constructed)
.Increment(static_cast<double>(all_tasks.size()));
return all_tasks;
}

Expand Down
11 changes: 11 additions & 0 deletions dbms/src/Flash/Planner/PhysicalPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ void PhysicalPlan::buildTiCIScan(const String & executor_id, const tipb::Executo
{
RUNTIME_ASSERT(executor->idx_scan().has_fts_query_info());
TiCIScan tici_scan(executor, executor_id, dagContext());
LOG_INFO(
log,
"tici scan: keyspace_id={} table_id={} index_id={} limit={} shard_count={} match_expr_size={} query_type={}",
tici_scan.getKeyspaceID(),
tici_scan.getTableId(),
tici_scan.getIndexId(),
tici_scan.getLimit(),
tici_scan.getShardInfos().shard_info_list.size(),
tici_scan.getMatchExpr().size(),
tipb::FTSQueryType_Name(executor->idx_scan().fts_query_info().query_type()));
pushBack(PhysicalTiCIScan::build(executor_id, log, tici_scan));
dagContext().table_scan_executor_id = executor_id;
}
Expand Down Expand Up @@ -214,6 +224,7 @@ void PhysicalPlan::build(const tipb::Executor * executor)
buildTableScan(executor_id, executor);
break;
case tipb::ExecType::TypeIndexScan:
GET_METRIC(tiflash_coprocessor_executor_count, type_tici).Increment();
buildTiCIScan(executor_id, executor);
break;
case tipb::ExecType::TypeJoin:
Expand Down
6 changes: 6 additions & 0 deletions dbms/src/Flash/Planner/Plans/PhysicalTiCIScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ void PhysicalTiCIScan::buildPipeline(
Context & context,
PipelineExecutorContext & exec_context)
{
LOG_INFO(
log,
"build tici pipeline: executor_id={} is_count={} max_streams={}",
executor_id,
tici_scan.isCount(),
context.getMaxStreams());
// For building PipelineExec in compile time.
StorageTantivyIterpreter storage_interpreter(context, tici_scan, context.getMaxStreams());
storage_interpreter.execute(exec_context, pipeline_exec_builder);
Expand Down