Skip to content

Indexing is broken in case of turned on Foreign keys #184

@lehvolk

Description

@lehvolk
        val db = jacodb {
            useProcessJavaRuntime()
            installFeatures(InMemoryHierarchy, Usages, Approximations)
        }

        val cp = db.classpath(jars, listOf(Approximations, UnknownClasses))

Produces sometimes this exception:

[Test worker @coroutine#1] INFO org.jooq.Constants - 
                                      
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@  @@        @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@        @@@@@@@@@@
@@@@@@@@@@@@@@@@  @@  @@    @@@@@@@@@@
@@@@@@@@@@  @@@@  @@  @@    @@@@@@@@@@
@@@@@@@@@@        @@        @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@        @@        @@@@@@@@@@
@@@@@@@@@@    @@  @@  @@@@  @@@@@@@@@@
@@@@@@@@@@    @@  @@  @@@@  @@@@@@@@@@
@@@@@@@@@@        @@  @  @  @@@@@@@@@@
@@@@@@@@@@        @@        @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@  @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  Thank you for using jOOQ 3.14.16
                                      
Exception in thread "DefaultDispatcher-worker-20 @coroutine#175" org.jooq.exception.DataAccessException: Error while running ConnectionCallable
	at org.jooq.impl.DefaultDSLContext.connectionResult(DefaultDSLContext.java:671)
	at org.jooq.impl.DefaultDSLContext.connection(DefaultDSLContext.java:680)
	at org.jacodb.impl.features.UsagesIndexer.flush(Usages.kt:293)
	at org.jacodb.impl.FeaturesRegistry$index$3.invoke(FeaturesRegistry.kt:53)
	at org.jacodb.impl.FeaturesRegistry$index$3.invoke(FeaturesRegistry.kt:52)
	at org.jacodb.impl.storage.SQLitePersistenceImpl.write(SQLitePersistenceImpl.kt:93)
	at org.jacodb.impl.FeaturesRegistry.index(FeaturesRegistry.kt:52)
	at org.jacodb.impl.FeaturesRegistry.index(FeaturesRegistry.kt:42)
	at org.jacodb.impl.JcDatabaseImpl$process$3$1$1.invokeSuspend(JcDatabaseImpl.kt:148)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [CoroutineId(110), "coroutine#110":StandaloneCoroutine{Cancelling}@438758dc, LimitedDispatcher@177c87b8]
Caused by: org.sqlite.SQLiteException: [SQLITE_CONSTRAINT_FOREIGNKEY] A foreign key constraint failed (FOREIGN KEY constraint failed)
	at org.sqlite.core.DB.newSQLException(DB.java:1179)
	at org.sqlite.core.DB.newSQLException(DB.java:1190)
	at org.sqlite.core.DB.throwex(DB.java:1150)
	at org.sqlite.core.DB.executeBatch(DB.java:951)
	at org.sqlite.core.DB.lambda$executeBatch$0(DB.java:916)
	at org.sqlite.core.SafeStmtPtr.safeRun(SafeStmtPtr.java:128)
	at org.sqlite.core.DB.executeBatch(DB.java:916)
	at org.sqlite.core.CorePreparedStatement.lambda$executeLargeBatch$1(CorePreparedStatement.java:76)
	at org.sqlite.jdbc3.JDBC3Statement.withConnectionTimeout(JDBC3Statement.java:454)
	at org.sqlite.core.CorePreparedStatement.executeLargeBatch(CorePreparedStatement.java:72)
	at org.sqlite.core.CorePreparedStatement.executeBatch(CorePreparedStatement.java:58)
	at org.jacodb.impl.storage.JooqKt.runBatch(Jooq.kt:87)
	at org.jacodb.impl.features.UsagesIndexer$flush$$inlined$withoutAutoCommit$1.run(Jooq.kt:161)
	at org.jooq.impl.DefaultDSLContext$4.run(DefaultDSLContext.java:683)
	at org.jooq.impl.DefaultDSLContext$4.run(DefaultDSLContext.java:680)
	at org.jooq.impl.DefaultDSLContext.connectionResult(DefaultDSLContext.java:662)
	... 16 more

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions