1
1
#include " kqp_compile_service.h"
2
+ #include " helpers/kqp_compile_service_helpers.h"
2
3
3
4
#include < ydb/core/actorlib_impl/long_timer.h>
4
5
#include < ydb/core/base/appdata.h>
12
13
#include < ydb/core/kqp/host/kqp_translate.h>
13
14
#include < ydb/library/aclib/aclib.h>
14
15
16
+
15
17
#include < ydb/library/actors/core/actor_bootstrapped.h>
16
18
#include < ydb/library/actors/wilson/wilson_span.h>
17
19
#include < ydb/library/actors/core/hfunc.h>
@@ -27,7 +29,6 @@ namespace NKqp {
27
29
using namespace NKikimrConfig ;
28
30
using namespace NYql ;
29
31
30
-
31
32
struct TKqpCompileSettings {
32
33
TKqpCompileSettings (bool keepInCache, bool isQueryActionPrepare, bool perStatementResult,
33
34
const TInstant& deadline, ECompileActorAction action = ECompileActorAction::COMPILE)
@@ -350,123 +351,20 @@ class TKqpCompileService : public TActorBootstrapped<TKqpCompileService> {
350
351
void HandleConfig (NConsole::TEvConsole::TEvConfigNotificationRequest::TPtr& ev) {
351
352
auto &event = ev->Get ()->Record ;
352
353
353
- bool allowMultiBroadcasts = TableServiceConfig.GetAllowMultiBroadcasts ();
354
- bool enableKqpDataQueryStreamIdxLookupJoin = TableServiceConfig.GetEnableKqpDataQueryStreamIdxLookupJoin ();
355
- bool enableKqpScanQueryStreamIdxLookupJoin = TableServiceConfig.GetEnableKqpScanQueryStreamIdxLookupJoin ();
356
-
357
- bool enableKqpScanQuerySourceRead = TableServiceConfig.GetEnableKqpScanQuerySourceRead ();
358
-
359
- bool defaultSyntaxVersion = TableServiceConfig.GetSqlVersion ();
360
-
361
- ui64 rangesLimit = TableServiceConfig.GetExtractPredicateRangesLimit ();
362
- ui64 paramLimitSize = TableServiceConfig.GetExtractPredicateParameterListSizeLimit ();
363
- ui64 idxLookupPointsLimit = TableServiceConfig.GetIdxLookupJoinPointsLimit ();
364
-
365
- bool allowOlapDataQuery = TableServiceConfig.GetAllowOlapDataQuery ();
366
- bool enableOlapSink = TableServiceConfig.GetEnableOlapSink ();
367
- bool enableOltpSink = TableServiceConfig.GetEnableOltpSink ();
368
- bool enableHtapTx = TableServiceConfig.GetEnableHtapTx ();
369
- bool enableStreamWrite = TableServiceConfig.GetEnableStreamWrite ();
370
- bool enableCreateTableAs = TableServiceConfig.GetEnableCreateTableAs ();
371
- bool enableDataShardCreateTableAs = TableServiceConfig.GetEnableDataShardCreateTableAs ();
372
- auto blockChannelsMode = TableServiceConfig.GetBlockChannelsMode ();
373
-
374
- bool enableAstCache = TableServiceConfig.GetEnableAstCache ();
375
- bool enableImplicitQueryParameterTypes = TableServiceConfig.GetEnableImplicitQueryParameterTypes ();
376
- bool enablePgConstsToParams = TableServiceConfig.GetEnablePgConstsToParams ();
377
- bool enablePerStatementQueryExecution = TableServiceConfig.GetEnablePerStatementQueryExecution ();
378
-
379
- auto mkqlHeavyLimit = TableServiceConfig.GetResourceManager ().GetMkqlHeavyProgramMemoryLimit ();
380
-
381
- ui64 defaultCostBasedOptimizationLevel = TableServiceConfig.GetDefaultCostBasedOptimizationLevel ();
382
- bool enableConstantFolding = TableServiceConfig.GetEnableConstantFolding ();
383
- bool enableFoldUdfs = TableServiceConfig.GetEnableFoldUdfs ();
384
-
385
- bool defaultEnableShuffleElimination = TableServiceConfig.GetDefaultEnableShuffleElimination ();
386
-
387
- TString enableSpillingNodes = TableServiceConfig.GetEnableSpillingNodes ();
388
- bool enableSpilling = TableServiceConfig.GetEnableQueryServiceSpilling ();
389
-
390
- bool enableSnapshotIsolationRW = TableServiceConfig.GetEnableSnapshotIsolationRW ();
391
-
392
- bool enableNewRBO = TableServiceConfig.GetEnableNewRBO ();
393
- bool enableSpillingInHashJoinShuffleConnections = TableServiceConfig.GetEnableSpillingInHashJoinShuffleConnections ();
394
- bool enableOlapScalarApply = TableServiceConfig.GetEnableOlapScalarApply ();
395
- bool enableOlapSubstringPushdown = TableServiceConfig.GetEnableOlapSubstringPushdown ();
396
-
397
- bool enableIndexStreamWrite = TableServiceConfig.GetEnableIndexStreamWrite ();
398
-
399
- bool enableOlapPushdownProjections = TableServiceConfig.GetEnableOlapPushdownProjections ();
400
-
401
- bool enableTempTablesForUser = TableServiceConfig.GetEnableTempTablesForUser ();
402
-
403
- bool enableSimpleProgramsSinglePartitionOptimization = TableServiceConfig.GetEnableSimpleProgramsSinglePartitionOptimization ();
404
- bool enableSimpleProgramsSinglePartitionOptimizationBroadPrograms = TableServiceConfig.GetEnableSimpleProgramsSinglePartitionOptimizationBroadPrograms ();
405
-
406
- ui32 defaultLangVer = TableServiceConfig.GetDefaultLangVer ();
407
-
408
- bool enableOlapPushdownAggregate = TableServiceConfig.GetEnableOlapPushdownAggregate ();
409
-
410
- bool enableOrderOptimizaionFSM = TableServiceConfig.GetEnableOrderOptimizaionFSM ();
354
+ auto diff = ShouldInvalidateCompileCache (TableServiceConfig, event.GetConfig ().GetTableServiceConfig ());
355
+ if (diff.has_value ()) {
356
+ LOG_NOTICE_S (*TlsActivationContext, NKikimrServices::KQP_COMPILE_SERVICE,
357
+ " Query cache was invalidated due to config change, config change differencer output: "
358
+ << diff.value ());
411
359
412
- bool enableTopSortSelectIndex = TableServiceConfig. GetEnableTopSortSelectIndex ();
413
- bool enablePointPredicateSortAutoSelectIndex = TableServiceConfig. GetEnablePointPredicateSortAutoSelectIndex ();
360
+ QueryCache-> Clear ();
361
+ }
414
362
415
363
TableServiceConfig.Swap (event.MutableConfig ()->MutableTableServiceConfig ());
416
364
LOG_INFO (*TlsActivationContext, NKikimrServices::KQP_COMPILE_SERVICE, " Updated config" );
417
365
418
366
auto responseEv = MakeHolder<NConsole::TEvConsole::TEvConfigNotificationResponse>(event);
419
367
Send (ev->Sender , responseEv.Release (), IEventHandle::FlagTrackDelivery, ev->Cookie );
420
-
421
- if (TableServiceConfig.GetSqlVersion () != defaultSyntaxVersion ||
422
- TableServiceConfig.GetEnableKqpScanQueryStreamIdxLookupJoin () != enableKqpScanQueryStreamIdxLookupJoin ||
423
- TableServiceConfig.GetEnableKqpDataQueryStreamIdxLookupJoin () != enableKqpDataQueryStreamIdxLookupJoin ||
424
- TableServiceConfig.GetEnableKqpScanQuerySourceRead () != enableKqpScanQuerySourceRead ||
425
- TableServiceConfig.GetAllowOlapDataQuery () != allowOlapDataQuery ||
426
- TableServiceConfig.GetEnableStreamWrite () != enableStreamWrite ||
427
- TableServiceConfig.GetEnableOlapSink () != enableOlapSink ||
428
- TableServiceConfig.GetEnableOltpSink () != enableOltpSink ||
429
- TableServiceConfig.GetEnableHtapTx () != enableHtapTx ||
430
- TableServiceConfig.GetEnableCreateTableAs () != enableCreateTableAs ||
431
- TableServiceConfig.GetEnableDataShardCreateTableAs () != enableDataShardCreateTableAs ||
432
- TableServiceConfig.GetBlockChannelsMode () != blockChannelsMode ||
433
- TableServiceConfig.GetExtractPredicateRangesLimit () != rangesLimit ||
434
- TableServiceConfig.GetExtractPredicateParameterListSizeLimit () != paramLimitSize ||
435
- TableServiceConfig.GetResourceManager ().GetMkqlHeavyProgramMemoryLimit () != mkqlHeavyLimit ||
436
- TableServiceConfig.GetIdxLookupJoinPointsLimit () != idxLookupPointsLimit ||
437
- TableServiceConfig.GetEnableSpillingNodes () != enableSpillingNodes ||
438
- TableServiceConfig.GetDefaultCostBasedOptimizationLevel () != defaultCostBasedOptimizationLevel ||
439
- TableServiceConfig.GetEnableConstantFolding () != enableConstantFolding ||
440
- TableServiceConfig.GetEnableFoldUdfs () != enableFoldUdfs ||
441
- TableServiceConfig.GetEnableAstCache () != enableAstCache ||
442
- TableServiceConfig.GetEnableImplicitQueryParameterTypes () != enableImplicitQueryParameterTypes ||
443
- TableServiceConfig.GetEnablePgConstsToParams () != enablePgConstsToParams ||
444
- TableServiceConfig.GetEnablePerStatementQueryExecution () != enablePerStatementQueryExecution ||
445
- TableServiceConfig.GetEnableSnapshotIsolationRW () != enableSnapshotIsolationRW ||
446
- TableServiceConfig.GetAllowMultiBroadcasts () != allowMultiBroadcasts ||
447
- TableServiceConfig.GetDefaultEnableShuffleElimination () != defaultEnableShuffleElimination ||
448
- TableServiceConfig.GetEnableQueryServiceSpilling () != enableSpilling ||
449
- TableServiceConfig.GetEnableNewRBO () != enableNewRBO ||
450
- TableServiceConfig.GetEnableSpillingInHashJoinShuffleConnections () != enableSpillingInHashJoinShuffleConnections ||
451
- TableServiceConfig.GetEnableOlapScalarApply () != enableOlapScalarApply ||
452
- TableServiceConfig.GetEnableOlapSubstringPushdown () != enableOlapSubstringPushdown ||
453
- TableServiceConfig.GetEnableIndexStreamWrite () != enableIndexStreamWrite ||
454
- TableServiceConfig.GetEnableOlapPushdownProjections () != enableOlapPushdownProjections ||
455
- TableServiceConfig.GetEnableTempTablesForUser () != enableTempTablesForUser ||
456
- TableServiceConfig.GetEnableSimpleProgramsSinglePartitionOptimization () != enableSimpleProgramsSinglePartitionOptimization ||
457
- TableServiceConfig.GetEnableSimpleProgramsSinglePartitionOptimizationBroadPrograms () != enableSimpleProgramsSinglePartitionOptimizationBroadPrograms ||
458
- TableServiceConfig.GetDefaultLangVer () != defaultLangVer ||
459
- TableServiceConfig.GetEnableOlapPushdownAggregate () != enableOlapPushdownAggregate ||
460
- TableServiceConfig.GetEnableOrderOptimizaionFSM () != enableOrderOptimizaionFSM ||
461
- TableServiceConfig.GetEnableTopSortSelectIndex () != enableTopSortSelectIndex ||
462
- TableServiceConfig.GetEnablePointPredicateSortAutoSelectIndex () != enablePointPredicateSortAutoSelectIndex)
463
- {
464
-
465
- QueryCache->Clear ();
466
-
467
- LOG_NOTICE_S (*TlsActivationContext, NKikimrServices::KQP_COMPILE_SERVICE,
468
- " Query cache was invalidated due to config change" );
469
- }
470
368
}
471
369
472
370
void HandleUndelivery (TEvents::TEvUndelivered::TPtr& ev) {
0 commit comments