On Sat, 26 Dec 2009 10:43:55 +0800 Eva said:

> 2009-12-26 2:36, Don Read :
> 
> >
> > Change noticed to enum('new', 'scan', 'done') not null default 'new';
> >
> > When proc two runs, it should
> > "UPDATE noticed='scan' WHERE noticed='new'"
> > Then repeat the scan with "SELECT ... WHERE noticed='scan'"
> > ...
> > and finally it should "UPDATE domain=whatever, ... noticed='done'"
> >
> 
> Thanks Don.
> That means, when process one want to update "ip" but it see 
> noticed="scan", it will block until the status become "done", is it?
> 
> Eva

Depends on how closely coupled the two processes are.
a. proc #1 can only insert new ip's (INSERT IGNORE)
b. proc #1 could ignore/refuse to update any ip not 'new'
c. proc #1 could leave the noticed field alone.
d. proc #1 could set noticed to 'new' (and let proc #2 scan it again)

Which alternative works best for your application?

Regards,
-- 
Don Read                                        don_r...@att.net
     It's always darkest before the dawn. So if you are going to
     steal the neighbor's newspaper, that's the time to do it.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to