Project: datamanagement
Issue DM-1732: Fix error on duplicate result_id_m table while launching qserv integration tests
Next command: {code} qserv-check-integration.py --case=01 --load; qserv-check-integration.py --case=02 --load {code} Fails, most of the time, with next error in logs: {code} qserv@clrinfoport09:~/src/qserv (u/fjammes/DM-627 *+)⟫ cat ~/qserv-run/2014_12/var/log/qserv-czar.log | grep result_1211906_m 0103 16:38:18.576 [0x7f23c4ff9700] DEBUG root (build/rproc/InfileMerger.cc:432) - InfileMerger create table:CREATE TABLE qservResult.result_1211906_m (`ra` DOUBLE) 0103 16:38:18.661 [0x7f23c4ff9700] DEBUG root (build/rproc/InfileMerger.cc:354) - InfileMerger sql success: CREATE TABLE qservResult.result_1211906_m (`ra` DOUBLE) 0103 16:38:18.661 [0x7f23c4ff9700] DEBUG root (build/rproc/InfileMerger.cc:445) - InfileMerger table qservResult.result_1211906_m is ready 0103 16:38:18.686 [0x7f23c77fe700] INFO root (build/rproc/InfileMerger.cc:299) - Merging w/CREATE TABLE qservResult.result_1211906 SELECT ra AS ra FROM qservResult.result_1211906_m ORDER BY ra 0103 16:38:18.720 [0x7f23c77fe700] DEBUG root (build/rproc/InfileMerger.cc:354) - InfileMerger sql success: CREATE TABLE qservResult.result_1211906 SELECT ra AS ra FROM qservResult.result_1211906_m ORDER BY ra 0103 16:38:18.720 [0x7f23c77fe700] INFO root (build/rproc/InfileMerger.cc:305) - Cleaning up qservResult.result_1211906_m 0103 16:38:18.721 [0x7f23c77fe700] INFO root (build/rproc/InfileMerger.cc:317) - Merged qservResult.result_1211906_m into qservResult.result_1211906 0103 16:38:24.716 [0x7fe3cf7fe700] DEBUG root (build/rproc/InfileMerger.cc:432) - InfileMerger create table:CREATE TABLE qservResult.result_1211906_m (`QS1_COUNT` BIGINT(21)) 0103 16:38:24.717 [0x7fe3cf7fe700] ERROR root (build/rproc/InfileMerger.cc:351) - InfileMerger sql error: Error applying sql. Error 1050: Table 'result_1211906_m' already exists Unable to execute query: CREATE TABLE qservResult.result_1211906_m (`QS1_COUNT` BIGINT(21)) 0103 16:38:24.717 [0x7fe3cf7fe700] ERROR root (build/rproc/InfileMerger.cc:438) - InfileMerger error: Error creating table (qservResult.result_1211906_m) 0103 16:38:34.672 [0x7fe3deffd700] INFO root (build/rproc/InfileMerger.cc:299) - Merging w/CREATE TABLE qservResult.result_1211906 SELECT SUM(QS1_COUNT) AS OBJ_COUNT FROM qservResult.result_1211906_m 0103 16:38:34.673 [0x7fe3deffd700] ERROR root (build/rproc/InfileMerger.cc:351) - InfileMerger sql error: Error applying sql. Error 1054: Unknown column 'QS1_COUNT' in 'field list' Unable to execute query: CREATE TABLE qservResult.result_1211906 SELECT SUM(QS1_COUNT) AS OBJ_COUNT FROM qservResult.result_1211906_m 0103 16:38:34.673 [0x7fe3deffd700] INFO root (build/rproc/InfileMerger.cc:305) - Cleaning up qservResult.result_1211906_m 0103 16:38:34.674 [0x7fe3deffd700] INFO root (build/rproc/InfileMerger.cc:317) - Merged qservResult.result_1211906_m into qservResult.result_1211906 {code} So it seems test case #01 create table .result_1211906_m, and then test case #02 try to re-use this name for an other query. Qserv result tables aren't cleaned (here Qserv has be stopped): {code} ls ~/qserv-run/2014_12/var/lib/mysql/qservResult/ db.opt result_1211336_m.MYI result_1211340_m.MYI result_1211343_m.MYI result_1211346_m.MYI result_1211382_m.MYI result_1211385_m.MYI result_1211902_m.MYI result_1211905_m.MYI result_1211334_m.frm result_1211337_m.frm result_1211341_m.frm result_1211344_m.frm result_1211347_m.frm result_1211383_m.frm result_1211386_m.frm result_1211903_m.frm result_1211906_m.frm result_1211334_m.MYD result_1211337_m.MYD result_1211341_m.MYD result_1211344_m.MYD result_1211347_m.MYD result_1211383_m.MYD result_1211386_m.MYD result_1211903_m.MYD result_1211906_m.MYD result_1211334_m.MYI result_1211337_m.MYI result_1211341_m.MYI result_1211344_m.MYI result_1211347_m.MYI result_1211383_m.MYI result_1211386_m.MYI result_1211903_m.MYI result_1211906_m.MYI result_1211335_m.frm result_1211339_m.frm result_1211342_m.frm result_1211345_m.frm result_1211381_m.frm result_1211384_m.frm result_1211901_m.frm result_1211904_m.frm result_1211335_m.MYD result_1211339_m.MYD result_1211342_m.MYD result_1211345_m.MYD result_1211381_m.MYD result_1211384_m.MYD result_1211901_m.MYD result_1211904_m.MYD result_1211335_m.MYI result_1211339_m.MYI result_1211342_m.MYI result_1211345_m.MYI result_1211381_m.MYI result_1211384_m.MYI result_1211901_m.MYI result_1211904_m.MYI result_1211336_m.frm result_1211340_m.frm result_1211343_m.frm result_1211346_m.frm result_1211382_m.frm result_1211385_m.frm result_1211902_m.frm result_1211905_m.frm result_1211336_m.MYD result_1211340_m.MYD result_1211343_m.MYD result_1211346_m.MYD result_1211382_m.MYD result_1211385_m.MYD result_1211902_m.MYD result_1211905_m.MYD {code} Changing _idCounter to next value in appInterface.py: {code:python} self._idCounter = int(time.time() % (60*60*24*365) * 10) {code} solves the problem, but a deeper explanation will allow to bring a more robust fix.
Story points: 8