Not a bug MySQL statement prepare error [1030]: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB

mcatze

Well-known member
Licensed customer
Affected version
2.3.10
When i want to watch a media from the gallery or as an attachment, the media cannot found. And igot this error in the admin cp.

XF\Db\Exception: MySQL statement prepare error [1030]: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
src/XF/Db/AbstractStatement.php:225
Code:
-- XFDB=noForceAllWrite
            INSERT INTO xf_attachment_view
                (attachment_id, total)
            VALUES
                (? , 1)
            ON DUPLICATE KEY UPDATE
                total = total + 1
        
------------

#0 src/XF/Db/Mysqli/Statement.php(207): XF\Db\AbstractStatement->getException('MySQL statement...', 1030, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(43): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1030, 'HY000')
#2 src/XF/Db/Mysqli/Statement.php(61): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Repository/AttachmentRepository.php(211): XF\Db\AbstractAdapter->query('
            -- XFDB=noF...', 18282)
#5 src/XF/ControllerPlugin/AttachmentPlugin.php(29): XF\Repository\AttachmentRepository->logAttachmentView(Object(XFMG\XF\Entity\Attachment))
#6 src/XF/Pub/Controller/AttachmentController.php(49): XF\ControllerPlugin\AttachmentPlugin->displayAttachment(Object(XFMG\XF\Entity\Attachment))
#7 src/XF/Mvc/Dispatcher.php(362): XF\Pub\Controller\AttachmentController->actionIndex(Object(XF\Mvc\ParameterBag))
#8 src/XF/Mvc/Dispatcher.php(264): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Index', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\AttachmentController), NULL)
#9 src/XF/Mvc/Dispatcher.php(121): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\AttachmentController), NULL)
#10 src/XF/Mvc/Dispatcher.php(63): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#11 src/XF/App.php(2824): XF\Mvc\Dispatcher->run()
#12 src/XF.php(814): XF\App->run()
#13 index.php(23): XF::runApp('XF\\Pub\\App')
#14 {main}

Code:
array(4) {
  ["url"] => string(35) "/attachments/kawa6maerz-webp.18282/"
  ["referrer"] => string(78) "https://www.home-of-doener.de/themen/6-maerz-kawanostra-eroeffnungsparty.2727/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
I could fix it by myself. Just run the following commands on the database..
SQL:
DROP TABLE IF EXISTS `xf_attachment_view`;
CREATE TABLE `xf_attachment_view` (
  `attachment_id` int(10) unsigned NOT NULL,
  `total` int(10) unsigned NOT NULL,
  PRIMARY KEY (`attachment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
SQL:
DROP TABLE IF EXISTS `xf_mg_media_view`;
CREATE TABLE `xf_mg_media_view` (
  `media_id` int(10) unsigned NOT NULL,
  `total` int(10) unsigned NOT NULL,
  PRIMARY KEY (`media_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
 
When i want to watch a media from the gallery or as an attachment, the media cannot found. And igot this error in the admin cp.

This doesn't seem to be a bug imo, but more an issue with your database / server. It has gotten corrupted. A bit of background info pertaining this type of error. MySQL stores all data in files with the extensions .ibd for InnoDB tables, which seems to be your database storage type. The aforementioned files contain the space so to speak in which table data is stored. Hence their name, tablespace. Things to check are if table files have the wrong ownership/permissions or it is misplaced. Another reason is when the data file has been corrupted or deleted.

Do you manage your own Vps? Dedicated box or are you on a shared hosting plan. If the latter there is nothing that you can do about this, but to let your host know s o they can look into it.
 
I manage my own VPS and changed a few weeks ago the VPS. So maybe there are some issues when i transfer the database.

You're right, its no bug and more an database issue. But its fixed now.. ;)
 
Back
Top Bottom