Kbase P69217: Intermittent error 132 within a multi-user environment
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
SYMPTOM(s):
Intermittent error 132 within a multi-user environment
** <file-name> already exists with <field/value...>. (132)
** y_z_sett already exists with seq_nr_log 5213. (132)
<file-name> in use by <user> on <tty>. Wait or press <STOP> to stop. (121)
y_z_sett in use by on tty ?. Wait or press CTRL-C to stop. (121)
The program below run within 2 sessions generate above errors
CAUSE:
Timing issue: two users can read the same LAST record as the new record was not created fast enough.
FIX:
Modify procedure "newcreate" so the exclusive-lock is a brief as possible.
PROCEDURE newcreate:
DEFINE VARIABLE vSeqNr AS INTEGER NO-UNDO.
DO ON STOP UNDO, RETURN ERROR
ON ERROR UNDO, RETURN ERROR:
FIND LAST y_z_sett NO-LOCK NO-ERROR.
IF AVAILABLE y_z_sett THEN DO:
vSeqNr = y_z_sett.seq_nr_log.
RecordLock:
REPEAT:
FIND LAST y_z_sett WHERE y_z_sett.seq_nr_log >= vSeqNr
EXCLUSIVE-LOCK NO-ERROR.
vSeqNr = IF AVAILABLE y_z_sett THEN y_z_sett.seq_nr_log ELSE 0.
FIND LAST y_z_sett WHERE y_z_sett.seq_nr_log >= vSeqNr
NO-LOCK NO-ERROR.
IF vSeqNr = y_z_sett.seq_nr_log THEN LEAVE RecordLock.
END.
vSeqNr = y_z_sett.seq_nr_log.
END.
CREATE y_z_sett.
ASSIGN
Y_z_sett.adm-nr = 5367
y_z_sett.seq_nr_log = vSeqNr + 1.
END.
END PROCEDURE.