void IndexCursor::setPosition(const BSONObj &key, const BSONObj &pk) { TOKULOG(3) << toString() << ": setPosition(): getf " << key << ", pk " << pk << ", direction " << _direction << endl; // Empty row buffer, reset fetch iteration, go get more rows. _buffer.empty(); _getf_iteration = 0; storage::Key sKey( key, !pk.isEmpty() ? &pk : NULL ); DBT key_dbt = sKey.dbt();; int r; const int rows_to_fetch = getf_fetch_count(); struct cursor_getf_extra extra(&_buffer, rows_to_fetch); DBC *cursor = _cursor.dbc(); if ( forward() ) { r = cursor->c_getf_set_range(cursor, getf_flags(), &key_dbt, cursor_getf, &extra); } else { r = cursor->c_getf_set_range_reverse(cursor, getf_flags(), &key_dbt, cursor_getf, &extra); } if ( extra.ex != NULL ) { throw *extra.ex; } if (r == TOKUDB_INTERRUPTED) { _interrupt_extra.throwException(); } if ( r != 0 && r != DB_NOTFOUND ) { extra.throwException(); storage::handle_ydb_error(r); } _getf_iteration++; _ok = extra.rows_fetched > 0 ? true : false; if ( ok() ) { getCurrentFromBuffer(); } TOKULOG(3) << "setPosition hit K, PK, Obj " << _currKey << _currPK << _currObj << endl; }