Subject Re: [ib-support] Serialization?
Author Martijn Tonies
Hi,

> as I stated before, I'm writing my graduation thesis.
> Part of my thesis requires I realize a kind of "crawler", that is a
> "robot" that discover and retrieve documents from a network. This
> robot keeps the URL that finds in the documents in a Firebird DB.
>
> Due to netiquette policy, I want that if one thread is downloading a
> document from a host, no other thread should download documents from
> the same host.
>
> HOST is a separate table, so I can "mark" a row as "downloading"
> when assigned to a task and then mark it as "free" when the download
> process ends.
>
> Now the problem: let's imagine that two threads request a URL at the
> same time.
> 1. How can I avoid they get the same URL?
> 2. How can I avoid they get two different URLs lying on the same
> HOST?

Transactions and deadlocks... If the columns aren't too long, a UNIQUE
or PRIMARY KEY constraint.

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."