Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-9270

Ideas to improve the code style/flexibility of the cpp suite

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • StorEng - Refinement Pipeline

      Summary
      We could improve the code style of the cpp suite. This ticket lists some of the ideas we have so far:

      • Align coding style with MongoDB server and the S3 extension
      • Instead of having the framework to generate the values when one performs inserts/updates, we should let the users provide the values - WT-9314
      • Use smart pointers and RAII wherever possible
      • Make sure each class definition is in its own file. WT-9383
      • Rename functions/variables (such as save_operation) where it makes sense. WT-9387
      • The collections defined in each test only support strings for their keys and values, allow them to handle all types supported by WiredTiger
        • This could be done in a similar fashion as we did for the tracking table (WT-9091): pass a cursor with the key/value pair already set to the internal CRUD operations defined in the thread_context class.
      • Identify and remove cases of code duplication, boilerplate.
        • The thread context class is a good start where we do the same thing for each operation
      • Simplify the interface of set_tracking_cursor. Preferably just pass in a single argument such as a thread_context. WT-9388
      • Functions like update_operation don't capture the entire lifetime of transactions, instead the contain logic at the start of the function that will optionally start a txn if we're not already in one. Could this be changed to start/stop transactions at the start of each function, or have the transaction reliably started/stopped in the parent function so that we always know when a txn starts and stops?
      • Use Doxygen on the cpp suite
      • Review string handling in cppsuite. For example thread_context::pad_string could use stringstreams in place of manual string construction.
      • It does not make sense to haveĀ key_size or value_size equal to 0, set the minimum value to 1 in test_data.py - might be fixed as part of WT-9094
      • The function can_rollback() does not seem to be implemented correctly and might be removed. To roll back, we should only check if there is an active transaction.
      • In WT-9094, we created the function init_tracking in test.h in order to update everything that has a reference to the tracking component when this one is updated. A better way of doing this (e.g via constructors) should be investigated.
      • Clean up overloaded functions in the CppSuite - WT-9333
      • Users modify config files in the test/ folder and then need to compile WT to propagate those changes to the build/ folder where they are used by cppsuite. This means users need to remember to compile for each config change. Creating a symlink instead of copying the file may work, but we need to check this is possible for both Unix and non-Unix platforms.
      • Avoid using WT internal macros like WT_DECL_RET in the cppsuite test code. The test code should only touch the public API WT-11793

      Motivation

      • Does this affect any team outside of WT?
        No
      • Is this issue urgent?
        No

      Acceptance Criteria
      Address all the ideas listed above.

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: