mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
server: Sort disk arguments for consistent ordering (#3469)
This is important in a distributed setup, where the server hosting the first disk formats a fresh setup. Sorting ensures that all servers arrive at the same 'first' server. Note: This change doesn't protect against different disk arguments with some disks being same across servers.
This commit is contained in:
committed by
Harshavardhana
parent
5404dddcea
commit
85c6bb9809
@@ -24,6 +24,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"runtime"
|
||||
@@ -429,6 +430,12 @@ func serverMain(c *cli.Context) {
|
||||
fatalIf(errInvalidArgument, "None of the disks passed as command line args are local to this server.")
|
||||
}
|
||||
|
||||
// Sort endpoints for consistent ordering across multiple
|
||||
// nodes in a distributed setup. This is to avoid format.json
|
||||
// corruption if the disks aren't supplied in the same order
|
||||
// on all nodes.
|
||||
sort.Sort(byHostPath(endpoints))
|
||||
|
||||
storageDisks, err := initStorageDisks(endpoints)
|
||||
fatalIf(err, "Unable to initialize storage disk(s).")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user