I have a Catalyst based application with a DBIx::Class model on top of an SQL database persistence layer. Following ‘best practice’ all my business logic is all within the framework and not within the database.

One particular requirement is that the date of an event is between the start date and end date of a parent object. I have a series of tests and am satisfied in my development environment this is always the case. However, in the live environment there are a number of records in the database that do not satisfy this requirement. I have realised that this is due to the high state of flux of all date values and that some users are amending the dates of the parent entities at the same time as others are creating the associated events.

I have two questions:

  1. What can I do within the framework to ensure that the requirement is met? I assume I need some sort of concurrency control. However, I need to make sure this doesn’t impact the scalability of the application more than is necessary.
  2. What tests can I write to ensure that the requirement is met, even in a multi-user environment i.e. how do you write multi-threaded tests to guarantee the concurrency controls are working as expected?

In reply to Catalyst Concurrency Control by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.