diff --git a/node/src/main/kotlin/net/corda/node/services/persistence/DBTransactionStorage.kt b/node/src/main/kotlin/net/corda/node/services/persistence/DBTransactionStorage.kt index 4dd4d4b8b6..3271208e95 100644 --- a/node/src/main/kotlin/net/corda/node/services/persistence/DBTransactionStorage.kt +++ b/node/src/main/kotlin/net/corda/node/services/persistence/DBTransactionStorage.kt @@ -96,7 +96,7 @@ class DBTransactionStorage(cacheSizeBytes: Long) : WritableTransactionStorage, S override fun track(): DataFeed, SignedTransaction> { return txStorage.locked { - DataFeed(allPersisted().map { it.second.toSignedTx() }.toList(), updates.bufferUntilSubscribed().wrapWithDatabaseTransaction()) + DataFeed(allPersisted().map { it.second.toSignedTx() }.toList(), updates.bufferUntilSubscribed()) } } diff --git a/node/src/main/kotlin/net/corda/node/services/statemachine/FlowStateMachineImpl.kt b/node/src/main/kotlin/net/corda/node/services/statemachine/FlowStateMachineImpl.kt index aabc75bb4c..b75a68178e 100644 --- a/node/src/main/kotlin/net/corda/node/services/statemachine/FlowStateMachineImpl.kt +++ b/node/src/main/kotlin/net/corda/node/services/statemachine/FlowStateMachineImpl.kt @@ -28,6 +28,7 @@ import net.corda.nodeapi.internal.persistence.contextTransaction import net.corda.nodeapi.internal.persistence.contextTransactionOrNull import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.slf4j.MDC import java.util.concurrent.TimeUnit import kotlin.reflect.KProperty1 @@ -164,11 +165,16 @@ class FlowStateMachineImpl(override val id: StateMachineRunId, } } + fun setLoggingContext() { + context.pushToLoggingContext() + MDC.put("flow-id", id.uuid.toString()) + } + @Suspendable override fun run() { logic.stateMachine = this - context.pushToLoggingContext() + setLoggingContext() initialiseFlow() @@ -321,6 +327,7 @@ class FlowStateMachineImpl(override val id: StateMachineRunId, require(continuation == FlowContinuation.ProcessEvents) Fiber.unparkDeserialized(this, scheduler) } + setLoggingContext() return uncheckedCast(processEventsUntilFlowIsResumed( isDbTransactionOpenOnEntry = false, isDbTransactionOpenOnExit = true