Handling locked db tables...



I have a db table that holds a list of ports. There is a column
in_use that is used as a flag for whether the port is currently in
use. When choosing a port the table is read and the first available
port with in_use = 0 is used, updated to in_use = 1, used, then
updated to in_use = 0. I am using MySQLdb and want to make sure I am
locking the table when doing reads, writes, updates since there will
be several instances of my program looking for available ports
simultaneously.

When I run a "lock table mytable read" I can do all of my
transactions. But, when another cursor then tries to do the read I
get an error unless the first process has been completed... unlocking
the tables. How is this handled generally?

Thanks.
.



Relevant Pages

  • Re: Portupgrading - portauditing
    ... > installed (window injection vulnerability). ... Even the portupgrade -f flag won't work and simply building ... > the port manually is also disabled for flagged ports. ... building ports despite vulnerabilities: ...
    (freebsd-questions)
  • Re: HEADSUP: arp-v2 has been committed
    ... I renamed this flag bit to RTF_LLDATA because only the ... Perhaps it's because these ports run on OS ... there is still a level of compatibility, ... It's just that this makes FreeBSD 8 ...
    (freebsd-current)
  • Re: HEADSUP: arp-v2 has been committed
    ... I renamed this flag bit to RTF_LLDATA because only the ... Perhaps it's because these ports run on OS ... there is still a level of compatibility, ... It's just that this makes FreeBSD 8 ...
    (freebsd-net)
  • RE: HEADSUP: arp-v2 has been committed
    ... Right now I am also a bit leaning towards reintroducing ... I renamed this flag bit to RTF_LLDATA because only the ... Perhaps it's because these ports run on OS ... there is still a level of compatibility, ...
    (freebsd-current)
  • RE: HEADSUP: arp-v2 has been committed
    ... Right now I am also a bit leaning towards reintroducing ... I renamed this flag bit to RTF_LLDATA because only the ... Perhaps it's because these ports run on OS ... there is still a level of compatibility, ...
    (freebsd-net)