Hello community, here is the log from the commit of package sysbench for openSUSE:Factory checked in at 2018-07-21 10:25:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/sysbench (Old) and /work/SRC/openSUSE:Factory/.sysbench.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "sysbench" Sat Jul 21 10:25:01 2018 rev:19 rq:624092 version:1.0.15 Changes: -------- --- /work/SRC/openSUSE:Factory/sysbench/sysbench.changes 2018-05-29 10:35:08.950133684 +0200 +++ /work/SRC/openSUSE:Factory/.sysbench.new/sysbench.changes 2018-07-21 10:25:03.198959909 +0200 @@ -1,0 +2,13 @@ +Thu Jul 19 14:47:13 UTC 2018 - [email protected] + +- Update to version 1.0.15: + * fileio: fix GH-229 (--file-fsync-freq=0 seems to prevent + fsync() at the end of the test) + * command line: improve parsing of boolean command line options + * tests: fix GH-220 (Testsuite api_sql_mysql.t failed ...) + * tests: fix GH-223 (test failure on ppc64) + * tests: fix opt_help.t to pass when the binary is not configured + with MySQL support + * MySQL driver: use it by default in DB benchmarks + +------------------------------------------------------------------- Old: ---- sysbench-1.0.14.tar.gz New: ---- sysbench-1.0.15.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ sysbench.spec ++++++ --- /var/tmp/diff_new_pack.LoY4Pa/_old 2018-07-21 10:25:03.886959743 +0200 +++ /var/tmp/diff_new_pack.LoY4Pa/_new 2018-07-21 10:25:03.886959743 +0200 @@ -17,7 +17,7 @@ Name: sysbench -Version: 1.0.14 +Version: 1.0.15 Release: 0 Summary: A MySQL benchmarking tool License: GPL-2.0-only ++++++ sysbench-1.0.14.tar.gz -> sysbench-1.0.15.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/.travis.yml new/sysbench-1.0.15/.travis.yml --- old/sysbench-1.0.14/.travis.yml 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/.travis.yml 2018-07-03 21:49:50.000000000 +0200 @@ -30,20 +30,20 @@ - TARGET=coverage - OS=el DIST=6 - OS=el DIST=7 - - OS=fedora DIST=26 - OS=fedora DIST=27 + - OS=fedora DIST=28 - OS=fedora DIST=rawhide - OS=ubuntu DIST=trusty - OS=ubuntu DIST=xenial - OS=ubuntu DIST=artful - - OS=debian DIST=wheezy + - OS=ubuntu DIST=bionic - OS=debian DIST=jessie - OS=debian DIST=stretch - OS=debian DIST=sid - OS=ubuntu DIST=trusty ARCH=i386 - OS=ubuntu DIST=xenial ARCH=i386 - OS=ubuntu DIST=artful ARCH=i386 - - OS=debian DIST=wheezy ARCH=i386 + - OS=ubuntu DIST=bionic ARCH=i386 - OS=debian DIST=jessie ARCH=i386 - OS=debian DIST=stretch ARCH=i386 - OS=debian DIST=sid ARCH=i386 @@ -54,10 +54,10 @@ compiler: clang - env: OS=el DIST=7 compiler: clang - - env: OS=fedora DIST=26 - compiler: clang - env: OS=fedora DIST=27 compiler: clang + - env: OS=fedora DIST=28 + compiler: clang - env: OS=fedora DIST=rawhide compiler: clang - env: OS=ubuntu DIST=trusty @@ -66,7 +66,7 @@ compiler: clang - env: OS=ubuntu DIST=artful compiler: clang - - env: OS=debian DIST=wheezy + - env: OS=ubuntu DIST=bionic compiler: clang - env: OS=debian DIST=jessie compiler: clang @@ -80,7 +80,7 @@ compiler: clang - env: OS=ubuntu DIST=artful ARCH=i386 compiler: clang - - env: OS=debian DIST=wheezy ARCH=i386 + - env: OS=ubuntu DIST=bionic ARCH=i386 compiler: clang - env: OS=debian DIST=jessie ARCH=i386 compiler: clang @@ -92,10 +92,10 @@ os: osx - env: OS=el DIST=7 os: osx - - env: OS=fedora DIST=26 - os: osx - env: OS=fedora DIST=27 os: osx + - env: OS=fedora DIST=28 + os: osx - env: OS=fedora DIST=rawhide os: osx - env: OS=ubuntu DIST=trusty @@ -104,7 +104,7 @@ os: osx - env: OS=ubuntu DIST=artful os: osx - - env: OS=debian DIST=wheezy + - env: OS=ubuntu DIST=bionic os: osx - env: OS=debian DIST=jessie os: osx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/ChangeLog new/sysbench-1.0.15/ChangeLog --- old/sysbench-1.0.14/ChangeLog 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/ChangeLog 2018-07-03 21:49:50.000000000 +0200 @@ -1,3 +1,19 @@ +2018-07-03 Alexey Kopytov <[email protected]> + + * version 1.0.15 + * CI/build/packaging: add Fedora 28 + * CI/build/packaging: add Ubuntu Bionic + * CI/build/packaging: remove Fedora 26 (EOL) + * CI/build/packaging: remove Debian Wheezy (EOL) + * fileio: fix GH-229 (--file-fsync-freq=0 seems to prevent + fsync() at the end of the test) + * command line: improve parsing of boolean command line options + * tests: fix GH-220 (Testsuite api_sql_mysql.t failed ...) + * tests: fix GH-223 (test failure on ppc64) + * tests: fix opt_help.t to pass when the binary is not + configured with MySQL support + * MySQL driver: use it by default in DB benchmarks + 2018-04-01 Alexey Kopytov <[email protected]> * version 1.0.14 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/README.md new/sysbench-1.0.15/README.md --- old/sysbench-1.0.14/README.md 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/README.md 2018-07-03 21:49:50.000000000 +0200 @@ -23,8 +23,9 @@ - [macOS](#macos) - [Build and Install](#build-and-install) - [Usage](#usage) - - [General syntax](#general-syntax) - - [General command line options](#general-command-line-options) + - [General Syntax](#general-syntax) + - [General Command Line Options](#general-command-line-options) +- [Versioning](#versioning) <!-- markdown-toc end --> @@ -133,7 +134,7 @@ ``` shell apt -y install make automake libtool pkg-config libaio-dev # For MySQL support - apt -y install libmysqlclient-dev + apt -y install libmysqlclient-dev libssl-dev # For PostgreSQL support apt -y install libpq-dev ``` @@ -142,7 +143,7 @@ ``` shell yum -y install make automake libtool pkgconfig libaio-devel # For MySQL support, replace with mysql-devel on RHEL/CentOS 5 - yum -y install mariadb-devel + yum -y install mariadb-devel openssl-devel # For PostgreSQL support yum -y install postgresql-devel ``` @@ -151,7 +152,7 @@ ``` shell dnf -y install make automake libtool pkgconfig libaio-devel # For MySQL support - dnf -y install mariadb-devel + dnf -y install mariadb-devel openssl-devel # For PostgreSQL support dnf -y install postgresql-devel ``` @@ -193,7 +194,7 @@ # Usage -## General syntax +## General Syntax The general command line syntax for sysbench is: @@ -239,7 +240,7 @@ You can use `sysbench --help` to display the general command line syntax and options. -## General command line options +## General Command Line Options The table below lists the supported common options, their descriptions and default values: @@ -259,6 +260,22 @@ Note that numerical values for all *size* options (like `--thread-stack-size` in this table) may be specified by appending the corresponding multiplicative suffix (K for kilobytes, M for megabytes, G for gigabytes and T for terabytes). +# Versioning + +For transparency and insight into its release cycle, and for striving to maintain backward compatibility, sysbench will be maintained under the Semantic Versioning guidelines as much as possible. + +Releases will be numbered with the following format: + +`<major>.<minor>.<patch>` + +And constructed with the following guidelines: + +* Breaking backward compatibility bumps the major (and resets the minor and patch) +* New additions without breaking backward compatibility bumps the minor (and resets the patch) +* Bug fixes and misc changes bumps the patch + +For more information on SemVer, please visit [http://semver.org/](http://semver.org/). + [coveralls-badge]: https://coveralls.io/repos/github/akopytov/sysbench/badge.svg?branch=1.0 [coveralls-url]: https://coveralls.io/github/akopytov/sysbench?branch=1.0 [travis-badge]: https://travis-ci.org/akopytov/sysbench.svg?branch=1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/configure.ac new/sysbench-1.0.15/configure.ac --- old/sysbench-1.0.14/configure.ac 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/configure.ac 2018-07-03 21:49:50.000000000 +0200 @@ -1,7 +1,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.63) -AC_INIT([sysbench],[1.0.14],[https://github.com/akopytov/sysbench/issues], +AC_INIT([sysbench],[1.0.15],[https://github.com/akopytov/sysbench/issues], [sysbench], [https://github.com/akopytov/sysbench]) AC_CONFIG_AUX_DIR([config]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/scripts/buildpack.sh new/sysbench-1.0.15/scripts/buildpack.sh --- old/sysbench-1.0.14/scripts/buildpack.sh 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/scripts/buildpack.sh 2018-07-03 21:49:50.000000000 +0200 @@ -49,12 +49,12 @@ distros_x86_64=( "el 6 x86_64" "el 7 x86_64" - "fedora 26 x86_64" "fedora 27 x86_64" + "fedora 28 x86_64" "ubuntu trusty x86_64" "ubuntu xenial x86_64" "ubuntu artful x86_64" - "debian wheezy x86_64" + "ubuntu bionic x86_64" "debian jessie x86_64" "debian stretch x86_64" ) @@ -63,16 +63,17 @@ "ubuntu trusty i386" "ubuntu xenial i386" "ubuntu artful i386" - "debian wheezy i386" + "ubuntu bionic i386" "debian jessie i386" "debian stretch i386" ) distros_aarch64=( "el 7 aarch64" - "fedora 26 aarch64" "fedora 27 aarch64" + "fedora 28 aarch64" "ubuntu artful aarch64" + "ubuntu bionic aarch64" "ubuntu trusty aarch64" "ubuntu xenial aarch64" "debian jessie aarch64" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/src/db_driver.c new/sysbench-1.0.15/src/db_driver.c --- old/sysbench-1.0.14/src/db_driver.c 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/src/db_driver.c 2018-07-03 21:49:50.000000000 +0200 @@ -77,7 +77,13 @@ static sb_arg_t db_args[] = { SB_OPT("db-driver", "specifies database driver to use " - "('help' to get list of available drivers)", NULL, STRING), + "('help' to get list of available drivers)", +#ifdef USE_MYSQL + "mysql", +#else + NULL, +#endif + STRING), SB_OPT("db-ps-mode", "prepared statements usage mode {auto, disable}", "auto", STRING), SB_OPT("db-debug", "print database-specific debug information", "off", BOOL), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/src/lua/internal/sysbench.cmdline.lua new/sysbench-1.0.15/src/lua/internal/sysbench.cmdline.lua --- old/sysbench-1.0.14/src/lua/internal/sysbench.cmdline.lua 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/src/lua/internal/sysbench.cmdline.lua 2018-07-03 21:49:50.000000000 +0200 @@ -1,4 +1,4 @@ --- Copyright (C) 2017 Alexey Kopytov <[email protected]> +-- Copyright (C) 2017-2018 Alexey Kopytov <[email protected]> -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -72,6 +72,40 @@ table = sysbench.cmdline.ARG_LIST } +local function __genOrderedIndex( t ) + local orderedIndex = {} + for key in pairs(t) do + table.insert( orderedIndex, key ) + end + table.sort( orderedIndex ) + return orderedIndex +end + +local function orderedNext(t, state) + local key = nil + if state == nil then + t.__orderedIndex = __genOrderedIndex( t ) + key = t.__orderedIndex[1] + else + for i = 1,table.getn(t.__orderedIndex) do + if t.__orderedIndex[i] == state then + key = t.__orderedIndex[i+1] + end + end + end + + if key then + return key, t[key] + end + + t.__orderedIndex = nil + return +end + +local function orderedPairs(t) + return orderedNext, t, nil +end + -- Parse command line options definitions, if present in the script as a -- 'sysbench.cmdline.options' table. If no such table exists, or if there a -- parsing error, return false. Return true on success. After parsing the @@ -93,7 +127,7 @@ local args = ffi.new('sb_arg_t[?]', i) i = 0 - for name, def in pairs(sysbench.cmdline.options) do + for name, def in orderedPairs(sysbench.cmdline.options) do -- name assert(type(name) == "string" and type(def) == "table", "wrong table structure in sysbench.cmdline.options") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/src/sb_options.c new/sysbench-1.0.15/src/sb_options.c --- old/sysbench-1.0.14/src/sb_options.c 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/src/sb_options.c 2018-07-03 21:49:50.000000000 +0200 @@ -1,5 +1,5 @@ /* Copyright (C) 2004 MySQL AB - Copyright (C) 2004-2015 Alexey Kopytov <[email protected]> + Copyright (C) 2004-2018 Alexey Kopytov <[email protected]> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -144,11 +144,19 @@ if (type != SB_ARG_TYPE_BOOL && (value == NULL || value[0] == '\0')) return opt; - + switch (type) { case SB_ARG_TYPE_BOOL: - if (value == NULL || !strcmp(value, "on")) + if (value == NULL || !strcmp(value, "on") || + !strcmp(value, "true") || !strcmp(value, "1")) + { add_value(&opt->values, "on"); + } + else if (strcmp(value, "off") && strcmp(value, "false") && + strcmp(value, "0")) + { + return NULL; + } break; case SB_ARG_TYPE_INT: case SB_ARG_TYPE_SIZE: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/src/sysbench.c new/sysbench-1.0.15/src/sysbench.c --- old/sysbench-1.0.14/src/sysbench.c 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/src/sysbench.c 2018-07-03 21:49:50.000000000 +0200 @@ -687,7 +687,7 @@ /* Check if we have a time limit */ if (sb_globals.max_time_ns > 0 && - sb_timer_value(&sb_exec_timer) >= sb_globals.max_time_ns) + SB_UNLIKELY(sb_timer_value(&sb_exec_timer) >= sb_globals.max_time_ns)) { log_text(LOG_INFO, "Time limit exceeded, exiting..."); return false; @@ -695,8 +695,12 @@ /* Check if we have a limit on the number of events */ if (sb_globals.max_events > 0 && - ck_pr_faa_64(&sb_globals.nevents, 1) >= sb_globals.max_events) + SB_UNLIKELY(ck_pr_faa_64(&sb_globals.nevents, 1) >= + sb_globals.max_events)) + { + log_text(LOG_INFO, "Event limit exceeded, exiting..."); return false; + } /* If we are in tx_rate mode, we take events from queue */ if (sb_globals.tx_rate > 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/src/tests/fileio/sb_fileio.c new/sysbench-1.0.15/src/tests/fileio/sb_fileio.c --- old/sysbench-1.0.14/src/tests/fileio/sb_fileio.c 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/src/tests/fileio/sb_fileio.c 2018-07-03 21:49:50.000000000 +0200 @@ -172,7 +172,6 @@ static long long position; /* current position in file */ static unsigned int current_file; /* current file */ static unsigned int fsynced_file; /* file number to be fsynced (periodic) */ -static unsigned int fsynced_file2; /* fsyncing in the end */ static int is_dirty; /* any writes after last fsync series ? */ static int read_ops; @@ -199,9 +198,6 @@ /* test mode type */ static file_test_mode_t test_mode; -/* Limit on the number of events */ -static uint64_t max_events; - /* Previous request needed for validation */ static sb_file_request_t prev_req; @@ -247,9 +243,7 @@ static int file_prepare(void); static sb_event_t file_next_event(int thread_id); static int file_execute_event(sb_event_t *, int); -#ifdef HAVE_LIBAIO static int file_thread_done(int); -#endif static int file_done(void); static void file_report_intermediate(sb_stat_t *); static void file_report_cumulative(sb_stat_t *); @@ -266,11 +260,7 @@ .execute_event = file_execute_event, .report_intermediate = file_report_intermediate, .report_cumulative = file_report_cumulative, -#ifdef HAVE_LIBAIO .thread_done = file_thread_done, -#else - .thread_done = NULL, -#endif .done = file_done }, .builtin_cmds = { @@ -295,6 +285,7 @@ static int file_validate_buffer(unsigned char *, unsigned int, size_t); /* File operation wrappers */ +static int file_do_fsync(unsigned int, int); static int file_fsync(unsigned int, int); static ssize_t file_pread(unsigned int, void *, ssize_t, long long, int); static ssize_t file_pwrite(unsigned int, void *, ssize_t, long long, int); @@ -343,10 +334,6 @@ init_vars(); clear_stats(); - /* Use our own limit on the number of events */ - max_events = sb_globals.max_events; - sb_globals.max_events = 0; - return 0; } @@ -473,26 +460,6 @@ else file_req->operation = FILE_OP_TYPE_READ; - /* Do final fsync on all files and quit if we are done */ - if (max_events > 0 && req_performed >= max_events) - { - /* no fsync for reads */ - if (file_fsync_end && file_req->operation == FILE_OP_TYPE_WRITE && - fsynced_file2 < num_files) - { - file_req->file_id = fsynced_file2; - file_req->pos = 0; - file_req->size = 0; - file_req->operation = FILE_OP_TYPE_FSYNC; - fsynced_file2++; - } - else - sb_req.type = SB_REQ_TYPE_NULL; - - SB_THREAD_MUTEX_UNLOCK(); - return sb_req; - } - /* See whether it's time to fsync file(s) */ if (file_fsync_freq != 0 && file_req->operation == FILE_OP_TYPE_WRITE && is_dirty && req_performed % file_fsync_freq == 0) @@ -557,7 +524,6 @@ sb_event_t sb_req; sb_file_request_t *file_req = &sb_req.u.file_request; unsigned long long tmppos; - int real_mode = test_mode; int mode = test_mode; unsigned int i; @@ -576,31 +542,6 @@ mode=MODE_RND_WRITE; } - /* fsync all files (if requested by user) as soon as we are done */ - if (max_events > 0 && req_performed >= max_events) - { - if (file_fsync_end != 0 && - (real_mode == MODE_RND_WRITE || real_mode == MODE_RND_RW || - real_mode == MODE_MIXED)) - { - if(fsynced_file2 < num_files) - { - file_req->file_id = fsynced_file2; - file_req->operation = FILE_OP_TYPE_FSYNC; - file_req->pos = 0; - file_req->size = 0; - fsynced_file2++; - - SB_THREAD_MUTEX_UNLOCK(); - return sb_req; - } - } - sb_req.type = SB_REQ_TYPE_NULL; - - SB_THREAD_MUTEX_UNLOCK(); - return sb_req; - } - /* is_dirty is only set if writes are done and cleared after all files are synced @@ -715,18 +656,8 @@ } /* Check if we have to fsync each write operation */ - if (file_fsync_all) - { - if (file_fsync(file_req->file_id, thread_id)) - { - log_errno(LOG_FATAL, "Failed to fsync file! file: " FD_FMT, fd); + if (file_fsync_all && file_fsync(file_req->file_id, thread_id)) return 1; - } - - SB_THREAD_MUTEX_LOCK(); - other_ops++; - SB_THREAD_MUTEX_UNLOCK(); - } /* In async mode stats will me updated on AIO requests completion */ if (file_io_mode != FILE_IO_MODE_ASYNC) @@ -773,21 +704,9 @@ if (file_fsync_all) break; if(file_fsync(file_req->file_id, thread_id)) - { - log_errno(LOG_FATAL, "Failed to fsync file! id: %u fd: " FD_FMT, - file_req->file_id, fd); return 1; - } - /* In async mode stats will me updated on AIO requests completion */ - if(file_io_mode != FILE_IO_MODE_ASYNC) - { - SB_THREAD_MUTEX_LOCK(); - other_ops++; - SB_THREAD_MUTEX_UNLOCK(); - } - - break; + break; default: log_text(LOG_FATAL, "Execute of UNKNOWN file request type called (%d)!, " "aborting", file_req->operation); @@ -830,7 +749,7 @@ case MODE_RND_READ: case MODE_RND_RW: log_text(LOG_NOTICE, "Number of IO requests: %" PRIu64, - max_events); + sb_globals.max_events); log_text(LOG_NOTICE, "Read/Write ratio for combined random IO test: %2.2f", file_rw_ratio); @@ -1182,7 +1101,6 @@ position = 0; /* position in file */ current_file = 0; fsynced_file = 0; /* for counting file to be fsynced */ - fsynced_file2 = 0; req_performed = 0; is_dirty = 0; if (sb_globals.validate) @@ -1206,6 +1124,29 @@ last_bytes_written = 0; } +/* + Before the benchmark is stopped, issue fsync() if --file-fsync-end is used, + and wait for all async operations to complete. +*/ + +int file_thread_done(int thread_id) +{ + if (file_fsync_end && test_mode != MODE_READ && test_mode != MODE_RND_READ) + { + for (unsigned i = 0; i < num_files; i++) + { + if(file_fsync(i, thread_id)) + return 1; + } + } + +#ifdef HAVE_LIBAIO + if (file_io_mode == FILE_IO_MODE_ASYNC && aio_ctxts[thread_id].nrequests > 0) + return file_wait(thread_id, aio_ctxts[thread_id].nrequests); +#endif + + return 0; +} #ifdef HAVE_LIBAIO /* Allocate async contexts pool */ @@ -1269,18 +1210,6 @@ return 0; } - -/* Wait for all async operations to complete before the end of the test */ - - -int file_thread_done(int thread_id) -{ - if (file_io_mode == FILE_IO_MODE_ASYNC && aio_ctxts[thread_id].nrequests > 0) - return file_wait(thread_id, aio_ctxts[thread_id].nrequests); - - return 0; -} - /* Submit async I/O requests until the length of request queue exceeds the limit. Then wait for at least one request to complete and proceed. @@ -1492,9 +1421,9 @@ } #endif /* HAVE_MMAP */ -int file_fsync(unsigned int file_id, int thread_id) +int file_do_fsync(unsigned int id, int thread_id) { - FILE_DESCRIPTOR fd = files[file_id]; + FILE_DESCRIPTOR fd = files[id]; #ifdef HAVE_LIBAIO struct iocb iocb; #else @@ -1547,9 +1476,9 @@ else if (file_io_mode == FILE_IO_MODE_MMAP) { #ifndef _WIN32 - return msync(mmaps[file_id], file_size, MS_SYNC | MS_INVALIDATE); + return msync(mmaps[id], file_size, MS_SYNC | MS_INVALIDATE); #else - return !FlushViewOfFile(mmaps[file_id], (size_t)file_size); + return !FlushViewOfFile(mmaps[id], (size_t) file_size); #endif } #endif @@ -1557,6 +1486,23 @@ return 1; /* Unknown I/O mode */ } + +int file_fsync(unsigned int id, int thread_id) +{ + if (file_do_fsync(id, thread_id)) + { + log_errno(LOG_FATAL, "Failed to fsync file! file: " FD_FMT, files[id]); + return 1; + } + + SB_THREAD_MUTEX_LOCK(); + other_ops++; + SB_THREAD_MUTEX_UNLOCK(); + + return 0; +} + + #ifdef _WIN32 ssize_t pread(HANDLE hFile, void *buf, ssize_t count, long long offset) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/tests/include/api_sql_common.sh new/sysbench-1.0.15/tests/include/api_sql_common.sh --- old/sysbench-1.0.14/tests/include/api_sql_common.sh 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/tests/include/api_sql_common.sh 2018-07-03 21:49:50.000000000 +0200 @@ -141,7 +141,11 @@ print(m) end EOF -sysbench $SB_ARGS --mysql-host="non-existing" --pgsql-host="non-existing" run +# Reset --mysql-socket if it's specified on the command line, otherwise sysbench +# will assume --mysql-host=localhost +sysbench $SB_ARGS --mysql-host="non-existing" --pgsql-host="non-existing" \ + --mysql-socket= \ + run # Error hooks cat >$CRAMTMP/api_sql.lua <<EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/tests/t/cmdline.t new/sysbench-1.0.15/tests/t/cmdline.t --- old/sysbench-1.0.14/tests/t/cmdline.t 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/tests/t/cmdline.t 2018-07-03 21:49:50.000000000 +0200 @@ -168,20 +168,20 @@ function help() Available options: - --dash-opt=STRING dash-opt desc [dash-opt val] - --str_opt1=STRING str_opt1 description + --bool_opt1[=on|off] bool_opt1 description [off] + --bool_opt2[=on|off] bool_opt2 description [on] --bool_opt3[=on|off] bool_opt3 description + --dash-opt=STRING dash-opt desc [dash-opt val] + --float_opt1=N float_opt1 description [3.14] + --float_opt2=N float_opt2 description [0.2] + --int_opt1=N int_opt1 description [10] --int_opt2=N int_opt2 description + --int_opt3=N int_opt3 description [20] + --list_opt1=[LIST,...] list_opt1 description [foo,bar] --list_opt2=[LIST,...] list_opt2 description - --float_opt2=N float_opt2 description [0.2] + --str_opt1=STRING str_opt1 description --str_opt2=STRING str_opt2 description [opt2] - --list_opt1=[LIST,...] list_opt1 description [foo,bar] --str_opt3=STRING str_opt3 description [opt3] - --int_opt3=N int_opt3 description [20] - --bool_opt1[=on|off] bool_opt1 description [off] - --float_opt1=N float_opt1 description [3.14] - --bool_opt2[=on|off] bool_opt2 description [on] - --int_opt1=N int_opt1 description [10] opt2 @@ -488,3 +488,36 @@ cmdline_module loaded FATAL: */cmdline_module.lua:5: test error (glob) [1] + +########################################################################## +# Test boolean option validation +########################################################################## + $ cat > cmdline.lua <<EOF + > sysbench.cmdline.options = { + > bool_opt = {"Flag", false} + > } + > + > function prepare() + > print("bool_opt = " .. tostring(sysbench.opt.bool_opt)) + > end + > EOF + + $ SB_ARGS=--verbosity=0 + $ sysbench $SB_ARGS cmdline.lua --bool-opt=on prepare + bool_opt = true + $ sysbench $SB_ARGS cmdline.lua --bool-opt=off prepare + bool_opt = false + $ sysbench $SB_ARGS cmdline.lua --bool-opt=true prepare + bool_opt = true + $ sysbench $SB_ARGS cmdline.lua --bool-opt=false prepare + bool_opt = false + $ sysbench $SB_ARGS cmdline.lua --bool-opt=1 prepare + bool_opt = true + $ sysbench $SB_ARGS cmdline.lua --bool-opt=0 prepare + bool_opt = false + $ sysbench $SB_ARGS cmdline.lua --bool-opt=5 prepare + invalid option: --bool-opt=5 + [1] + $ sysbench $SB_ARGS cmdline.lua --bool-opt=foo prepare + invalid option: --bool-opt=foo + [1] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/tests/t/help_drv_mysql.t new/sysbench-1.0.15/tests/t/help_drv_mysql.t --- old/sysbench-1.0.14/tests/t/help_drv_mysql.t 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/tests/t/help_drv_mysql.t 2018-07-03 21:49:50.000000000 +0200 @@ -5,6 +5,9 @@ > exit 80 > fi + $ sysbench --help | grep -- '--db-driver' + --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) [mysql] + $ sysbench --help | sed -n '/mysql options:/,/^$/p' mysql options: --mysql-host=[LIST,...] MySQL server host [localhost] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/tests/t/opt_help.t new/sysbench-1.0.15/tests/t/opt_help.t --- old/sysbench-1.0.14/tests/t/opt_help.t 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/tests/t/opt_help.t 2018-07-03 21:49:50.000000000 +0200 @@ -46,7 +46,7 @@ General database options: - --db-driver=STRING specifies database driver to use ('help' to get list of available drivers) + --db-driver=STRING specifies database driver to use \('help' to get list of available drivers\)( \[mysql\])? (re) --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto] --db-debug[=on|off] print database-specific debug information [off] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/tests/t/script_oltp_help.t new/sysbench-1.0.15/tests/t/script_oltp_help.t --- old/sysbench-1.0.14/tests/t/script_oltp_help.t 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/tests/t/script_oltp_help.t 2018-07-03 21:49:50.000000000 +0200 @@ -6,22 +6,22 @@ sysbench * (glob) oltp_read_write.lua options: - --distinct_ranges=N Number of SELECT DISTINCT queries per transaction [1] - --sum_ranges=N Number of SELECT SUM() queries per transaction [1] - --skip_trx[=on|off] Don't start explicit transactions and execute all queries in the AUTOCOMMIT mode [off] - --secondary[=on|off] Use a secondary index in place of the PRIMARY KEY [off] - --create_secondary[=on|off] Create a secondary index in addition to the PRIMARY KEY [on] - --index_updates=N Number of UPDATE index queries per transaction [1] - --range_size=N Range size for range SELECT queries [100] --auto_inc[=on|off] Use AUTO_INCREMENT column as Primary Key (for MySQL), or its alternatives in other DBMS. When disabled, use client-generated IDs [on] + --create_secondary[=on|off] Create a secondary index in addition to the PRIMARY KEY [on] --delete_inserts=N Number of DELETE/INSERT combinations per transaction [1] - --tables=N Number of tables [1] + --distinct_ranges=N Number of SELECT DISTINCT queries per transaction [1] + --index_updates=N Number of UPDATE index queries per transaction [1] --mysql_storage_engine=STRING Storage engine, if MySQL is used [innodb] --non_index_updates=N Number of UPDATE non-index queries per transaction [1] - --table_size=N Number of rows per table [10000] - --pgsql_variant=STRING Use this PostgreSQL variant when running with the PostgreSQL driver. The only currently supported variant is 'redshift'. When enabled, create_secondary is automatically disabled, and delete_inserts is set to 0 - --simple_ranges=N Number of simple range SELECT queries per transaction [1] --order_ranges=N Number of SELECT ORDER BY queries per transaction [1] - --range_selects[=on|off] Enable/disable all range SELECT queries [on] + --pgsql_variant=STRING Use this PostgreSQL variant when running with the PostgreSQL driver. The only currently supported variant is 'redshift'. When enabled, create_secondary is automatically disabled, and delete_inserts is set to 0 --point_selects=N Number of point SELECT queries per transaction [10] + --range_selects[=on|off] Enable/disable all range SELECT queries [on] + --range_size=N Range size for range SELECT queries [100] + --secondary[=on|off] Use a secondary index in place of the PRIMARY KEY [off] + --simple_ranges=N Number of simple range SELECT queries per transaction [1] + --skip_trx[=on|off] Don't start explicit transactions and execute all queries in the AUTOCOMMIT mode [off] + --sum_ranges=N Number of SELECT SUM() queries per transaction [1] + --table_size=N Number of rows per table [10000] + --tables=N Number of tables [1] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sysbench-1.0.14/tests/t/test_fileio.t new/sysbench-1.0.15/tests/t/test_fileio.t --- old/sysbench-1.0.14/tests/t/test_fileio.t 2018-04-01 13:51:12.000000000 +0200 +++ new/sysbench-1.0.15/tests/t/test_fileio.t 2018-07-03 21:49:50.000000000 +0200 @@ -68,7 +68,7 @@ General statistics: total time: *.*s (glob) - total number of events: 158 + total number of events: 150 Latency (ms): min: *.* (glob) @@ -78,7 +78,7 @@ sum: *.* (glob) Threads fairness: - events (avg/stddev): 158.0000/0.00 + events (avg/stddev): 150.0000/0.00 execution time (avg/stddev): *.*/0.00 (glob) $ sysbench $fileio_args --events=150 --file-test-mode=rndrd run @@ -209,7 +209,7 @@ General statistics: total time: *.*s (glob) - total number of events: 158 + total number of events: 150 Latency (ms): min: *.* (glob) @@ -219,7 +219,7 @@ sum: *.* (glob) Threads fairness: - events (avg/stddev): 158.0000/0.00 + events (avg/stddev): 150.0000/0.00 execution time (avg/stddev): *.*/0.00 (glob) @@ -318,3 +318,114 @@ sysbench * (glob) Removing test files... + +######################################################################## +GH-229: "--file-fsync-freq=0" seems to prevent fsync() at end of test +######################################################################## + $ args="fileio --file-total-size=160K --file-num=10 --file-test-mode=seqwr" + $ args="$args --file-fsync-freq=0 --file-fsync-end=1" + $ args="$args --events=0 --time=1" + $ sysbench $args prepare + sysbench * (glob) + + 10 files, 16Kb each, 0Mb total + Creating files for the test... + Extra file open flags: (none) + Creating file test_file.0 + Creating file test_file.1 + Creating file test_file.2 + Creating file test_file.3 + Creating file test_file.4 + Creating file test_file.5 + Creating file test_file.6 + Creating file test_file.7 + Creating file test_file.8 + Creating file test_file.9 + 163840 bytes written in * seconds (* MiB/sec). (glob) + $ sysbench $args run + sysbench * (glob) + + Running the test with following options: + Number of threads: 1 + Initializing random number generator from current time + + + Extra file open flags: (none) + 10 files, 16KiB each + 160KiB total file size + Block size 16KiB + Calling fsync() at the end of test, Enabled. + Using synchronous I/O mode + Doing sequential write (creation) test + Initializing worker threads... + + Threads started! + + + File operations: + reads/s: 0.00 + writes/s: [^0].* (re) + fsyncs/s: [^0].* (re) + + Throughput: + read, MiB/s: 0.00 + written, MiB/s: [^0].* (re) + + General statistics: + total time: [^0].*s (re) + total number of events: [^0].* (re) + + Latency (ms): + min: *.* (glob) + avg: *.* (glob) + max: *.* (glob) + 95th percentile: *.* (glob) + sum: *.* (glob) + + Threads fairness: + events (avg/stddev): *.*/0.00 (glob) + execution time (avg/stddev): *.*/0.00 (glob) + + $ sysbench $args --file-fsync-end=off run + sysbench * (glob) + + Running the test with following options: + Number of threads: 1 + Initializing random number generator from current time + + + Extra file open flags: (none) + 10 files, 16KiB each + 160KiB total file size + Block size 16KiB + Using synchronous I/O mode + Doing sequential write (creation) test + Initializing worker threads... + + Threads started! + + + File operations: + reads/s: 0.00 + writes/s: [^0].* (re) + fsyncs/s: 0.00 + + Throughput: + read, MiB/s: 0.00 + written, MiB/s: [^0].* (re) + + General statistics: + total time: [^0].*s (re) + total number of events: [^0].* (re) + + Latency (ms): + min: *.* (glob) + avg: *.* (glob) + max: *.* (glob) + 95th percentile: *.* (glob) + sum: *.* (glob) + + Threads fairness: + events (avg/stddev): *.*/0.00 (glob) + execution time (avg/stddev): *.*/0.00 (glob) +
