Skip to content

query concurrency problem - Table is Locked #1243

@msudhayaraj

Description

@msudhayaraj

Environment

Knex version: 0.20.11
Database + version: ORACLE 11g
OS: Ubuntu 16.04 LTS

I try to run a update query with concurrent call.
The result is table locked. How to handle this issue. Is this correct way.
how to handle the concurrency .

The old conversion of the issue click here. Please help solve this. Thanks in advance.

The sample code is below

var oracledb = require('oracledb');
var strConnection = {
user: 'USR',
password: 'PWD',
connectString: "DB"
};
oracledb.poolMin = 3;
oracledb.poolMax = 7;
oracledb.poolIncrement = 1;
oracledb.poolPingInterval = 60; // seconds
oracledb.poolTimeout = 60;

oracledb.createPool(strConnection).then(pool => {
oraclePool = pool;

let sql = "update transaction_set set status='OK' where ts_id = 10693";

let manyQueries = [];
for (let i = 0; i < 200; i++) {
manyQueries.push(
pool.getConnection().then(conn => {
return conn.execute(sql);
}));
}
Promise.all(manyQueries).then(() => {
console.log('All queries done!');
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions