Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-11841

Make the output of "wt printlog -u" a valid, machine-parsable JSON

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.2.0, 7.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None

      Summary

      The output of wt printlog -u looks like JSON, but it is not actually a valid, machine-parsable JSON document. For example, here is a sample log record for row_put:

            { "optype": "row_put",
              "fileid": 0 0x0,
              "key": "file:table.wt\u0000",
              "value": "(redacted)"
            },
      

      The fileid field is not a valid JSON, as its value is printed twice: first as a regular integer and then as a hex.

       

      Suggested solution

      If we would like to keep the hex output, we can store it in a separate string field:

            { "optype": "row_put",
              "fileid": 0,
              "fileid-hex": "0x0",
              "key": "file:table.wt\u0000",
              "value": "(redacted)"
            },
      

      This would follow our precedent in printing values in hex, which use a separate value-hex field.

      We should be able to do this as a small change to dist/log.py, which generates src/log/log_auto.c. After that, we should look for any more instances of improper JSON.

            Assignee:
            peter.macko@mongodb.com Peter Macko
            Reporter:
            peter.macko@mongodb.com Peter Macko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: