ENT-6677: When you clear the cache via the command line it now also updates node_named_identities table. (#7075)

This commit is contained in:
Adel El-Beik 2022-02-18 15:04:35 +00:00 committed by GitHub
parent b008f5f42a
commit 20d2e2b3eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -455,7 +455,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
}
}
fun clearNetworkMapCache() {
open fun clearNetworkMapCache() {
Node.printBasicNodeInfo("Clearing network map cache entries")
log.info("Starting clearing of network map cache entries...")
startDatabase()

View File

@ -564,6 +564,11 @@ open class Node(configuration: NodeConfiguration,
return super.generateAndSaveNodeInfo()
}
override fun clearNetworkMapCache() {
initialiseSerialization()
super.clearNetworkMapCache()
}
override fun runDatabaseMigrationScripts(
updateCoreSchemas: Boolean,
updateAppSchemas: Boolean,

View File

@ -455,7 +455,10 @@ open class PersistentNetworkMapCache(cacheFactory: NamedCacheFactory,
database.transaction {
val result = getAllNodeInfos(session)
logger.debug { "Number of node infos to be cleared: ${result.size}" }
for (nodeInfo in result) session.remove(nodeInfo)
for (nodeInfo in result) {
session.remove(nodeInfo)
archiveNamedIdentity(session, nodeInfo.toNodeInfo())
}
}
}