You are viewing limited content. For full access, please sign in.

Question

Question

Concurrency control when copying pages to same document

asked on August 29, 2021

I have a situation in which multiple documents can be released by Quick Fields Agent into the repository at about the same time. As each document is released, it triggers a workflow that (among other things) copies pages from the released document to another document. Sometimes several of these dropped files will copy pages to the same document.

My question is, do I have to worry about concurrency or will Workflow take care of things automatically.

I can think of several ways Workflow could handle the situation of a workflow that tries to copy pages into a document while another workflow is already copying pages to the same document.

  1. (The best situation I can think of) The second workflow detects that it can't proceed due to a lock on the first document, and automatically waits for the lock to be released, then proceeds.
  2. The second workflow could detect a lock and terminate the workflow with an exception.
  3. The pages from the two workflows could end up being interleaved--if the copy of each page was treated as an atomic operation.
  4. (I trust Laserfiche wouldn't purposely do anything this bad) The document could become corrupted and unusable.

 

Does anyone know what really happens in this scenario? Unlike some things I do, timing situations are difficult to predictably test.

0 0

Answer

SELECTED ANSWER
replied on August 30, 2021

Workflow will lock the document while moving pages. The second instance will detect the lock and try again later. Assuming you are copying all pages at one, they will not end up interleaved.

One thing Is there an order that these documents need to be merged in? Since Workflow is multi-threaded, multiple documents created by Quick Fields may be processed at the same time and whichever workflow instance gets there first will lock the document and do work. It's unlikely they'll be out of order since QF only creates one at a time, but depending on whatever else happens in your workflow before the document merge, it may be possible that one instance is faster than others.

1 0
replied on August 30, 2021

Thank you for your precise answer, Miruna. If I understand correctly then, the lock is taken and held only for the duration of a single workflow activity. I'll review my workflows with that in mind, but I think that'll work.

I'm also glad to hear that if a workflow encounters a lock in this situation, it won't give up immediately, but will retry later.

0 0
replied on August 30, 2021

That's correct. Activities acquire locks as needed and release them as the action is complete.

Any error listed under task error handlers is considered recoverable and the action will be retried.

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.