@@ -232,11 +232,12 @@ IntentAwareIterator::IntentAwareIterator(
232232}
233233
234234void IntentAwareIterator::Seek (const dockv::DocKey &doc_key) {
235- Seek (doc_key.Encode (), Full::kFalse );
235+ Seek (doc_key.Encode (), SeekFilter:: kAll , Full::kFalse );
236236}
237237
238- void IntentAwareIterator::Seek (Slice key, Full full) {
239- VLOG_WITH_FUNC (4 ) << " key: " << DebugDumpKeyToStr (key) << " , full: " << full;
238+ void IntentAwareIterator::Seek (Slice key, SeekFilter filter, Full full) {
239+ VLOG_WITH_FUNC (4 )
240+ << " key: " << DebugDumpKeyToStr (key) << " , full: " << full << " , filter: " << filter;
240241 DOCDB_DEBUG_SCOPE_LOG (
241242 key.ToDebugString (),
242243 std::bind (&IntentAwareIterator::DebugDump, this ));
@@ -246,7 +247,17 @@ void IntentAwareIterator::Seek(Slice key, Full full) {
246247
247248 SeekTriggered ();
248249
249- SkipFutureRecords<Direction::kForward >(ROCKSDB_SEEK (&iter_, key));
250+ [&] {
251+ switch (filter) {
252+ case SeekFilter::kAll :
253+ SkipFutureRecords<Direction::kForward >(ROCKSDB_SEEK (&iter_, key));
254+ return ;
255+ case SeekFilter::kIntentsOnly :
256+ regular_entry_.Reset ();
257+ return ;
258+ }
259+ FATAL_INVALID_ENUM_VALUE (SeekFilter, filter);
260+ }();
250261 if (intent_iter_.Initialized ()) {
251262 if (!SetIntentUpperbound ()) {
252263 return ;
@@ -348,7 +359,7 @@ void IntentAwareIterator::SeekPastSubKey(Slice key) {
348359 FillEntry ();
349360}
350361
351- void IntentAwareIterator::SeekOutOfSubDoc (KeyBytes* key_bytes) {
362+ void IntentAwareIterator::SeekOutOfSubDoc (SeekFilter filter, KeyBytes* key_bytes) {
352363 VLOG_WITH_FUNC (4 ) << DebugDumpKeyToStr (*key_bytes);
353364 if (!status_.ok ()) {
354365 return ;
@@ -358,7 +369,17 @@ void IntentAwareIterator::SeekOutOfSubDoc(KeyBytes* key_bytes) {
358369
359370 auto prefix_len = intent_iter_.Initialized ()
360371 ? IntentPrepareSeek (*key_bytes, KeyEntryTypeAsChar::kMaxByte ) : 0 ;
361- SkipFutureRecords<Direction::kForward >(docdb::SeekOutOfSubKey (key_bytes, &iter_));
372+ [&] {
373+ switch (filter) {
374+ case SeekFilter::kAll :
375+ SkipFutureRecords<Direction::kForward >(docdb::SeekOutOfSubKey (key_bytes, &iter_));
376+ return ;
377+ case SeekFilter::kIntentsOnly :
378+ regular_entry_.Reset ();
379+ return ;
380+ }
381+ FATAL_INVALID_ENUM_VALUE (SeekFilter, filter);
382+ }();
362383 IntentSeekForward (prefix_len);
363384 FillEntry ();
364385}
@@ -645,7 +666,7 @@ void IntentAwareIterator::SeekToLatestSubDocKeyInternal() {
645666 return ;
646667 }
647668 subdockey_slice.remove_suffix (1 );
648- Seek (subdockey_slice);
669+ Seek (subdockey_slice, SeekFilter:: kAll );
649670}
650671
651672void IntentAwareIterator::SeekToLatestDocKeyInternal () {
@@ -656,13 +677,23 @@ void IntentAwareIterator::SeekToLatestDocKeyInternal() {
656677 if (!HandleStatus (dockey_size)) {
657678 return ;
658679 }
659- Seek (Slice (subdockey_slice.data (), *dockey_size));
680+ Seek (Slice (subdockey_slice.data (), *dockey_size), SeekFilter:: kAll );
660681}
661682
662- void IntentAwareIterator::Revalidate () {
683+ void IntentAwareIterator::Revalidate (SeekFilter seek_filter ) {
663684 VLOG_WITH_FUNC (4 );
664685
665- SkipFutureRecords<Direction::kForward >(iter_.Entry ());
686+ [&] {
687+ switch (seek_filter) {
688+ case SeekFilter::kAll :
689+ SkipFutureRecords<Direction::kForward >(iter_.Entry ());
690+ return ;
691+ case SeekFilter::kIntentsOnly :
692+ regular_entry_.Reset ();
693+ return ;
694+ }
695+ FATAL_INVALID_ENUM_VALUE (SeekFilter, seek_filter);
696+ }();
666697 if (intent_iter_.Initialized ()) {
667698 if (!SetIntentUpperbound ()) {
668699 return ;
0 commit comments