mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
test: add checking snapshot be sent in mix_version_test.
Signed-off-by: Siyuan Zhang <sizhang@google.com>
This commit is contained in:
parent
464df4a979
commit
c391d69b08
@ -302,7 +302,7 @@ func newConfig() *config {
|
|||||||
fs.BoolVar(&cfg.ec.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ec.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
|
fs.BoolVar(&cfg.ec.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ec.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
|
||||||
fs.BoolVar(&cfg.ec.ExperimentalTxnModeWriteWithSharedBuffer, "experimental-txn-mode-write-with-shared-buffer", true, "Enable the write transaction to use a shared buffer in its readonly check operations.")
|
fs.BoolVar(&cfg.ec.ExperimentalTxnModeWriteWithSharedBuffer, "experimental-txn-mode-write-with-shared-buffer", true, "Enable the write transaction to use a shared buffer in its readonly check operations.")
|
||||||
fs.UintVar(&cfg.ec.ExperimentalBootstrapDefragThresholdMegabytes, "experimental-bootstrap-defrag-threshold-megabytes", 0, "Enable the defrag during etcd server bootstrap on condition that it will free at least the provided threshold of disk space. Needs to be set to non-zero value to take effect.")
|
fs.UintVar(&cfg.ec.ExperimentalBootstrapDefragThresholdMegabytes, "experimental-bootstrap-defrag-threshold-megabytes", 0, "Enable the defrag during etcd server bootstrap on condition that it will free at least the provided threshold of disk space. Needs to be set to non-zero value to take effect.")
|
||||||
fs.Uint64Var(&cfg.ec.SnapshotCatchUpEntries, "experimental-snapshot-catchup-entries", cfg.ec.SnapshotCatchUpEntries, "Number of entries for a slow follower to catch up after compacting the raft storage entries. (WARNING: only use this flag for tests.)")
|
fs.Uint64Var(&cfg.ec.SnapshotCatchUpEntries, "experimental-snapshot-catchup-entries", cfg.ec.SnapshotCatchUpEntries, "(WARNING: Use this flag with caution!) Number of entries for a slow follower to catch up after compacting the raft storage entries.")
|
||||||
|
|
||||||
// unsafe
|
// unsafe
|
||||||
fs.BoolVar(&cfg.ec.UnsafeNoFsync, "unsafe-no-fsync", false, "Disables fsync, unsafe, will cause data loss.")
|
fs.BoolVar(&cfg.ec.UnsafeNoFsync, "unsafe-no-fsync", false, "Disables fsync, unsafe, will cause data loss.")
|
||||||
|
@ -82,6 +82,7 @@ func mixVersionsSnapshotTestByAddingMember(t *testing.T, cfg e2e.EtcdProcessClus
|
|||||||
|
|
||||||
t.Logf("Create an etcd cluster with %d member\n", cfg.ClusterSize)
|
t.Logf("Create an etcd cluster with %d member\n", cfg.ClusterSize)
|
||||||
cfg.SnapshotCount = 10
|
cfg.SnapshotCount = 10
|
||||||
|
cfg.SnapshotCatchUpEntries = 10
|
||||||
cfg.BasePeerScheme = "unix" // to avoid port conflict
|
cfg.BasePeerScheme = "unix" // to avoid port conflict
|
||||||
|
|
||||||
epc, err := e2e.NewEtcdProcessCluster(t, &cfg)
|
epc, err := e2e.NewEtcdProcessCluster(t, &cfg)
|
||||||
@ -126,6 +127,7 @@ func mixVersionsSnapshotTestByMockPartition(t *testing.T, cfg e2e.EtcdProcessClu
|
|||||||
|
|
||||||
t.Logf("Create an etcd cluster with %d member\n", cfg.ClusterSize)
|
t.Logf("Create an etcd cluster with %d member\n", cfg.ClusterSize)
|
||||||
cfg.SnapshotCount = 10
|
cfg.SnapshotCount = 10
|
||||||
|
cfg.SnapshotCatchUpEntries = 10
|
||||||
cfg.BasePeerScheme = "unix" // to avoid port conflict
|
cfg.BasePeerScheme = "unix" // to avoid port conflict
|
||||||
|
|
||||||
epc, err := e2e.NewEtcdProcessCluster(t, &cfg)
|
epc, err := e2e.NewEtcdProcessCluster(t, &cfg)
|
||||||
@ -154,6 +156,12 @@ func mixVersionsSnapshotTestByMockPartition(t *testing.T, cfg e2e.EtcdProcessClu
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assertKVHash(t, epc)
|
assertKVHash(t, epc)
|
||||||
|
|
||||||
|
leaderEPC = epc.Procs[epc.WaitLeader(t)]
|
||||||
|
if leaderEPC.Config().ExecPath == e2e.BinPath {
|
||||||
|
t.Log("Verify logs to check snapshot be sent from leader to follower")
|
||||||
|
e2e.AssertProcessLogs(t, leaderEPC, "sent database snapshot")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeKVs(t *testing.T, etcdctl *e2e.Etcdctl, startIdx, endIdx int) {
|
func writeKVs(t *testing.T, etcdctl *e2e.Etcdctl, startIdx, endIdx int) {
|
||||||
|
@ -159,6 +159,7 @@ type EtcdProcessClusterConfig struct {
|
|||||||
MetricsURLScheme string
|
MetricsURLScheme string
|
||||||
|
|
||||||
SnapshotCount int // default is 10000
|
SnapshotCount int // default is 10000
|
||||||
|
SnapshotCatchUpEntries int // default is 5000
|
||||||
|
|
||||||
ClientTLS ClientConnType
|
ClientTLS ClientConnType
|
||||||
ClientCertAuthEnabled bool
|
ClientCertAuthEnabled bool
|
||||||
@ -402,6 +403,12 @@ func (cfg *EtcdProcessClusterConfig) EtcdServerProcessConfig(tb testing.TB, i in
|
|||||||
panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version))
|
panic(fmt.Sprintf("Unknown cluster version %v", cfg.Version))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the "--experimental-snapshot-catchup-entries" flag is not available in 3.4.
|
||||||
|
// so it should not be set if the process execPath is not BinPath.
|
||||||
|
if cfg.SnapshotCatchUpEntries > 0 && execPath == BinPath {
|
||||||
|
args = append(args, "--experimental-snapshot-catchup-entries", fmt.Sprintf("%d", cfg.SnapshotCatchUpEntries))
|
||||||
|
}
|
||||||
|
|
||||||
return &EtcdServerProcessConfig{
|
return &EtcdServerProcessConfig{
|
||||||
lg: cfg.Logger,
|
lg: cfg.Logger,
|
||||||
ExecPath: execPath,
|
ExecPath: execPath,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user