Better test diag output on OOM (#42989)

If linearizability checking fails with OOM (or other exception), we did
not get the serialized history written into the log, making it difficult
to debug in cases where the problem is hard to reproduce. Fixed to
always attempt dumping the serialized history.

Related to #42244
This commit is contained in:
Henning Andersen 2019-06-11 09:48:07 +02:00 committed by Henning Andersen
parent 79052050bf
commit 6a77dde5ea
1 changed files with 11 additions and 7 deletions

View File

@ -447,13 +447,17 @@ public class ConcurrentSeqNoVersioningIT extends AbstractDisruptionTestCase {
logger.info("--> Linearizability checking history of size: {} for key: {} and initialVersion: {}: {}", history.size(),
id, initialVersion, history);
LinearizabilityChecker.SequentialSpec spec = new CASSequentialSpec(initialVersion);
boolean linearizable = new LinearizabilityChecker().isLinearizable(spec, history, missingResponseGenerator());
// implicitly test that we can serialize all histories.
String serializedHistory = base64Serialize(history);
if (linearizable == false) {
// we dump base64 encoded data, since the nature of this test is that it does not reproduce even with same seed.
logger.error("Linearizability check failed. Spec: {}, initial version: {}, serialized history: {}", spec, initialVersion,
serializedHistory);
boolean linearizable = false;
try {
linearizable = new LinearizabilityChecker().isLinearizable(spec, history, missingResponseGenerator());
} finally {
// implicitly test that we can serialize all histories.
String serializedHistory = base64Serialize(history);
if (linearizable == false) {
// we dump base64 encoded data, since the nature of this test is that it does not reproduce even with same seed.
logger.error("Linearizability check failed. Spec: {}, initial version: {}, serialized history: {}",
spec, initialVersion, serializedHistory);
}
}
return linearizable;
}