Hi BaseX team,

The new job:execute function in BaseX 12 is incredibly useful. Using 
job:execute, it's now possible to have a query that fetches data, dynamically 
computes the names of databases, creates the databases, populates the 
databases, and then reads from the same databases, all contained in one query 
or module!!! This can greatly simplify processes that previously required 
multiple steps.

I'm running into trouble when trying to use %unit:test to test code that uses 
job:execute. Running the test causes a deadlock, even though the code works 
correctly when run on its own.

Here is a small example based on the example in the documentation 
https://docs.basex.org/main/Job_Functions#job:execute

This query produces "true" when run in BaseX GUI.

job:execute('db:create("test")'),
job:execute('db:put-value("test", 1 to 10, "numbers")'),
job:execute('db:get-value("test", "numbers")') = (1 to 10)

After adding %unit:test and unit:assert, when this test is run in BaseX GUI it 
stalls (until I click Stop to interrupt the process).

module namespace t = "test";
declare %unit:test function t:test01 () {
  job:execute('db:create("test")'),
  job:execute('db:put-value("test", 1 to 10, "numbers")'),
  unit:assert(job:execute('db:get-value("test", "numbers")') = (1 to 10))
};

Should this work, or am I missing something?

The documentation mentions to be careful to avoid deadlocks with updating 
queries. I've also found that a deadlock can occur when the main query uses 
fn:doc even if unrelated to job:execute, but this can be solved by wrapping 
fn:doc in job:execute. I haven't found a way to work around deadlocks that 
occur with %unit:test.  I'm using BaseX version 12.2.

Many thanks,
Vincent


______________________________________________

Vincent M. Lizzi

Head of Information Standards | Taylor & Francis Group

E-Mail: 
[email protected]<mailto:[email protected]>

Web: www.tandfonline.com<http://www.tandfonline.com/>

Time zone: US Eastern



Taylor & Francis is a trading name of Informa UK Limited,

registered in England under no. 1072954



"Everything should be made as simple as possible, but not simpler."



[cid:498c7d70-ddef-4485-9ad7-484411b1c0f5]<https://outlook.office.com/bookwithme/user/[email protected]?anonymous&ep=owaSlotsEmailSignature>
Book time to meet with 
me<https://outlook.office.com/bookwithme/user/[email protected]?anonymous&ep=owaSlotsEmailSignature>


Information Classification: General

Reply via email to