Andrew
10/03/2024, 4:20 AMAndrew
10/03/2024, 4:23 AMSQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', 'e4d778b6-8a49-4dc4-a089-b130a6c3dbce', FALSE, 'vCh0q', 0.9003645)
SQL: INSERT INTO items_t_ju8 (classification, id, in_place, "name", score) VALUES ('CRITICAL', '675f9e66-4670-4c08-895a-3f29db726166', TRUE, '9D9ZR', 0.59893584)
Chantal Loncle
10/03/2024, 4:37 PMtransaction {
addLogger(StdOutSqlLogger)
// query #1 will log once
transaction {
addLogger(StdOutSqlLogger)
// query #2 will log twice
}
}
// if the queries were instead DAO inserts, each would log twice because
// inserts are implicitly flushed at the end of nested transactions
If you can confirm that you don't have multiple Exposed loggers going at the same time, please then confirm the following so we can look further into this:
• What Exposed version is being used?
• You're performing the count query using DSL. Are you performing inserts also with DSL, or with DAO?
• Have you set keepLoadedReferencesOutOfTransaction = true
? This has caused duplicate selects in the past, but only when loading entities using load()
or with()
. And that bug should have been fixed in version 0.50.0.Andrew
10/03/2024, 9:30 PMtransaction {
addLogger(StdOutSqlLogger)
SchemaUtils.create(store)
}
• I am using 0.55.0
• I have noticed logging only outputs like that when using IntelliJ to run the tests (whether gradle or Intellij). When I run from terminal, no logging issues.
• Have not set that flag anywhere (assume it's not a default)
• Insert is DSL (screenshot). Not using DAO at all.Chantal Loncle
10/03/2024, 11:27 PMdbQuery
just be something like this?
fun <T> dbQuery(block: () -> T): T = transaction {
addLogger(StdOutSqlLogger)
block()
}
I tried to spin up some tests, but I haven't been able to get any to duplicate the logs with IntelliJ so far.
Could you try some things please:
1. In your test database setup with Database.connect
, please use DatabaseConfig { useNestedTransactions = true }
. Do the logs still duplicate even with this setting?
◦ This is unlikely to make a difference since the logs don't duplicate when run from the terminal.
2. Do you have something like log4j2 or logback configured somewhere, like in an .xml or properties? Is there any chance of potential additivity being configured in your test resources root?
3. What if you were to copy and paste the code for table creation and the content from create()
into a single transaction in a main()
for example, instead of in a test function/suite? Do you get the same logs?
More than likely I'll have to request a minimally reproducible sample of how the tests are being run and how logs are set up to see if I can help troubleshoot further.Andrew
10/04/2024, 12:47 AMAndrew
10/04/2024, 7:57 AMAndrew
10/04/2024, 8:44 AMAndrew
10/13/2024, 10:35 PM