Skip to content

Support MariaDB system-versioned tables #13

@federico-razzoli

Description

@federico-razzoli

MariaDB 10.3 supports system-versioned tables.

go-dump could support them in several ways:

  • It makes no sense to create a table WITH SYSTEM VERSIONING before backup. Create it as a normal table, then add the INSERTs, then run ALTER TABLE ... ADD SYSTEM VERSIONING.
    • There is a slightly more complicated case to support, where historical data is contained in a separate partition. In that case, the table should be created without partitions and partitions should be created later.
      - SET SESSION system_versioning_asof = 'DEFAULT' -- should be issued, to make sure that no implicit FOR SYSTEM_TIME is added to our SELECTs.
  • Add an options to decide which historical data is backuped:
    • By default include the whole history: SELECT ... FOR SYSTEM_TIME ALL
    • History since last backup: SELECT ... FOR SYSTEM_TIME BETWEEN (NOW() - INTERVAL 1 DAY) AND NOW()
    • History of a time range: SELECT ... FOR SYSTEM_TIME FROM <timestamp1> TO <timestamp2>
    • Backup exact point in time: SELECT ... FOR SYSTEM_TIME AS OF TIMESTAMP .... Useful to recover data after a mistake.

I left out many details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions