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

wt stat confusion for "number of key/value pairs"

    Details

    • Type: Task
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.5.2
    • Labels:

      Description

      After creating a btree with 279 entries, wt dump shows 279 entries, and wt stat reports 281 for btree: number of key/value pairs. The difference arises because entries in internal pages that point to subordinate pages are counted in this statistic. The btree for this case looks like this:

             |
        Internal page
         /        \
      Leaf       Leaf
      

      We show:

        btree: number of key/value pairs=281
        btree: row-store internal pages=1
        btree: row-store leaf pages=2
      

      To get the "right" answer in a row store with current stat output, one needs to calculate: E - I - L + 1, where:

      E  == btree: number of key/value pairs
      I  == btree: row-store internal pages
      L  == btree: row-store leaf pages
      

      Or are there more factors to consider to get an accurate view? At any rate, this seems confusing and makes it harder to use wt stat as a quick diagnostic tool. It came up as part of SUPPORT-1248.

        Issue Links

          Activity

          Hide
          sueloverso Sue Loverso added a comment -

          Thanks for this issue Don because I read Dan's edited entry in that ticket last night and was in the middle of composing email to ask what was going on there because it bugged me because I thought it was accurate and may have misled them earlier. Thanks for figuring that out! I think that this situation is going to be common. Looking at tables in a copied database directory, quick-turnaround debugging situation.

          However, your calculation is off somewhere, E + I + L - 1 gives me 281 + 1 + 2 - 1 = 283.

          Show
          sueloverso Sue Loverso added a comment - Thanks for this issue Don because I read Dan's edited entry in that ticket last night and was in the middle of composing email to ask what was going on there because it bugged me because I thought it was accurate and may have misled them earlier. Thanks for figuring that out! I think that this situation is going to be common. Looking at tables in a copied database directory, quick-turnaround debugging situation. However, your calculation is off somewhere, E + I + L - 1 gives me 281 + 1 + 2 - 1 = 283.
          Hide
          ddanderson Don Anderson (Inactive) added a comment -

          Oops. I think E - I - L + 1. Each pointer to a leaf page is double counted, Each pointer to a internal page is double counted. One (the head node) is not double counted.

          Show
          ddanderson Don Anderson (Inactive) added a comment - Oops. I think E - I - L + 1. Each pointer to a leaf page is double counted, Each pointer to a internal page is double counted. One (the head node) is not double counted.
          Hide
          ddanderson Don Anderson (Inactive) added a comment -

          Closed by merge of WT-1752.

          Show
          ddanderson Don Anderson (Inactive) added a comment - Closed by merge of WT-1752 .
          Hide
          ramon.fernandez Ramon Fernandez added a comment -

          Additional ticket information from GitHub

          This ticket was referenced in the following commits:
          Show
          ramon.fernandez Ramon Fernandez added a comment - Additional ticket information from GitHub This ticket was referenced in the following commits: df05a6ec71ff1f4fedd8045d7c735f8ef828fdf8 a1c9f8f8833482c9773fc30b7b9a7b5f1ab09014

            People

            • Assignee:
              donald.anderson Donald Anderson
              Reporter:
              donald.anderson Donald Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: