Reseting DB through test support endpoint takes a lot of time sometimes
See original GitHub issueThis is a…
[ ] Feature request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Documentation issue or request
Description
I thought it was related to the openstack environment, but I managed to reproduce on minishift as well. The resetDB endpoint is called before each test and after several tests, the resetDB starts to takes more and more time, on openstack I saw the call to take 50 minutes once.
There are some idle connections in the DB that may be related to that:
pid | state | query_start | query
------+---------------------+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
130 | idle | 2019-01-18 11:38:26.663967+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
131 | idle in transaction | 2019-01-18 11:38:25.988674+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
132 | active | 2019-01-18 11:38:25.520318+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
133 | idle | 2019-01-18 11:37:38.739764+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
134 | idle | 2019-01-18 11:17:19.974948+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
135 | idle | 2019-01-18 11:33:39.611987+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
136 | idle in transaction | 2019-01-18 10:07:44.501777+00 | SELECT p.proname,p.oid FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n WHERE p.pronamespace=n.oid AND n.nspname='pg_catalog' AND ( proname = 'lo_open' or proname = 'lo_close' or proname = 'lo_creat' or proname = 'lo_unlink' or proname = 'lo_lseek' or proname = 'lo_lseek64' or proname = 'lo_tell' or proname = 'lo_tell64' or proname = 'loread' or proname = 'lowrite' or proname = 'lo_truncate' or proname = 'lo_truncate64')
137 | idle | 2019-01-18 11:12:03.668276+00 | COMMIT
138 | active | 2019-01-18 11:38:23.892177+00 | select path,value,ovalue from jsondb where path LIKE $1 order by path ASC
139 | idle in transaction | 2019-01-18 11:19:48.943358+00 | SELECT data FROM filestore WHERE path=$1
8061 | active | 2019-01-18 11:38:26.982092+00 | select pid,state,query_start,query from pg_stat_activity where pg_stat_activity.datname = current_database()
(11 rows)
When I restart syndesis-server pod, all connections are cleared and resetDB is almost instant again.
This may be related to the excessive usage of reset db endpoint and customers may not hit that, but I would like to have a confirmation from ENG.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
What is your go-to solution for resetting a database between ...
I tried writing a DB-resetting script to run between tests, but it took over 6s to execute, so that doesn't seem like the...
Read more >9 Ways To Make Slow Tests Faster - Semaphore CI
Problem: large tests take a long time to complete, are hard to maintain, and cannot take advantage of concurrency. Solution: divide et impera....
Read more >Optimizing Spring Integration Tests - Baeldung
In this article, we'll have a holistic discussion about integration tests using Spring and how to optimize them.
Read more >A step-by-step intro to end-point testing - freeCodeCamp
I've been playing around with testing lately. One thing I tried to do was to test the endpoints of my Express application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zregvart looks ok now, at least it doesn’t get stuck after the mentioned scenario. I just started the tests and hopefully, everything remains ok 😃
For some reason, after creating the AMQ to REST quickstart integration, DB reset seem to be stuck on
TRUNCATE TABLE filestore
, causing reset db to not finish at all. May this be related to the fact that the extension is in the integration?steps to reproduce: