Some cleanup after network map removal (#2006)

This commit is contained in:
Katarzyna Streich 2017-11-07 12:16:49 +00:00 committed by GitHub
parent 7944fcde5c
commit deaba2887d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 4 additions and 38 deletions

View File

@ -138,19 +138,6 @@ service. Also, this service allows mapping of friendly names, or
physical host and port information required for the physical physical host and port information required for the physical
``ArtemisMQ`` messaging layer. ``ArtemisMQ`` messaging layer.
PersistentNetworkMapService
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``PersistentNetworkMapService`` keeps track of ``NodeInfo`` and
persists it to the database. It and will include nodes that are not currently active.
The networking layer will persist any messages directed at such inactive
nodes with the expectation that they will be delivered eventually, or
else that the source flow will be terminated by admin intervention.
An ``InMemoryNetworkMapService`` is also available for unit tests
without a database.
Storage and persistence related services Storage and persistence related services
---------------------------------------- ----------------------------------------

View File

@ -23,13 +23,10 @@ abstract class ArtemisMessagingComponent : SingletonSerializeAsToken() {
// case is a forward slash // case is a forward slash
const val NODE_USER = "SystemUsers/Node" const val NODE_USER = "SystemUsers/Node"
const val PEER_USER = "SystemUsers/Peer" const val PEER_USER = "SystemUsers/Peer"
const val INTERNAL_PREFIX = "internal." const val INTERNAL_PREFIX = "internal."
const val PEERS_PREFIX = "${INTERNAL_PREFIX}peers." //TODO Come up with better name for common peers/services queue const val PEERS_PREFIX = "${INTERNAL_PREFIX}peers." //TODO Come up with better name for common peers/services queue
const val IP_REQUEST_PREFIX = "ip."
const val P2P_QUEUE = "p2p.inbound" const val P2P_QUEUE = "p2p.inbound"
const val NOTIFICATIONS_ADDRESS = "${INTERNAL_PREFIX}activemq.notifications" const val NOTIFICATIONS_ADDRESS = "${INTERNAL_PREFIX}activemq.notifications"
const val NETWORK_MAP_QUEUE = "${INTERNAL_PREFIX}networkmap"
} }
interface ArtemisAddress : MessageRecipients { interface ArtemisAddress : MessageRecipients {

View File

@ -17,7 +17,6 @@ import net.corda.core.utilities.unwrap
import net.corda.node.internal.Node import net.corda.node.internal.Node
import net.corda.node.internal.StartedNode import net.corda.node.internal.StartedNode
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.INTERNAL_PREFIX import net.corda.nodeapi.ArtemisMessagingComponent.Companion.INTERNAL_PREFIX
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NETWORK_MAP_QUEUE
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NOTIFICATIONS_ADDRESS import net.corda.nodeapi.ArtemisMessagingComponent.Companion.NOTIFICATIONS_ADDRESS
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.P2P_QUEUE import net.corda.nodeapi.ArtemisMessagingComponent.Companion.P2P_QUEUE
import net.corda.nodeapi.ArtemisMessagingComponent.Companion.PEERS_PREFIX import net.corda.nodeapi.ArtemisMessagingComponent.Companion.PEERS_PREFIX
@ -97,16 +96,6 @@ abstract class MQSecurityTest : NodeBasedTest() {
assertAllQueueCreationAttacksFail(invalidPeerQueue) assertAllQueueCreationAttacksFail(invalidPeerQueue)
} }
@Test
fun `consume message from network map queue`() {
assertConsumeAttackFails(NETWORK_MAP_QUEUE)
}
@Test
fun `send message to network map address`() {
assertSendAttackFails(NETWORK_MAP_QUEUE)
}
@Test @Test
fun `consume message from RPC requests queue`() { fun `consume message from RPC requests queue`() {
assertConsumeAttackFails(RPCApi.RPC_SERVER_QUEUE_NAME) assertConsumeAttackFails(RPCApi.RPC_SERVER_QUEUE_NAME)

View File

@ -183,7 +183,6 @@ class ArtemisMessagingServer(override val config: NodeConfiguration,
// by having its password be an unknown securely random 128-bit value. // by having its password be an unknown securely random 128-bit value.
clusterPassword = BigInteger(128, newSecureRandom()).toString(16) clusterPassword = BigInteger(128, newSecureRandom()).toString(16)
queueConfigurations = listOf( queueConfigurations = listOf(
queueConfig(NETWORK_MAP_QUEUE, durable = true),
queueConfig(P2P_QUEUE, durable = true), queueConfig(P2P_QUEUE, durable = true),
// Create an RPC queue: this will service locally connected clients only (not via a bridge) and those // Create an RPC queue: this will service locally connected clients only (not via a bridge) and those
// clients must have authenticated. We could use a single consumer for everything and perhaps we should, // clients must have authenticated. We could use a single consumer for everything and perhaps we should,

View File

@ -608,7 +608,7 @@ class TwoPartyTradeFlowTests(private val anonymous: Boolean) {
notaryNode: StartedNode<*>, notaryNode: StartedNode<*>,
vararg extraSigningNodes: StartedNode<*>): Map<SecureHash, SignedTransaction> { vararg extraSigningNodes: StartedNode<*>): Map<SecureHash, SignedTransaction> {
val notaryParty = notaryNode.info.legalIdentities[0] val notaryParty = node.services.getDefaultNotary()
val signed = wtxToSign.map { val signed = wtxToSign.map {
val id = it.id val id = it.id
val sigs = mutableListOf<TransactionSignature>() val sigs = mutableListOf<TransactionSignature>()

View File

@ -72,7 +72,6 @@ data class LoadTest<T, S>(
if (parameters.clearDatabaseBeforeRun) { if (parameters.clearDatabaseBeforeRun) {
log.info("Clearing databases as clearDatabaseBeforeRun=true") log.info("Clearing databases as clearDatabaseBeforeRun=true")
// We need to clear the network map first so that other nodes register fine // We need to clear the network map first so that other nodes register fine
nodes.networkMap.clearDb()
(nodes.simpleNodes + listOf(nodes.notary)).parallelStream().forEach { (nodes.simpleNodes + listOf(nodes.notary)).parallelStream().forEach {
it.clearDb() it.clearDb()
} }
@ -152,10 +151,9 @@ data class LoadTest<T, S>(
data class Nodes( data class Nodes(
val notary: NodeConnection, val notary: NodeConnection,
val networkMap: NodeConnection,
val simpleNodes: List<NodeConnection> val simpleNodes: List<NodeConnection>
) { ) {
val allNodes by lazy { (listOf(notary, networkMap) + simpleNodes).associateBy { it.info }.values } val allNodes by lazy { (listOf(notary) + simpleNodes).associateBy { it.info }.values }
} }
/** /**
@ -172,8 +170,6 @@ fun runLoadTests(configuration: LoadTestConfiguration, tests: List<Pair<LoadTest
} }
} }
val networkMap = remoteNodes[0].hostname// TODO Should be taken from configs? but also we don't care that much about that, because networkMapService will be gone and no one uses LoadTesting now
connectToNodes(remoteNodes, PortAllocation.Incremental(configuration.localTunnelStartingPort)) { connections -> connectToNodes(remoteNodes, PortAllocation.Incremental(configuration.localTunnelStartingPort)) { connections ->
log.info("Connected to all nodes!") log.info("Connected to all nodes!")
val hostNodeMap = ConcurrentHashMap<String, NodeConnection>() val hostNodeMap = ConcurrentHashMap<String, NodeConnection>()
@ -193,12 +189,10 @@ fun runLoadTests(configuration: LoadTestConfiguration, tests: List<Pair<LoadTest
hostNodeMap.put(connection.remoteNode.hostname, connection) hostNodeMap.put(connection.remoteNode.hostname, connection)
} }
val networkMapNode = hostNodeMap[networkMap]!! val notaryIdentity = hostNodeMap.values.first().proxy.notaryIdentities().single()
val notaryIdentity = networkMapNode.proxy.notaryIdentities().single()
val notaryNode = hostNodeMap.values.single { notaryIdentity in it.info.legalIdentities } val notaryNode = hostNodeMap.values.single { notaryIdentity in it.info.legalIdentities }
val nodes = Nodes( val nodes = Nodes(
notary = notaryNode, notary = notaryNode,
networkMap = networkMapNode,
simpleNodes = hostNodeMap.values.filter { it.info.legalIdentitiesAndCerts.size == 1 } // TODO Fix it with network map. simpleNodes = hostNodeMap.values.filter { it.info.legalIdentitiesAndCerts.size == 1 } // TODO Fix it with network map.
) )