Skip to content

Commit 33d4fe7

Browse files
p3rf Teamcopybara-github
authored andcommitted
Support gs:// URLs in --ycsb_tar_url
PiperOrigin-RevId: 846466524
1 parent cf228cb commit 33d4fe7

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

CHANGES.next.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,3 +635,4 @@
635635
- Add fio benchmark for object storage via FUSE.
636636
- Updated the CONTRIBUTING.md guide with steps to minimize merging & review
637637
friction for new PRs.
638+
- Support gs:// URLs in --ycsb_tar_url.

perfkitbenchmarker/linux_packages/ycsb.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,27 @@ def CheckPrerequisites():
691691
)
692692

693693

694+
def _DownloadAndInstallTarball(vm, install_dir, url):
695+
"""Downloads and installs a tarball to the VM."""
696+
if url.startswith('gs://'):
697+
download_cmd = 'gsutil cat'
698+
else:
699+
download_cmd = 'curl -L'
700+
install_cmd = (
701+
f'mkdir -p {install_dir} && {download_cmd} {url} | '
702+
f'tar -C {install_dir} --strip-components=1 -xzf - '
703+
# Log4j 2 < 2.16 is vulnerable to
704+
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228.
705+
# YCSB currently ships with a number of vulnerable jars. None are used by
706+
# PKB, so simply exclude them.
707+
# After https://github.com/brianfrankcooper/YCSB/pull/1583 is merged and
708+
# released, this will not be necessary.
709+
# TODO(user): Update minimum YCSB version and remove.
710+
"--exclude='**/log4j-core-2*.jar' "
711+
)
712+
vm.RemoteCommand(install_cmd)
713+
714+
694715
@vm_util.Retry(poll_interval=1)
695716
def Install(vm):
696717
"""Installs the YCSB and, if needed, hdrhistogram package on the VM."""
@@ -702,18 +723,7 @@ def Install(vm):
702723
# ycsb.py uses /usr/bin/env python
703724
vm.RemoteCommand('sudo ln -sf /usr/bin/python2.7 /usr/local/bin/python')
704725
vm.Install('maven')
705-
install_cmd = (
706-
'mkdir -p {0} && curl -L {1} | '
707-
'tar -C {0} --strip-components=1 -xzf - '
708-
# Log4j 2 < 2.16 is vulnerable to
709-
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228.
710-
# YCSB currently ships with a number of vulnerable jars. None are used by
711-
# PKB, so simply exclude them.
712-
# After https://github.com/brianfrankcooper/YCSB/pull/1583 is merged and
713-
# released, this will not be necessary.
714-
# TODO(user): Update minimum YCSB version and remove.
715-
"--exclude='**/log4j-core-2*.jar' "
716-
)
726+
717727
if _YCSB_COMMIT.value:
718728
vm.RemoteCommand(
719729
f'mkdir -p {YCSB_DIR} && cd {YCSB_DIR} && git init && (git config'
@@ -735,8 +745,8 @@ def Install(vm):
735745
or FLAGS.ycsb_tar_url
736746
or YCSB_URL_TEMPLATE.format(_YCSB_VERSION.value)
737747
)
738-
vm.RemoteCommand(install_cmd.format(YCSB_DIR, ycsb_url))
739-
vm.RemoteCommand(install_cmd.format(HDRHISTOGRAM_DIR, HDRHISTOGRAM_TAR_URL))
748+
_DownloadAndInstallTarball(vm, YCSB_DIR, ycsb_url)
749+
_DownloadAndInstallTarball(vm, HDRHISTOGRAM_DIR, HDRHISTOGRAM_TAR_URL)
740750
# _JAVA_OPTIONS needed to work around this issue:
741751
# https://stackoverflow.com/questions/53010200/maven-surefire-could-not-find-forkedbooter-class
742752
# https://stackoverflow.com/questions/34170811/maven-connection-reset-error

0 commit comments

Comments
 (0)