我有一个多个处理器请求工作的API。 API的工作是从内存优化表中选择记录,并标记分配的状态并将其交给请求者。我有多个处理器可以同时请求工作,我们一直在争吵
Error Message :- The current transaction attempted to update a record that has been updated since this transaction started. The transaction was aborted.
我该如何克服这个问题?
这是API中GetWork方法的示例
update memtabletemp set memtabletemp.status = 'ASSIGNED' , memtabletemp.statustimestamp = current_timestamp
OUTPUT INSERTED.memid,INSERTED.recordtype from(select top 5 memid, recordtype,status,statustimestamp from
memtable where status = 'READY')memtabletemp