Recovering from transaction failures due to optimistic locking (2024)

There are three main strategies that you can use to recover from failing transactions ifthere are collisions in the database due to optimistic locking: Serialization, Retry, Ignore. Thesestrategies are contingent on the relative importance or criticality of the transaction inquestion.

Procedure

  • Serialization

    This first strategy is to serialize the transaction that is failing. Serialization enforcesthe order of operations on the database to ensure that no other transactions update the same resultset between the time a transaction reads and writes a result set. In other words, serialization overa certain set of database operations offers the temporary reversal of the freedom that optimisticlocking offers.

    For example, if many different users perform a certain transaction often, thelikelihood of having collisions during the same set of operations is high. Serialization helps byfunneling users through that section of operations one-at-a-time by temporarily switching to a morepessimistic strategy over that critical section of code.

    Serialization is of benefit when:

    • The transaction is critical in nature, and you do not want to fail on criticaltransactions.
    • The update to the database is likely to have a high frequency of collisions.

    Note: By default, the INVENTORY table is serialized using select forupdate.

    Serialization can increase throughput for that operation when the error rate ishigh without it (that is, frequent collisions occur) by avoiding retrying the operation.

    Theappearance of one of the following exceptions in the HCL Commerce log indicates that anoptimistic update failure might have occurred:

    com.ibm.ejs.persistence.OptimisticUpdateFailureException: executeUpdate returned zero rowsupdated
    The exception when the failure occurs when the EJB container attempts to update the entitybean.
    com.ibm.commerce.base.helpers.ECJDBCOptimisticUpdateFailureException
    The exception when the failure occurs when a session bean attempts to update a row in a databasetable using a JDBC database connection.

    To force (or serialize) the SELECT and UPDATE statements to occur one after the other, changethe isolation level of the current operation to ReadStability.

    • Change the problematic SELECT statement to SELECT . . . FORUPDATE WITH RS.
    • Recovering from transaction failures due to optimistic locking (1)Change the SELECT statement to SELECT . . .FORUPDATE.

    Note: For the serialization of EJB beans, do not modify existing beans. Instead, introduce JDBCqueries that use SELECT ... FOR UPDATE, as shown in the precedingexample.

  • Retry

    The second strategy is to retry the command that fails. There is a mechanism in theTransaction server engine that allows you to rerun a command on failure.

    Recovering from transaction failures due to optimistic locking (2) See the Making controller commands retriable.

    The defaultvalue for the retriable property is true. A command implementation can override this value, althoughthe normal way to override without changing any code is to explicitly specify it in the CMDREGdatabase table PROPERTIES column value. For example, if the CMDREG.PROPERTIES column value specifiesretriable=false, then the command will not be retried when its database transaction rolls back.

    Retrying a command that is failing is beneficial when there is a low probability ofcollision. Retrying a command is more expensive relative to serialization, but for infrequentlycolliding operations, it is preferable.

  • Ignore

    If the transactions that are failing are insignificant (end users can refresh theirbrowsers and continue) you can ignore the error.

Recovering from transaction failures due to optimistic locking (2024)
Top Articles
Secondary and dry drowning: Should you be worried? |
Is Forex trading profitable for everyone?
Www.mytotalrewards/Rtx
Bank Of America Financial Center Irvington Photos
2018 Jeep Wrangler Unlimited All New for sale - Portland, OR - craigslist
The Blackening Showtimes Near Century Aurora And Xd
Christian McCaffrey loses fumble to open Super Bowl LVIII
122242843 Routing Number BANK OF THE WEST CA - Wise
Weeminuche Smoke Signal
Blanchard St Denis Funeral Home Obituaries
Jonathon Kinchen Net Worth
9192464227
Canelo Vs Ryder Directv
Does Publix Have Sephora Gift Cards
Fire Rescue 1 Login
Missing 2023 Showtimes Near Landmark Cinemas Peoria
Craigslist Cars Nwi
Transfer Credits Uncc
Alejos Hut Henderson Tx
Saberhealth Time Track
24 Hour Walmart Detroit Mi
Arboristsite Forum Chainsaw
Highland Park, Los Angeles, Neighborhood Guide
Tamilrockers Movies 2023 Download
Der Megatrend Urbanisierung
How Much You Should Be Tipping For Beauty Services - American Beauty Institute
Plan Z - Nazi Shipbuilding Plans
Union Ironworkers Job Hotline
Petco Vet Clinic Appointment
Xfinity Cup Race Today
6892697335
Effingham Daily News Police Report
Greater Orangeburg
3 Bedroom 1 Bath House For Sale
Haley Gifts :: Stardew Valley
Metro By T Mobile Sign In
Wsbtv Fish And Game Report
10 games with New Game Plus modes so good you simply have to play them twice
The Transformation Of Vanessa Ray From Childhood To Blue Bloods - Looper
Craigslist Jobs Brownsville Tx
Publictributes
Puretalkusa.com/Amac
Aita For Announcing My Pregnancy At My Sil Wedding
Below Five Store Near Me
Penny Paws San Antonio Photos
Alba Baptista Bikini, Ethnicity, Marriage, Wedding, Father, Shower, Nazi
Ouhsc Qualtrics
Myra's Floral Princeton Wv
Costner-Maloy Funeral Home Obituaries
60 Second Burger Run Unblocked
Is TinyZone TV Safe?
Pilot Travel Center Portersville Photos
Latest Posts
Article information

Author: Pres. Carey Rath

Last Updated:

Views: 6143

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Pres. Carey Rath

Birthday: 1997-03-06

Address: 14955 Ledner Trail, East Rodrickfort, NE 85127-8369

Phone: +18682428114917

Job: National Technology Representative

Hobby: Sand art, Drama, Web surfing, Cycling, Brazilian jiu-jitsu, Leather crafting, Creative writing

Introduction: My name is Pres. Carey Rath, I am a faithful, funny, vast, joyous, lively, brave, glamorous person who loves writing and wants to share my knowledge and understanding with you.