Uploaded image for project: 'HTrace'
  1. HTrace
  2. HTRACE-307

htraced: queries sometimes return no results even when many results exist due to confusion in iterator usage

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 4.1
    • htraced
    • None
    • 4.1

    Description

      htraced: queries sometimes return no results even when many results exist due to confusion in iterator usage

      When a range query such that greater than or less than is made, sometimes the value we are starting at is greater or less than the value of the relevant field in any span. For example, let's say we have spans with end time 1, and 2, 3 and we do a query for end time < 999. In that case, our leveldb iterator will actually not be in the 'end time index' section, but in the section after that, which happens to be the 'parent id index' section at the moment. And so the following code will trigger and cut off the query results:

        if !bytes.HasPrefix(key, []byte{src.keyPrefix}) {
          if lg.DebugEnabled() {
            lg.Debugf("Can't populate: Iterator for shard %s does not have prefix %s\n",
              shdPath, string(src.keyPrefix))
          }
        }
      

      Of course, this is incorrect... there are 3 results, but we need to move the iterator backwards by one in leveldb to get to the last part of the "end time" index.

      Attachments

        1. HTRACE-307.001.patch
          3 kB
          Colin McCabe

        Activity

          People

            cmccabe Colin McCabe
            cmccabe Colin McCabe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: