• Resolved managedhostingpartners

    (@managedhostingpartners)


    Hi,

    I’m hosting about 25 WordPress websites with Amazon RDS (MySQL) as a database provider. Recently I performed a Point-In-Time restore of my database server to get a website back into a certain state (not security related). Amazon RDS has this built in as a service feature.

    This point in time restore failed and we were not sure of the cause of it, some ideas were discussed here: https://serverfault.com/q/914332/81774

    However, since then I have worked with AWS to identify a reproducible case of this issue and it is this database statement:

    create table IF NOT EXISTS wp_wfBlocks7 (
          id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
          type int(10) unsigned NOT NULL DEFAULT '0',
          IP binary(16) NOT NULL DEFAULT '\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@',
          blockedTime</code> bigint(20) NOT NULL,
          reason varchar(255) NOT NULL,
          lastAttempt int(10) unsigned DEFAULT '0',
          blockedHits int(10) unsigned DEFAULT '0',
          expiration bigint(20) unsigned NOT NULL DEFAULT '0',
          parameters text,
          PRIMARY KEY (id),
          KEY type (type),
          KEY IP (IP),
          KEY expiration (expiration)
        ) DEFAULT CHARSET=utf8

    I have confirmed this is the schema used in one of the sites hosted, which uses Wordfence 7.1.3

    Can you advise if this is a known issue? What is the reason for this specific default value and how can I make sure PIT restore works in the short term?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @managedhostingpartners,

    The column and information that AWS referenced is a binary column storing values for IP addresses. The default value is all zeroes (16 characters in this case for either IPv4 or IPv6 values).

    The wp_wfBlocks7 table is going to be created using the default engine for your database, so you may want to double-check whether or not it’s using MyISAM. As noted by michael-sqlbot in the serverfault thread:

    The MyISAM storage engine does not support reliable recovery and can result in lost or corrupt data when MySQL is restarted after a recovery, preventing Point-In-Time restore or snapshot restore from working as intended.

    Let us know if you have any further questions!

    Thread Starter managedhostingpartners

    (@managedhostingpartners)

    Hi there,

    it is not created as MyISAM.

    The way it is set up now, it won’t support point in time recovery on RDS, is there no other way to default this column?

    Jochen

    Thread Starter managedhostingpartners

    (@managedhostingpartners)

    Here is also a quick test of default values for binary columns on MySQL 5.7.21. It seems Binary columns are already defaulted to \0

    mysql> create table btest (t varchar(10) not null,bcol binary not null);
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> show create table btest;
    +-------+---------------------------------------------------------------------------------------------------------------------+
    | Table | Create Table                                                                                                        |
    +-------+---------------------------------------------------------------------------------------------------------------------+
    | btest | CREATE TABLE <code>btest</code> (
      <code>t</code> varchar(10) NOT NULL,
      <code>bcol</code> binary(1) NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
    +-------+---------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    mysql> insert into btest (t) values ('a');
    Query OK, 1 row affected, 1 warning (0.00 sec)
    
    mysql> select * from btest where bcol = "\0";
    +---+------+
    | t | bcol |
    +---+------+
    | a |      |
    +---+------+
    1 row in set (0.00 sec)
    

    Hi @managedhostingpartners,

    I had Quality Assurance take a look at this issue, and when they tested your table and insert they triggered “ERROR 1364 (HY000): Field ‘bcol’ doesn’t have a default value”, which may point to a configuration difference where instead you just saw a warning. Beyond that, we’re not seeing anything that points to Wordfence, as we aren’t seeing any other reports of this or similar issues. We don’t recommend changing the column default as this could break future updates to Wordfence and wouldn’t be supported.

    Since the failure seems to be around their restore process taking a valid table definition, exporting it, and re-importing its own output, it may be worth investigating on their end whether something is going on with how they’re handling and interpreting binary data through that process.

    Thread Starter managedhostingpartners

    (@managedhostingpartners)

    Ok, could you have a look at the response from Amazon Web Services here: https://serverfault.com/a/917563/81774

    I wonder why the default is set as

    \^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@

    instead of

    \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0

    Jochen

    Thread Starter managedhostingpartners

    (@managedhostingpartners)

    Hi there,

    have you had any further thoughts on the default setting of this field and why it is not usiung a simpler format?

    Jochen

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Amazon RDS Point-In-Time restore fails – wp_wfBlocks7 issue’ is closed to new replies.