Subject | Lock update for checkin/checkout? |
---|---|
Author | h_urlaf |
Post date | 2004-02-03T19:55:49Z |
Hi,
I have a database with pictures like
CREATE TABLE IMGS (
IMG_ID BIGINT NOT NULL,
IMG_DATA BLOB
MIMETYPE VARCHAR(10) NOT NULL,
CONVERT_TO VARCHAR(10)
PRIMARY KEY (IMG_ID),
)
;
(this is not the exact table but simplified for this example). This
database would be accessed by multiple clients that look for rows that
have CONVERT_TO not equal NULL, lock the row in some way so other
clients would not see it or would know to ignore it without race
conditions, the client would convert the blob to the requested
mimetype, and set convert_to to NULL. Conversion can take anywhere
from 1 second to 45 minutes; typical conversion time is 2 minutes.
Although I guess I would only have to fetch and set to NULL the
CONVERT_TO within the transaction.
Is the new SELECT WITH LOCK the way to go here, or is there a simpler
facility. This is really the only place I want transactions to
'exclude' each other. In all other instances I want as high a level of
concurrency as possible.
Thanks,
Emiliano
I have a database with pictures like
CREATE TABLE IMGS (
IMG_ID BIGINT NOT NULL,
IMG_DATA BLOB
MIMETYPE VARCHAR(10) NOT NULL,
CONVERT_TO VARCHAR(10)
PRIMARY KEY (IMG_ID),
)
;
(this is not the exact table but simplified for this example). This
database would be accessed by multiple clients that look for rows that
have CONVERT_TO not equal NULL, lock the row in some way so other
clients would not see it or would know to ignore it without race
conditions, the client would convert the blob to the requested
mimetype, and set convert_to to NULL. Conversion can take anywhere
from 1 second to 45 minutes; typical conversion time is 2 minutes.
Although I guess I would only have to fetch and set to NULL the
CONVERT_TO within the transaction.
Is the new SELECT WITH LOCK the way to go here, or is there a simpler
facility. This is really the only place I want transactions to
'exclude' each other. In all other instances I want as high a level of
concurrency as possible.
Thanks,
Emiliano