mirror of
https://github.com/corda/corda.git
synced 2025-06-18 23:28:21 +00:00
Add helper for checking whether to check checkpoints and unit test it.
This commit is contained in:
@ -49,6 +49,10 @@ interface NodeConfiguration : NodeSSLConfiguration {
|
|||||||
val detectPublicIp: Boolean get() = true
|
val detectPublicIp: Boolean get() = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun NodeConfiguration.shouldCheckCheckpoints(): Boolean{
|
||||||
|
return this.devMode && this.devModeOptions?.disableCheckpointChecker != true
|
||||||
|
}
|
||||||
|
|
||||||
data class NotaryConfig(val validating: Boolean,
|
data class NotaryConfig(val validating: Boolean,
|
||||||
val raft: RaftConfig? = null,
|
val raft: RaftConfig? = null,
|
||||||
val bftSMaRt: BFTSMaRtConfiguration? = null,
|
val bftSMaRt: BFTSMaRtConfiguration? = null,
|
||||||
|
@ -31,6 +31,7 @@ import net.corda.node.internal.InitiatedFlowFactory
|
|||||||
import net.corda.node.services.api.Checkpoint
|
import net.corda.node.services.api.Checkpoint
|
||||||
import net.corda.node.services.api.CheckpointStorage
|
import net.corda.node.services.api.CheckpointStorage
|
||||||
import net.corda.node.services.api.ServiceHubInternal
|
import net.corda.node.services.api.ServiceHubInternal
|
||||||
|
import net.corda.node.services.config.shouldCheckCheckpoints
|
||||||
import net.corda.node.services.messaging.ReceivedMessage
|
import net.corda.node.services.messaging.ReceivedMessage
|
||||||
import net.corda.node.services.messaging.TopicSession
|
import net.corda.node.services.messaging.TopicSession
|
||||||
import net.corda.node.utilities.*
|
import net.corda.node.utilities.*
|
||||||
@ -88,7 +89,7 @@ class StateMachineManagerImpl(
|
|||||||
private val scheduler = FiberScheduler()
|
private val scheduler = FiberScheduler()
|
||||||
private val mutex = ThreadBox(InnerState())
|
private val mutex = ThreadBox(InnerState())
|
||||||
// This thread (only enabled in dev mode) deserialises checkpoints in the background to shake out bugs in checkpoint restore.
|
// This thread (only enabled in dev mode) deserialises checkpoints in the background to shake out bugs in checkpoint restore.
|
||||||
private val checkpointCheckerThread = if (serviceHub.configuration.devModeOptions?.disableCheckpointChecker != true) {
|
private val checkpointCheckerThread = if (serviceHub.configuration.shouldCheckCheckpoints()) {
|
||||||
newNamedSingleThreadExecutor("CheckpointChecker")
|
newNamedSingleThreadExecutor("CheckpointChecker")
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
@ -23,10 +23,10 @@ class NodeConfigurationImplTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `check devModeOptions flag helper`() {
|
fun `check devModeOptions flag helper`() {
|
||||||
assertFalse { configDebugOptions(true, null).devModeOptions?.disableCheckpointChecker == true }
|
assertTrue { configDebugOptions(true, null).shouldCheckCheckpoints() }
|
||||||
assertFalse { configDebugOptions(true, DevModeOptions()).devModeOptions?.disableCheckpointChecker == true }
|
assertTrue { configDebugOptions(true, DevModeOptions()).shouldCheckCheckpoints() }
|
||||||
assertFalse { configDebugOptions(true, DevModeOptions(false)).devModeOptions?.disableCheckpointChecker == true }
|
assertTrue { configDebugOptions(true, DevModeOptions(false)).shouldCheckCheckpoints() }
|
||||||
assertTrue { configDebugOptions(true, DevModeOptions(true)).devModeOptions?.disableCheckpointChecker == true }
|
assertFalse { configDebugOptions(true, DevModeOptions(true)).shouldCheckCheckpoints() }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun configDebugOptions(devMode: Boolean, devModeOptions: DevModeOptions?) : NodeConfiguration {
|
private fun configDebugOptions(devMode: Boolean, devModeOptions: DevModeOptions?) : NodeConfiguration {
|
||||||
|
Reference in New Issue
Block a user