• Paddy

    (@seriouspaddy)


    Hi Ollie, thanks for the plugin!

    I have it installed on a site with >500k users. The indexing seems to get so far but then fails and stops progressing.

    I’m seeing this in the debug log:

    [20-Oct-2024 13:24:02 UTC] Cron unschedule event error for hook: index_wp_users_for_speed_task, Error code: could_not_set, Error message: The cron event list could not be saved., Data: {"schedule":false,"args":["-populate-meta-index-roles_1",42]}
    [20-Oct-2024 13:24:05 UTC] WordPress database error Failed to read auto-increment value from storage engine for query INSERT INTO wp_usermeta (user_id, meta_key) SELECT user_id, meta_key FROM (SELECT a.user_id, 'wp_iufsr:administrator' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:administrator'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'administrator', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:editor' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:editor'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'editor', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:author' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:author'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'author', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:contributor' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:contributor'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'contributor', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:subscriber' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:subscriber'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'subscriber', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:customer' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:customer'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'customer', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:shop_manager' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:shop_manager'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'shop\\_manager', '%')
    AND b.user_id IS NULL) a WHERE a.user_id >= 209999 AND a.user_id < 214999 made by include('phar:///usr/local/bin/wp/php/boot-phar.php'), include('phar:///usr/local/bin/wp/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, Cron_Event_Command->run, Cron_Event_Command::run_event, do_action_ref_array('index_wp_users_for_speed_task'), WP_Hook->do_action, WP_Hook->apply_filters, IndexWpUsersForSpeed\index_wp_users_for_speed_do_task, IndexWpUsersForSpeed\Task->doTaskStep, IndexWpUsersForSpeed\PopulateMetaIndexRoles->doChunk, IndexWpUsersForSpeed\Task->doQuery

    Resetting it to “immediately, then daily” doesn’t re-trigger the indexing. The only way to get it to restart is to deactivate/reactivate, but then it starts from the beginning again and fails at a random point.

    The site has WP CRON disabled and is running a server CRON every 60s. There’s no object caching installed.

    Any ideas?

    Many thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author OllieJones

    (@olliejones)

    Thanks for the question, and my apologies for not noticing it sooner.

    You’re getting the database error Failed to read auto-increment value from storage engine from your DBMS. That can happen when your current autoincrementing meta_id value gets bigger than the space allocated for it in your table. There are also a couple of old MySQL bugs that can cause it too.

    If you could do something like this:

    wp db query "show create table wp_usermeta;"

    and reply to this topic with the table definition you get back I might be able to troubleshoot further.

    Thread Starter Paddy

    (@seriouspaddy)

    Thanks for getting back to me!

    Here’s the table structure:

     wp_usermeta | CREATE TABLE wp_usermeta (
    umeta_id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    user_id bigint(20) unsigned NOT NULL DEFAULT 0,
    meta_key varchar(255) NOT NULL,
    meta_value longtext DEFAULT NULL,
    PRIMARY KEY (user_id,meta_key,umeta_id),
    UNIQUE KEY umeta_id (umeta_id),
    KEY meta_key (meta_key,meta_value(32),user_id,umeta_id),
    KEY meta_value (meta_value(32),umeta_id)
    ) ENGINE=InnoDB AUTO_INCREMENT=37520662 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

    Plugin Author OllieJones

    (@olliejones)

    Well, this is quite strange. The usual reason for this error — your autoincrement number growing too large for its column — isn’t in play. Try restarting your MySQL or MariaDB database server.

    It looks like you’re using my other plugin, Index WP MySQL for Speed. Could you go to Tools -> Index MySQL and then to the About tab. Then upload your metadata and reply to this topic with the upload id. And I’ll take another look.

    Sorry for the inconvenience, and thanks for your patience.

    Thread Starter Paddy

    (@seriouspaddy)

    I’ve restarted the database and attempted to restart the user indexing. However, it only progressed to 41% before stalling, with no errors appearing in the debug log.

    My metadata upload ID is:

    YGe5KMsc

    Thanks for persevering with this, I really appreciate your help!

    Plugin Author OllieJones

    (@olliejones)

    Weird. If you still have the patience for this, please try deactivating the plugin.

    Then, if you’re willing, try editing .../wp-content/plugins/index-wp-users-for-speed/index-wp-users-for-speed.php.

    Look for this line

    const INDEX_WP_USERS_FOR_SPEED_BATCHSIZE = 5000;

    and change 5000 to 1000.

    Then reactivate it. Maybe that will help. Thanks again for working with me on this.

    Thread Starter Paddy

    (@seriouspaddy)

    Tried reducing the batch size to 1000, stalled again at 45%.
    Debug log is showing both a deadlock and auto-increment errors this time.

    [05-Nov-2024 23:55:05 UTC] WordPress database error Deadlock found when trying to get lock; try restarting transaction for query INSERT INTO wp_usermeta (user_id, meta_key) SELECT user_id, meta_key FROM (SELECT a.user_id, 'wp_iufsr:administrator' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:administrator'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'administrator', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:editor' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:editor'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'editor', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:author' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:author'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'author', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:contributor' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:contributor'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'contributor', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:subscriber' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:subscriber'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'subscriber', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:customer' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:customer'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'customer', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:shop_manager' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:shop_manager'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'shop\\_manager', '%')
    AND b.user_id IS NULL) a WHERE a.user_id >= 251999 AND a.user_id < 252999 made by do_action_ref_array('index_wp_users_for_speed_task'), WP_Hook->do_action, WP_Hook->apply_filters, IndexWpUsersForSpeed\index_wp_users_for_speed_do_task, IndexWpUsersForSpeed\Task->doTaskStep, IndexWpUsersForSpeed\PopulateMetaIndexRoles->doChunk, IndexWpUsersForSpeed\Task->doQuery
    [05-Nov-2024 23:55:05 UTC] WordPress database error Failed to read auto-increment value from storage engine for query INSERT INTO wp_usermeta (user_id, meta_key) SELECT user_id, meta_key FROM (SELECT a.user_id, 'wp_iufsr:administrator' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:administrator'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'administrator', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:editor' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:editor'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'editor', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:author' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:author'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'author', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:contributor' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:contributor'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'contributor', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:subscriber' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:subscriber'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'subscriber', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:customer' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:customer'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'customer', '%')
    AND b.user_id IS NULL UNION SELECT a.user_id, 'wp_iufsr:shop_manager' meta_key
    FROM wp_usermeta a
    LEFT JOIN wp_usermeta b
    ON a.user_id = b.user_id
    AND b.meta_key = 'wp_iufsr:shop_manager'
    WHERE a.meta_key = 'wp_capabilities'
    AND a.meta_value LIKE CONCAT('%', 'shop\\_manager', '%')
    AND b.user_id IS NULL) a WHERE a.user_id >= 251999 AND a.user_id < 252999 made by do_action_ref_array('index_wp_users_for_speed_task'), WP_Hook->do_action, WP_Hook->apply_filters, IndexWpUsersForSpeed\index_wp_users_for_speed_do_task, IndexWpUsersForSpeed\Task->doTaskStep, IndexWpUsersForSpeed\PopulateMetaIndexRoles->doChunk, IndexWpUsersForSpeed\Task->doQuery

    Let me know if you want me to try anything else. Thanks!

    Plugin Author OllieJones

    (@olliejones)

    Ah, thanks for your kindness trying that. Deadlock, huh? I bet your site is quite busy!

    I’m going to push out a new version of the plugin with some transaction management in it, and some restarting capability. I’ll let you know.

    Plugin Author OllieJones

    (@olliejones)

    I just released v 1.1.8 with, hopefully, some database deadlock protection in it.

    I hope it works for you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.