Skip to content

Commit

Permalink
gcworker: disable green GC (#22533)
Browse files Browse the repository at this point in the history
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
  • Loading branch information
youjiali1995 authored Jan 28, 2021
1 parent d4796a8 commit 9390c50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion store/tikv/gcworker/gc_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions store/tikv/gcworker/gc_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9390c50

Please sign in to comment.