1. 28 Aug, 2019 25 commits
  2. 26 Jul, 2019 1 commit
    • Ante Kresic's avatar
      Improve Timescale query timing by confirming query completion · 57922da0
      Ante Kresic authored
      When using the `pgx` sql driver, running the query does not wait for a
      response from the server. In order to verify that the query has returned
      complete results, we must run `Rows.Next()` until it returns false
      meaning we have fetched all the rows from the query result. Note that
      this behavior is different than the current implementation of the `pq`
      driver.
      57922da0
  3. 15 Jul, 2019 1 commit
    • Stephen Polcyn's avatar
      Fix argument name · a8aec49d
      Stephen Polcyn authored
      Previously, the -n flag sent its data to the "max-queries" variable, which results in an unknown variable name when running the script because the python variable used to generate the run script is 'limit' (see line 163). "Max-queries" is only applicable as a flag for the tsbs_run_queries script, i.e., "--max-queries=###".
      a8aec49d
  4. 17 Jun, 2019 1 commit
  5. 28 May, 2019 1 commit
    • Blagoj Atanasovski's avatar
      Make statProcessor an interface and create tests for BenchRunner · ad198f45
      Blagoj Atanasovski authored
      The statProcessor responsible for gathering statistics
      when executing queries was built as a struct. This commit
      will change it to an interface to make the BenchmarkRunner code
      more easier to test. This commit also adds some unit tests for
      the benchmark runner that check if proper argument checks are
      done, and if proper init happens when the Run method is called
      ad198f45
  6. 24 May, 2019 1 commit
  7. 22 May, 2019 3 commits
    • Rob Kiefer's avatar
      Rename DevopsGenerator to QueryGenerator · a9858758
      Rob Kiefer authored
      This interface is not tied to the devops use case in any way, so
      its naming was a misnomer. It is actually generic and can be used
      for any use case since, so this renaming reflects that.
      a9858758
    • Rob Kiefer's avatar
      Refactor generate_queries devops case to use errs · ff6e61ab
      Rob Kiefer authored
      Previously the devops use case generation code used a call to
      log.Fatalf when something went wrong. This makes it awkward to test
      error conditions when generating queries from other packages, since
      we need a way to (a) replace the unexported call to log.Fatalf and
      (b) prevent the runtime from actually quitting.
      
      It is better for the library to actually return errors on calls
      that can fail, rather than either fataling or panicking. Now other
      packages can handle the errors themselves and also test error
      conditions in their packages as well.
      
      This refactor was pruned a bit to bubble the 'panic' up one level
      for now. When the actual generation code encounters the error
      during normal execution, it will panic. But these are easier to
      test for and don't require adding hooks to replace the 'fatal'
      path in the original package.
      ff6e61ab
    • Rob Kiefer's avatar
      Combine both TimeInterval types into single type · 3cad7a88
      Rob Kiefer authored
      Query generation and Cassandra's query running both used a type
      called TimeInterval that did roughly the same thing. This change
      combines the two into one type that can be used from the utils
      package in internal/. This improves code reuse and keeps the two
      representations in sync, and also increases the testability of
      the code.
      3cad7a88
  8. 20 May, 2019 1 commit
    • Ante Kresic's avatar
      Add unit tests to increase coverage for query generation · 3cfaae09
      Ante Kresic authored
      For now the tests are mainly matching the output against pre-generated/known
      outputs to ensure we have some coverage. A more robust checking, e.g., making
      sure the semantics of the query are actually correct, is a future task.
      3cfaae09
  9. 25 Apr, 2019 1 commit
    • Lee Hampton's avatar
      Fix parsing columns when --do-create-db=false · 19932e72
      Lee Hampton authored
      This fixes a bug where the PostCreateDB function would exit early when
      the user set --do-create-db=false and/or --create-metrics-table=False.
      This early exit caused TSBS to skip the updating of some global caches,
      which broke assumptions in other parts of the codebase.
      
      This commit also refactors the PostCreateDB function to split the
      parsing of columns and the potential creation of tables and indexes into
      separate functions. This makes it easier to test the functions in
      isolation and cleaner to create the conditional create-table logic that is
      at the heart of this bug.
      
      While this does add tests to the parsing function, the create
      tables/index function remains untested. This is left for a later PR that
      will hopefully clean up global state and provide a more comprehensive
      framework for testing IO.
      19932e72
  10. 18 Apr, 2019 1 commit
    • Rob Kiefer's avatar
      Fix additional tags to work with pgx · addc7918
      Rob Kiefer authored
      Unlike libpq/sqlx, pgx expects JSON/B fields in the copy command to
      be in the 'native' format, which is a map[string]interface{}, not a
      string in valid JSON format. Without this change, the copy would
      fail with "ERROR: unsupported jsonb version number 123".
      addc7918
  11. 09 Apr, 2019 1 commit
    • Rob Kiefer's avatar
      Rewrite tsbs_generate_queries to use internal/inputs · feb417e0
      Rob Kiefer authored
      This PR continues on the work in the previous one that changed
      tsbs_generate_data to use a new internal/inputs package. This PR
      adds a new Generator type for query generation called QueryGenerator.
      
      Now that these two generators share some common code, they both
      become much more robust and easier to test and manage. Previously
      tsbs_generate_queries had no test coverage, but with this change it
      will actually have quite high coverage.
      
      There are still some rough spots with this refactor. In particular,
      how the useCaseMatrix is handled needs some more thought, especially
      if we are going to add more use cases going forward. Additionally,
      the database specific flags like TimescaleUseJSON could probably
      be handled in a cleaner way as well.
      feb417e0
  12. 04 Apr, 2019 1 commit
    • Rob Kiefer's avatar
      Add internal/inputs package and rewrite tsbs_generate_data · b5815287
      Rob Kiefer authored
      For a long time, our two generation binaries -- tsbs_generate_data
      and tsbs_generate_queries -- have shared (roughly) a fair bit of
      code, especially when it comes to flags and validation. However,
      they were never truly in sync and combining them has been a long
      wanted to-do. Similarly, to enable better tooling around TSBS, it
      would be beneficial if more of its functionality was exposed as a
      library instead of a CLI that needs to be called.
      
      To those ends, this PR is a first step in addressing both of them.
      It introduces the internal/inputs package, which can eventually be
      moved to pkg/inputs when we are ready for other things to consume
      its API. This package will contain the structs, interfaces, and
      functions for generating 'input' to other TSBS tools. For now, that
      only includes generating data files (for tsbs_load_* binaries) and
      query files (for tsbs_run_queries_* binaries). This PR starts by
      introducing these building blocks and converting tsbs_generate_data
      to use it.
      
      The idea is that each type of input (e.g., data, queries) is handled
      by a Generator, which is customized by a GeneratorConfig. The config
      contains fields such as the PRNG seed, number of items to generate,
      etc, which are used by the Generator to control the output. These
      GeneratorConfigs come with a means of easily adding their fields
      to a flag.FlagSet, making them work well with CLIs while also not
      restricting their use to only CLIs. Once configured, this
      GeneratorConfig is passed to a Generator, which then produces the
      output.
      
      This design has a few other nice features to help cleanup TSBS.
      One, it uses an approach of bubbling up errors and passing them
      back to the caller, allowing for more graceful error handling. CLIs
      can output them to the console, while other programs using the
      library can pass them to another error handling system if they
      desire. Two, Generators should be designed with an Out field that
      allows the caller to point to any io.Writer it wants -- not
      just the console or a file.
      
      The next step will be to convert tsbs_generate_queries to use this
      as well, which will be done in a follow up PR.
      b5815287
  13. 28 Mar, 2019 1 commit
    • niksa's avatar
      Add binary format support · f07cde40
      niksa authored
      Using binary format when talking to TimescaleDB
      means less data being sent back and forth.
      Config option is added to force TEXT format if needed
      (binary is default). PGX driver is used for
      binary and PQ driver for TEXT. Based on some benchmarks
      binary should increase write throughput by 5-10% and
      result in about 35% faster queries.
      f07cde40
  14. 20 Mar, 2019 1 commit