@@ -1150,7 +1150,7 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
11501150 })
11511151
11521152 When ("setting 2 logs per disk" , func () {
1153- var initialLogServerPerPod , expectedPodCnt , expectedLogProcessesCnt int
1153+ var initialLogServerPerPod , expectedPodCnt , expectedLogProcessesCnt , serverPerPod int
11541154
11551155 BeforeEach (func () {
11561156 initialLogServerPerPod = fdbCluster .GetLogServersPerPod ()
@@ -1165,67 +1165,17 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
11651165 Eventually (func () int {
11661166 return len (fdbCluster .GetLogPods ().Items )
11671167 }).Should (BeNumerically ("==" , expectedPodCnt ))
1168+
1169+ serverPerPod = initialLogServerPerPod * 2
1170+ log .Printf ("new log servers per Pod: %d" , serverPerPod )
11681171 })
11691172
11701173 AfterEach (func () {
11711174 log .Printf ("set log servers per Pod to %d" , initialLogServerPerPod )
11721175 Expect (
11731176 fdbCluster .SetLogServersPerPod (initialLogServerPerPod , true ),
11741177 ).ShouldNot (HaveOccurred ())
1175- log .Printf (
1176- "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1177- expectedPodCnt ,
1178- expectedPodCnt * initialLogServerPerPod ,
1179- )
1180- Eventually (func () int {
1181- return len (fdbCluster .GetLogPods ().Items )
1182- }).Should (BeNumerically ("==" , expectedPodCnt ))
1183- })
11841178
1185- It ("should update the log servers to the expected amount" , func () {
1186- serverPerPod := initialLogServerPerPod * 2
1187- log .Printf ("set log servers per Pod to %d" , initialLogServerPerPod )
1188- Expect (fdbCluster .SetLogServersPerPod (serverPerPod , true )).ShouldNot (HaveOccurred ())
1189- log .Printf (
1190- "expectedPodCnt: %d, expectedStorageProcessesCnt: %d" ,
1191- expectedPodCnt ,
1192- expectedPodCnt * serverPerPod ,
1193- )
1194- fdbCluster .ValidateProcessesCount (
1195- fdbv1beta2 .ProcessClassLog ,
1196- expectedPodCnt ,
1197- expectedPodCnt * serverPerPod ,
1198- )
1199- })
1200- })
1201-
1202- When ("setting 2 logs per disk to use transaction process" , func () {
1203- var initialLogServerPerPod , expectedPodCnt , expectedLogProcessesCnt int
1204-
1205- BeforeEach (func () {
1206- initialLogServerPerPod = fdbCluster .GetLogServersPerPod ()
1207- initialPods := fdbCluster .GetLogPods ()
1208- expectedPodCnt = len (initialPods .Items )
1209- expectedLogProcessesCnt = expectedPodCnt * initialLogServerPerPod
1210- log .Printf (
1211- "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1212- expectedPodCnt ,
1213- expectedLogProcessesCnt ,
1214- )
1215- Eventually (func () int {
1216- return len (fdbCluster .GetLogPods ().Items )
1217- }).Should (BeNumerically ("==" , expectedPodCnt ))
1218- })
1219-
1220- AfterEach (func () {
1221- log .Printf ("set log servers per Pod to %d" , initialLogServerPerPod )
1222- Expect (
1223- fdbCluster .SetTransactionServerPerPod (
1224- initialLogServerPerPod ,
1225- expectedLogProcessesCnt ,
1226- true ,
1227- ),
1228- ).ShouldNot (HaveOccurred ())
12291179 log .Printf (
12301180 "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
12311181 expectedPodCnt ,
@@ -1236,29 +1186,76 @@ var _ = Describe("Operator", Label("e2e", "pr"), func() {
12361186 }).Should (BeNumerically ("==" , expectedPodCnt ))
12371187 })
12381188
1239- It (
1240- "should update the log servers to the expected amount and should create transaction Pods" ,
1241- func () {
1242- serverPerPod := initialLogServerPerPod * 2
1243- Expect (
1244- fdbCluster .SetTransactionServerPerPod (
1245- serverPerPod ,
1246- expectedLogProcessesCnt ,
1247- true ,
1248- ),
1249- ).ShouldNot (HaveOccurred ())
1189+ When ("when using log servers" , func () {
1190+ BeforeEach (func () {
1191+ Expect (fdbCluster .SetLogServersPerPod (serverPerPod , true )).ShouldNot (HaveOccurred ())
1192+ })
1193+
1194+ It ("should update the log servers to the expected amount" , func () {
1195+ Expect (fdbCluster .SetLogServersPerPod (serverPerPod , true )).ShouldNot (HaveOccurred ())
12501196 log .Printf (
12511197 "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
12521198 expectedPodCnt ,
12531199 expectedPodCnt * serverPerPod ,
12541200 )
12551201 fdbCluster .ValidateProcessesCount (
1256- fdbv1beta2 .ProcessClassTransaction ,
1202+ fdbv1beta2 .ProcessClassLog ,
12571203 expectedPodCnt ,
12581204 expectedPodCnt * serverPerPod ,
12591205 )
1260- },
1261- )
1206+ })
1207+ })
1208+
1209+ When ("migrating from log processes to transaction processes" , func () {
1210+ BeforeEach (func () {
1211+ // Change the servers per pod and change the transaction process counts and set the log process counts
1212+ // to -1.
1213+ cluster := fdbCluster .GetCluster ()
1214+ spec := cluster .Spec .DeepCopy ()
1215+ spec .LogServersPerPod = serverPerPod
1216+
1217+ processCounts , err := cluster .GetProcessCountsWithDefaults ()
1218+ Expect (err ).NotTo (HaveOccurred ())
1219+ spec .ProcessCounts .Transaction = processCounts .Log
1220+ spec .ProcessCounts .Log = - 1
1221+
1222+ // process counts with default?
1223+ log .Println (spec .ProcessCounts )
1224+ fdbCluster .UpdateClusterSpecWithSpec (spec )
1225+ Expect (fdbCluster .WaitForReconciliation ()).NotTo (HaveOccurred ())
1226+ })
1227+
1228+ AfterEach (func () {
1229+ // Reset the transaction process class changes and make sure we create log pods again.
1230+ cluster := fdbCluster .GetCluster ()
1231+ spec := cluster .Spec .DeepCopy ()
1232+ spec .LogServersPerPod = initialLogServerPerPod
1233+
1234+ processCounts , err := cluster .GetProcessCountsWithDefaults ()
1235+ Expect (err ).NotTo (HaveOccurred ())
1236+ spec .ProcessCounts .Log = processCounts .Transaction
1237+ spec .ProcessCounts .Transaction = - 1
1238+ log .Println (spec .ProcessCounts )
1239+ fdbCluster .UpdateClusterSpecWithSpec (spec )
1240+ Expect (fdbCluster .WaitForReconciliation ()).NotTo (HaveOccurred ())
1241+ })
1242+
1243+ It (
1244+ "should update the log servers to the expected amount and should create transaction Pods" ,
1245+ func () {
1246+ log .Printf (
1247+ "expectedPodCnt: %d, expectedProcessesCnt: %d" ,
1248+ expectedPodCnt ,
1249+ expectedPodCnt * serverPerPod ,
1250+ )
1251+ fdbCluster .ValidateProcessesCount (
1252+ fdbv1beta2 .ProcessClassTransaction ,
1253+ expectedPodCnt ,
1254+ expectedPodCnt * serverPerPod ,
1255+ )
1256+ },
1257+ )
1258+ })
12621259 })
12631260
12641261 When ("Replacing a Pod with PVC stuck in Terminating state" , func () {
0 commit comments