Skip to content

Commit 346f22b

Browse files
committed
Correct log message and correct the way how the transaction pods are added and removed
1 parent 939fdbb commit 346f22b

File tree

2 files changed

+35
-42
lines changed

2 files changed

+35
-42
lines changed

e2e/fixtures/fdb_cluster.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -673,23 +673,6 @@ func (fdbCluster *FdbCluster) SetStorageServerPerPod(serverPerPod int) error {
673673
return fdbCluster.setStorageServerPerPod(serverPerPod, true)
674674
}
675675

676-
// SetTransactionServerPerPod set the LogServersPerPod field in the cluster spec and changes log Pods to transaction Pods.
677-
func (fdbCluster *FdbCluster) SetTransactionServerPerPod(
678-
serverPerPod int,
679-
processCount int,
680-
waitForReconcile bool,
681-
) error {
682-
fdbCluster.cluster.Spec.LogServersPerPod = serverPerPod
683-
fdbCluster.cluster.Spec.ProcessCounts.Transaction = processCount
684-
fdbCluster.cluster.Spec.ProcessCounts.Log = 0
685-
fdbCluster.UpdateClusterSpec()
686-
687-
if !waitForReconcile {
688-
return nil
689-
}
690-
return fdbCluster.WaitForReconciliation()
691-
}
692-
693676
// ReplacePod replaces the provided Pod if it's part of the FoundationDBCluster.
694677
func (fdbCluster *FdbCluster) ReplacePod(pod corev1.Pod, waitForReconcile bool) {
695678
cluster := fdbCluster.GetCluster()

e2e/test_operator/operator_test.go

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,10 +1166,15 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
11661166
}).Should(BeNumerically("==", expectedPodCnt))
11671167

11681168
serverPerPod = initialLogServerPerPod * 2
1169-
log.Printf("new log servers per Pod: %d", initialLogServerPerPod)
1169+
log.Printf("new log servers per Pod: %d", serverPerPod)
11701170
})
11711171

11721172
AfterEach(func() {
1173+
log.Printf("set log servers per Pod to %d", initialLogServerPerPod)
1174+
Expect(
1175+
fdbCluster.SetLogServersPerPod(initialLogServerPerPod, true),
1176+
).ShouldNot(HaveOccurred())
1177+
11731178
log.Printf(
11741179
"expectedPodCnt: %d, expectedProcessesCnt: %d",
11751180
expectedPodCnt,
@@ -1181,13 +1186,6 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
11811186
})
11821187

11831188
When("when using log servers", func() {
1184-
AfterEach(func() {
1185-
log.Printf("set log servers per Pod to %d", initialLogServerPerPod)
1186-
Expect(
1187-
fdbCluster.SetLogServersPerPod(initialLogServerPerPod, true),
1188-
).ShouldNot(HaveOccurred())
1189-
})
1190-
11911189
BeforeEach(func() {
11921190
Expect(fdbCluster.SetLogServersPerPod(serverPerPod, true)).ShouldNot(HaveOccurred())
11931191
})
@@ -1208,25 +1206,37 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
12081206
})
12091207

12101208
When("migrating from log processes to transaction processes", func() {
1211-
AfterEach(func() {
1212-
log.Printf("set log servers per Pod to %d", initialLogServerPerPod)
1213-
Expect(
1214-
fdbCluster.SetTransactionServerPerPod(
1215-
initialLogServerPerPod,
1216-
expectedLogProcessesCnt,
1217-
true,
1218-
),
1219-
).ShouldNot(HaveOccurred())
1209+
BeforeEach(func() {
1210+
// Change the servers per pod and change the transaction process counts and set the log process counts
1211+
// to -1.
1212+
cluster := fdbCluster.GetCluster()
1213+
spec := cluster.Spec.DeepCopy()
1214+
spec.LogServersPerPod = serverPerPod
1215+
1216+
processCounts, err := cluster.GetProcessCountsWithDefaults()
1217+
Expect(err).NotTo(HaveOccurred())
1218+
spec.ProcessCounts.Transaction = processCounts.Log
1219+
spec.ProcessCounts.Log = -1
1220+
1221+
// process counts with default?
1222+
log.Println(spec.ProcessCounts)
1223+
fdbCluster.UpdateClusterSpecWithSpec(spec)
1224+
Expect(fdbCluster.WaitForReconciliation()).NotTo(HaveOccurred())
12201225
})
12211226

1222-
BeforeEach(func() {
1223-
Expect(
1224-
fdbCluster.SetTransactionServerPerPod(
1225-
serverPerPod,
1226-
expectedLogProcessesCnt,
1227-
true,
1228-
),
1229-
).ShouldNot(HaveOccurred())
1227+
AfterEach(func() {
1228+
// Reset the transaction process class changes and make sure we create log pods again.
1229+
cluster := fdbCluster.GetCluster()
1230+
spec := cluster.Spec.DeepCopy()
1231+
spec.LogServersPerPod = initialLogServerPerPod
1232+
1233+
processCounts, err := cluster.GetProcessCountsWithDefaults()
1234+
Expect(err).NotTo(HaveOccurred())
1235+
spec.ProcessCounts.Log = processCounts.Transaction
1236+
spec.ProcessCounts.Transaction = -1
1237+
log.Println(spec.ProcessCounts)
1238+
fdbCluster.UpdateClusterSpecWithSpec(spec)
1239+
Expect(fdbCluster.WaitForReconciliation()).NotTo(HaveOccurred())
12301240
})
12311241

12321242
It(

0 commit comments

Comments
 (0)