Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Owers with derefType Pointers should be classified as Pointers? #14

Open
qqiangwu opened this issue Jan 28, 2024 · 1 comment
Open

Owers with derefType Pointers should be classified as Pointers? #14

qqiangwu opened this issue Jan 28, 2024 · 1 comment
Labels
features new features working in progress lifetime-category Category related issues

Comments

@qqiangwu
Copy link
Owner

@qqiangwu qqiangwu added lifetime-category Category related issues features new features working in progress labels Jan 28, 2024
@qqiangwu
Copy link
Owner Author

ColumnFamilyData* DBImpl::PickCompactionFromQueue(
    std::unique_ptr<TaskLimiterToken>* token, LogBuffer* log_buffer) {
  assert(!compaction_queue_.empty());
  assert(*token == nullptr);
  autovector<ColumnFamilyData*> throttled_candidates;
  ColumnFamilyData* cfd = nullptr;
  while (!compaction_queue_.empty()) {
    // pset(compaction_queue_) = {*this}
    // pset(compaction_queue_.begin()) = {*this}
    // pset(*compaction_queue_.begin()) = {**this}
    auto first_cfd = *compaction_queue_.begin();
    compaction_queue_.pop_front();
    assert(first_cfd->queued_for_compaction());

    // RequestCompactionToken is a non-const member function so `first_cfd` is invalidated
    if (!RequestCompactionToken(first_cfd, false, token, log_buffer)) {
      // pset(first_cfd) = {invalid}
      throttled_candidates.push_back(first_cfd);
      continue;
    }
    cfd = first_cfd;
    cfd->set_queued_for_compaction(false);
    break;
  }
  // Add throttled compaction candidates back to queue in the original order.
  for (auto iter = throttled_candidates.rbegin();
       iter != throttled_candidates.rend(); ++iter) {
    compaction_queue_.push_front(*iter);
  }
  return cfd;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features new features working in progress lifetime-category Category related issues
Projects
None yet
Development

No branches or pull requests

1 participant