|
15 | 15 |
|
16 | 16 | import com.scalar.db.api.TransactionState; |
17 | 17 | import com.scalar.db.exception.storage.ExecutionException; |
| 18 | +import com.scalar.db.exception.transaction.CommitConflictException; |
18 | 19 | import com.scalar.db.exception.transaction.CommitException; |
19 | 20 | import com.scalar.db.exception.transaction.UnknownTransactionStatusException; |
20 | 21 | import com.scalar.db.exception.transaction.ValidationConflictException; |
21 | 22 | import com.scalar.db.transaction.consensuscommit.CoordinatorGroupCommitter.CoordinatorGroupCommitKeyManipulator; |
22 | 23 | import com.scalar.db.util.groupcommit.GroupCommitConfig; |
23 | 24 | import java.util.List; |
24 | 25 | import java.util.UUID; |
25 | | -import org.junit.jupiter.api.Disabled; |
26 | 26 | import org.junit.jupiter.api.Test; |
27 | 27 | import org.junit.jupiter.params.ParameterizedTest; |
28 | 28 | import org.junit.jupiter.params.provider.ValueSource; |
@@ -75,6 +75,20 @@ protected CommitHandler createCommitHandler(boolean coordinatorWriteOmissionOnRe |
75 | 75 | groupCommitter); |
76 | 76 | } |
77 | 77 |
|
| 78 | + @Override |
| 79 | + protected CommitHandler createCommitHandlerWithOnePhaseCommit() { |
| 80 | + createGroupCommitterIfNotExists(); |
| 81 | + return new CommitHandlerWithGroupCommit( |
| 82 | + storage, |
| 83 | + coordinator, |
| 84 | + tableMetadataManager, |
| 85 | + parallelExecutor, |
| 86 | + mutationsGrouper, |
| 87 | + true, |
| 88 | + true, |
| 89 | + groupCommitter); |
| 90 | + } |
| 91 | + |
78 | 92 | private String anyGroupCommitParentId() { |
79 | 93 | return parentKey; |
80 | 94 | } |
@@ -199,72 +213,121 @@ public void commit_NoReadsInSnapshot_ShouldNotValidateRecords(boolean withSnapsh |
199 | 213 | verify(groupCommitter, never()).remove(anyId()); |
200 | 214 | } |
201 | 215 |
|
202 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
203 | | - @Override |
204 | 216 | @Test |
205 | | - public void canOnePhaseCommit_WhenOnePhaseCommitDisabled_ShouldReturnFalse() {} |
206 | | - |
207 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
208 | 217 | @Override |
209 | | - @Test |
210 | | - public void canOnePhaseCommit_WhenValidationRequired_ShouldReturnFalse() {} |
| 218 | + public void onePhaseCommitRecords_WhenSuccessful_ShouldMutateUsingComposerMutations() |
| 219 | + throws CommitConflictException, UnknownTransactionStatusException, ExecutionException { |
| 220 | + super.onePhaseCommitRecords_WhenSuccessful_ShouldMutateUsingComposerMutations(); |
211 | 221 |
|
212 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
213 | | - @Override |
214 | | - @Test |
215 | | - public void canOnePhaseCommit_WhenNoWritesAndDeletes_ShouldReturnFalse() {} |
| 222 | + // Assert |
| 223 | + verify(groupCommitter).remove(anyId()); |
| 224 | + } |
216 | 225 |
|
217 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
218 | | - @Override |
219 | 226 | @Test |
220 | | - public void canOnePhaseCommit_WhenDeleteWithoutExistingRecord_ShouldReturnFalse() {} |
221 | | - |
222 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
223 | 227 | @Override |
224 | | - @Test |
225 | | - public void canOnePhaseCommit_WhenMutationsCanBeGrouped_ShouldReturnTrue() {} |
| 228 | + public void |
| 229 | + onePhaseCommitRecords_WhenNoMutationExceptionThrown_ShouldThrowCommitConflictException() |
| 230 | + throws ExecutionException { |
| 231 | + super.onePhaseCommitRecords_WhenNoMutationExceptionThrown_ShouldThrowCommitConflictException(); |
226 | 232 |
|
227 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
228 | | - @Override |
229 | | - @Test |
230 | | - public void canOnePhaseCommit_WhenMutationsCannotBeGrouped_ShouldReturnFalse() {} |
| 233 | + // Assert |
| 234 | + verify(groupCommitter).remove(anyId()); |
| 235 | + } |
231 | 236 |
|
232 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
233 | | - @Override |
234 | 237 | @Test |
235 | | - public void canOnePhaseCommit_WhenMutationsGrouperThrowsException_ShouldThrowCommitException() {} |
| 238 | + @Override |
| 239 | + public void |
| 240 | + onePhaseCommitRecords_WhenRetriableExecutionExceptionThrown_ShouldThrowCommitConflictException() |
| 241 | + throws ExecutionException { |
| 242 | + super |
| 243 | + .onePhaseCommitRecords_WhenRetriableExecutionExceptionThrown_ShouldThrowCommitConflictException(); |
236 | 244 |
|
237 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
| 245 | + // Assert |
| 246 | + verify(groupCommitter).remove(anyId()); |
| 247 | + } |
| 248 | + |
| 249 | + @Test |
238 | 250 | @Override |
| 251 | + public void |
| 252 | + onePhaseCommitRecords_WhenExecutionExceptionThrown_ShouldThrowUnknownTransactionStatusException() |
| 253 | + throws ExecutionException { |
| 254 | + super |
| 255 | + .onePhaseCommitRecords_WhenExecutionExceptionThrown_ShouldThrowUnknownTransactionStatusException(); |
| 256 | + |
| 257 | + // Assert |
| 258 | + verify(groupCommitter).remove(anyId()); |
| 259 | + } |
| 260 | + |
239 | 261 | @Test |
240 | | - public void onePhaseCommitRecords_WhenSuccessful_ShouldMutateUsingComposerMutations() {} |
| 262 | + @Override |
| 263 | + public void canOnePhaseCommit_WhenOnePhaseCommitDisabled_ShouldReturnFalse() throws Exception { |
| 264 | + super.canOnePhaseCommit_WhenOnePhaseCommitDisabled_ShouldReturnFalse(); |
| 265 | + groupCommitter.remove(anyId()); |
| 266 | + } |
241 | 267 |
|
242 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
| 268 | + @Test |
243 | 269 | @Override |
| 270 | + public void canOnePhaseCommit_WhenValidationRequired_ShouldReturnFalse() throws Exception { |
| 271 | + super.canOnePhaseCommit_WhenValidationRequired_ShouldReturnFalse(); |
| 272 | + groupCommitter.remove(anyId()); |
| 273 | + } |
| 274 | + |
244 | 275 | @Test |
245 | | - public void |
246 | | - onePhaseCommitRecords_WhenNoMutationExceptionThrown_ShouldThrowCommitConflictException() {} |
| 276 | + @Override |
| 277 | + public void canOnePhaseCommit_WhenNoWritesAndDeletes_ShouldReturnFalse() throws Exception { |
| 278 | + super.canOnePhaseCommit_WhenNoWritesAndDeletes_ShouldReturnFalse(); |
| 279 | + groupCommitter.remove(anyId()); |
| 280 | + } |
247 | 281 |
|
248 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
| 282 | + @Test |
249 | 283 | @Override |
| 284 | + public void canOnePhaseCommit_WhenDeleteWithoutExistingRecord_ShouldReturnFalse() |
| 285 | + throws Exception { |
| 286 | + super.canOnePhaseCommit_WhenDeleteWithoutExistingRecord_ShouldReturnFalse(); |
| 287 | + groupCommitter.remove(anyId()); |
| 288 | + } |
| 289 | + |
250 | 290 | @Test |
251 | | - public void |
252 | | - onePhaseCommitRecords_WhenRetriableExecutionExceptionThrown_ShouldThrowCommitConflictException() {} |
| 291 | + @Override |
| 292 | + public void canOnePhaseCommit_WhenMutationsCanBeGrouped_ShouldReturnTrue() throws Exception { |
| 293 | + super.canOnePhaseCommit_WhenMutationsCanBeGrouped_ShouldReturnTrue(); |
| 294 | + groupCommitter.remove(anyId()); |
| 295 | + } |
253 | 296 |
|
254 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
| 297 | + @Test |
255 | 298 | @Override |
| 299 | + public void canOnePhaseCommit_WhenMutationsCannotBeGrouped_ShouldReturnFalse() throws Exception { |
| 300 | + super.canOnePhaseCommit_WhenMutationsCannotBeGrouped_ShouldReturnFalse(); |
| 301 | + groupCommitter.remove(anyId()); |
| 302 | + } |
| 303 | + |
256 | 304 | @Test |
| 305 | + @Override |
257 | 306 | public void |
258 | | - onePhaseCommitRecords_WhenExecutionExceptionThrown_ShouldThrowUnknownTransactionStatusException() {} |
| 307 | + canOnePhaseCommit_WhenMutationsGrouperThrowsExecutionException_ShouldThrowCommitException() |
| 308 | + throws ExecutionException { |
| 309 | + super |
| 310 | + .canOnePhaseCommit_WhenMutationsGrouperThrowsExecutionException_ShouldThrowCommitException(); |
259 | 311 |
|
260 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
261 | | - @Override |
262 | | - @Test |
263 | | - public void commit_OnePhaseCommitted_ShouldNotThrowAnyException() {} |
| 312 | + // Assert |
| 313 | + verify(groupCommitter).remove(anyId()); |
| 314 | + } |
264 | 315 |
|
265 | | - @Disabled("Enabling both one-phase commit and group commit is not supported") |
| 316 | + @Test |
266 | 317 | @Override |
| 318 | + public void commit_OnePhaseCommitted_ShouldNotThrowAnyException() |
| 319 | + throws CommitException, UnknownTransactionStatusException { |
| 320 | + super.commit_OnePhaseCommitted_ShouldNotThrowAnyException(); |
| 321 | + groupCommitter.remove(anyId()); |
| 322 | + } |
| 323 | + |
267 | 324 | @Test |
| 325 | + @Override |
268 | 326 | public void |
269 | | - commit_OnePhaseCommitted_UnknownTransactionStatusExceptionThrown_ShouldThrowUnknownTransactionStatusException() {} |
| 327 | + commit_OnePhaseCommitted_UnknownTransactionStatusExceptionThrown_ShouldThrowUnknownTransactionStatusException() |
| 328 | + throws CommitException, UnknownTransactionStatusException { |
| 329 | + super |
| 330 | + .commit_OnePhaseCommitted_UnknownTransactionStatusExceptionThrown_ShouldThrowUnknownTransactionStatusException(); |
| 331 | + groupCommitter.remove(anyId()); |
| 332 | + } |
270 | 333 | } |
0 commit comments