Skip to content

Commit

Permalink
*: remove syncLog (pingcap#33306)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjhuang2016 authored Mar 23, 2022
1 parent 2d3e469 commit d282940
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 48 deletions.
7 changes: 0 additions & 7 deletions distsql/request_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ func TestRequestBuilder1(t *testing.T) {
IsolationLevel: 0,
Priority: 0,
NotFillCache: false,
SyncLog: false,
Streaming: false,
ReplicaRead: kv.ReplicaReadLeader,
ReadReplicaScope: kv.GlobalReplicaScope,
Expand Down Expand Up @@ -352,7 +351,6 @@ func TestRequestBuilder2(t *testing.T) {
IsolationLevel: 0,
Priority: 0,
NotFillCache: false,
SyncLog: false,
Streaming: false,
ReplicaRead: kv.ReplicaReadLeader,
ReadReplicaScope: kv.GlobalReplicaScope,
Expand Down Expand Up @@ -400,7 +398,6 @@ func TestRequestBuilder3(t *testing.T) {
IsolationLevel: 0,
Priority: 0,
NotFillCache: false,
SyncLog: false,
Streaming: false,
ReplicaRead: kv.ReplicaReadLeader,
ReadReplicaScope: kv.GlobalReplicaScope,
Expand Down Expand Up @@ -449,7 +446,6 @@ func TestRequestBuilder4(t *testing.T) {
Priority: 0,
Streaming: true,
NotFillCache: false,
SyncLog: false,
ReplicaRead: kv.ReplicaReadLeader,
ReadReplicaScope: kv.GlobalReplicaScope,
}
Expand Down Expand Up @@ -493,7 +489,6 @@ func TestRequestBuilder5(t *testing.T) {
IsolationLevel: kv.RC,
Priority: 1,
NotFillCache: true,
SyncLog: false,
Streaming: false,
ReadReplicaScope: kv.GlobalReplicaScope,
}
Expand Down Expand Up @@ -524,7 +519,6 @@ func TestRequestBuilder6(t *testing.T) {
IsolationLevel: 0,
Priority: 0,
NotFillCache: true,
SyncLog: false,
Streaming: false,
ReadReplicaScope: kv.GlobalReplicaScope,
}
Expand Down Expand Up @@ -561,7 +555,6 @@ func TestRequestBuilder7(t *testing.T) {
IsolationLevel: 0,
Priority: 0,
NotFillCache: false,
SyncLog: false,
Streaming: false,
ReplicaRead: replicaRead.replicaReadType,
ReadReplicaScope: kv.GlobalReplicaScope,
Expand Down
37 changes: 2 additions & 35 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3333,9 +3333,7 @@ func (s *testSuite) TestEmptyEnum(c *C) {
}

const (
checkRequestOff = iota
checkRequestSyncLog
checkDDLAddIndexPriority
checkDDLAddIndexPriority = 1
)

type checkRequestClient struct {
Expand All @@ -3345,7 +3343,6 @@ type checkRequestClient struct {
mu struct {
sync.RWMutex
checkFlags uint32
syncLog bool
}
}

Expand All @@ -3358,17 +3355,7 @@ func (c *checkRequestClient) SendRequest(ctx context.Context, addr string, req *
c.mu.RLock()
checkFlags := c.mu.checkFlags
c.mu.RUnlock()
if checkFlags == checkRequestSyncLog {
switch req.Type {
case tikvrpc.CmdPrewrite, tikvrpc.CmdCommit:
c.mu.RLock()
syncLog := c.mu.syncLog
c.mu.RUnlock()
if syncLog != req.SyncLog {
return nil, errors.New("fail to set sync log")
}
}
} else if checkFlags == checkDDLAddIndexPriority {
if checkFlags == checkDDLAddIndexPriority {
if req.Type == tikvrpc.CmdScan {
if c.getCheckPriority() != req.Priority {
return nil, errors.New("fail to set priority")
Expand Down Expand Up @@ -3507,26 +3494,6 @@ func (s *testSuite) TestNotFillCacheFlag(c *C) {
c.Assert(count, Equals, len(tests)) // Make sure the hook function is called.
}

func (s *testSuite1) TestSyncLog(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")

cli := s.cli
cli.mu.Lock()
cli.mu.checkFlags = checkRequestSyncLog
cli.mu.syncLog = true
cli.mu.Unlock()
tk.MustExec("create table t (id int primary key)")
cli.mu.Lock()
cli.mu.syncLog = false
cli.mu.Unlock()
tk.MustExec("insert into t values (1)")

cli.mu.Lock()
cli.mu.checkFlags = checkRequestOff
cli.mu.Unlock()
}

func (s *testSuite) TestHandleTransfer(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
Expand Down
2 changes: 0 additions & 2 deletions kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,6 @@ type Request struct {
Desc bool
// NotFillCache makes this request do not touch the LRU cache of the underlying storage.
NotFillCache bool
// SyncLog decides whether the WAL(write-ahead log) of this request should be synchronized.
SyncLog bool
// Streaming indicates using streaming API for this request, result in that one Next()
// call would not corresponds to a whole region result.
Streaming bool
Expand Down
2 changes: 1 addition & 1 deletion kv/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
Priority
// NotFillCache makes this request do not touch the LRU cache of the underlying storage.
NotFillCache
// SyncLog decides whether the WAL(write-ahead log) of this request should be synchronized.
// SyncLog is not used anymore.
SyncLog
// KeyOnly retrieve only keys, it can be used in scan now.
KeyOnly
Expand Down
1 change: 0 additions & 1 deletion meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ type Meta struct {
// If the current Meta needs to handle a job, jobListKey is the type of the job's list.
func NewMeta(txn kv.Transaction, jobListKeys ...JobListKeyType) *Meta {
txn.SetOption(kv.Priority, kv.PriorityHigh)
txn.SetOption(kv.SyncLog, struct{}{})
txn.SetDiskFullOpt(kvrpcpb.DiskFullOpt_AllowedOnAlmostFull)
t := structure.NewStructure(txn, txn, mMetaPrefix)
listKey := DefaultJobListKey
Expand Down
2 changes: 0 additions & 2 deletions store/driver/txn/txn_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ func (txn *tikvTxn) SetOption(opt int, val interface{}) {
txn.KVTxn.SetPriority(getTiKVPriority(val.(int)))
case kv.NotFillCache:
txn.KVTxn.GetSnapshot().SetNotFillCache(val.(bool))
case kv.SyncLog:
txn.EnableForceSyncLog()
case kv.Pessimistic:
txn.SetPessimistic(val.(bool))
case kv.SnapshotTS:
Expand Down

0 comments on commit d282940

Please sign in to comment.