Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4574148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:53:00+00:00 2026-05-21T19:53:00+00:00

CAVEAT : I ran into this problem a few years ago. I forget the

  • 0

CAVEAT: I ran into this problem a few years ago. I forget the actual problem I was trying to solve so I have substituted it with a theoretical problem involving a linked list.


I’ve been trying to use READ_COMMITTED transaction isolation level for over a year now and I’m getting very frustrated with the bugs resulting from my lack of experience. I would appreciate it if you guys could give me a head’s up as to what I am missing here.

Pretty much all application logic I implement cannot be expressed in terms of a single SQL query. That is, I almost always end up having to walk the object graph. Inevitably I run into inconsistent state from within the same transaction. For example, imagine you store a singly-linked list in the database and you want to find out whether the list contains a loop (described in greater detail below). I can’t think of any way to do this under READ_COMMITTED because the outbound references could be updated from underneath my feet as I walk the graph. I can only see READ_COMMITTED working is for queries which can be represented using a single SQL statement.

  • The database schema is Node[id, name, next_id]
  • Initially the database contains: A -> B -> C -> A

    1. Thread 1 reads: A -> B, B -> C
    2. Thread 2 updates the database to: D -> B -> C -> D
    3. Thread 1 reads: C -> D
    4. Thread 1 detects no loop although one should have been detected. From Thread 1’s point of view it read: A -> B -> C -> D but it should have detected one of the following loops:

A -> B -> C -> A or
D -> B -> C -> D

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:53:01+00:00Added an answer on May 21, 2026 at 7:53 pm

    Answer courtesy of Michal Bergmann: http://groups.google.com/group/h2-database/browse_frm/thread/8f253177e2b6c543?tvc=1

    READ_COMMITTED_SNAPSHOT isolation level can help you to solve problem
    with concurrent operations. It allows to performing multiple queries
    without being affected by other simultaneous transactions.

    You could also

    • copy data to temporary table first
    • lock the table and prevent updates
    • monitor table for changes (with a trigger) and if it does change
      during loop detection, your result may not be valid, then you can
      throw it away and repeat loop detection.
    • use application logic to postpone any changes till loop detection is
      finished

    Using READ_COMMITTED_SNAPSHOT isolation level is probably the best
    solution, if database supports it. It has low overhead and doesn’t
    block concurrent transactions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[Caveat] This is not directly a programing question, but it is something that comes
Standard SEO caveat: It's a black box, and the algorithms are proprietary, and trying
Will this robots.txt file only allow googlebot to index my site's index.php file? CAVEAT,
Caveat: I realize this is potentially a server configuration question, but I thought there
Caveat: I'm relatively new to coding as well as TextMate , so apologies if
How do you tell if caps lock is on using JavaScript? One caveat though:
I'm trying to figure the best way to query a date range from rails...I
A while ago we started developing a new project which internally has about 25-30
I have an SP that takes 10 seconds to run about 10 times (about
Caveat: I'm still struggling with proper MVC in Eclipse plugin development, so if you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.