Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go/vt/mysqlctl/backupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ type BackupManifest struct {

TabletAlias string

Hostname string

Keyspace string

Shard string
Expand Down
8 changes: 8 additions & 0 deletions go/vt/mysqlctl/builtinbackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"vitess.io/vitess/go/ioutil"
"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/mysql/replication"
"vitess.io/vitess/go/netutil"
"vitess.io/vitess/go/os2"
"vitess.io/vitess/go/protoutil"
"vitess.io/vitess/go/vt/log"
Expand Down Expand Up @@ -1000,6 +1001,12 @@ func (be *BuiltinBackupEngine) backupManifest(
}
}()

// Get the hostname
hostname, err := netutil.FullyQualifiedHostname()
if err != nil {
hostname = ""
}

// JSON-encode and write the MANIFEST
bm := &builtinBackupManifest{
// Common base fields
Expand All @@ -1013,6 +1020,7 @@ func (be *BuiltinBackupEngine) backupManifest(
Incremental: !fromPosition.IsZero(),
ServerUUID: serverUUID,
TabletAlias: params.TabletAlias,
Hostname: hostname,
Keyspace: params.Keyspace,
Shard: params.Shard,
BackupTime: params.BackupTime.UTC().Format(time.RFC3339),
Expand Down
8 changes: 8 additions & 0 deletions go/vt/mysqlctl/mysqlshellbackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (

"vitess.io/vitess/go/mysql"
"vitess.io/vitess/go/mysql/capabilities"
"vitess.io/vitess/go/netutil"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/mysqlctl/backupstorage"
tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
Expand Down Expand Up @@ -204,6 +205,12 @@ func (be *MySQLShellBackupEngine) ExecuteBackup(ctx context.Context, params Back
}
defer closeFile(mwc, backupManifestFileName, params.Logger, &finalErr)

// Get the hostname
hostname, err := netutil.FullyQualifiedHostname()
if err != nil {
hostname = ""
}

// JSON-encode and write the MANIFEST
bm := &MySQLShellBackupManifest{
// Common base fields
Expand All @@ -218,6 +225,7 @@ func (be *MySQLShellBackupEngine) ExecuteBackup(ctx context.Context, params Back
FinishedTime: FormatRFC3339(time.Now().UTC()),
ServerUUID: serverUUID,
TabletAlias: params.TabletAlias,
Hostname: hostname,
Keyspace: params.Keyspace,
Shard: params.Shard,
MySQLVersion: mysqlVersion,
Expand Down
5 changes: 5 additions & 0 deletions go/vt/mysqlctl/mysqlshellbackupengine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

"vitess.io/vitess/go/ioutil"
"vitess.io/vitess/go/mysql/fakesqldb"
"vitess.io/vitess/go/netutil"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/logutil"
tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
Expand Down Expand Up @@ -406,6 +407,10 @@ func TestMySQLShellBackupEngine_ExecuteBackup_ReleaseLock(t *testing.T) {

require.Equal(t, mysqlShellBackupEngineName, manifest.BackupMethod)

if hostname, err := netutil.FullyQualifiedHostname(); err == nil {
require.Equal(t, hostname, manifest.Hostname)
}

// did we notice the lock was release and did we release it ours as well?
require.Contains(t, logger.String(), "global read lock released after",
"failed to release the global lock after mysqlsh")
Expand Down
8 changes: 8 additions & 0 deletions go/vt/mysqlctl/xtrabackupengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

"vitess.io/vitess/go/ioutil"
"vitess.io/vitess/go/mysql/replication"
"vitess.io/vitess/go/netutil"
"vitess.io/vitess/go/vt/logutil"
"vitess.io/vitess/go/vt/mysqlctl/backupstorage"
tabletmanagerdatapb "vitess.io/vitess/go/vt/proto/tabletmanagerdata"
Expand Down Expand Up @@ -241,6 +242,12 @@ func (be *XtrabackupEngine) executeFullBackup(ctx context.Context, params Backup
}
defer closeFile(mwc, backupManifestFileName, params.Logger, &finalErr)

// Get the hostname
hostname, err := netutil.FullyQualifiedHostname()
if err != nil {
hostname = ""
}

// JSON-encode and write the MANIFEST
bm := &xtraBackupManifest{
// Common base fields
Expand All @@ -251,6 +258,7 @@ func (be *XtrabackupEngine) executeFullBackup(ctx context.Context, params Backup
PurgedPosition: replicationPosition,
ServerUUID: serverUUID,
TabletAlias: params.TabletAlias,
Hostname: hostname,
Keyspace: params.Keyspace,
Shard: params.Shard,
BackupTime: FormatRFC3339(params.BackupTime.UTC()),
Expand Down
Loading