[MDEV-10665] Json_writer produces extra members in output Created: 2016-08-25  Updated: 2016-08-25  Resolved: 2016-08-25

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.1
Fix Version/s: 10.1.17

Type: Bug Priority: Trivial
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None


 Description   

There is a bug in the JSON pretty-printer:

   "tree": {
    "merges": [
      {
        "index_merge": {
          "tree": {
            "ranges": ["c1(1)0"]
          },
          "tree": {
            "ranges": ["c2(1)1"]
          }
        }
      },
      "ranges": "c2(1)1",  <--- this member was not intended to be printed
      {
        "index_merge": {
          "tree": {
            "ranges": ["c1(1)2"]
          },
          "tree": {
            "ranges": ["c2(1)3"]
          }
        }
      }
    ]
  }

As far as I know, there is no way to observe the bug for a user.
Json_writer is only used to produce ANALYZE|EXPLAIN FORMAT=JSON output. These documents have particular structure, and it doesn't allow to hit a bug.

I've hit the bug by using Json_writer from extra debugging code.



 Comments   
Comment by Sergei Petrunia [ 2016-08-25 ]

The debug diff that was used to create a problematic JSON output:
https://gist.github.com/spetrunia/445e6ffdddfe4621c15212ce8a8126fb

Generated at Thu Feb 08 07:43:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.