Skip to content

Commit

Permalink
pkg/roachprod: fix mounting on GCP and default to multiple stores
Browse files Browse the repository at this point in the history
Fixes bugs introduced by #72553, which ported support for multiple
stores from AWS to GCP.  This change fixes the bugs that caused
disks mounted to not be written to `/etc/fstab` on GCP instances,
causing mounts to go missing on instance restart.  Additionally, this
change modifies the defaults on GCP and AWS to prefer creating multiple
stores rather than creating a RAID 0 array, thus preserving the existing
behavior used in roachtests such as `kv/multi-store-with-overload`.

Fixes #72635

Release note: None
  • Loading branch information
AlexTalks committed Nov 16, 2021
1 parent 91d86e3 commit e16cc14
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/roachprod/vm/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ func (o *ProviderOpts) ConfigureCreateFlags(flags *pflag.FlagSet) {
flags.StringVar(&o.ImageAMI, ProviderName+"-image-ami",
o.ImageAMI, "Override image AMI to use. See https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-images.html")
flags.BoolVar(&o.UseMultipleDisks, ProviderName+"-enable-multiple-stores",
o.UseMultipleDisks, "Enable the use of multiple stores by creating one store directory per disk. "+
"Default is to raid0 stripe all disks. "+
true, "Enable the use of multiple stores by creating one store directory per disk. "+
"Default enabled, disable to raid0 stripe all disks. "+
"See repeating --"+ProviderName+"-ebs-volume for adding extra volumes.")
flags.Float64Var(&o.CreateRateLimit, ProviderName+"-create-rate-limit", o.CreateRateLimit, "aws"+
" rate limit (per second) for instance creation. This is used to avoid hitting the request"+
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/vm/aws/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ mount_prefix="/mnt/data"
for d in $(ls /dev/nvme?n1 /dev/xvdd); do
if ! mount | grep ${d}; then
disks+=("${d}")
echo "Disk ${d} not mounted, creating..."
echo "Disk ${d} not mounted, need to mount..."
else
echo "Disk ${d} already mounted, skipping..."
fi
Expand All @@ -70,7 +70,7 @@ elif [ "${#disks[@]}" -eq "1" ] || [ -n "$use_multiple_disks" ]; then
do
mountpoint="${mount_prefix}${disknum}"
disknum=$((disknum + 1 ))
echo "Creating ${mountpoint}"
echo "Mounting ${disk} at ${mountpoint}"
mkdir -p ${mountpoint}
mkfs.ext4 -F ${disk}
mount -o ${mount_opts} ${disk} ${mountpoint}
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/vm/gce/gcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ func (o *ProviderOpts) ConfigureCreateFlags(flags *pflag.FlagSet) {
flags.IntVar(&o.PDVolumeSize, ProviderName+"-pd-volume-size", 500,
"Size in GB of persistent disk volume, only used if local-ssd=false")
flags.BoolVar(&o.UseMultipleDisks, ProviderName+"-enable-multiple-stores",
o.UseMultipleDisks, "Enable the use of multiple stores by creating one store directory per disk. "+
"Default is to raid0 stripe all disks.")
true, "Enable the use of multiple stores by creating one store directory per disk. "+
"Default enabled, disable to raid0 stripe all disks.")

flags.StringSliceVar(&o.Zones, ProviderName+"-zones", nil,
fmt.Sprintf("Zones for cluster. If zones are formatted as AZ:N where N is an integer, the zone\n"+
Expand Down
6 changes: 3 additions & 3 deletions pkg/roachprod/vm/gce/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ for d in $(ls /dev/disk/by-id/google-local-* /dev/disk/by-id/google-persistent-d
if ! mount | grep ${d}; then
{{ end }}
disks+=("${d}")
echo "Disk ${d} not mounted, creating..."
echo "Disk ${d} not mounted, need to mount..."
else
echo "Disk ${d} already mounted, skipping..."
fi
Expand All @@ -90,15 +90,15 @@ elif [ "${#disks[@]}" -eq "1" ] || [ -n "$use_multiple_disks" ]; then
do
mountpoint="${mount_prefix}${disknum}"
disknum=$((disknum + 1 ))
echo "Creating ${mountpoint}"
echo "Mounting ${disk} at ${mountpoint}"
mkdir -p ${mountpoint}
{{ if .Zfs }}
zpool create -f $(basename $mountpoint) -m ${mountpoint} ${disk}
# NOTE: we don't need an /etc/fstab entry for ZFS. It will handle this itself.
{{ else }}
mkfs.ext4 -q -F ${disk}
mount -o ${mount_opts} ${disk} ${mountpoint}
echo "/dev/md0 ${mountpoint} ext4 ${mount_opts} 1 1" | tee -a /etc/fstab
echo "{d} ${mountpoint} ext4 ${mount_opts} 1 1" | tee -a /etc/fstab
{{ end }}
chmod 777 ${mountpoint}
done
Expand Down

0 comments on commit e16cc14

Please sign in to comment.