XF 2.1 Updating Phrase leads to error

tajhay

Well-known member
Trying to update the following phrase:
New (happens with others too)

191259


Error occuring:
XF\Db\Exception: MySQL statement prepare error [1932]: Table 'nzwarrio_xf2.xf_template_phrase' doesn't exist in engine in src/XF/Db/AbstractStatement.php at line 217
  1. XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
  2. XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
  3. XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
  4. XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 89
  5. XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 121
  6. XF\Db\AbstractAdapter->fetchAllColumn() in src/XF/Service/Phrase/Compile.php at line 63
  7. XF\Service\Phrase\Compile->recompileIncludeContent() in src/XF/Entity/Phrase.php at line 171
  8. XF\Entity\Phrase->_postSave() in src/XF/Mvc/Entity/Entity.php at line 1202
  9. XF\Mvc\Entity\Entity->save() in src/XF/Mvc/FormAction.php at line 69
  10. XF\Mvc\FormAction->XF\Mvc\{closure}() in src/XF/Mvc/FormAction.php at line 187
  11. XF\Mvc\FormAction->run() in src/XF/Admin/Controller/Phrase.php at line 128
  12. XF\Admin\Controller\Phrase->actionSave() in src/XF/Mvc/Dispatcher.php at line 321
  13. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 248
  14. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
  15. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
  16. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
  17. XF\App->run() in src/XF.php at line 392
  18. XF::runApp() in admin.php at line 13

Also noticed i dont have a 'master' language...thought id seen it before. dont have it either on my XF1.5 board nor my test site (XF2.1 Beta 5). Not sure if its related.

191260
 
This won't be add-on related -- unless an add-on has deleted the table, which would be pretty insane.

As mentioned in the linked thread, this can be indicative of DB corruption. You may be able to recreate the table (as this doesn't really contain data that isn't rebuildable), though I'm willing to bet that will fail if you just run a create table query. You'll probably need to drop the table first, even though it may not even appear in the table list.

Corruption like this generally relates to an issue with MySQL itself, MySQL being stopped without following the normal shutdown, or even a potential hardware issue. Software can't (or shouldn't be able to) trigger corruption like this.
SQL to recreate the table Mike?
 
It might be worth to post the result of the following query

SQL:
SHOW TABLES LIKE 'xf\_%'
localhost/nzwarrio_xf2/xf_phrase_map/

Your SQL query has been executed successfully.

SHOW TABLES LIKE 'xf\_%'



xf_addon
xf_addon_install_batch
xf_addon_install_batch__conflict
xf_addon_install_batch_entry
xf_admin
xf_admin_log
xf_admin_navigation
xf_admin_permission
xf_admin_permission_entry
xf_advertising
xf_advertising_position
xf_api_attachment_key
xf_api_key
xf_api_key_scope
xf_api_scope
xf_approval_queue
xf_attachment
xf_attachment_data
xf_attachment_view
xf_ban_email
xf_bb_code
xf_bb_code_media_site
xf_bdbank_archive
xf_bdbank_attachment_downloaded
xf_bdbank_transaction
xf_bdpaygate_log
xf_bdpaygate_purchase
xf_bookmark_item
xf_bookmark_label
xf_bookmark_label_use
xf_br_extra_navigation_menu
xf_*******_addon
xf_*******_autolink
xf_*******_listener_class
xf_*******_modern_caches
xf_brms_modern_cache
xf_brms_modern_statistic
xf_captcha_log
xf_captcha_question
xf_category
xf_change_log
xf_class_extension
xf_code_event
xf_code_event_listener
xf_connected_account_provider
xf_content_spam_cache
xf_content_type_field
xf_conversation_master
xf_conversation_message
xf_conversation_recipient
xf_conversation_user
xf_conversation_user_access
xf_cron_entry
xf_css_cache
xf_data_registry
xf_deletion_log
xf_draft
xf_edit_history
xf_editor_dropdown
xf_email_bounce_log
xf_email_bounce_soft
xf_error_log
xf_faq_category
xf_faq_question
xf_feed
xf_feed_log
xf_file_check
xf_find_new
xf_find_new_default
xf_flood_check
xf_forum
xf_forum_field
xf_forum_post_field
xf_forum_prefix
xf_forum_prompt
xf_forum_read
xf_forum_watch
xf_help_page
xf_image_proxy
xf_image_proxy_referrer
xf_import_log
xf_ip
xf_ip_match
xf_job
xf_keywordalert_keyword
xf_keywordalert_queue
xf_language
xf_link_forum
xf_link_proxy
xf_link_proxy_referrer
xf_login_attempt
xf_mail_queue
xf_member_stat
xf_moderator
xf_moderator_content
xf_moderator_log
xf_navigation
xf_navigation_type
xf_news_feed
xf_nflj_ams_tag

xf_nflj_ams_tagged_content
xf_nflj_showcase_tag
xf_nflj_showcase_tagged_content
xf_nflj_survivor_comment
xf_nflj_survivor_comment_reply
xf_nflj_survivor_game
xf_nflj_survivor_pick
xf_nflj_survivor_player
xf_nflj_survivor_pool
xf_nflj_survivor_season
xf_nflj_survivor_sport
xf_nflj_survivor_team
xf_nflj_survivor_week
xf_node
xf_node_type
xf_notice
xf_notice_dismissed
xf_oembed
xf_oembed_referrer
xf_option
xf_option_group
xf_option_group_relation
xf_page
xf_payment_profile
xf_payment_provider
xf_payment_provider_log
xf_permission
xf_permission_cache_content
xf_permission_combination
xf_permission_combination_user_group
xf_permission_entry
xf_permission_entry_content
xf_permission_interface_group
xf_phrase
xf_phrase_compiled
xf_phrase_map
xf_player_match
xf_player_match_post
xf_player_opponent
xf_player_rating
xf_player_rating_coach
xf_player_rating_coach_review
xf_player_rating_more
xf_player_team
xf_poll
xf_poll_response
xf_poll_vote
xf_post
xf_post_field
xf_post_field_group
xf_post_field_value
xf_profile_post
xf_profile_post_comment
xf_purchasable
xf_purchase_request
xf_reaction
xf_reaction_content
xf_registration_spam_cache
xf_report
xf_report_comment
xf_rotating_ads_item
xf_route
xf_route_filter
xf_search
xf_search_index
xf_session
xf_session_activity
xf_session_admin
xf_session_install
xf_siropu_ads_manager_ad
xf_siropu_ads_manager_ad_extra
xf_siropu_ads_manager_click_fraud
xf_siropu_ads_manager_invoice
xf_siropu_ads_manager_package
xf_siropu_ads_manager_position
xf_siropu_ads_manager_position_category
xf_siropu_ads_manager_promo_code
xf_siropu_ads_manager_stats_access
xf_siropu_ads_manager_stats_click
xf_siropu_ads_manager_stats_daily
xf_sitemap
xf_smilie
xf_smilie_category
xf_social_forum_watch
xf_spam_cleaner_log
xf_spam_trigger_log
xf_st_fetchscore_games
xf_st_json_game_data
xf_stats_daily
xf_style
xf_style_property
xf_style_property_group
xf_style_property_map
xf_sv_tag_trending
xf_sv_tag_trending_summary
xf_sv_user_activity
xf_tag
xf_tag_content
xf_tag_result_cache
xf_template

xf_template_history
xf_template_map
xf_template_modification
xf_template_modification_log
xf_tfa_attempt
xf_tfa_provider
xf_thread
xf_thread_field
xf_thread_field_value
xf_thread_prefix
xf_thread_prefix_group
xf_thread_prompt
xf_thread_prompt_group
xf_thread_read
xf_thread_redirect
xf_thread_reply_ban
xf_thread_user_post
xf_thread_view
xf_thread_watch
xf_trophy
xf_unfurl_result
xf_upgrade_check
xf_upgrade_job
xf_upgrade_log
xf_user
xf_user_alert
xf_user_alert_optout
xf_user_authenticate
xf_user_ban
xf_user_change_temp
xf_user_confirmation
xf_user_connected_account
xf_user_field
xf_user_field_value
xf_user_follow
xf_user_group
xf_user_group_change
xf_user_group_promotion
xf_user_group_promotion_log
xf_user_group_relation
xf_user_ignored
xf_user_option
xf_user_privacy
xf_user_profile
xf_user_push_optout
xf_user_push_subscription
xf_user_reject
xf_user_remember
xf_user_tfa
xf_user_tfa_trusted
xf_user_title_ladder
xf_user_trophy
xf_user_upgrade
xf_user_upgrade_active
xf_user_upgrade_expired
xf_warning
xf_warning_action
xf_warning_action_trigger
xf_warning_definition
xf_widget
xf_widget_1540061817
xf_widget__conflict
xf_widget_definition
xf_widget_position
xf_widgetframework_cache
xf_widgetframework_widget_page
xf_xa_ams_article
xf_xa_ams_article_feature
xf_xa_ams_article_field
xf_xa_ams_article_field_value
xf_xa_ams_article_page
xf_xa_ams_article_prefix
xf_xa_ams_article_prefix_group
xf_xa_ams_article_rating
xf_xa_ams_article_read
xf_xa_ams_article_reply_ban
xf_xa_ams_article_view
xf_xa_ams_article_watch
xf_xa_ams_author_watch
xf_xa_ams_category
xf_xa_ams_category_field
xf_xa_ams_category_prefix
xf_xa_ams_category_review_field
xf_xa_ams_category_watch
xf_xa_ams_comment
xf_xa_ams_comment_read
xf_xa_ams_feed
xf_xa_ams_feed_log
xf_xa_ams_review_field
xf_xa_ams_review_field_value
xf_xa_ams_series
xf_xa_ams_series_feature
xf_xa_ams_series_part
xf_xa_ams_series_watch
xf_xa_pkm_comment
xf_xa_pkm_comment_read
xf_xa_pkm_game
xf_xa_pkm_game_pool_data
xf_xa_pkm_pick
xf_xa_pkm_player

xf_xa_pkm_pool
xf_xa_pkm_pool_watch
xf_xa_pkm_pool_week_winners
xf_xa_pkm_season
xf_xa_pkm_sport
xf_xa_pkm_team
xf_xa_pkm_tie_breaker
xf_xa_pkm_week
xf_xa_sb_bet
xf_xa_sb_bet_comment_read
xf_xa_sb_bet_wager
xf_xa_sb_bet_watch
xf_xa_sb_category
xf_xa_sb_category_prefix
xf_xa_sb_category_watch
xf_xa_sb_comment
xf_xa_sb_event
xf_xa_sb_event_comment_read
xf_xa_sb_event_outcome
xf_xa_sb_event_outcome_wager
xf_xa_sb_event_prefix
xf_xa_sb_event_prefix_group
xf_xa_sb_event_read
xf_xa_sb_event_view
xf_xa_sb_event_watch
xf_xa_sc_category
xf_xa_sc_category_field
xf_xa_sc_category_prefix
xf_xa_sc_category_review_field
xf_xa_sc_category_watch
xf_xa_sc_comment
xf_xa_sc_comment_read
xf_xa_sc_feed
xf_xa_sc_feed_log
xf_xa_sc_item
xf_xa_sc_item_feature
xf_xa_sc_item_field
xf_xa_sc_item_field_value
xf_xa_sc_item_prefix
xf_xa_sc_item_prefix_group
xf_xa_sc_item_rating
xf_xa_sc_item_rating_reply
xf_xa_sc_item_read
xf_xa_sc_item_reply_ban
xf_xa_sc_item_view
xf_xa_sc_item_watch
xf_xa_sc_review_field
xf_xa_sc_review_field_value
xf_xenmade_kwm
xf_xenmade_kwm_clicks
xf_xenmade_kwm_overlay
xf_xenmade_kwm_slug
 
SQL to recreate the table Mike?
This should work:
Code:
CREATE TABLE `xf_template_phrase` (
  `template_id` int(10) UNSIGNED NOT NULL,
  `phrase_title` varbinary(100) NOT NULL,
  PRIMARY KEY (`template_id`,`phrase_title`),
  KEY `phrase_title` (`phrase_title`)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
 
This should work:
Code:
CREATE TABLE `xf_template_phrase` (
  `template_id` int(10) UNSIGNED NOT NULL,
  `phrase_title` varbinary(100) NOT NULL,
  PRIMARY KEY (`template_id`,`phrase_title`),
  KEY `phrase_title` (`phrase_title`)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATEu tf8mb4_general_ci;
Thanks, unfortunately kept on getting error trying to create that table. Deleted the table's .idb and .frm but no cigar. Ended up duplicating my XF1.5 db again and importing via CLI and everything seems fine so far. Thanks for the assistance.
 
This should work:
Code:
CREATE TABLE `xf_template_phrase` (
  `template_id` int(10) UNSIGNED NOT NULL,
  `phrase_title` varbinary(100) NOT NULL,
  PRIMARY KEY (`template_id`,`phrase_title`),
  KEY `phrase_title` (`phrase_title`)
) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATEu tf8mb4_general_ci;
Code should be:
PHP:
ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
utf8mb4_general_ci Right?
 
I was able to fix it by doing the following:

  1. Close the forum
  2. Export the database sans the xf_template_phrase table with this:

Bash:
mysqldump -v --single-transaction --quick --default-character-set=utf8mb4 --ignore-table=database_name.xf_template_phrase  database_name > /home/somefolder/export_name.sql

  1. Create a new database
  2. Import the above export into the database
  3. Run the following MySQL command to add the table to the new database:

SQL:
CREATE TABLE `xf_template_phrase` (`template_id` int(10) UNSIGNED NOT NULL, `phrase_title` varbinary(100) NOT NULL, PRIMARY KEY (`template_id`,`phrase_title`), KEY `phrase_title` (`phrase_title`)) ENGINE=InnoDB CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci

6. Drop old database and rename new database to the name the old one was using (alternatively, you could just update config to use the new db name - I did that initially to make sure it worked before killing the old one).
 
Thanks, unfortunately kept on getting error trying to create that table. Deleted the table's .idb and .frm but no cigar. Ended up duplicating my XF1.5 db again and importing via CLI and everything seems fine so far. Thanks for the assistance.
Well funnily enough after a few days break from updating my site...i wanted to update some templates...tried to and now getting the same error again. Its weird because everything was fine a few days ago but all of a sudden not working again.

XF\Db\Exception: MySQL statement prepare error [1932]: Table 'nzwarrio_test.xf_template_phrase' doesn't exist in engine in src/XF/Db/AbstractStatement.php at line 217
  1. XF\Db\AbstractStatement->getException() in src/XF/Db/Mysqli/Statement.php at line 196
  2. XF\Db\Mysqli\Statement->getException() in src/XF/Db/Mysqli/Statement.php at line 39
  3. XF\Db\Mysqli\Statement->prepare() in src/XF/Db/Mysqli/Statement.php at line 54
  4. XF\Db\Mysqli\Statement->execute() in src/XF/Db/AbstractAdapter.php at line 89
  5. XF\Db\AbstractAdapter->query() in src/XF/Db/AbstractAdapter.php at line 243
  6. XF\Db\AbstractAdapter->delete() in src/XF/Service/Template/Compile.php at line 84
  7. XF\Service\Template\Compile->updatePhrasesUsed() in src/XF/Entity/Template.php at line 427
  8. XF\Entity\Template->_postSave() in src/XF/Mvc/Entity/Entity.php at line 1202
  9. XF\Mvc\Entity\Entity->save() in src/XF/Service/Advertising/Writer.php at line 86
  10. XF\Service\Advertising\Writer->write() in src/XF/Repository/Advertising.php at line 70
  11. XF\Repository\Advertising->writeAdsTemplate() in src/XF/AddOn/DataType/AdvertisingPosition.php at line 100
  12. XF\AddOn\DataType\AdvertisingPosition->XF\AddOn\DataType\{closure}() in src/XF.php at line 292
  13. XF::triggerRunOnce() in src/XF/Mvc/Dispatcher.php at line 143
  14. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
  15. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
  16. XF\App->run() in src/XF.php at line 392
  17. XF::runApp() in admin.php at line 13
 
If you do the steps I had above it should fix it for you, @tajhay. I would also recommend looking at your server config, since I think it's something with how MySQL, Apache, or PHP is configured that causes it to happen. We made a number of performance changes to all three so I don't know exactly which fixed it, although I suspect it might have been php-fpm that was doing it.
 
Back
Top Bottom