• Resolved Dave Lozier

    (@dave-lozier)


    Was wondering if this would work on our database. We have WooCommerce, bbPress and BuddyPress installed. There are over 1.6 million replies and 200,000 topics. We are currently writing a custom forum solution to replace bbPress/BuddyPress. Not everything can be treated as a blog post and work well.

    
    newin7183@idmp2:~/public_html$ php ../php/wp-cli.phar --info
    OS:     Linux 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64
    Shell:  /bin/bash
    PHP binary:     /usr/bin/php7.4
    PHP version:    7.4.3
    php.ini used:   /etc/php/7.4/cli/php.ini
    MySQL binary:   /usr/bin/mysql
    MySQL version:  mysql  Ver 15.1 Distrib 10.3.31-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
    SQL modes:
    WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir:      phar://wp-cli.phar/vendor
    WP_CLI phar path:       /home/new.example.com/public_html
    WP-CLI packages dir:
    WP-CLI global config:
    WP-CLI project config:  /home/new.example.com/public_html/wp-cli.yml
    WP-CLI version: 2.5.0
    
    newin7183@idmp2:~/public_html$ php ../php/wp-cli.phar index-mysql reset --all
    Index WP MySQL For Speed 1.3.3
    Versions MySQL:10.3.31-MariaDB-0ubuntu0.20.04.1 WordPress:5.8.2 php:7.4.3
    reset wp_usermeta complete. (8 MySQL commands, 88.06s)
    reset wp_posts complete. (14 MySQL commands, 180.81s)
    
    newin7183@idmp2:~/public_html$ php ../php/wp-cli.phar index-mysql upgrade --all
    Index WP MySQL For Speed 1.3.3
    Versions MySQL:10.3.31-MariaDB-0ubuntu0.20.04.1 WordPress:5.8.2 php:7.4.3
    upgrade wp_2_create_map complete. (1 MySQL commands, 0.01s)
    upgrade wp_2_group_map complete. (1 MySQL commands, 0.01s)
    upgrade wp_2_map_locations complete. (1 MySQL commands, 0.01s)
    upgrade wp_2_map_routes complete. (1 MySQL commands, 0.01s)
    upgrade wp_3_create_map complete. (1 MySQL commands, 0.01s)
    upgrade wp_3_group_map complete. (1 MySQL commands, 0.01s)
    upgrade wp_3_map_locations complete. (1 MySQL commands, 0.00s)
    upgrade wp_3_map_routes complete. (1 MySQL commands, 0.00s)
    upgrade wp_create_map complete. (1 MySQL commands, 0.01s)
    upgrade wp_group_map complete. (1 MySQL commands, 0.00s)
    upgrade wp_map_locations complete. (1 MySQL commands, 0.01s)
    upgrade wp_map_routes complete. (1 MySQL commands, 0.00s)
    PHP Warning:  unlink(/home/new.example.com/public_html/.maintenance): No such file or directory in /home/new.example.com/public_html/wp-content/plugins/index-wp-mysql-for-speed/code/imsfdb.php on line 272
    Warning: unlink(/home/new.example.com/public_html/.maintenance): No such file or directory in /home/new.example.com/public_html/wp-content/plugins/index-wp-mysql-for-speed/code/imsfdb.php on line 272
    newin7183@idmp2:~/public_html$ php ../php/wp-cli.phar index-mysql enable --all
    
    Index WP MySQL For Speed 1.3.3
    Versions MySQL:10.3.31-MariaDB-0ubuntu0.20.04.1 WordPress:5.8.2 php:7.4.3
    WordPress database error Temporary file write failure for query /*imfs-query-tag*/ALTER TABLE wp_postmeta ADD PRIMARY KEY (post_id, meta_key, meta_id) made by include('phar:///home/new.example.com/php/wp-cli.phar/php/boot-phar.php'), include('phar:///home/new.example.com/php/wp-cli.phar/vendor/wp-cli/wp-cli/php/wp-cli.php'), WP_CLI\bootstrap, WP_CLI\Bootstrap\LaunchRunner->process, WP_CLI\Runner->start, WP_CLI\Runner->run_command_and_exit, WP_CLI\Runner->run_command, WP_CLI\Dispatcher\Subcommand->invoke, call_user_func, WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}, call_user_func, ImsfCli->enable, ImsfCli->doRekeying, ImfsDb->rekeyTables, ImfsDb->rekeyTable, ImfsDb->query
    PHP Fatal error:  Uncaught ImfsException: [0]: Temporary file write failure in /*imfs-query-tag*/ALTER TABLE wp_postmeta ADD PRIMARY KEY (post_id, meta_key, meta_id)
      thrown in /home/new.example.com/public_html/wp-content/plugins/index-wp-mysql-for-speed/code/imsfdb.php on line 228
    Fatal error: Uncaught ImfsException: [0]: Temporary file write failure in /*imfs-query-tag*/ALTER TABLE wp_postmeta ADD PRIMARY KEY (post_id, meta_key, meta_id)
      thrown in /home/new.example.com/public_html/wp-content/plugins/index-wp-mysql-for-speed/code/imsfdb.php on line 228
    Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.
    newin7183@idmp2:~/public_html$
    

    Any thoughts? Thanks!

    • This topic was modified 3 years, 3 months ago by Dave Lozier.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author OllieJones

    (@olliejones)

    I fear your MySQL server machine is underprovisioned. Its temporary file system has filled up during the rekeying process. Your best bet here is to contact your hosting provider and see if they can give you more temp file space. The error message to show them is this:

    Temporary file write failure for query ALTER TABLE wp_postmeta ADD PRIMARY KEY (post_id, meta_key, meta_id)

    Another way to handle this server underprovisioning problem is to dump the wp_postmeta table to a file, edit the dump file, and recreate the table from the dump file. I really really don’t want to try to explain that in a forum post.

    • This reply was modified 3 years, 3 months ago by OllieJones.
    Thread Starter Dave Lozier

    (@dave-lozier)

    There’s 250 gigabytes of free space on the disk. I’ll investigate some more but I don’t think the issue is what you are thinking it is.

    Possibly a file size restriction? I’m not really sure off hand. Thanks though.

    Thread Starter Dave Lozier

    (@dave-lozier)

    It looks like the new server has a dedicated partition for the /tmp directory which was only 1.5 gigabytes. I changed the database’s temp directory location to utilize the main partition. The updates finished without issue.

    Thanks!

    Plugin Author OllieJones

    (@olliejones)

    Glad you got it working. I wish there were a way to ask MySQL or MariaDB the size of the /tmp directory so the plugin could warn about this problem.

    Thanks for following up.

    Thread Starter Dave Lozier

    (@dave-lozier)

    This should do the trick?

    
    if ( $row = $wpdb->get_row("SHOW VARIABLES LIKE 'tmpdir'") ) {
    	if (is_dir($row->Value)) {
    		echo '<p>Database Temp Dir: ' . $row->Value . '</p>';
    
    		$bytes = disk_free_space( $row->Value );
    		$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
    		$base = 1024;
    		$class = min((int)log($bytes , $base) , count($si_prefix) - 1);
    		echo '<p>Free Space: ' . sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . '</p>';
    	}
    }
    
    Plugin Author OllieJones

    (@olliejones)

    Thanks for that. It works if the web server host is the same as the database server host. That’s only true in some WordPress installations.

    Thread Starter Dave Lozier

    (@dave-lozier)

    Ahh right – not much can be done about remote mysql hosts.

    Where to place the code mentioned in this thread to solve the Temporary file write failure issue?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Temporary file write failure?’ is closed to new replies.