Indexing gets confused when immutable resources are modified (in service mode)
ERROR [2023-10-03 11:24:27,668] org.simantics.db.indexing.ImmutableIndexedRelationsSearcher: Setting problem for ImmutableIndexedRelationsSearcher [org.simantics.db.indexing.IndexSchema@77a552c4, [id=$28868], [id=$917505], C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505, SimpleFSDirectory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505 lockFactory=NativeFSLockFactory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505, READY] and previous state READY
org.apache.lucene.index.IndexNotFoundException: no segments* file found in SimpleFSDirectory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505 lockFactory=NativeFSLockFactory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505: files: [.changed]
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:865)
at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:53)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:67)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.changeState(IndexedRelationsSearcherBase.java:232)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.changeState(IndexedRelationsSearcherBase.java:136)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.startAccess(IndexedRelationsSearcherBase.java:560)
at org.simantics.db.indexing.IndexedRelationsImpl.waitLoaded(IndexedRelationsImpl.java:171)
at org.simantics.db.indexing.IndexedRelationsImpl.queryResources(IndexedRelationsImpl.java:325)
at org.simantics.db.layer0.genericrelation.DependenciesRelation.queryResources(DependenciesRelation.java:294)
at org.simantics.db.layer0.genericrelation.DependencyResources$1.perform(DependencyResources.java:70)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:121)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:666)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1964)
at fi.vtt.simantics.procore.internal.QueryControlImpl.syncRequestIndependent(QueryControlImpl.java:158)
at org.simantics.db.layer0.genericrelation.DependencyResources.apply(DependencyResources.java:67)
at org.simantics.db.layer0.genericrelation.DependencyResources.apply(DependencyResources.java:51)
at org.simantics.db.layer0.genericrelation.DependencyResources.apply(DependencyResources.java:1)
at org.simantics.db.layer0.adapter.impl.EntityInstances$QueryIndex.perform(EntityInstances.java:86)
at org.simantics.db.layer0.adapter.impl.EntityInstances$QueryIndex.perform(EntityInstances.java:1)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:121)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:694)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1983)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1976)
at org.simantics.db.layer0.QueryIndexUtils.searchByTypeShallow(QueryIndexUtils.java:24)
at org.simantics.modeling.ModelingUtils.searchByTypeShallow(ModelingUtils.java:771)
at fi.semantum.simupedia.AliasesRequest.perform(AliasesRequest.java:65)
at fi.semantum.simupedia.AliasesRequest.perform(AliasesRequest.java:1)
at org.simantics.db.impl.query.ReadEntry$1.recompute(ReadEntry.java:63)
at org.simantics.db.impl.query.QueryProcessor.compareTo(QueryProcessor.java:1370)
at org.simantics.db.impl.query.QueryListening.fireListeners_(QueryListening.java:272)
at org.simantics.db.impl.query.QueryListening.fireListeners(QueryListening.java:231)
at fi.vtt.simantics.procore.internal.State.commitWriteTransaction(State.java:344)
at fi.vtt.simantics.procore.internal.SessionRequestManager$4.run0(SessionRequestManager.java:236)
at org.simantics.db.impl.query.QueryProcessor$SessionTask.run(QueryProcessor.java:234)
at org.simantics.db.impl.query.QueryThread.run(QueryThread.java:238)
INFO [2023-10-03 11:24:27,668] org.simantics.db.indexing.ImmutableIndexedRelationsSearcher: Try to exit problem state for ImmutableIndexedRelationsSearcher [org.simantics.db.indexing.IndexSchema@77a552c4, [id=$28868], [id=$917505], C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505, SimpleFSDirectory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505 lockFactory=NativeFSLockFactory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505, PROBLEM] and state NONE
ERROR [2023-10-03 11:24:27,668] org.simantics.db.indexing.ImmutableIndexedRelationsSearcher: Best effort clear has failed for state NONE and this ImmutableIndexedRelationsSearcher [org.simantics.db.indexing.IndexSchema@77a552c4, [id=$28868], [id=$917505], C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505, SimpleFSDirectory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505 lockFactory=NativeFSLockFactory@C:\Work\workspace\modelbroker\runtime\167\.metadata\.plugins\org.simantics.db.indexing\index\database.28868.917505, PROBLEM]
java.lang.IllegalStateException: Immutable index cannot be cleared
at org.simantics.db.indexing.ImmutableIndexedRelationsSearcher.bestEffortClear(ImmutableIndexedRelationsSearcher.java:38)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.changeState(IndexedRelationsSearcherBase.java:155)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.changeState(IndexedRelationsSearcherBase.java:255)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.changeState(IndexedRelationsSearcherBase.java:136)
at org.simantics.db.indexing.IndexedRelationsSearcherBase.startAccess(IndexedRelationsSearcherBase.java:560)
at org.simantics.db.indexing.IndexedRelationsImpl.waitLoaded(IndexedRelationsImpl.java:171)
at org.simantics.db.indexing.IndexedRelationsImpl.queryResources(IndexedRelationsImpl.java:325)
at org.simantics.db.layer0.genericrelation.DependenciesRelation.queryResources(DependenciesRelation.java:294)
at org.simantics.db.layer0.genericrelation.DependencyResources$1.perform(DependencyResources.java:70)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:121)
at org.simantics.db.impl.query.QueryCache.runnerReadEntry(QueryCache.java:666)
at org.simantics.db.impl.graph.ReadGraphImpl.syncRequest(ReadGraphImpl.java:1964)
at fi.vtt.simantics.procore.internal.QueryControlImpl.syncRequestIndependent(QueryControlImpl.java:158)