[SERVER-74974] Add logging facility for int128 Created: 17/Mar/23  Updated: 11/Jan/24  Resolved: 11/Jan/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Matt Kneiser Assignee: Gavin Peters
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-12-25, Execution Team 2024-01-08, Execution Team 2024-01-22
Participants:

 Description   

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 



 Comments   
Comment by Githook User [ 05/Jan/24 ]

Author:

{'name': 'Gavin Peters', 'email': 'gavin@ytz.ca', 'username': 'gavinp'}

Message: SERVER-74974 adding logger for int128 types (#17856)

GitOrigin-RevId: a1e836333d923d499c5c824d48b07f3d42ba3d00
Branch: master
https://github.com/mongodb/mongo/commit/90e8fe6194c9530aa81e19cc32abb601128b67f1

Generated at Thu Feb 08 06:29:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.