@@ -484,7 +484,9 @@ void TUserTable::DoApplyCreate(
484
484
alter.SetExecutorFastLogPolicy (partConfig.GetExecutorFastLogPolicy ());
485
485
}
486
486
487
- alter.SetEraseCache (tid, partConfig.GetEnableEraseCache (), partConfig.GetEraseCacheMinRows (), partConfig.GetEraseCacheMaxBytes ());
487
+ if (!AppData ().FeatureFlags .GetDisableEraseCache ()) {
488
+ alter.SetEraseCache (tid, partConfig.GetEnableEraseCache (), partConfig.GetEraseCacheMinRows (), partConfig.GetEraseCacheMaxBytes ());
489
+ }
488
490
489
491
if (IsBackup) {
490
492
alter.SetColdBorrow (tid, true );
@@ -630,7 +632,9 @@ void TUserTable::ApplyAlter(
630
632
if (configDelta.HasEraseCacheMaxBytes ()) {
631
633
config.SetEraseCacheMaxBytes (configDelta.GetEraseCacheMaxBytes ());
632
634
}
633
- alter.SetEraseCache (LocalTid, config.GetEnableEraseCache (), config.GetEraseCacheMinRows (), config.GetEraseCacheMaxBytes ());
635
+ if (!AppData ().FeatureFlags .GetDisableEraseCache ()) {
636
+ alter.SetEraseCache (LocalTid, config.GetEnableEraseCache (), config.GetEraseCacheMinRows (), config.GetEraseCacheMaxBytes ());
637
+ }
634
638
}
635
639
636
640
schema.SetTableSchemaVersion (delta.GetTableSchemaVersion ());
@@ -650,12 +654,19 @@ void TUserTable::ApplyDefaults(TTransactionContext& txc) const
650
654
GetSchema (schema);
651
655
const auto & config = schema.GetPartitionConfig ();
652
656
653
- if ((!config.HasEnableEraseCache () && config.GetEnableEraseCache () != tableInfo->EraseCacheEnabled ) ||
654
- (config.GetEnableEraseCache () && !config.HasEraseCacheMinRows () && config.GetEraseCacheMinRows () != tableInfo->EraseCacheMinRows ) ||
655
- (config.GetEnableEraseCache () && !config.HasEraseCacheMaxBytes () && config.GetEraseCacheMaxBytes () != tableInfo->EraseCacheMaxBytes ))
656
- {
657
- // Protobuf defaults for erase cache changed, apply to local database
658
- txc.DB .Alter ().SetEraseCache (LocalTid, config.GetEnableEraseCache (), config.GetEraseCacheMinRows (), config.GetEraseCacheMaxBytes ());
657
+ if (AppData ().FeatureFlags .GetDisableEraseCache ()) {
658
+ // Erase cache was disabled, make sure it is disabled in the schema as well
659
+ if (tableInfo->EraseCacheEnabled ) {
660
+ txc.DB .Alter ().SetEraseCache (LocalTid, false , 0 , 0 );
661
+ }
662
+ } else {
663
+ // Erase cache not disabled, make sure current settings are re-applied
664
+ if ((config.GetEnableEraseCache () != tableInfo->EraseCacheEnabled ) ||
665
+ (config.GetEnableEraseCache () && config.GetEraseCacheMinRows () != tableInfo->EraseCacheMinRows ) ||
666
+ (config.GetEnableEraseCache () && config.GetEraseCacheMaxBytes () != tableInfo->EraseCacheMaxBytes ))
667
+ {
668
+ txc.DB .Alter ().SetEraseCache (LocalTid, config.GetEnableEraseCache (), config.GetEraseCacheMinRows (), config.GetEraseCacheMaxBytes ());
669
+ }
659
670
}
660
671
}
661
672
0 commit comments