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

Randomise read logic in the cppsuite

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

      Summary
      In order to vary the interaction with the database in the default read operation defined in the cppsuite in the database_operation class, we could randomise which key a thread reads.

      Currently, each thread positions a cursor at the start of the collection and reads it, key after key, until the transaction is completed and resets the cursor.

      Instead, we could position the cursor on a random key and start reading.

      Motivation

      • Is this issue urgent?
        It is great to vary the interactions with a database.

      Acceptance Criteria (Definition of Done)

      • Testing
        Make sure the reads start at random positions.
      • Documentation update
        There should be none.

      Suggested Solution
      It might be as simple as passing the random cursor configuration when creating the cursor:

      diff --git a/test/cppsuite/src/main/database_operation.cpp b/test/cppsuite/src/main/database_operation.cpp
      index 089eeb0ae..c4b240b7b 100644
      --- a/test/cppsuite/src/main/database_operation.cpp
      +++ b/test/cppsuite/src/main/database_operation.cpp
      @@ -231,7 +231,8 @@ database_operation::read_operation(thread_worker *tc)
               collection &coll = tc->db.get_random_collection();
       
               if (cursors.find(coll.id) == cursors.end())
      -            cursors.emplace(coll.id, std::move(tc->session.open_scoped_cursor(coll.name)));
      +            cursors.emplace(
      +              coll.id, std::move(tc->session.open_scoped_cursor(coll.name, "next_random=true")));
      

            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:
            1 Start watching this issue

              Created:
              Updated: