Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Xtrabackup From Zero to Hero

Xtrabackup From Zero to Hero

Slides from Percona Live Denver tutorial explaining the internals of how Percona Xtrabackup for MySQL works

Marcelo Altmann

June 02, 2023
Tweet

More Decks by Marcelo Altmann

Other Decks in Technology

Transcript

  1. © Copyright 2023 Percona® LLC. All rights reserved Percona Xtrabackup:

    From Zero to Hero Marcelo Altmann - Senior Software Engineer Vinicius Grippa - Senior Support Engineer Percona Live Denver / May 2023
  2. Marcelo Altmann • Senior Software Engineer @ Percona • Working

    on Xtrabackup Project • Author of key features ◦ FIFO Datasink / xbcloud multi-thread ◦ Memory Estimation ◦ ZSTD Compression Support ◦ Xbcloud exponential Backoff ◦ Xbcloud instance profile ◦ KMIP & KMS Keyring Component Integration
  3. Vinicius Grippa • Senior Support Engineer @ Percona • MySQL

    and MongoDB specialist • Working with databases for 18 years • Co-Author of the book Learning MySQL
  4. © Copyright 2023 Percona® LLC. All rights reserved • Download

    the PDF with examples to follow at https://bit.ly/pl_tutorial • If you are on ARM - Ask presenter for a remote Instance credentials. Before we start
  5. © Copyright 2023 Percona® LLC. All rights reserved • This

    is an interactive session • Ask questions • We will rafle two signed copies of Learning MySQL • Let’s have some fun! Before we start
  6. © Copyright 2023 Percona® LLC. All rights reserved InnoDB -

    Disk Table Layout • LSN - Last Sequence Number Number of bytes written on InnoDB system. Used as a version ID for InnoDB objects.
  7. © Copyright 2023 Percona® LLC. All rights reserved InnoDB -

    Redo Log (WAL) • Used to be ib_logfile[0-1]
  8. © Copyright 2023 Percona® LLC. All rights reserved InnoDB -

    Write workflow mysql> UPDATE TABLE table1 SET name = ‘Marcelo’ WHERE ID = 88
  9. © Copyright 2023 Percona® LLC. All rights reserved InnoDB -

    Write workflow mysql> UPDATE TABLE table1 SET name = ‘Marcelo’ WHERE ID = 88
  10. © Copyright 2023 Percona® LLC. All rights reserved InnoDB -

    Write workflow mysql> UPDATE TABLE table1 SET name = ‘Marcelo’ WHERE ID = 88
  11. © Copyright 2023 Percona® LLC. All rights reserved InnoDB -

    Disk Table Layout • LSN - Last Sequence Number Number of bytes written on InnoDB system. Used as a version ID for InnoDB objects.
  12. © Copyright 2023 Percona® LLC. All rights reserved Incremental Backups

    • LSN from last backup (LSN 50) • Copy pages from that LSN forward • Redo Follow Thread
  13. © Copyright 2023 Percona® LLC. All rights reserved Incremental Backups

    • UPDATE table1 SET name = ‘Marcelo’ WHERE ID = 88;
  14. © Copyright 2023 Percona® LLC. All rights reserved Incremental Backups

    • Brutal Force - Scan all pages and check LSN
  15. © Copyright 2023 Percona® LLC. All rights reserved Incremental Backups

    • Page Tracking (8.0.27+) • Server Component to keep track of changed pages • Xtrabackup calls server API and get list of changed pages between range of LSN
  16. © Copyright 2023 Percona® LLC. All rights reserved • Used

    to stream data to another machine or Object Storage • Currently supported Object Storages: ◦ S3 / Azure / GCP / Swift • Uses custom xbstream format - https://bit.ly/xbstream-format • Introduces two new binaries ◦ Xbstream - responsible for interpret xbstream chunks and reassembly the original file ◦ Xbcloud - responsible for downloading and uploading chunks to object storage Streaming
  17. © Copyright 2023 Percona® LLC. All rights reserved • Uses

    GnuPG (GPG) library • Uses Advanced Encryption Standard (AES) algorithm • Support key lengths of 128 / 192 / 256 Encrypted Backups
  18. © Copyright 2023 Percona® LLC. All rights reserved • Currently

    support for QuickLZ, LZ4 and ZSTD ◦ QuickLZ no longer maintained ◦ Deprecated on 8.0.32 ◦ ZSTD will become default on 8.0.34 ◦ Ability to --backup will be removed at 8.0.35 (Backward compatibility) • Use LZ4 and ZSTD instead Compressed Backups
  19. © Copyright 2023 Percona® LLC. All rights reserved • Can

    be tuned with: ◦ --parallel - number of parallel copy threads ◦ --compress-threads - number of threads responsible for compression work ◦ --encrypt-threads - number of threads responsible for encryption work • Rule of thumbs - parallel > compress > encrypt Encrypted & Compressed Backups
  20. © Copyright 2023 Percona® LLC. All rights reserved • Intentionally

    copy just required tables • Can be done by providing: ◦ Regular Expression of matching tables ◦ File with list of tables ◦ File with a list of databases Partial Backups
  21. © Copyright 2023 Percona® LLC. All rights reserved • Restore

    just specific table(s) from full backup • Works using Transportable Tablespace • xtrabackup --prepare --export - produces exportable table spaces files • For each table, user needs to: ◦ Create table with same definition ◦ Discard Tablespace ◦ Copy table files (.ibd, .cfg) to server datadir ◦ Import Tablespace Partial Restore
  22. © Copyright 2023 Percona® LLC. All rights reserved • Allows

    for restoring a backup and replay transactions up to a specific point in time • Useful when a disaster has occurred and the data between the last backup and time of disaster cannot be lost • Requires copy of binary logs Point In Time Recovery
  23. © Copyright 2023 Percona® LLC. All rights reserved • Join

    at slido.com • #4260 437 What is next - We want to hear from you
  24. © Copyright 2023 Percona® LLC. All rights reserved • Which

    feature(s) would you like to be added to xtrabackup? • PXB-2901 - Add Full page tracking feature in PXB • PXB-3034 - Reduce the time the instance remains locked during the backup • PXB-2745 - Selective table backup/restore What is next Join at slido.com #4260 437
  25. © Copyright 2023 Percona® LLC. All rights reserved Thank you!

    ObrigadoMerci Danke Grazie Dhanyavaad Mam'noon Xièxiè Arigato