Skip to content

Commit 1547cff

Browse files
authored
YQ-3561 FQrun supported remote databases (#15016)
1 parent 45f8fc2 commit 1547cff

30 files changed

+969
-314
lines changed

ydb/core/fq/libs/actors/pending_fetcher.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ struct TEvPrivate {
105105

106106
constexpr auto CLEANUP_PERIOD = TDuration::Seconds(60);
107107

108+
TDuration GetPendingFetchPeriod(const NFq::NConfig::TPendingFetcherConfig& config) {
109+
if (const auto periodMs = config.GetPendingFetchPeriodMs()) {
110+
return TDuration::MilliSeconds(periodMs);
111+
}
112+
return TDuration::Seconds(1);
113+
}
114+
108115
} // namespace
109116

110117
class TPendingFetcher : public NActors::TActorBootstrapped<TPendingFetcher> {
@@ -170,6 +177,7 @@ class TPendingFetcher : public NActors::TActorBootstrapped<TPendingFetcher> {
170177
, ServiceCounters(serviceCounters, "pending_fetcher")
171178
, GetTaskCounters("GetTask", ServiceCounters.Counters)
172179
, FailedStatusCodeCounters(MakeIntrusive<TStatusCodeByScopeCounters>("IntermediateFailedStatusCode", ServiceCounters.RootCounters->GetSubgroup("component", "QueryDiagnostic")))
180+
, PendingFetchPeriod(GetPendingFetchPeriod(config.GetPendingFetcher()))
173181
, CredentialsFactory(credentialsFactory)
174182
, S3Gateway(s3Gateway)
175183
, ConnectorClient(connectorClient)
@@ -518,7 +526,7 @@ class TPendingFetcher : public NActors::TActorBootstrapped<TPendingFetcher> {
518526
IModuleResolver::TPtr ModuleResolver;
519527

520528
bool HasRunningRequest = false;
521-
const TDuration PendingFetchPeriod = TDuration::Seconds(1);
529+
const TDuration PendingFetchPeriod;
522530

523531
TActorId DatabaseResolver;
524532

ydb/core/fq/libs/config/protos/pending_fetcher.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ option java_package = "ru.yandex.kikimr.proto";
88

99
message TPendingFetcherConfig {
1010
bool Enabled = 1;
11+
uint64 PendingFetchPeriodMs = 2; // 1s by default
1112
}

ydb/core/fq/libs/row_dispatcher/leader_election.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ TLeaderElection::TLeaderElection(
180180
: Config(config)
181181
, CredentialsProviderFactory(credentialsProviderFactory)
182182
, YqSharedResources(yqSharedResources)
183-
, YdbConnection(NewYdbConnection(config.GetDatabase(), credentialsProviderFactory, yqSharedResources->UserSpaceYdbDriver))
183+
, YdbConnection(config.GetLocalMode() ? nullptr : NewYdbConnection(config.GetDatabase(), credentialsProviderFactory, yqSharedResources->UserSpaceYdbDriver))
184184
, TablePathPrefix(JoinPath(config.GetDatabase().GetDatabase(), config.GetCoordinationNodePath()))
185185
, CoordinationNodePath(JoinPath(TablePathPrefix, tenant))
186186
, ParentId(parentId)

ydb/tests/tools/fqrun/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ For profiling memory allocations build fqrun with ya make flags `-D PROFILE_MEMO
88

99
* `flame_graph.sh` - script for collecting flame graphs in svg format, usage:
1010
```(bash)
11-
./flame_graph.sh [graph collection time in seconds]
11+
./flame_graph.sh [graph collection time in seconds] [use sudo]
1212
```
1313
1414
## Examples

ydb/tests/tools/fqrun/configuration/fq_config.conf

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ EnableDynamicNameservice: true
33
EnableTaskCounters: true
44

55
CheckpointCoordinator {
6-
Enabled: true
76
CheckpointingPeriodMillis: 30000
87
MaxInflight: 1
98

@@ -24,7 +23,7 @@ Common {
2423
MdbGateway: "https://mdb.api.cloud.yandex.net:443"
2524
MdbTransformHost: false
2625
ObjectStorageEndpoint: "https://storage.yandexcloud.net"
27-
IdsPrefix: "kr"
26+
IdsPrefix: "fr"
2827
QueryArtifactsCompressionMethod: "zstd_6"
2928
MonitoringEndpoint: "monitoring.api.cloud.yandex.net"
3029
KeepInternalErrors: true
@@ -42,10 +41,12 @@ Common {
4241

4342
ControlPlaneProxy {
4443
Enabled: true
44+
RequestTimeout: "1m"
4545
}
4646

4747
ControlPlaneStorage {
4848
Enabled: true
49+
UseInMemory: true
4950
StatsMode: STATS_MODE_PROFILE
5051
DumpRawStatistics: true
5152
TasksBatchSize: 100
@@ -84,6 +85,9 @@ ControlPlaneStorage {
8485
OperationTimeoutSec: 60
8586
CancelAfterSec: 60
8687
}
88+
89+
RetryPolicyMapping {
90+
}
8791
}
8892

8993
DbPool {
@@ -201,10 +205,6 @@ Gateways {
201205
}
202206
}
203207

204-
Health {
205-
Enabled: true
206-
}
207-
208208
NodesManager {
209209
Enabled: true
210210
}
@@ -223,7 +223,6 @@ PrivateProxy {
223223
}
224224

225225
QuotasManager {
226-
Enabled: true
227226
QuotaDescriptions {
228227
SubjectType: "cloud"
229228
MetricName: "yq.cpuPercent.count"
@@ -244,10 +243,6 @@ QuotasManager {
244243
}
245244

246245
RateLimiter {
247-
Enabled: true
248-
ControlPlaneEnabled: true
249-
DataPlaneEnabled: true
250-
251246
Database {
252247
TablePrefix: "yq/rate_limiter"
253248
ClientTimeoutSec: 70

ydb/tests/tools/fqrun/flame_graph.sh

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,11 @@
22

33
set -eux
44

5-
function cleanup {
6-
sudo rm ./profdata
7-
rm ./profdata.txt
8-
}
9-
trap cleanup EXIT
10-
11-
if [ $# -gt 1 ]; then
5+
if [ $# -gt 2 ]; then
126
echo "Too many arguments"
137
exit -1
148
fi
159

16-
fqrun_pid=$(pgrep -u $USER fqrun)
17-
18-
sudo perf record -F 50 --call-graph dwarf -g --proc-map-timeout=10000 --pid $fqrun_pid -v -o profdata -- sleep ${1:-'30'}
19-
sudo perf script -i profdata > profdata.txt
20-
2110
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
2211

23-
flame_graph_tool="$SCRIPT_DIR/../../../../contrib/tools/flame-graph/"
24-
25-
${flame_graph_tool}/stackcollapse-perf.pl profdata.txt | ${flame_graph_tool}/flamegraph.pl > profdata.svg
12+
$SCRIPT_DIR/../kqprun/flame_graph.sh ${1:-'30'} ${2:-''} fqrun

0 commit comments

Comments
 (0)