absl raw/flat hash map/set pretty printers don't work for "small mode"

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • ALL
    • SP Prioritized List
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I'm not sure the exact conditions that trigger "small mode" (code reference here though). From looking around, on aarch64 it seems like capacity < 8 is the trigger, but I don't observe that with stdx::unordered_map<int, int>.

      Our pretty printers don't handle this mode, and the code for our absl pretty printers (e.g., absl_get_nodes) is also shared in other pretty printers. This is partially the cause of mongod-dump-sessions not being able to work (at least if there are fewer than 8 sessions).

      This can easily be reproduced by adding a test like this in unordered_map_test.cpp, breaking on the ASSERT_EQ, and then running p pre:

      struct X { int a, b, c, d, e, f, g, h, i; };
      TEST(StdxUnorderedMapTest, SmallMode) {
          const mongo::stdx::unordered_map<int, X> pre{
              {1, {}},
          };
          ASSERT_EQ(pre.size(), 1);
      }
      

      Results look like this:

      (gdb) p pre
      $1 = absl::node_hash_map<int, (anonymous namespace)::X> with 1 elems  = {
        [Cannot access memory at address 0x1
      

            Assignee:
            Unassigned
            Reporter:
            Ryan Berryhill
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: