diff --git a/bin/ycsb b/bin/ycsb index 4db2926e..dad1fab2 100755 --- a/bin/ycsb +++ b/bin/ycsb @@ -1,295 +1,299 @@ #!/usr/bin/env python # # Copyright (c) 2012 - 2015 YCSB contributors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in compliance with the License. You # may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. See accompanying # LICENSE file. # import errno import fnmatch import io import os import shlex import sys import subprocess try: mod = __import__('argparse') import argparse except ImportError: print >> sys.stderr, '[ERROR] argparse not found. Try installing it via "pip".' exit(1) BASE_URL = "https://github.com/brianfrankcooper/YCSB/tree/master/" COMMANDS = { "shell" : { "command" : "", "description" : "Interactive mode", "main" : "com.yahoo.ycsb.CommandLine", }, "load" : { "command" : "-load", "description" : "Execute the load phase", "main" : "com.yahoo.ycsb.Client", }, "run" : { "command" : "-t", "description" : "Execute the transaction phase", "main" : "com.yahoo.ycsb.Client", }, } DATABASES = { "accumulo" : "com.yahoo.ycsb.db.accumulo.AccumuloClient", "aerospike" : "com.yahoo.ycsb.db.AerospikeClient", "asynchbase" : "com.yahoo.ycsb.db.AsyncHBaseClient", "basic" : "com.yahoo.ycsb.BasicDB", "cassandra-7" : "com.yahoo.ycsb.db.CassandraClient7", "cassandra-8" : "com.yahoo.ycsb.db.CassandraClient8", "cassandra-10" : "com.yahoo.ycsb.db.CassandraClient10", "cassandra-cql": "com.yahoo.ycsb.db.CassandraCQLClient", "cassandra2-cql": "com.yahoo.ycsb.db.CassandraCQLClient", "couchbase" : "com.yahoo.ycsb.db.CouchbaseClient", "couchbase2" : "com.yahoo.ycsb.db.couchbase2.Couchbase2Client", "dynamodb" : "com.yahoo.ycsb.db.DynamoDBClient", "elasticsearch": "com.yahoo.ycsb.db.ElasticsearchClient", "geode" : "com.yahoo.ycsb.db.GeodeClient", "googlebigtable" : "com.yahoo.ycsb.db.GoogleBigtableClient", "googledatastore" : "com.yahoo.ycsb.db.GoogleDatastoreClient", "hbase094" : "com.yahoo.ycsb.db.HBaseClient", "hbase098" : "com.yahoo.ycsb.db.HBaseClient", "hbase10" : "com.yahoo.ycsb.db.HBaseClient10", "hypertable" : "com.yahoo.ycsb.db.HypertableClient", "infinispan-cs": "com.yahoo.ycsb.db.InfinispanRemoteClient", "infinispan" : "com.yahoo.ycsb.db.InfinispanClient", "jdbc" : "com.yahoo.ycsb.db.JdbcDBClient", "kudu" : "com.yahoo.ycsb.db.KuduYCSBClient", "mapkeeper" : "com.yahoo.ycsb.db.MapKeeperClient", "memcached" : "com.yahoo.ycsb.db.MemcachedClient", "mongodb" : "com.yahoo.ycsb.db.MongoDbClient", "mongodb-async": "com.yahoo.ycsb.db.AsyncMongoDbClient", "nosqldb" : "com.yahoo.ycsb.db.NoSqlDbClient", "orientdb" : "com.yahoo.ycsb.db.OrientDBClient", "rados" : "com.yahoo.ycsb.db.RadosClient", "redis" : "com.yahoo.ycsb.db.RedisClient", "riak" : "com.yahoo.ycsb.db.riak.RiakKVClient", "s3" : "com.yahoo.ycsb.db.S3Client", "solr" : "com.yahoo.ycsb.db.SolrClient", "tarantool" : "com.yahoo.ycsb.db.TarantoolClient", "voldemort" : "com.yahoo.ycsb.db.VoldemortClient" } OPTIONS = { "-P file" : "Specify workload file", "-p key=value" : "Override workload property", "-s" : "Print status to stderr", "-target n" : "Target ops/sec (default: unthrottled)", "-threads n" : "Number of client threads (default: 1)", "-cp path" : "Additional Java classpath entries", "-jvm-args args" : "Additional arguments to the JVM", } def usage(): output = io.BytesIO() print >> output, "%s command database [options]" % sys.argv[0] print >> output, "\nCommands:" for command in sorted(COMMANDS.keys()): print >> output, " %s %s" % (command.ljust(14), COMMANDS[command]["description"]) print >> output, "\nDatabases:" for db in sorted(DATABASES.keys()): print >> output, " %s %s" % (db.ljust(14), BASE_URL + db.split("-")[0]) print >> output, "\nOptions:" for option in sorted(OPTIONS.keys()): print >> output, " %s %s" % (option.ljust(14), OPTIONS[option]) print >> output, """\nWorkload Files: There are various predefined workloads under workloads/ directory. See https://github.com/brianfrankcooper/YCSB/wiki/Core-Properties for the list of workload properties.""" return output.getvalue() # Python 2.6 doesn't have check_output. Add the method as it is in Python 2.7 # Based on https://github.com/python/cpython/blob/2.7/Lib/subprocess.py#L545 def check_output(*popenargs, **kwargs): r"""Run command with arguments and return its output as a byte string. If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute. The arguments are the same as for the Popen constructor. Example: >>> check_output(["ls", "-l", "/dev/null"]) 'crw-rw-rw- 1 root root 1, 3 Oct 18 2007 /dev/null\n' The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT. >>> check_output(["/bin/sh", "-c", ... "ls -l non_existent_file ; exit 0"], ... stderr=STDOUT) 'ls: non_existent_file: No such file or directory\n' """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) output, unused_err = process.communicate() retcode = process.poll() if retcode: cmd = kwargs.get("args") if cmd is None: cmd = popenargs[0] error = subprocess.CalledProcessError(retcode, cmd) error.output = output raise error return output def debug(message): print >> sys.stderr, "[DEBUG] ", message def warn(message): print >> sys.stderr, "[WARN] ", message def error(message): print >> sys.stderr, "[ERROR] ", message def find_jars(dir, glob='*.jar'): jars = [] for (dirpath, dirnames, filenames) in os.walk(dir): for filename in fnmatch.filter(filenames, glob): jars.append(os.path.join(dirpath, filename)) return jars def get_ycsb_home(): dir = os.path.abspath(os.path.dirname(sys.argv[0])) while "LICENSE.txt" not in os.listdir(dir): dir = os.path.join(dir, os.path.pardir) return os.path.abspath(dir) def is_distribution(): # If there's a top level pom, we're a source checkout. otherwise a dist artifact return "pom.xml" not in os.listdir(get_ycsb_home()) # Run the maven dependency plugin to get the local jar paths. # presumes maven can run, so should only be run on source checkouts # will invoke the 'package' goal for the given binding in order to resolve intra-project deps # presumes maven properly handles system-specific path separators # Given module is full module name eg. 'core' or 'couchbase-binding' def get_classpath_from_maven(module): try: debug("Running 'mvn -pl com.yahoo.ycsb:" + module + " -am package -DskipTests " "dependency:build-classpath -DincludeScope=compile -Dmdep.outputFilterFile=true'") mvn_output = check_output(["mvn", "-pl", "com.yahoo.ycsb:" + module, "-am", "package", "-DskipTests", "dependency:build-classpath", "-DincludeScope=compile", "-Dmdep.outputFilterFile=true"]) # the above outputs a "classpath=/path/tojar:/path/to/other/jar" for each module # the last module will be the datastore binding line = [x for x in mvn_output.splitlines() if x.startswith("classpath=")][-1:] return line[0][len("classpath="):] except subprocess.CalledProcessError, err: error("Attempting to generate a classpath from Maven failed " "with return code '" + str(err.returncode) + "'. The output from " "Maven follows, try running " "'mvn -DskipTests package dependency:build=classpath' on your " "own and correct errors." + os.linesep + os.linesep + "mvn output:" + os.linesep + err.output) sys.exit(err.returncode) def main(): p = argparse.ArgumentParser( usage=usage(), formatter_class=argparse.RawDescriptionHelpFormatter) p.add_argument('-cp', dest='classpath', help="""Additional classpath entries, e.g. '-cp /tmp/hbase-1.0.1.1/conf'. Will be prepended to the YCSB classpath.""") p.add_argument("-jvm-args", default=[], type=shlex.split, help="""Additional arguments to pass to 'java', e.g. '-Xmx4g'""") p.add_argument("command", choices=sorted(COMMANDS), help="""Command to run.""") p.add_argument("database", choices=sorted(DATABASES), help="""Database to test.""") args, remaining = p.parse_known_args() ycsb_home = get_ycsb_home() # Use JAVA_HOME to find java binary if set, otherwise just use PATH. java = "java" java_home = os.getenv("JAVA_HOME") if java_home: java = os.path.join(java_home, "bin", "java") db_classname = DATABASES[args.database] command = COMMANDS[args.command]["command"] main_classname = COMMANDS[args.command]["main"] # Classpath set up binding = args.database.split("-")[0] # Deprecation message for the entire cassandra-binding if binding == "cassandra": warn("The 'cassandra-7', 'cassandra-8', 'cassandra-10', and " "cassandra-cql' clients are deprecated. If you are using " "Cassandra 2.X try using the 'cassandra2-cql' client instead.") + if binding == "couchbase": + warn("The 'couchbase' client has been deprecated. If you are using " + "Couchbase 4.0+ try using the 'couchbase2' client instead.") + if is_distribution(): db_dir = os.path.join(ycsb_home, binding + "-binding") # include top-level conf for when we're a binding-specific artifact. # If we add top-level conf to the general artifact, starting here # will allow binding-specific conf to override (because it's prepended) cp = [os.path.join(ycsb_home, "conf")] cp.extend(find_jars(os.path.join(ycsb_home, "lib"))) cp.extend(find_jars(os.path.join(db_dir, "lib"))) else: warn("Running against a source checkout. In order to get our runtime " "dependencies we'll have to invoke Maven. Depending on the state " "of your system, this may take ~30-45 seconds") db_location = "core" if binding == "basic" else binding project = "core" if binding == "basic" else binding + "-binding" db_dir = os.path.join(ycsb_home, db_location) # goes first so we can rely on side-effect of package maven_says = get_classpath_from_maven(project) # TODO when we have a version property, skip the glob cp = find_jars(os.path.join(db_dir, "target"), project + "*.jar") # alredy in jar:jar:jar form cp.append(maven_says) cp.insert(0, os.path.join(db_dir, "conf")) classpath = os.pathsep.join(cp) if args.classpath: classpath = os.pathsep.join([args.classpath, classpath]) ycsb_command = ([java] + args.jvm_args + ["-cp", classpath, main_classname, "-db", db_classname] + remaining) if command: ycsb_command.append(command) print >> sys.stderr, " ".join(ycsb_command) try: return subprocess.call(ycsb_command) except OSError as e: if e.errno == errno.ENOENT: error('Command failed. Is java installed and on your PATH?') return 1 else: raise if __name__ == '__main__': sys.exit(main()) diff --git a/bin/ycsb.bat b/bin/ycsb.bat index a43a1677..bd609481 100644 --- a/bin/ycsb.bat +++ b/bin/ycsb.bat @@ -1,202 +1,207 @@ @REM @REM Copyright (c) 2012 - 2016 YCSB contributors. All rights reserved. @REM @REM Licensed under the Apache License, Version 2.0 (the "License"); you @REM may not use this file except in compliance with the License. You @REM may obtain a copy of the License at @REM @REM http://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, software @REM distributed under the License is distributed on an "AS IS" BASIS, @REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or @REM implied. See the License for the specific language governing @REM permissions and limitations under the License. See accompanying @REM LICENSE file. @REM @REM ----------------------------------------------------------------------- @REM Control Script for YCSB @REM @REM Environment Variable Prerequisites @REM @REM Do not set the variables in this script. Instead put them into a script @REM setenv.sh in YCSB_HOME/bin to keep your customizations separate. @REM @REM YCSB_HOME (Optional) YCSB installation directory. If not set @REM this script will use the parent directory of where this @REM script is run from. @REM @REM JAVA_HOME (Required) Must point at your Java Development Kit @REM or Java Runtime Environment installation. @REM @REM JAVA_OPTS (Optional) Java runtime options used when any command @REM is executed. @REM @REM WARNING!!! YCSB home must be located in a directory path that doesn't @REM contain spaces. @REM @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION @REM Only set YCSB_HOME if not already set PUSHD %~dp0.. IF NOT DEFINED YCSB_HOME SET YCSB_HOME=%CD% POPD @REM Ensure that any extra CLASSPATH variables are set via setenv.bat SET CLASSPATH= @REM Pull in customization options if exist "%YCSB_HOME%\bin\setenv.bat" call "%YCSB_HOME%\bin\setenv.bat" @REM Check if we have a usable JDK IF "%JAVA_HOME%." == "." GOTO noJavaHome IF NOT EXIST "%JAVA_HOME%\bin\java.exe" GOTO noJavaHome GOTO okJava :noJavaHome ECHO The JAVA_HOME environment variable is not defined correctly. GOTO exit :okJava @REM Determine YCSB command argument IF NOT "load" == "%1" GOTO noload SET YCSB_COMMAND=-load SET YCSB_CLASS=com.yahoo.ycsb.Client GOTO gotCommand :noload IF NOT "run" == "%1" GOTO noRun SET YCSB_COMMAND=-t SET YCSB_CLASS=com.yahoo.ycsb.Client GOTO gotCommand :noRun IF NOT "shell" == "%1" GOTO noShell SET YCSB_COMMAND= SET YCSB_CLASS=com.yahoo.ycsb.CommandLine GOTO gotCommand :noShell ECHO [ERROR] Found unknown command '%1' ECHO [ERROR] Expected one of 'load', 'run', or 'shell'. Exiting. GOTO exit :gotCommand @REM Find binding information FOR /F "delims=" %%G in ( 'FINDSTR /B "%2:" %YCSB_HOME%\bin\bindings.properties' ) DO SET "BINDING_LINE=%%G" IF NOT "%BINDING_LINE%." == "." GOTO gotBindingLine ECHO [ERROR] The specified binding '%2' was not found. Exiting. GOTO exit :gotBindingLine @REM Pull out binding name and class FOR /F "tokens=1-2 delims=:" %%G IN ("%BINDING_LINE%") DO ( SET BINDING_NAME=%%G SET BINDING_CLASS=%%H ) @REM Some bindings have multiple versions that are managed in the same @REM directory. @REM They are noted with a '-' after the binding name. @REM (e.g. cassandra-7 & cassandra-8) FOR /F "tokens=1 delims=-" %%G IN ("%BINDING_NAME%") DO ( SET BINDING_DIR=%%G ) @REM The 'basic' binding is core functionality IF NOT "%BINDING_NAME%" == "basic" GOTO noBasic SET BINDING_DIR=core :noBasic @REM Add Top level conf to classpath IF "%CLASSPATH%." == "." GOTO emptyClasspath SET CLASSPATH=%CLASSPATH%;%YCSB_HOME%\conf GOTO confAdded :emptyClasspath SET CLASSPATH=%YCSB_HOME%\conf :confAdded @REM Build classpath according to source checkout or release distribution IF EXIST "%YCSB_HOME%\pom.xml" GOTO gotSource @REM Core libraries FOR %%F IN (%YCSB_HOME%\lib\*.jar) DO ( SET CLASSPATH=!CLASSPATH!;%%F% ) @REM Database conf dir IF NOT EXIST "%YCSB_HOME%\%BINDING_DIR%-binding\conf" GOTO noBindingConf set CLASSPATH=%CLASSPATH%;%YCSB_HOME%\%BINDING_DIR%-binding\conf :noBindingConf @REM Database libraries FOR %%F IN (%YCSB_HOME%\%BINDING_DIR%-binding\lib\*.jar) DO ( SET CLASSPATH=!CLASSPATH!;%%F% ) GOTO classpathComplete :gotSource @REM Check for some basic libraries to see if the source has been built. IF EXIST "%YCSB_HOME%\%BINDING_DIR%\target\*.jar" GOTO gotJars @REM Call mvn to build source checkout. IF "%BINDING_NAME%" == "basic" GOTO buildCore SET MVN_PROJECT=%BINDING_DIR%-binding goto gotMvnProject :buildCore SET MVN_PROJECT=core :gotMvnProject ECHO [WARN] YCSB libraries not found. Attempting to build... CALL mvn -pl com.yahoo.ycsb:%MVN_PROJECT% -am package -DskipTests IF %ERRORLEVEL% NEQ 0 ( ECHO [ERROR] Error trying to build project. Exiting. GOTO exit ) :gotJars @REM Core libraries FOR %%F IN (%YCSB_HOME%\core\target\*.jar) DO ( SET CLASSPATH=!CLASSPATH!;%%F% ) @REM Database conf (need to find because location is not consistent) FOR /D /R %YCSB_HOME%\%BINDING_DIR% %%F IN (*) DO ( IF "%%~nxF" == "conf" SET CLASSPATH=!CLASSPATH!;%%F% ) @REM Database libraries FOR %%F IN (%YCSB_HOME%\%BINDING_DIR%\target\*.jar) DO ( SET CLASSPATH=!CLASSPATH!;%%F% ) @REM Database dependency libraries FOR %%F IN (%YCSB_HOME%\%BINDING_DIR%\target\dependency\*.jar) DO ( SET CLASSPATH=!CLASSPATH!;%%F% ) :classpathComplete @REM Cassandra deprecation message IF NOT "%BINDING_DIR%" == "cassandra" GOTO notOldCassandra echo [WARN] The 'cassandra-7', 'cassandra-8', 'cassandra-10', and cassandra-cql' clients are deprecated. If you are using Cassandra 2.X try using the 'cassandra2-cql' client instead. :notOldCassandra +@REM Couchbase deprecation message +IF NOT "%BINDING_DIR%" == "couchbase" GOTO notOldCouchbase +echo [WARN] The 'couchbase' client is deprecated. If you are using Couchbase 4.0+ try using the 'couchbase2' client instead. +:notOldCouchbase + @REM Get the rest of the arguments, skipping the first 2 FOR /F "tokens=2*" %%G IN ("%*") DO ( SET YCSB_ARGS=%%H ) @REM Run YCSB @ECHO ON "%JAVA_HOME%\bin\java.exe" %JAVA_OPTS% -classpath "%CLASSPATH%" %YCSB_CLASS% %YCSB_COMMAND% -db %BINDING_CLASS% %YCSB_ARGS% @ECHO OFF GOTO end :exit EXIT /B 1; :end diff --git a/bin/ycsb.sh b/bin/ycsb.sh index efdb58bd..cc882602 100755 --- a/bin/ycsb.sh +++ b/bin/ycsb.sh @@ -1,236 +1,242 @@ #!/bin/sh # # Copyright (c) 2012 - 2016 YCSB contributors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in compliance with the License. You # may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. See the License for the specific language governing # permissions and limitations under the License. See accompanying # LICENSE file. # # ----------------------------------------------------------------------------- # Control Script for YCSB # # Environment Variable Prerequisites # # Do not set the variables in this script. Instead put them into a script # setenv.sh in YCSB_HOME/bin to keep your customizations separate. # # YCSB_HOME (Optional) YCSB installation directory. If not set # this script will use the parent directory of where this # script is run from. # # JAVA_HOME (Optional) Must point at your Java Development Kit # installation. If empty, this script tries use the # available java executable. # # JAVA_OPTS (Optional) Java runtime options used when any command # is executed. # # WARNING!!! YCSB home must be located in a directory path that doesn't # contain spaces. # # www.shellcheck.net was used to validate this script # Cygwin support CYGWIN=false case "$(uname)" in CYGWIN*) CYGWIN=true;; esac # Get script path SCRIPT_DIR=$(dirname "$0" 2>/dev/null) # Only set YCSB_HOME if not already set [ -z "$YCSB_HOME" ] && YCSB_HOME=$(cd "$SCRIPT_DIR/.." || exit; pwd) # Ensure that any extra CLASSPATH variables are set via setenv.sh CLASSPATH= # Pull in customization options if [ -r "$YCSB_HOME/bin/setenv.sh" ]; then # Shellcheck wants a source, but this directive only runs if available # So, tell shellcheck to ignore # shellcheck source=/dev/null . "$YCSB_HOME/bin/setenv.sh" fi # Attempt to find the available JAVA, if JAVA_HOME not set if [ -z "$JAVA_HOME" ]; then JAVA_PATH=$(which java 2>/dev/null) if [ "x$JAVA_PATH" != "x" ]; then JAVA_HOME=$(dirname "$(dirname "$JAVA_PATH" 2>/dev/null)") fi fi # If JAVA_HOME still not set, error if [ -z "$JAVA_HOME" ]; then echo "[ERROR] Java executable not found. Exiting." exit 1; fi # Determine YCSB command argument if [ "load" = "$1" ] ; then YCSB_COMMAND=-load YCSB_CLASS=com.yahoo.ycsb.Client elif [ "run" = "$1" ] ; then YCSB_COMMAND=-t YCSB_CLASS=com.yahoo.ycsb.Client elif [ "shell" = "$1" ] ; then YCSB_COMMAND= YCSB_CLASS=com.yahoo.ycsb.CommandLine else echo "[ERROR] Found unknown command '$1'" echo "[ERROR] Expected one of 'load', 'run', or 'shell'. Exiting." exit 1; fi # Find binding information BINDING_LINE=$(grep "^$2:" "$YCSB_HOME/bin/bindings.properties" -m 1) if [ -z "$BINDING_LINE" ] ; then echo "[ERROR] The specified binding '$2' was not found. Exiting." exit 1; fi # Get binding name and class BINDING_NAME=$(echo "$BINDING_LINE" | cut -d':' -f1) BINDING_CLASS=$(echo "$BINDING_LINE" | cut -d':' -f2) # Some bindings have multiple versions that are managed in the same directory. # They are noted with a '-' after the binding name. # (e.g. cassandra-7 & cassandra-8) BINDING_DIR=$(echo "$BINDING_NAME" | cut -d'-' -f1) # The 'basic' binding is core functionality if [ "$BINDING_NAME" = "basic" ] ; then BINDING_DIR=core fi # For Cygwin, ensure paths are in UNIX format before anything is touched if $CYGWIN; then [ -n "$JAVA_HOME" ] && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") [ -n "$CLASSPATH" ] && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") fi # Check if source checkout, or release distribution DISTRIBUTION=true if [ -r "$YCSB_HOME/pom.xml" ]; then DISTRIBUTION=false; fi # Add Top level conf to classpath if [ -z "$CLASSPATH" ] ; then CLASSPATH="$YCSB_HOME/conf" else CLASSPATH="$CLASSPATH:$YCSB_HOME/conf" fi # Build classpath # The "if" check after the "for" is because glob may just return the pattern # when no files are found. The "if" makes sure the file is really there. if $DISTRIBUTION; then # Core libraries for f in "$YCSB_HOME"/lib/*.jar ; do if [ -r "$f" ] ; then CLASSPATH="$CLASSPATH:$f" fi done # Database conf dir if [ -r "$YCSB_HOME"/"$BINDING_DIR"-binding/conf ] ; then CLASSPATH="$CLASSPATH:$YCSB_HOME/$BINDING_DIR-binding/conf" fi # Database libraries for f in "$YCSB_HOME"/"$BINDING_DIR"-binding/lib/*.jar ; do if [ -r "$f" ] ; then CLASSPATH="$CLASSPATH:$f" fi done # Source checkout else # Check for some basic libraries to see if the source has been built. for f in "$YCSB_HOME"/"$BINDING_DIR"/target/*.jar ; do # Call mvn to build source checkout. if [ ! -e "$f" ] ; then if [ "$BINDING_NAME" = "basic" ] ; then MVN_PROJECT=core else MVN_PROJECT="$BINDING_DIR"-binding fi echo "[WARN] YCSB libraries not found. Attempting to build..." mvn -pl com.yahoo.ycsb:"$MVN_PROJECT" -am package -DskipTests if [ "$?" -ne 0 ] ; then echo "[ERROR] Error trying to build project. Exiting." exit 1; fi fi done # Core libraries for f in "$YCSB_HOME"/core/target/*.jar ; do if [ -r "$f" ] ; then CLASSPATH="$CLASSPATH:$f" fi done # Database conf (need to find because location is not consistent) CLASSPATH_CONF=$(find "$YCSB_HOME"/$BINDING_DIR -name "conf" | while IFS="" read -r file; do echo ":$file"; done) if [ "x$CLASSPATH_CONF" != "x" ]; then CLASSPATH="$CLASSPATH$CLASSPATH_CONF" fi # Database libraries for f in "$YCSB_HOME"/"$BINDING_DIR"/target/*.jar ; do if [ -r "$f" ] ; then CLASSPATH="$CLASSPATH:$f" fi done # Database dependency libraries for f in "$YCSB_HOME"/"$BINDING_DIR"/target/dependency/*.jar ; do if [ -r "$f" ] ; then CLASSPATH="$CLASSPATH:$f" fi done fi # Cassandra deprecation message if [ "$BINDING_DIR" = "cassandra" ] ; then echo "[WARN] The 'cassandra-7', 'cassandra-8', 'cassandra-10', and \ cassandra-cql' clients are deprecated. If you are using \ Cassandra 2.X try using the 'cassandra2-cql' client instead." fi +# Couchbase deprecation message +if [ "${BINDING_DIR}" = "couchbase" ] ; then + echo "[WARN] The 'couchbase' client is deprecated. If you are using \ +Couchbase 4.0+ try using the 'couchbase2' client instead." +fi + # For Cygwin, switch paths to Windows format before running java if $CYGWIN; then [ -n "$JAVA_HOME" ] && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") [ -n "$CLASSPATH" ] && CLASSPATH=$(cygpath --path --windows "$CLASSPATH") fi # Get the rest of the arguments YCSB_ARGS=$(echo "$@" | cut -d' ' -f3-) # About to run YCSB echo "$JAVA_HOME/bin/java $JAVA_OPTS -classpath $CLASSPATH $YCSB_CLASS $YCSB_COMMAND -db $BINDING_CLASS $YCSB_ARGS" # Run YCSB # Shellcheck reports the following line as needing double quotes to prevent # globbing and word splitting. However, word splitting is the desired effect # here. So, the shellcheck error is disabled for this line. # shellcheck disable=SC2086 "$JAVA_HOME/bin/java" $JAVA_OPTS -classpath "$CLASSPATH" $YCSB_CLASS $YCSB_COMMAND -db $BINDING_CLASS $YCSB_ARGS