From 9390c5053b3eb622191e34a1b9c5d78d0d8b5381 Mon Sep 17 00:00:00 2001 From: Lei Zhao Date: Thu, 28 Jan 2021 16:07:31 +0800 Subject: [PATCH] gcworker: disable green GC (#22533) Signed-off-by: youjiali1995 --- store/tikv/gcworker/gc_worker.go | 2 +- store/tikv/gcworker/gc_worker_test.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/store/tikv/gcworker/gc_worker.go b/store/tikv/gcworker/gc_worker.go index 837e4049879f0..d48c501b726bc 100644 --- a/store/tikv/gcworker/gc_worker.go +++ b/store/tikv/gcworker/gc_worker.go @@ -144,7 +144,7 @@ const ( gcScanLockModeKey = "tikv_gc_scan_lock_mode" gcScanLockModeLegacy = "legacy" gcScanLockModePhysical = "physical" - gcScanLockModeDefault = gcScanLockModePhysical + gcScanLockModeDefault = gcScanLockModeLegacy gcAutoConcurrencyKey = "tikv_gc_auto_concurrency" gcDefaultAutoConcurrency = true diff --git a/store/tikv/gcworker/gc_worker_test.go b/store/tikv/gcworker/gc_worker_test.go index e8fc5099904a4..5c850ebea3feb 100644 --- a/store/tikv/gcworker/gc_worker_test.go +++ b/store/tikv/gcworker/gc_worker_test.go @@ -499,23 +499,24 @@ func (s *testGCWorkerSuite) TestCheckGCMode(c *C) { func (s *testGCWorkerSuite) TestCheckScanLockMode(c *C) { usePhysical, err := s.gcWorker.checkUsePhysicalScanLock() c.Assert(err, IsNil) + c.Assert(usePhysical, Equals, false) c.Assert(usePhysical, Equals, gcScanLockModeDefault == gcScanLockModePhysical) // Now the row must be set to the default value. str, err := s.gcWorker.loadValueFromSysTable(gcScanLockModeKey) c.Assert(err, IsNil) c.Assert(str, Equals, gcScanLockModeDefault) - err = s.gcWorker.saveValueToSysTable(gcScanLockModeKey, gcScanLockModeLegacy) + err = s.gcWorker.saveValueToSysTable(gcScanLockModeKey, gcScanLockModePhysical) c.Assert(err, IsNil) usePhysical, err = s.gcWorker.checkUsePhysicalScanLock() c.Assert(err, IsNil) - c.Assert(usePhysical, Equals, false) + c.Assert(usePhysical, Equals, true) - err = s.gcWorker.saveValueToSysTable(gcScanLockModeKey, gcScanLockModePhysical) + err = s.gcWorker.saveValueToSysTable(gcScanLockModeKey, gcScanLockModeLegacy) c.Assert(err, IsNil) usePhysical, err = s.gcWorker.checkUsePhysicalScanLock() c.Assert(err, IsNil) - c.Assert(usePhysical, Equals, true) + c.Assert(usePhysical, Equals, false) err = s.gcWorker.saveValueToSysTable(gcScanLockModeKey, "invalid_mode") c.Assert(err, IsNil)