You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-12-01 22:30:09 +02:00
Set application_name to "pgBackRest [command]" for database connections.
Suggested by Jens Wilke.
This commit is contained in:
@@ -2100,10 +2100,26 @@ sub backupTestRun
|
||||
{strTest => TEST_MANIFEST_BUILD, fTestDelay => $fTestDelay,
|
||||
strOptionalParam => '--' . OPTION_STOP_AUTO . ' --no-' . OPTION_BACKUP_ARCHIVE_CHECK});
|
||||
|
||||
# Drop a table
|
||||
$oHostDbMaster->sqlExecute('drop table test_remove');
|
||||
$oHostDbMaster->sqlXlogRotate();
|
||||
$oHostDbMaster->sqlExecute("update test set message = '$strIncrMessage'", {bCommit => true});
|
||||
|
||||
# Check that application name is set
|
||||
if ($oHostDbMaster->dbVersion() >= PG_VERSION_APPLICATION_NAME)
|
||||
{
|
||||
my $strApplicationNameExpected = BACKREST_NAME . ' [' . CMD_BACKUP . ']';
|
||||
my $strApplicationName = $oHostDbMaster->sqlSelectOne(
|
||||
"select application_name from pg_stat_activity where application_name like '" . BACKREST_NAME . "%'");
|
||||
|
||||
if (!defined($strApplicationName) || $strApplicationName ne $strApplicationNameExpected)
|
||||
{
|
||||
confess &log(ERROR,
|
||||
"application name '" . (defined($strApplicationName) ? $strApplicationName : '[null]') .
|
||||
"' does not match '" . $strApplicationNameExpected . "'");
|
||||
}
|
||||
}
|
||||
|
||||
my $strIncrBackup = $oHostBackup->backupEnd($strType, $oExecuteBackup);
|
||||
|
||||
# Setup the xid target
|
||||
|
||||
Reference in New Issue
Block a user