1 | $ ./python_db_test.py |
---|
2 | |
---|
3 | Python Version : 2.7.15rc1 |
---|
4 | SQL Driver Version: ('MySQLdb', 1, 3, 10, 'final', 0) |
---|
5 | |
---|
6 | This test run in 2 steps: |
---|
7 | - tc #1 uses the old version of MysqlDB.ping: '_ping121(self): self._get_db().ping(True)' |
---|
8 | - tc #2 uses the new version of MysqlDB.ping: '_ping122(self): self._get_db().ping()' |
---|
9 | Each test connects to mysql via the MythTV Python Bindings and checks connection recovery after a timeout occured. |
---|
10 | Note: MythTV Python uses a pool of connections to MysqlDB. For test purposes, this script allows only one connection at a time. |
---|
11 | |
---|
12 | Connect to MythDB (tc = 1) : |
---|
13 | Allow only one connection from Python Bindings to mysql: MythDB.db.resizePool(1) |
---|
14 | MYSQL version : 10.1.34-MariaDB-0ubuntu0.18.04.1 |
---|
15 | Connection_ID : 152 |
---|
16 | current SQL timeouts for this session: |
---|
17 | session.wait_timeout : 28800 |
---|
18 | session.interactive_timeout : 28800 |
---|
19 | Connection_ID : 152 |
---|
20 | set session timeouts to 60 secs: |
---|
21 | Connection_ID : 152 |
---|
22 | session.wait_timeout set to 60 |
---|
23 | session.interactive_timeout set to 60 |
---|
24 | check again current timeouts: |
---|
25 | session.wait_timeout : 60 |
---|
26 | session.interactive_timeout : 60 |
---|
27 | Connection_ID : 152 |
---|
28 | sleep 50 secs (should not time out) ... |
---|
29 | ping db connection with _ping121() |
---|
30 | sleep 50 secs (should not time out) ... |
---|
31 | ping db connection with _ping121() |
---|
32 | sleep 80 secs (should time out) ... |
---|
33 | ping db connection with _ping121() |
---|
34 | Connection_ID : 153 |
---|
35 | Is this Connection_ID ident to the original one ( 152 <> 153 ) ? |
---|
36 | |
---|
37 | Connect to MythDB (tc = 2) : |
---|
38 | Allow only one connection from Python Bindings to mysql: MythDB.db.resizePool(1) |
---|
39 | MYSQL version : 10.1.34-MariaDB-0ubuntu0.18.04.1 |
---|
40 | Connection_ID : 154 |
---|
41 | current SQL timeouts for this session: |
---|
42 | session.wait_timeout : 28800 |
---|
43 | session.interactive_timeout : 28800 |
---|
44 | Connection_ID : 154 |
---|
45 | set session timeouts to 60 secs: |
---|
46 | Connection_ID : 154 |
---|
47 | session.wait_timeout set to 60 |
---|
48 | session.interactive_timeout set to 60 |
---|
49 | check again current timeouts: |
---|
50 | session.wait_timeout : 60 |
---|
51 | session.interactive_timeout : 60 |
---|
52 | Connection_ID : 154 |
---|
53 | sleep 50 secs (should not time out) ... |
---|
54 | ping db connection with _ping122() |
---|
55 | sleep 50 secs (should not time out) ... |
---|
56 | ping db connection with _ping122() |
---|
57 | sleep 80 secs (should time out) ... |
---|
58 | ping db connection with _ping122() |
---|
59 | XXX rollback called ! |
---|
60 | Traceback (most recent call last): |
---|
61 | File "./python_db_test.py", line 126, in <module> |
---|
62 | %(connection_id_1, connection_id_2) ) |
---|
63 | File "/usr/lib/python2.7/dist-packages/MythTV/database.py", line 1431, in __exit__ |
---|
64 | def __exit__(self, ty, va, tr): return self.db.__exit__(ty, va, tr) |
---|
65 | File "/usr/lib/python2.7/dist-packages/MythTV/connections.py", line 181, in __exit__ |
---|
66 | cursor.rollback() |
---|
67 | File "/usr/lib/python2.7/dist-packages/MythTV/_conn_mysqldb.py", line 108, in rollback |
---|
68 | self._get_db().rollback() |
---|
69 | _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away') |
---|
70 | |
---|