Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: remove periods and align case at the beginning of sentences #6034

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/pd-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func createServerWrapper(cmd *cobra.Command, args []string) {
}

<-ctx.Done()
log.Info("Got signal to exit", zap.String("signal", sig.String()))
log.Info("got signal to exit", zap.String("signal", sig.String()))

svr.Close()
switch sig {
Expand Down
2 changes: 1 addition & 1 deletion pkg/audit/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ func (l *LocalLogBackend) ProcessHTTPRequest(r *http.Request) bool {
if !ok {
return false
}
log.Info("Audit Log", zap.String("service-info", requestInfo.String()))
log.Info("audit log", zap.String("service-info", requestInfo.String()))
return true
}
2 changes: 1 addition & 1 deletion pkg/audit/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestLocalLogBackendUsingFile(t *testing.T) {
b, _ := os.ReadFile(fname)
output := strings.SplitN(string(b), "]", 4)
re.Equal(
fmt.Sprintf(" [\"Audit Log\"] [service-info=\"{ServiceLabel:, Method:HTTP/1.1/GET:/test, Component:anonymous, IP:, "+
fmt.Sprintf(" [\"audit log\"] [service-info=\"{ServiceLabel:, Method:HTTP/1.1/GET:/test, Component:anonymous, IP:, "+
"StartTime:%s, URLParam:{\\\"test\\\":[\\\"test\\\"]}, BodyParam:testBody}\"]\n",
time.Unix(info.StartTimeStamp, 0).String()),
output[3],
Expand Down
11 changes: 5 additions & 6 deletions pkg/dashboard/adapter/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import (
"time"

"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/tidb-dashboard/pkg/apiserver"

"github.com/pingcap/log"
"github.com/pingcap/tidb-dashboard/pkg/apiserver"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/utils/logutil"
"github.com/tikv/pd/server"
Expand Down Expand Up @@ -192,9 +191,9 @@ func (m *Manager) startService() {
return
}
if err := m.service.Start(m.ctx); err != nil {
log.Error("Can not start dashboard server", errs.ZapError(errs.ErrDashboardStart, err))
log.Error("can not start dashboard server", errs.ZapError(errs.ErrDashboardStart, err))
} else {
log.Info("Dashboard server is started")
log.Info("dashboard server is started")
}
}

Expand All @@ -203,8 +202,8 @@ func (m *Manager) stopService() {
return
}
if err := m.service.Stop(context.Background()); err != nil {
log.Error("Stop dashboard server error", errs.ZapError(errs.ErrDashboardStop, err))
log.Error("stop dashboard server error", errs.ZapError(errs.ErrDashboardStop, err))
} else {
log.Info("Dashboard server is stopped")
log.Info("dashboard server is stopped")
}
}
6 changes: 3 additions & 3 deletions pkg/dashboard/distroutil/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const (
func MustGetResPath() string {
exePath, err := os.Executable()
if err != nil {
log.Fatal("Failed to read the execution path", zap.Error(err))
log.Fatal("failed to read the execution path", zap.Error(err))
return ""
}
return path.Join(path.Dir(exePath), resFolderName)
Expand All @@ -46,8 +46,8 @@ func MustLoadAndReplaceStrings() {
resPath := MustGetResPath()
strings, err := distro.ReadResourceStringsFromFile(path.Join(resPath, stringsFileName))
if err != nil {
log.Fatal("Failed to load distro strings", zap.Error(err))
log.Fatal("failed to load distro strings", zap.Error(err))
}
log.Info("Using distribution strings", zap.Any("strings", strings))
log.Info("using distribution strings", zap.Any("strings", strings))
distro.ReplaceGlobal(strings)
}
2 changes: 1 addition & 1 deletion pkg/dashboard/keyvisual/input/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ func clusterScan(rc *core.BasicCluster) RegionsInfo {
}
}

log.Debug("Update key visual regions", zap.Int("total-length", len(regions)))
log.Debug("update key visual regions", zap.Int("total-length", len(regions)))
return regions
}
4 changes: 2 additions & 2 deletions pkg/encryption/key_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ func saveKeys(
Then(clientv3.OpPut(EncryptionKeysPath, string(value))).
Commit()
if err != nil {
log.Warn("fail to save encryption keys.", errs.ZapError(err))
log.Warn("fail to save encryption keys", errs.ZapError(err))
return errs.ErrEtcdTxnInternal.Wrap(err).GenWithStack("fail to save encryption keys")
}
if !resp.Succeeded {
log.Warn("fail to save encryption keys. leader expired.")
log.Warn("fail to save encryption keys and leader expired")
return errs.ErrEncryptionSaveDataKeys.GenWithStack("leader expired")
}
// Leave for the watcher to load the updated keys.
Expand Down
2 changes: 1 addition & 1 deletion pkg/mcs/resource_manager/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func CreateServerWrapper(cmd *cobra.Command, args []string) {
}

<-ctx.Done()
log.Info("Got signal to exit", zap.String("signal", sig.String()))
log.Info("got signal to exit", zap.String("signal", sig.String()))

svr.Close()
switch sig {
Expand Down
4 changes: 2 additions & 2 deletions pkg/mcs/tso/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func CreateServerWrapper(cmd *cobra.Command, args []string) {
defer log.Sync()

versioninfo.Log("TSO")
log.Info("TSO Config", zap.Reflect("config", cfg))
log.Info("TSO config", zap.Reflect("config", cfg))

grpcprometheus.EnableHandlingTimeHistogram()

Expand All @@ -314,7 +314,7 @@ func CreateServerWrapper(cmd *cobra.Command, args []string) {
}

<-ctx.Done()
log.Info("Got signal to exit", zap.String("signal", sig.String()))
log.Info("got signal to exit", zap.String("signal", sig.String()))

svr.Close()
switch sig {
Expand Down
6 changes: 3 additions & 3 deletions server/cluster/unsafe_recovery_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func (u *unsafeRecoveryController) dispatchPlan(heartbeat *pdpb.StoreHeartbeatRe

if expire, dispatched := u.storePlanExpires[storeID]; !dispatched || expire.Before(now) {
if dispatched {
log.Info("Unsafe recovery store recovery plan execution timeout, retry", zap.Uint64("store-id", storeID))
log.Info("unsafe recovery store recovery plan execution timeout, retry", zap.Uint64("store-id", storeID))
}
// Dispatch the recovery plan to the store, and the plan may be empty.
resp.RecoveryPlan = u.getRecoveryPlan(storeID)
Expand All @@ -433,7 +433,7 @@ func (u *unsafeRecoveryController) collectReport(heartbeat *pdpb.StoreHeartbeatR
}

if heartbeat.StoreReport.GetStep() != u.step {
log.Info("Unsafe recovery receives invalid store report",
log.Info("unsafe recovery receives invalid store report",
zap.Uint64("store-id", storeID), zap.Uint64("expected-step", u.step), zap.Uint64("obtained-step", heartbeat.StoreReport.GetStep()))
// invalid store report, ignore
return false
Expand Down Expand Up @@ -527,7 +527,7 @@ func (u *unsafeRecoveryController) changeStage(stage unsafeRecoveryStage) {
u.output = append(u.output, output)
data, err := json.Marshal(output)
if err != nil {
log.Error("Unsafe recovery fail to marshal json object", zap.Error(err))
log.Error("unsafe recovery fail to marshal json object", zap.Error(err))
} else {
log.Info(string(data))
}
Expand Down
2 changes: 1 addition & 1 deletion server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
err := storage.TryLoadRegionsOnce(ctx, regionStorage, bc.CheckAndPutRegion)
log.Info("region syncer finished load region", zap.Duration("time-cost", time.Since(start)))
if err != nil {
log.Warn("failed to load regions.", errs.ZapError(err))
log.Warn("failed to load regions", errs.ZapError(err))
}
// establish client.
var conn *grpc.ClientConn
Expand Down
4 changes: 2 additions & 2 deletions server/schedule/labeler/labeler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ func (l *RegionLabeler) doGC(gcInterval time.Duration) {
select {
case <-ticker.C:
l.checkAndClearExpiredLabels()
log.Debug("RegionLabeler GC")
log.Debug("region labeler GC")
case <-l.ctx.Done():
log.Info("RegionLabeler GC stopped")
log.Info("region labeler GC stopped")
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ func (s *Server) SetAuditConfig(cfg config.AuditConfig) error {
errs.ZapError(err))
return err
}
log.Info("Audit config is updated", zap.Reflect("new", cfg), zap.Reflect("old", old))
log.Info("audit config is updated", zap.Reflect("new", cfg), zap.Reflect("old", old))
return nil
}

Expand Down Expand Up @@ -1010,7 +1010,7 @@ func (s *Server) SetRateLimitConfig(cfg config.RateLimitConfig) error {
errs.ZapError(err))
return err
}
log.Info("Rate Limit config is updated", zap.Reflect("new", cfg), zap.Reflect("old", old))
log.Info("rate limit config is updated", zap.Reflect("new", cfg), zap.Reflect("old", old))
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion tests/server/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ func (suite *middlewareTestSuite) TestAuditLocalLogBackend() {
_, err = io.ReadAll(resp.Body)
resp.Body.Close()
b, _ := os.ReadFile(tempStdoutFile.Name())
suite.Contains(string(b), "Audit Log")
suite.Contains(string(b), "audit log")
suite.NoError(err)
suite.Equal(http.StatusOK, resp.StatusCode)

Expand Down
4 changes: 2 additions & 2 deletions tools/pd-analysis/analysis/parse_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func forEachLine(filename string, solve func(string) error) error {
}
defer func() {
if err := fi.Close(); err != nil {
log.Printf("Error closing file: %s\n", err)
log.Printf("error closing file: %s\n", err)
}
}()
br := bufio.NewReader(fi)
Expand Down Expand Up @@ -134,7 +134,7 @@ func currentTime(layout string) func(content string) (time.Time, error) {
log.Fatal(err)
}
} else {
log.Fatal("Unsupported time layout.")
log.Fatal("unsupported time layout")
}
return func(content string) (time.Time, error) {
result := r.FindStringSubmatch(content)
Expand Down
17 changes: 9 additions & 8 deletions tools/pd-analysis/analysis/transfer_counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sync"

"github.com/tikv/pd/pkg/utils/syncutil"
"go.uber.org/zap"
)

// TransferCounter is to count transfer schedule for judging whether redundant
Expand Down Expand Up @@ -96,7 +97,7 @@ func (c *TransferCounter) AddSource(regionID, sourceStoreID uint64) {
}
delete(c.regionMap, regionID)
} else {
log.Fatal("Error when add sourceStore in transfer region map. SourceStoreID: ", sourceStoreID, " regionID: ", regionID)
log.Fatal("error when add sourceStore in transfer region map", zap.Uint64("source-store", sourceStoreID), zap.Uint64("region", regionID))
}
}

Expand Down Expand Up @@ -220,20 +221,20 @@ func (c *TransferCounter) printGraph() {
func (c *TransferCounter) PrintResult() {
c.prepare()
// Output log
log.Println("Total Schedules Graph: ")
log.Println("total schedules graph: ")
c.printGraph()
// Solve data
c.Result()
// Output log
log.Println("Redundant Loop: ")
log.Println("redundant loop: ")
for index, value := range c.loopResultPath {
fmt.Println(index, value, c.loopResultCount[index])
}
log.Println("Necessary Schedules Graph: ")
log.Println("necessary schedules graph: ")
c.printGraph()
log.Println("Scheduled Store: ", c.scheduledStoreNum)
log.Println("Redundant Schedules: ", c.Redundant)
log.Println("Necessary Schedules: ", c.Necessary)
log.Println("scheduled store: ", c.scheduledStoreNum)
log.Println("redundant schedules: ", c.Redundant)
log.Println("necessary schedules: ", c.Necessary)

// Output csv file
fd, err := os.OpenFile("result.txt", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
Expand All @@ -242,7 +243,7 @@ func (c *TransferCounter) PrintResult() {
}
defer func() {
if err := fd.Close(); err != nil {
log.Printf("Error closing file: %s\n", err)
log.Printf("error closing file: %s\n", err)
}
}()
fdContent := strings.Join([]string{
Expand Down
6 changes: 3 additions & 3 deletions tools/pd-analysis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
InitLogger(*logLevel)
analysis.GetTransferCounter().Init(0, 0)
if *input == "" {
Logger.Fatal("Need to specify one input pd log.")
Logger.Fatal("need to specify one input pd log")
}
if *output != "" {
f, err := os.OpenFile(*output, os.O_WRONLY|os.O_CREATE|os.O_SYNC|os.O_APPEND, 0600)
Expand All @@ -63,7 +63,7 @@ func main() {
case "transfer-counter":
{
if *operator == "" {
Logger.Fatal("Need to specify one operator.")
Logger.Fatal("need to specify one operator")
}
r, err := analysis.GetTransferCounter().CompileRegex(*operator)
if err != nil {
Expand All @@ -77,6 +77,6 @@ func main() {
break
}
default:
Logger.Fatal("Style is not exist.")
Logger.Fatal("style is not exist")
}
}
2 changes: 1 addition & 1 deletion tools/pd-heartbeat-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ func main() {
regions.update(cfg.Replica)
go stores.update(regions) // update stores in background, unusually region heartbeat is slower than store update.
case <-ctx.Done():
log.Info("Got signal to exit")
log.Info("got signal to exit")
switch sig {
case syscall.SIGTERM:
exit(0)
Expand Down
4 changes: 2 additions & 2 deletions tools/pd-simulator/simulator/cases/cases.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ func isUniform(count, meanCount int, threshold float64) bool {
func getStoreNum() int {
storeNum := simutil.CaseConfigure.StoreNum
if storeNum < 3 {
simutil.Logger.Fatal("Store num should be larger than or equal to 3.")
simutil.Logger.Fatal("store num should be larger than or equal to 3")
}
return storeNum
}

func getRegionNum() int {
regionNum := simutil.CaseConfigure.RegionNum
if regionNum <= 0 {
simutil.Logger.Fatal("Region num should be larger than 0.")
simutil.Logger.Fatal("region num should be larger than 0")
}
return regionNum
}
Expand Down
2 changes: 1 addition & 1 deletion tools/pd-simulator/simulator/cases/import_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ func renderPlot(name string, data [][3]int, len, minCount, maxCount int) {
f, _ := os.Create(name)
err := bar3d.Render(f)
if err != nil {
log.Error("Render error", zap.Error(err))
log.Error("render error", zap.Error(err))
}
}