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

Add logging facility for int128

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Storage Execution
    • Fully Compatible
    • Execution Team 2023-12-25, Execution Team 2024-01-08, Execution Team 2024-01-22

      Implement a string version for the int128 type so it can be logged easily.

      Here's the error trace when you try to use an int128 with the LOGV2 macro:

      In file included from src/mongo/logv2/log.h:36:
      In file included from src/mongo/logv2/log_debug.h:36:
      In file included from src/mongo/logv2/log_detail.h:37:
      src/mongo/logv2/attribute_storage.h:286:5: error: static_assert failed due to requirement 'hasToString<absl::int128> || hasToStringReturnStringData<absl::int128> || hasStringSerialize<absl::int128> || hasNonMemberToString<absl::int128> || hasNonMemberToStringReturnStringData<absl::int128> || hasBSONBuilderAppend<absl::int128> || hasBSONSerialize<absl::int128> || hasToBSON<absl::int128> || hasToBSONArray<absl::int128> || hasNonMemberToBSON<absl::int128>' "custom type needs toBSON(), toBSONArray(), serialize(BSONObjBuilder*), toString() or serialize(fmt::memory_buffer&) implementation"
          static_assert(hasToString<T> || hasToStringReturnStringData<T> || hasStringSerialize<T> ||
          ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/mongo/logv2/attribute_storage.h:594:66: note: in instantiation of function template specialization 'mongo::logv2::detail::mapValue<absl::int128, 0>' requested here
          NamedAttribute(const char* n, const T& val) : name(n), value(mapValue(val)) {}
                                                                       ^
      src/mongo/logv2/attribute_storage.h:622:17: note: in instantiation of function template specialization 'mongo::logv2::detail::NamedAttribute::NamedAttribute<absl::int128>' requested here
              : _data{detail::NamedAttribute(args.name, args.value)...} {}
                      ^
      src/mongo/logv2/attribute_storage.h:637:12: note: in instantiation of member function 'mongo::logv2::detail::AttributeStorage<mongo::logv2::detail::NamedArg<absl::int128>>::AttributeStorage' requested here
          return {args...};
                 ^
      src/mongo/logv2/log_detail.h:76:23: note: in instantiation of function template specialization 'mongo::logv2::detail::makeAttributeStorage<mongo::logv2::detail::NamedArg<absl::int128>>' requested here
          auto attributes = makeAttributeStorage(args...);
                            ^
      src/mongo/logv2/log_detail.h:122:38: note: in instantiation of function template specialization 'mongo::logv2::detail::doLogUnpacked<FMT_COMPILE_STRING, absl::int128>' requested here
                         auto&&... args) { doLogUnpacked(id, severity, options, formatMsg, args...); },
                                           ^
      src/mongo/bson/util/bsoncolumn_test.cpp:812:5: note: in instantiation of function template specialization 'mongo::logv2::detail::doLog<FMT_COMPILE_STRING, mongo::logv2::detail::NamedArg<absl::int128>>' requested here 

            Assignee:
            gavin.peters@mongodb.com Gavin Peters (Inactive)
            Reporter:
            matt.kneiser@mongodb.com Matt Kneiser
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: