Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-57492

Side table writes insert more than just the keystring

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.4.0, 5.0.0-rc0
    • 4.4.7, 5.0.0-rc4, 5.1.0-rc0
    • None
    • None
    • Fully Compatible
    • ALL
    • v5.0, v4.4
    • Hide

      diff --git a/src/mongo/db/index/index_build_interceptor.cpp b/src/mongo/db/index/index_build_interceptor.cpp
      index 2e79179df2..c7656c061f 100644
      --- a/src/mongo/db/index/index_build_interceptor.cpp
      +++ b/src/mongo/db/index/index_build_interceptor.cpp
      @@ -469,6 +469,9 @@ Status IndexBuildInterceptor::sideWrite(OperationContext* opCtx,
               builder.reset();
               keyString.serialize(builder);
               BSONBinData binData(builder.buf(), builder.getSize(), BinDataGeneral);
      +        logd("DBG. SideWrite. KeyString Size: {} BinData Size: {}",
      +             keyString.getSize(),
      +             binData.length);
               toInsert.emplace_back(BSON("op" << (op == Op::kInsert ? "i" : "d") << "key" << binData));
           }
       
      

      resmoke run jstests/noPassthrough/hybrid_index_with_updates.js
      ...
      [js_test:hybrid_index_with_updates] d20020| 2021-06-07T09:50:55.731-04:00 I  -        [conn1] DBG. SideWrite. KeyString Size: 6 BinData Size: 512
      

      Show
      diff --git a/src/mongo/db/index/index_build_interceptor.cpp b/src/mongo/db/index/index_build_interceptor.cpp index 2e79179df2..c7656c061f 100644 --- a/src/mongo/db/index/index_build_interceptor.cpp +++ b/src/mongo/db/index/index_build_interceptor.cpp @@ -469,6 +469,9 @@ Status IndexBuildInterceptor::sideWrite(OperationContext* opCtx, builder.reset(); keyString.serialize(builder); BSONBinData binData(builder.buf(), builder.getSize(), BinDataGeneral); + logd("DBG. SideWrite. KeyString Size: {} BinData Size: {}", + keyString.getSize(), + binData.length); toInsert.emplace_back(BSON("op" << (op == Op::kInsert ? "i" : "d") << "key" << binData)); } resmoke run jstests/noPassthrough/hybrid_index_with_updates.js ... [js_test:hybrid_index_with_updates] d20020| 2021-06-07T09:50:55.731-04:00 I - [conn1] DBG. SideWrite. KeyString Size: 6 BinData Size: 512
    • Execution Team 2021-06-28

    Description

      Writes to the side table re-use a BufBuilder to write keystrings to the hybrid index build side-table.

      It seems the BinData value in the side-write gets the a length derived from the capacity of the builders buffer instead of the length. This results in (at best) wasteful resource usage (for example writing out 512 bytes for 5 byte keystrings) and (at worst) a correctness problem due to undefined behavior.

      Attachments

        Issue Links

          Activity

            People

              louis.williams@mongodb.com Louis Williams
              daniel.gottlieb@mongodb.com Daniel Gottlieb
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: