Locktable Issue

vikram7_dabasvikram7_dabas Member Posts: 611
Dear All
In Codeunit ID 22(Item Jnl.-Post Line),if I will remove the Locktable function in 22 codeunit then what will happen?Many users will use this database concurrently.Will it show me the error or not?
Vikram Dabas
Navision Technical Consultant

Comments

  • kapamaroukapamarou Member Posts: 1,152
    I don't think you should remove it. What's the problem you're facing? If it's locking conflicts then you should check the locking order of the tables. Give some more info on your problem so that we can have a better view.
  • vikram7_dabasvikram7_dabas Member Posts: 611
    If I will remove the Locktable function then which error I will face?many users using the same DB.Is it something like this:Entry No. 'ABCD' already exists.
    Vikram Dabas
    Navision Technical Consultant
  • krikikriki Member, Moderator Posts: 9,110
    You should leave the LOCKTABLE.
    The functionality of Navision is such that only 1 process maybe insert into this table. This is when posting in it.

    Why is this? This is because Navision has to add a record. To be sure it has a unique number, it locks the table and gets the last record. Another session has to wait on this point. If you are using SQL, other sessions can still modify other records in the table.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kapamaroukapamarou Member Posts: 1,152
    Example if you are refering to
    GlobalValueEntry.LOCKTABLE;

    The system will lock the table, find the last entry, get the entry no., increase that number by 1 and assign it to the next value entry. It is used to assure that since the begining of your transaction noone will modify that table.

    If your problem is table locking between transactions you need to review the order of the lockings. For example:
    Trans [a] Locks first Sales Header then Sales line.
    Trans Locks first Sales Line then Sales Header.

    This will cause a deadlock and you need to make the transactions lock the tables in the same order.
  • EugeneEugene Member Posts: 309
    if you remove LOCKTABLE you will get no error but you may lose data consistency. what i mean is that you risk posting not all journal lines or mixing journal lines of two different simultanious users.

    Most efficient solution with codeunit 22 concurrency issues i believe is SHORTANING OF TRANSACTIONS. Try to make your posting as short and fast as possible, if you need to post a very long journal (thousands of lines in it) then try to think a way to split it into several shorter postings. For example filter by some field and post separately with intermediate COMMITs and SLEEPs

    Also think about moving long postings to the night
    so basically at day your users mark their journals for posting but do not post. Then at night a scheduler starts the process and posts marked postings one by one
Sign In or Register to comment.