error wile building master branch

55 views
Skip to first unread message

Alex Tsvetkov

unread,
Aug 11, 2024, 2:46:04 PMAug 11
to H2 Database
Hi.

I have strange error while building main branch in github CI.

I can't reproduce it locally.

> 15:34:20 00:00.004 org.h2.test.db.TestIgnoreCatalogs
> Test (21023 KB used)
> ERROR: org/h2/test/scripts/functions/numeric/random-uuid.sql
l> ine: 13
> exp: >> TRUE
> got: >> FALSE
> ------------------------------
> 15:34:31 00:10.261 org.h2.test.scripts.TestScript FAIL java.lang.Exception: errors in script found
> ERROR: FAIL () java.lang.Exception: errors in script found java.lang.Exception: errors in script found ------------------------------
> java.lang.Exception: errors in script found
> at org.h2.test.scripts.TestScript.test(TestScript.java:245)
> at org.h2.test.TestBase.runTest(TestBase.java:145)
> at org.h2.test.TestAll.addTest(TestAll.java:994)
> at org.h2.test.TestAll.test(TestAll.java:711)
> at org.h2.test.TestAll.runTests(TestAll.java:626)
> at org.h2.test.TestAll.testAll(TestAll.java:551)
> at org.h2.test.TestAll.run(TestAll.java:492)
> at org.h2.test.TestAll.main(TestAll.java:436)


Sql contains following lines:

SELECT RANDOM_UUID(7) < RANDOM_UUID(7);
>> TRUE


Any suggestion on how to fix that?

Alex Tsvetkov

unread,
Aug 11, 2024, 3:58:34 PMAug 11
to H2 Database
I suspect that test that high part of UUID will be different, but on fast machines (with not so precise tiers) it can be same.
And low part is random so 50% chance test fails.

There is no way to test it reliable without 100 millisecond delay. Doubt we support pause function.

Suggest to remove test or replace with  SELECT RANDOM_UUID(7) = RANDOM_UUID(7); Maybe add unit test to ValueUuid#getNewRandom


воскресенье, 11 августа 2024 г. в 21:46:04 UTC+3, Alex Tsvetkov:

Evgenij Ryazanov

unread,
Aug 11, 2024, 8:13:50 PMAug 11
to H2 Database
Hi!

How many fractional digits Instant.now() returns on your system?

Evgenij Ryazanov

unread,
Aug 11, 2024, 8:41:30 PMAug 11
to H2 Database
I think I measured performance of new generator incorrectly and on really fast CPUs two sequential invocations of RANDOM_UUID(7) can produce UUIDs with the same time value, so result of such comparison depends on random part too. I'll replace this test with better one.
Reply all
Reply to author
Forward
0 new messages