If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Concurrency problem: Use row locking or some other method?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-20-09, 22:56
KingSpork KingSpork is offline
Registered User
 
Join Date: Jul 2009
Posts: 1
Concurrency problem: Use row locking or some other method?

I am working on an application that regularly dumps various URLs into a table. Elsewhere, another process then routinely checks for new rows, fetches each URL, and then deletes the row. I'd make the part of the app that does the URL fetching to be multithreaded. However, I don't know how I am going to avoid concurrency issues. What's the best way to approach this problem?

I want to make sure that each URL is fetched only once, plus ensure that if an HTTP error occurs (or a similar error) while fetching the URL that the row is not deleted from the table.

(I'm using plpgsql sprocs (PostgreSQL) and Python on the app end if anyone cares. But this seems to more of a general architectural question)
Reply With Quote
  #2 (permalink)  
Old 07-21-09, 04:07
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
I don't know PostgreSQL, however the RDBMS might be relevant. For example, my RDBMS of choice is SQL Server and my first thought would be to issue a delete statement with the OUTPUT clause - this would deletes rows and returns the deleted rows as a result set in a single operation.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On