Skip to content

Commit

Permalink
DM: fix default physical import mode disk quota (#8680)
Browse files Browse the repository at this point in the history
close #8672
  • Loading branch information
lichunzhu authored Mar 24, 2023
1 parent fd2efea commit dfac8e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dm/loader/lightning.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ func GetLightningConfig(globalCfg *lcfg.GlobalConfig, subtaskCfg *config.SubTask
// checkpoint meta and updating dm checkpoint meta to 'finished'.
cfg.Checkpoint.KeepAfterSuccess = lcfg.CheckpointRemove

cfg.TikvImporter.DiskQuota = subtaskCfg.LoaderConfig.DiskQuotaPhysical
if subtaskCfg.LoaderConfig.DiskQuotaPhysical > 0 {
cfg.TikvImporter.DiskQuota = subtaskCfg.LoaderConfig.DiskQuotaPhysical
}
cfg.TikvImporter.OnDuplicate = string(subtaskCfg.OnDuplicateLogical)
cfg.TikvImporter.IncrementalImport = true
switch subtaskCfg.OnDuplicatePhysical {
Expand Down
3 changes: 3 additions & 0 deletions dm/loader/lightning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ func TestGetLightiningConfig(t *testing.T) {
require.Equal(t, 32, conf.TikvImporter.RangeConcurrency)
require.Equal(t, lcfg.CompressionGzip, conf.TikvImporter.CompressKVPairs)
require.Equal(t, lcfg.OpLevelRequired, conf.PostRestore.Analyze)
lightningDefaultQuota := lcfg.NewConfig().TikvImporter.DiskQuota
// when we don't set dm loader disk quota, it should be equal to lightning's default quota
require.Equal(t, lightningDefaultQuota, conf.TikvImporter.DiskQuota)
}

0 comments on commit dfac8e3

Please sign in to comment.