xtrabackup permissions as described here: [URL]https://www.percona.com/doc/percona-xtrabackup/2.4/using_xtrabackup/privileges.html[/URL] are possibly incomplete.
If the backup is running on a slave where read_only=1 is set and history is requested, xtrabackup will attempt to create percona_schema and fail with the following:
Error: failed to execute query CREATE DATABASE IF NOT EXISTS PERCONA_SCHEMA: The MySQL server is running with the --read-only option so it cannot execute this statement
and give a return code = 1.
(We comment for clarity that percona_schema did exist!)
In fact, the backup was successful; only the writing of history failed. At a minimum the definition of grants should be updated. (I have added a note to the web page) but at another level it should be possible to differentiate this error from a truly failed backup using a different return code.
In a perfect world, xtrabackup would determine it is running on a read only slave and attempt to record the history in the master server.
In an even more perfect world, xtrabackup would not try to create percona_schema if it exists. This may cause an error if an xtrabackup creates the schema on the master which replicates to the slave using row based replication should the xtrabackup running on the slave also create the percona_schama.
John.