FIND CURRENT EXCLUSIVE-LOCK query was not updating the record

Hello my beautiful OpenEdgers~

 

The fantastic @Sil Boydens (Customer)​ was posing a question in the Discord Channel, and I thought it might be good to get it up here, in case you might have answers. I will copy/paste his text verbatim:

 

~~~~~~~~~

 

Just had a weird situation.

 

a FIND CURRENT EXCLUSIVE-LOCK query was not updating the record, almost as if the

IF LOCKED <record> THEN NEXT. kept being triggered. but the _lock VST was empty, nothing in promon about locking issues either and the issue persistent across DB restarts. eventually i decided to do a proutil <db> -C idxfix across the entire DB. (option 3, all tables, all records)

 

> 178 indexes, 53378 blocks, 3059800 keys checked.

> Index fix completed successfully. (4332)

> Index fix made 2 index changes. (4975)

 

about halfway through the idxfix, the record finally updated.

 

Anyone here able to explain what could have been happening that required idxfix to fix this?

 

12.8.9 RDBMS and PASOE. this part of the code belongs to keeping track of when something was last seen so a datetime field that gets updated a lot and in this case for a specific record that datetime field wasn't getting updated for about 3 and a half hours while it should have been at least once every 5 to 10 minutes.

 

should probably add this bit of context too:

 

  1. DO TRANS:
  2. FIND <record> WHERE <filter on all fields of unique primary index> NO-LOCK NO-ERROR.
  3. IF NOT AVAILABLE <record> THEN
  4. DO:
  5. CREATE ...
  6. ASSIGN ...
  7. END.
  8. ELSE FIND CURRENT <record> EXCLUSIVE-LOCK NO-ERROR NO-WAIT.
  9. IF LOCKED <record> THEN NEXT. /* other session currently doing this one */
  10. ASSIGN <record>.last-seen = NOW.
  11. FIND CURRENT <record> NO-LOCK NO-ERROR.
  12. END. /* TRANS */

so only way that it was writing to the log file but not updating or creating records, is that IF LOCKED check.

 

~~~~~~~~~~

 

Please help Sil out! If you want to join the Discord Server as well, feel free to pop on in!


  • Sil Boydens (Customer)

    thanks Nichol!

     

    it's not something that's blocking right now, just curious what it could have been.

  • Frank Meulblok (Customer)

    > Index fix made 2 index changes. (4975)

     

    The complete output for the idxfix should also include what changes it made for which specific records in which table; there should be

    "Deleted key <key value> recid <record identifier>. (8828)" and "Added key <index value> recid <record identifier>. (8827)" messages in the full output.

     

    If what was fixed is an index for the record that failed to update, it was probably the initial FIND ... NO-LOCK that failed, not the FIND CURRENT ... .

     

    If it's another table, you'll have to work back from there to see how that table relates to the one where the update failed,