Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2935

shallow woEqual check used for index dup checking

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • ALL

      Dwight noticed this yesterday. We probably want to do woCompare to handle cases like int/double comparison.

      bool BtreeBucket::exists(const IndexDetails& idx, const DiskLoc &thisLoc, const BSONObj& key, const Ordering& order) const {
      int pos;
      bool found;
      DiskLoc b = locate(idx, thisLoc, key, order, pos, found, minDiskLoc);

      // skip unused keys
      while ( 1 )

      { if( b.isNull() ) break; const BtreeBucket *bucket = b.btree(); const _KeyNode& kn = bucket->k(pos); if ( kn.isUsed() ) return bucket->keyAt(pos).woEqual(key); b = bucket->advance(b, pos, 1, "BtreeBucket::exists"); }

      return false;
      }

      bool BtreeBucket::wouldCreateDup(
      const IndexDetails& idx, const DiskLoc &thisLoc,
      const BSONObj& key, const Ordering& order,
      const DiskLoc &self) const {
      int pos;
      bool found;
      DiskLoc b = locate(idx, thisLoc, key, order, pos, found, minDiskLoc);

      while ( !b.isNull() ) {
      // we skip unused keys
      const BtreeBucket *bucket = b.btree();
      const _KeyNode& kn = bucket->k(pos);
      if ( kn.isUsed() )

      { if( bucket->keyAt(pos).woEqual(key) ) return kn.recordLoc != self; break; }

      b = bucket->advance(b, pos, 1, "BtreeBucket::dupCheck");
      }

      return false;
      }

            Assignee:
            dwight@mongodb.com Dwight Merriman
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: