mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd-tester: more logs for compact operations
This commit is contained in:
parent
3ed5d28e2e
commit
04039eb006
@ -329,21 +329,29 @@ func (c *cluster) compactKV(rev int64, timeout time.Duration) (err error) {
|
|||||||
for i, u := range c.GRPCURLs {
|
for i, u := range c.GRPCURLs {
|
||||||
conn, derr := grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
|
conn, derr := grpc.Dial(u, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
|
||||||
if derr != nil {
|
if derr != nil {
|
||||||
|
plog.Printf("[compact kv #%d] dial error %v (endpoint %s)", i, derr, u)
|
||||||
err = derr
|
err = derr
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
kvc := pb.NewKVClient(conn)
|
kvc := pb.NewKVClient(conn)
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
|
plog.Printf("[compact kv #%d] starting (endpoint %s)", i, u)
|
||||||
_, cerr := kvc.Compact(ctx, &pb.CompactionRequest{Revision: rev, Physical: true})
|
_, cerr := kvc.Compact(ctx, &pb.CompactionRequest{Revision: rev, Physical: true})
|
||||||
cancel()
|
cancel()
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
succeed := true
|
||||||
if cerr != nil {
|
if cerr != nil {
|
||||||
if strings.Contains(cerr.Error(), "required revision has been compacted") && i > 0 {
|
if strings.Contains(cerr.Error(), "required revision has been compacted") && i > 0 {
|
||||||
plog.Printf("%s is already compacted with %d (%v)", u, rev, cerr)
|
plog.Printf("[compact kv #%d] already compacted (endpoint %s)", i, u)
|
||||||
} else {
|
} else {
|
||||||
|
plog.Printf("[compact kv #%d] error %v (endpoint %s)", i, cerr, u)
|
||||||
err = cerr
|
err = cerr
|
||||||
|
succeed = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if succeed {
|
||||||
|
plog.Printf("[compact kv #%d] done (endpoint %s)", i, u)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -358,7 +366,7 @@ func (c *cluster) checkCompact(rev int64) error {
|
|||||||
DialTimeout: 5 * time.Second,
|
DialTimeout: 5 * time.Second,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("%v (endpoint %s)", err, u)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
@ -369,10 +377,10 @@ func (c *cluster) checkCompact(rev int64) error {
|
|||||||
cli.Close()
|
cli.Close()
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("watch channel terminated")
|
return fmt.Errorf("watch channel terminated (endpoint %s)", u)
|
||||||
}
|
}
|
||||||
if wr.CompactRevision != rev {
|
if wr.CompactRevision != rev {
|
||||||
return fmt.Errorf("got compact revision %v, wanted %v", wr.CompactRevision, rev)
|
return fmt.Errorf("got compact revision %v, wanted %v (endpoint %s)", wr.CompactRevision, rev, u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -204,7 +204,6 @@ func (tt *tester) checkConsistency() (failed bool, err error) {
|
|||||||
func (tt *tester) compact(rev int64, timeout time.Duration) error {
|
func (tt *tester) compact(rev int64, timeout time.Duration) error {
|
||||||
plog.Printf("%s compacting storage (current revision %d, compact revision %d)", tt.logPrefix(), tt.currentRevision, rev)
|
plog.Printf("%s compacting storage (current revision %d, compact revision %d)", tt.logPrefix(), tt.currentRevision, rev)
|
||||||
if err := tt.cluster.compactKV(rev, timeout); err != nil {
|
if err := tt.cluster.compactKV(rev, timeout); err != nil {
|
||||||
plog.Printf("%s compactKV error (%v)", tt.logPrefix(), err)
|
|
||||||
if cerr := tt.cleanup(); cerr != nil {
|
if cerr := tt.cleanup(); cerr != nil {
|
||||||
return fmt.Errorf("%s, %s", err, cerr)
|
return fmt.Errorf("%s, %s", err, cerr)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user