Skip to content

Commit

Permalink
Merge branch 'release-2.1' into automated-cherry-pick-of-pingcap#11578-…
Browse files Browse the repository at this point in the history
…upstream-release-2.1
  • Loading branch information
sre-bot committed Aug 9, 2019
2 parents 2d691dd + 186f464 commit 7857cb3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile
Expand Up @@ -66,7 +66,7 @@ build:
# Install the check tools.
check-setup:tools/bin/megacheck tools/bin/revive tools/bin/goword tools/bin/gometalinter tools/bin/gosec

check: fmt errcheck lint tidy
check: fmt errcheck lint tidy testSuite

# These need to be fixed before they can be ran regularly
check-fail: goword check-static check-slow
Expand Down Expand Up @@ -106,6 +106,10 @@ vet:
@echo "vet"
$(GO) vet -all -shadow $(PACKAGES) 2>&1 | $(FAIL_ON_STDOUT)

testSuite:
@echo "testSuite"
./tools/check/check_testSuite.sh

clean:
$(GO) clean -i ./...
rm -rf *.out
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Expand Up @@ -432,6 +432,7 @@ func (cc *clientConn) connectInfo() *variable.ConnectionInfo {
// ShowProcessList implements the SessionManager interface.
func (s *Server) ShowProcessList() map[uint64]*util.ProcessInfo {
s.rwlock.RLock()
defer s.rwlock.RUnlock()
rs := make(map[uint64]*util.ProcessInfo, len(s.clients))
for _, client := range s.clients {
if atomic.LoadInt32(&client.status) == connStatusWaitShutdown {
Expand All @@ -441,7 +442,6 @@ func (s *Server) ShowProcessList() map[uint64]*util.ProcessInfo {
rs[pi.ID] = pi
}
}
s.rwlock.RUnlock()
return rs
}

Expand Down
1 change: 1 addition & 0 deletions store/mockstore/mocktikv/mock_tikv_test.go
Expand Up @@ -40,6 +40,7 @@ type testMVCCLevelDB struct {
}

var (
_ = Suite(&testMockTiKVSuite{})
_ = Suite(&testMVCCLevelDB{})
_ = Suite(testMarshal{})
)
Expand Down
17 changes: 17 additions & 0 deletions tools/check/check_testSuite.sh
@@ -0,0 +1,17 @@
#!/bin/bash

set -euo pipefail

exitCode=0
for testSuite in $(find . -name "*_test.go" -print0 | xargs -0 grep -P "type test(.*)Suite" | awk '{print $2}'); do
# TODO: ugly regex
# TODO: check code comment
if ! find . -name "*_test.go" -print0 | xargs -0 grep -P "_ = (check\.)?(Suite|SerialSuites)\((&?${testSuite}{|new\(${testSuite}\))" > /dev/null
then
if find . -name "*_test.go" -print0 | xargs -0 grep -P "func \((.* )?\*?${testSuite}\) Test" > /dev/null
then
echo "${testSuite} is not enabled" && exitCode=1
fi
fi
done
exit ${exitCode}
6 changes: 5 additions & 1 deletion util/processinfo.go
Expand Up @@ -48,6 +48,10 @@ func (pi *ProcessInfo) ToRowForShow(full bool) []interface{} {
}
}
t := uint64(time.Since(pi.Time) / time.Second)
bytesConsumed := int64(0)
if pi.StmtCtx.MemTracker != nil {
bytesConsumed = pi.StmtCtx.MemTracker.BytesConsumed()
}
return []interface{}{
pi.ID,
pi.User,
Expand All @@ -57,7 +61,7 @@ func (pi *ProcessInfo) ToRowForShow(full bool) []interface{} {
t,
fmt.Sprintf("%d", pi.State),
info,
pi.StmtCtx.MemTracker.BytesConsumed(),
bytesConsumed,
}
}

Expand Down

0 comments on commit 7857cb3

Please sign in to comment.