Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3281

mongo-go-driver - PR #1699: GODRIVER-3090 Optimize logging truncation for large documents

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      timothy-kim-mongo has created PR #1699: GODRIVER-3090 Optimize logging truncation for large documents in mongo-go-driver

      Issue Text:
      GODRIVER-3090(https://jira.mongodb.org/browse/GODRIVER-3090)

        1. Summary

      The goal of this pull request is to optimize the logging truncation process for large documents in the Go Driver. This optimization aims to improve driver performance when handling and truncating large extensive BSON documents and payloads, specifically addressing issues related to logging large documents, which can adversely affect driver performance and can cause resource containment and are critical for maintaining application performance and operational efficiency.

      Key changes introduced include the implementation of a StringN method for bsoncore.Document. This method allows BSON documents to be stringified up to a specified byte limit (N), incorporating precise truncation logic that accounts for multi-byte characters. By leveraging the existing logging truncation algorithm, the method ensures accurate and efficient handling of BSON documents in extended JSON format, thereby maintaining data integrity and aligning with BSON specifications.

      Furthermore, the pull request updates various BSON element string methods (Array.StringN, Value.StringN, etc.) to utilize the new StringN functionality. This ensures consistent and optimized truncation across different BSON element types, such as arrays and nested documents, when exceeding specified byte limits. Comprehensive unit tests and benchmark tests accompany these changes, validating the performance improvements in terms of reduced execution time (ns/op), decreased memory allocations (B/op), and enhanced efficiency in handling large BSON payloads.

      Therefore, this pull request significantly improves driver performance by optimizing BSON document truncation for logging purposes. It addresses scalability challenges and enhances the reliability of the MongoDB Go Driver in handling large BSON payloads, thereby benefiting applications with critical logging and operational needs.

            Assignee:
            qingyang.hu@mongodb.com Qingyang Hu
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: