Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pingcap/tidb into unistor…
Browse files Browse the repository at this point in the history
…e-support-read-through-lock

Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
  • Loading branch information
youjiali1995 committed Nov 29, 2021
2 parents 7f53097 + 306621e commit f51cbb6
Show file tree
Hide file tree
Showing 333 changed files with 20,031 additions and 12,982 deletions.
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ linters-settings:
checks: ["S1002","S1004","S1007","S1009","S1010","S1012","S1019","S1020","S1021","S1024","S1030","SA2*","SA3*","SA4009","SA5*","SA6000","SA6001","SA6005", "-SA2002"]
stylecheck:
checks: ["-ST1003"]
gosec:
excludes:
- G601
issues:
exclude-rules:
- path: _test\.go
Expand Down
9 changes: 6 additions & 3 deletions bindinfo/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ func (br *BindRecord) HasUsingBinding() bool {

// FindBinding find bindings in BindRecord.
func (br *BindRecord) FindBinding(hint string) *Binding {
for _, binding := range br.Bindings {
for i := range br.Bindings {
binding := br.Bindings[i]
if binding.ID == hint {
return &binding
}
Expand Down Expand Up @@ -160,7 +161,8 @@ func merge(lBindRecord, rBindRecord *BindRecord) *BindRecord {
return lBindRecord
}
result := lBindRecord.shallowCopy()
for _, rbind := range rBindRecord.Bindings {
for i := range rBindRecord.Bindings {
rbind := rBindRecord.Bindings[i]
found := false
for j, lbind := range lBindRecord.Bindings {
if lbind.isSame(&rbind) {
Expand All @@ -184,7 +186,8 @@ func (br *BindRecord) remove(deleted *BindRecord) *BindRecord {
return &BindRecord{OriginalSQL: br.OriginalSQL, Db: br.Db}
}
result := br.shallowCopy()
for _, deletedBind := range deleted.Bindings {
for j := range deleted.Bindings {
deletedBind := deleted.Bindings[j]
for i, bind := range result.Bindings {
if bind.isSame(&deletedBind) {
result.Bindings = append(result.Bindings[:i], result.Bindings[i+1:]...)
Expand Down
7 changes: 5 additions & 2 deletions br/cmd/tidb-lightning/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import (

func main() {
globalCfg := config.Must(config.LoadGlobalConfig(os.Args[1:], nil))
fmt.Fprintf(os.Stdout, "Verbose debug logs will be written to %s\n\n", globalCfg.App.Config.File)
logToFile := globalCfg.App.File != "" && globalCfg.App.File != "-"
if logToFile {
fmt.Fprintf(os.Stdout, "Verbose debug logs will be written to %s\n\n", globalCfg.App.Config.File)
}

app := lightning.New(globalCfg)

Expand Down Expand Up @@ -95,7 +98,7 @@ func main() {
}

// call Sync() with log to stdout may return error in some case, so just skip it
if globalCfg.App.File != "" {
if logToFile {
syncErr := logger.Sync()
if syncErr != nil {
fmt.Fprintln(os.Stderr, "sync log failed", syncErr)
Expand Down
Loading

0 comments on commit f51cbb6

Please sign in to comment.