Про списки объектов
Привет всем.
В потрохах Firebird многие вещи организованы в списки. Однонаправленные. Других я там не встречал. Ну организованы, так организованы. Вообщем-то, это их личные проблемы, которые снаружи не парят до определенного момента.
В процессе натягивания существующих тестов, созданных для собственного клиента FB (10-12 протоколы), на клиента для FB3 (13-ый протокол), задрался ждать пока завершится ничем неприметный тест. Полчаса работал. Полез в лог: в цикле три раза подряд создается/подготавливается/освобождается группа из 64999 запросов.
[THR:012440] [18.09.2016 10:44:40] *********************************************** [THR:012440] [18.09.2016 10:44:40] * START TEST [RemoteFB.WORK.013.StmtAllocate.v2.ptype__lazy_send.011.check_release_of_dropped_stmts] [THR:012440] [18.09.2016 10:44:40] * [THR:012440] [18.09.2016 10:44:40] [test] Hello from test! [THR:012440] [18.09.2016 10:44:40] [test] RemoteFB__Connector::ConnectToDatabase ...OK [THR:012440] [18.09.2016 10:44:40] [test] RemoteFB__Connector::StartTransaction ...OK [THR:012440] [18.09.2016 10:44:40] [test] Allocate statements ... [THR:012440] [18.09.2016 10:46:31] [test] OK. We got the error. [THR:012440] [18.09.2016 10:46:31] [test] 1. [Firebird] too many open handles to database [THR:012440] [18.09.2016 10:46:31] [test] 2. [LCPI.IBProvider.3] [Подсистема: remote_fb.p13] Ошибка инициализации дескриптора запроса. [THR:012440] [18.09.2016 10:46:31] [test] nMaxStatements: 64999 [THR:012440] [18.09.2016 10:46:32] [test] RemoteFB__Connector::ConnectToDatabase ...OK [THR:012440] [18.09.2016 10:46:32] [test] RemoteFB__Connector::StartTransaction ...OK [THR:012440] [18.09.2016 10:46:32] [test] -------------------------------- pass: 1 [THR:012440] [18.09.2016 10:46:32] [test] Allocate statements ... [THR:012440] [18.09.2016 10:46:32] [test] ---- [THR:012440] [18.09.2016 10:48:37] [test] Drop statements ... [THR:012440] [18.09.2016 10:48:37] [test] -------------------------------- pass: 2 [THR:012440] [18.09.2016 10:48:37] [test] Allocate statements ... [THR:012440] [18.09.2016 10:56:57] [test] ---- [THR:012440] [18.09.2016 10:58:49] [test] Drop statements ... [THR:012440] [18.09.2016 10:58:49] [test] -------------------------------- pass: 3 [THR:012440] [18.09.2016 10:58:49] [test] Allocate statements ... [THR:012440] [18.09.2016 11:10:01] [test] ---- [THR:012440] [18.09.2016 11:11:51] [test] Drop statements ... [THR:012440] [18.09.2016 11:11:51] [test] RemoteFB__Connector::Commit ...OK [THR:012440] [18.09.2016 11:14:24] [test] RemoteFB__Connector::DetachDatabase ...OK [THR:012440] [18.09.2016 11:14:24] * [THR:012440] [18.09.2016 11:14:24] * REAL TIME:17845270915 [00:29:44.5270915] [THR:012440] [18.09.2016 11:14:24] * USER TIME:155844999 [00:00:15.5844999] [THR:012440] [18.09.2016 11:14:24] * KERNEL TIME:82524529 [00:00:08.2524529] [THR:012440] [18.09.2016 11:14:24] * TOTAL TIME:238369528 [00:00:23.8369528] [THR:012440] [18.09.2016 11:14:24] * [THR:012440] [18.09.2016 11:14:24] * STOP TEST [RemoteFB.WORK.013.StmtAllocate.v2.ptype__lazy_send.011.check_release_of_dropped_stmts]
А, ну да… Однонаправленный список объектов запросов.
Где-то год назад меня эта однонаправленность конкретно задолбала и пришлось выписать серверу лекарство — двунаправленный список, который гарантирует фиксированное время удаления элементов.
Наверное надо будет в свою тройку его тоже залить. Потому что FB2.5 (такой же отладочный как и тройка) с этим исправлением работает в два раза быстрее:
[THR:013768] [18.09.2016 11:19:07] *********************************************** [THR:013768] [18.09.2016 11:19:07] * START TEST [RemoteFB.WORK.013.StmtAllocate.v2.ptype__lazy_send.011.check_release_of_dropped_stmts] [THR:013768] [18.09.2016 11:19:07] * [THR:013768] [18.09.2016 11:19:07] [test] Hello from test! [THR:013768] [18.09.2016 11:19:09] [test] RemoteFB__Connector::ConnectToDatabase ...OK [THR:013768] [18.09.2016 11:19:09] [test] RemoteFB__Connector::StartTransaction ...OK [THR:013768] [18.09.2016 11:19:09] [test] Allocate statements ... [THR:013768] [18.09.2016 11:21:38] [test] OK. We got the error. [THR:013768] [18.09.2016 11:21:38] [test] 1. [Firebird] too many open handles to database [THR:013768] [18.09.2016 11:21:38] [test] 2. [LCPI.IBProvider.3] [Подсистема: remote_fb.p12] Ошибка инициализации дескриптора запроса. [THR:013768] [18.09.2016 11:21:38] [test] nMaxStatements: 64999 [THR:013768] [18.09.2016 11:22:06] [test] RemoteFB__Connector::ConnectToDatabase ...OK [THR:013768] [18.09.2016 11:22:06] [test] RemoteFB__Connector::StartTransaction ...OK [THR:013768] [18.09.2016 11:22:06] [test] -------------------------------- pass: 1 [THR:013768] [18.09.2016 11:22:06] [test] Allocate statements ... [THR:013768] [18.09.2016 11:22:06] [test] ---- [THR:013768] [18.09.2016 11:24:37] [test] Drop statements ... [THR:013768] [18.09.2016 11:24:37] [test] -------------------------------- pass: 2 [THR:013768] [18.09.2016 11:24:37] [test] Allocate statements ... [THR:013768] [18.09.2016 11:26:27] [test] ---- [THR:013768] [18.09.2016 11:28:56] [test] Drop statements ... [THR:013768] [18.09.2016 11:28:56] [test] -------------------------------- pass: 3 [THR:013768] [18.09.2016 11:28:56] [test] Allocate statements ... [THR:013768] [18.09.2016 11:30:47] [test] ---- [THR:013768] [18.09.2016 11:33:16] [test] Drop statements ... [THR:013768] [18.09.2016 11:33:16] [test] RemoteFB__Connector::Commit ...OK [THR:013768] [18.09.2016 11:33:50] [test] RemoteFB__Connector::DetachDatabase ...OK [THR:013768] [18.09.2016 11:33:50] * [THR:013768] [18.09.2016 11:33:50] * REAL TIME:8831512364 [00:14:43.1512364] [THR:013768] [18.09.2016 11:33:50] * USER TIME:134316861 [00:00:13.4316861] [THR:013768] [18.09.2016 11:33:50] * KERNEL TIME:131352842 [00:00:13.1352842] [THR:013768] [18.09.2016 11:33:50] * TOTAL TIME:265669703 [00:00:26.5669703] [THR:013768] [18.09.2016 11:33:50] * [THR:013768] [18.09.2016 11:33:50] * STOP TEST [RemoteFB.WORK.013.StmtAllocate.v2.ptype__lazy_send.011.check_release_of_dropped_stmts]
Но это надо раз десять тест запустить, чтобы созреть для такого подвига.