• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Awaiting feedback  Import from vBulletin fails on polls

Rigel Kentaurus

Well-known member
#1
I tried an import from my database, and got stuck at the "Import polls" stage. I kept getting this errors:

Code:
Mysqli statement execute error : Duplicate entry 'thread-2881' for key 2 			library/Zend/Db/Statement/Mysqli.php:214
Detail:
Code:
#0 /home/fanficslandia/xenforo/library/Zend/Db/Statement.php(292): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/fanficslandia/xenforo/library/Zend/Db/Adapter/Abstract.php(468): Zend_Db_Statement->execute(Array)
#2 /home/fanficslandia/xenforo/library/Zend/Db/Adapter/Abstract.php(546): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
#3 /home/fanficslandia/xenforo/library/XenForo/DataWriter.php(1490): Zend_Db_Adapter_Abstract->insert('xf_poll', Array)
#4 /home/fanficslandia/xenforo/library/XenForo/DataWriter.php(1479): XenForo_DataWriter->_insert()
#5 /home/fanficslandia/xenforo/library/XenForo/DataWriter.php(1287): XenForo_DataWriter->_save()
#6 /home/fanficslandia/xenforo/library/XenForo/Model/Import.php(292): XenForo_DataWriter->save()
#7 /home/fanficslandia/xenforo/library/XenForo/Model/Import.php(856): XenForo_Model_Import->_importData(8118, 'XenForo_DataWri...', 'poll', 'poll_id', Array)
#8 /home/fanficslandia/xenforo/library/XenForo/Importer/vBulletin.php(1916): XenForo_Model_Import->importThreadPoll(8118, '2881', Array, Array, Array)
#9 /home/fanficslandia/xenforo/library/XenForo/Importer/Abstract.php(77): XenForo_Importer_vBulletin->stepPolls(8115, Array)
#10 /home/fanficslandia/xenforo/library/XenForo/ControllerAdmin/Import.php(161): XenForo_Importer_Abstract->runStep(Object(XenForo_ControllerAdmin_Import), Object(XenForo_ImportSession), 'polls', 8115, Array)
#11 /home/fanficslandia/xenforo/library/XenForo/ControllerAdmin/Import.php(105): XenForo_ControllerAdmin_Import->_runStep(Object(XenForo_Importer_vBulletin), Object(XenForo_ImportSession), 'polls', 8115, Array)
#12 /home/fanficslandia/xenforo/library/XenForo/FrontController.php(303): XenForo_ControllerAdmin_Import->actionImport()
#13 /home/fanficslandia/xenforo/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#14 /home/fanficslandia/xenforo/admin.php(13): XenForo_FrontController->run()
#15 {main}
Worst part is, when I try to resume the import, it gets stuck on polls, so I have no way of say, continuing without polls.

My workaround was disabling indexes on the xf_poll table, but then I started getting errors on xf_poll_response and xf_poll_vote.

After disabling indexes in all of them, I got duplicates

Code:
select content_id,count(*) from xf_poll group by content_id having count(*) > 1;
produces

Code:
|         50 |        5 | 
|       2540 |        5 | 
|       2548 |        5 | 
|       2749 |        5 | 
|       2873 |        5 | 
|       2881 |        5 | 
|       2922 |        4 | 
|       2941 |        5 | 
|       2970 |        5 | 
|       2980 |        5 | 
|       3001 |        5 | 
|       3037 |        5 | 
|       3044 |        5 | 
|       3067 |        5 | 
|       3074 |        5 | 
|       3076 |        5 | 
|       3098 |        5 | 
|       3117 |        5 | 
|       3118 |        5 | 
|       3137 |        5 | 
|       3139 |        5 | 
|       3167 |        5 | 
|       3184 |        5 | 
|       3187 |        5 | 
|       3249 |        5 | 
|       3282 |        5 |
 

Mike

XenForo developer
Staff member
#2
I'm actually sort of baffled how this could happen. I did find a potential bug, but I'm struggling to see how it could cause this. The data structure we're importing from ensures that there's only 1 poll per thread, so I'm not sure how repetitions could fit in. I do know of an issue that causes the importer to get into a loop, but you would've run into that far earlier (and you wouldn't have been able to get out of it).

I don't know if you are willing/able to try to debug this any further, but do you see duplicates coming out of the $polls data? (it's around line 1900 of library/XenForo/Importer/vBulletin.php)