Skip to content

Commit cda443c

Browse files
fuweidk8s-infra-cherrypick-robot
authored and
k8s-infra-cherrypick-robot
committed
deflakey: TestCompactionHash in integration
We should use WithCompactPhysical to wait for compaction to finish, because 50ms sleep can't guarantee compaction is done. Based on the log, the defragment is finished before compaction, which is not expected. This patch is to make sure compaction should be finished before assertation. ``` =========================== defragment ============== logger.go:146: 2025-02-27T07:57:18.652Z INFO m0 finished defragment {"member": "m0"} ===================================================== logger.go:146: 2025-02-27T07:57:18.652Z INFO m0 grpc service status changed {"member": "m0", "service": "", "status": "SERVING"} logger.go:146: 2025-02-27T07:57:18.653Z INFO grpc [[core] [Channel #1457]Channel Connectivity change to SHUTDOWN] logger.go:146: 2025-02-27T07:57:18.653Z INFO grpc [[core] [Channel #1457]Closing the name resolver] logger.go:146: 2025-02-27T07:57:18.653Z INFO grpc [[core] [Channel #1457]ccBalancerWrapper: closing] logger.go:146: 2025-02-27T07:57:18.653Z INFO grpc [[core] [Channel #1457 SubChannel #1458]Subchannel Connectivity change to SHUTDOWN] logger.go:146: 2025-02-27T07:57:18.653Z INFO grpc [[core] [Channel #1457 SubChannel #1458]Subchannel deleted] logger.go:146: 2025-02-27T07:57:18.654Z INFO grpc [[transport] [client-transport 0xc00237bd48] Closing: rpc error: code = Canceled desc = grpc: the client connection is closing] logger.go:146: 2025-02-27T07:57:18.654Z INFO grpc [[transport] [client-transport 0xc00237bd48] loopyWriter exiting with error: rpc error: code = Canceled desc = grpc: the client connection is closing] logger.go:146: 2025-02-27T07:57:18.654Z INFO grpc [[transport] [server-transport 0xc0006bb520] Closing: EOF] logger.go:146: 2025-02-27T07:57:18.654Z INFO grpc [[core] [Channel #1457]Channel deleted] logger.go:146: 2025-02-27T07:57:18.654Z INFO grpc [[transport] [server-transport 0xc0006bb520] loopyWriter exiting with error: transport closed by client] hash.go:82: Error Trace: /home/prow/go/src/github.com/etcd-io/etcd/server/storage/mvcc/testutil/hash.go:82 /home/prow/go/src/github.com/etcd-io/etcd/server/storage/mvcc/testutil/hash.go:44 Error: Not equal: expected: testutil.KeyValueHash{Hash:0x94694091, CompactRevision:1278, Revision:2507} actual : testutil.KeyValueHash{Hash:0x58af47dc, CompactRevision:2488, Revision:2507} Diff: --- Expected +++ Actual @@ -1,4 +1,4 @@ (testutil.KeyValueHash) { - Hash: (uint32) 2489925777, - CompactRevision: (int64) 1278, + Hash: (uint32) 1487882204, + CompactRevision: (int64) 2488, Revision: (int64) 2507 Test: TestCompactionHash Messages: hashes do not match on rev 2488 cluster.go:1423: ========= Cluster termination started ===================== logger.go:146: 2025-02-27T07:57:18.655Z INFO grpc [[core] [Channel #1377]Channel Connectivity change to SHUTDOWN] logger.go:146: 2025-02-27T07:57:18.655Z INFO grpc [[core] [Channel #1377]Closing the name resolver] logger.go:146: 2025-02-27T07:57:18.655Z INFO grpc [[core] [Channel #1377]ccBalancerWrapper: closing] logger.go:146: 2025-02-27T07:57:18.656Z INFO grpc [[core] [Channel #1377 SubChannel #1378]Subchannel Connectivity change to SHUTDOWN] logger.go:146: 2025-02-27T07:57:18.656Z INFO grpc [[core] [Channel #1377 SubChannel #1378]Subchannel deleted] logger.go:146: 2025-02-27T07:57:18.656Z INFO grpc [[transport] [client-transport 0xc0025f2248] Closing: rpc error: code = Canceled desc = grpc: the client connection is closing] logger.go:146: 2025-02-27T07:57:18.656Z INFO grpc [[transport] [client-transport 0xc0025f2248] loopyWriter exiting with error: rpc error: code = Canceled desc = grpc: the client connection is closing] logger.go:146: 2025-02-27T07:57:18.656Z INFO grpc [[transport] [server-transport 0xc000b56ea0] Closing: EOF] =========================== compaction ============== logger.go:146: 2025-02-27T07:57:18.656Z INFO m0 finished scheduled compaction {"member": "m0", "compact-revision": 2488, "took": "129.590742ms", "hash": 2489925777, "current-db-size-bytes": 40960, "current-db-size": "41 kB", "current-db-size-in-use-bytes": 40960, "current-db-size-in-use": "41 kB"} ===================================================== ``` Fixes: #19497 Signed-off-by: Wei Fu <[email protected]>
1 parent 2261c53 commit cda443c

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tests/integration/hashkv_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"net"
2020
"net/http"
2121
"testing"
22-
"time"
2322

2423
clientv3 "go.etcd.io/etcd/client/v3"
2524
"go.etcd.io/etcd/server/v3/etcdserver"
@@ -83,8 +82,6 @@ func (tc hashTestCase) Defrag(ctx context.Context) error {
8382
}
8483

8584
func (tc hashTestCase) Compact(ctx context.Context, rev int64) error {
86-
_, err := tc.Client.Compact(ctx, rev)
87-
// Wait for compaction to be compacted
88-
time.Sleep(50 * time.Millisecond)
85+
_, err := tc.Client.Compact(ctx, rev, clientv3.WithCompactPhysical())
8986
return err
9087
}

0 commit comments

Comments
 (0)