Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is not parallel postgresql connection. #9

Open
akalend opened this issue Jun 13, 2024 · 2 comments
Open

Is not parallel postgresql connection. #9

akalend opened this issue Jun 13, 2024 · 2 comments

Comments

@akalend
Copy link

akalend commented Jun 13, 2024

The code of postgresql rw-test usingmolly. After first or second call method invoike the connection was closed. It can check parallel sql command:

SELECT client_addr,pid,usename,application_name FROM pg_stat_activity;

So, it can look in output trace:

Run PostgreSQL examples with Tarantool
setup
setup
setup
setup
setup
teardown
class:	table: 0x7f7ef8691d40
close 
teardown
[INFO  2024-06-13 10:50:29:87823 ]: ERROR: test/examples/pgsql-rw-register.lua:90: calling 'execute' on bad self (LuaSQL: connection is closed)
teardown
[INFO  2024-06-13 10:50:29:87871 ]: ERROR: test/examples/pgsql-rw-register.lua:90: calling 'execute' on bad self (LuaSQL: connection is closed)
teardown
[INFO  2024-06-13 10:50:29:87889 ]: ERROR: test/examples/pgsql-rw-register.lua:90: calling 'execute' on bad self (LuaSQL: connection is closed)
teardown
[INFO  2024-06-13 10:50:29:87908 ]: ERROR: test/examples/pgsql-rw-register.lua:90: calling 'execute' on bad self (LuaSQL: connection is closed)
@akalend
Copy link
Author

akalend commented Jun 13, 2024

So, see pg_rw_register.teardown () method:
assert(self.con:execute("INSERT INTO log_register VALUES(1)"))

For 5 open connections must be 5 records, is only one.

@akalend
Copy link
Author

akalend commented Jun 13, 2024

The simple corutine model have 5 connections constantly:

function testdb(n)
local luasql = require "luasql.postgres"
local env = assert (luasql.postgres())
local con = assert (env:connect('test2', 'postgres', nil, "127.0.0.1", 5432))

coroutine.yield(n)

local query = string.format("SELECT * FROM rw_register where val=%d", n)
local cur = assert(con:execute(query))
print(query)
coroutine.yield(query)

local row = cur:fetch ({}, "a")
local count = 0
while row do
print(string.format("%d %d", row.val, row.ver ))
row = cur:fetch (row, "a")
count = count + 1
end

coroutine.yield(count)

cur:close()
con:close()
env:close()

end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant