Skip to content

rgw: modify multisite coroutine stack block - #48626

Merged
cbodley merged 1 commit into
ceph:mainfrom
qiuxinyidian:rgw-coroutine
Dec 9, 2022
Merged

cbodley merged 1 commit into
ceph:mainfrom
qiuxinyidian:rgw-coroutine

Conversation

@qiuxinyidian

@qiuxinyidian qiuxinyidian commented Oct 26, 2022 •

Copy link
Copy Markdown
Contributor

Fixes: https://tracker.ceph.com/issues/57853

Signed-off-by: zhipeng li [email protected]

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@qiuxinyidian

Copy link
Copy Markdown
Contributor Author

I think interval_wait_count only increase cause the issue

@qiuxinyidian qiuxinyidian reopened this Oct 28, 2022
@cbodley
cbodley self-requested a review November 3, 2022 14:26
@qiuxinyidian

Copy link
Copy Markdown
Contributor Author

anybody here ?

@cbodley

cbodley commented Nov 23, 2022

Copy link
Copy Markdown
Contributor

@qiuxinyidian can you please explain what this fixes? it's not obvious from the commit message or the tracker issue

@qiuxinyidian

qiuxinyidian commented Nov 23, 2022 •

Copy link
Copy Markdown
Contributor Author

@cbodley

int RGWCoroutinesManager::run(const DoutPrefixProvider *dpp, list<RGWCoroutinesStack *> &stacks)

call handle_unblocked_stack to deal unblocked stack, while in RGWCoroutinesManager::run(

while (blocked_count - interval_wait_count >= ops_window)
{
  lock.unlock();
  ret = completion_mgr->get_next(&io);
  lock.lock();
  if (ret < 0)
  {
    ldout(cct, 5) << "completion_mgr.get_next() returned ret=" << ret << dendl;
  }
  handle_unblocked_stack(context_stacks, scheduled_stacks, io, &blocked_count);
}

interval_wait_count only increase even overflow , blocked_count des in handle_unblocked_stack,so may cause not call handle_unblocked_stack

@qiuxinyidian

Copy link
Copy Markdown
Contributor Author

if some unblocked stack not deal with ,may cause multisite data not sync

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot for the explanation, the fix looks sensible

Comment thread src/rgw/rgw_coroutine.cc
Comment on lines +573 to +575
if (stack->is_interval_waiting()) {
--(*interval_wait_count);
}

@cbodley cbodley Nov 23, 2022 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nesting this inside of the is_io_blocked() block assumes that interval_waits will always be io_blocked. this appears to be the case for RGWCoroutinesStack::wait(), but maybe this logic should treat them independently?

   if (stack->is_io_blocked()) {
     --(*blocked_count);
     stack->set_io_blocked(false);
   }
+  if (stack->is_interval_waiting()) {
+    --(*interval_wait_count);
+    stack->set_interval_wait(false);
+  }
-  stack->set_interval_wait(false);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, at present , the code shows interval_wait is one of scene of io_block

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RGWCoroutinesManager::run.  
if (stack->is_io_blocked())
{
  ldout(cct, 20) << __func__ << ":"
                 << " stack=" << (void *)stack << " is io blocked" << dendl;
  if (stack->is_interval_waiting())
  {
    interval_wait_count++;
  }
  blocked_count++;
}

may this logic should treat them independently ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbodley there seems to be one case where we want to call handle_unblocked_stack() only on blocked operations without the interval_wait. Like in

* only account blocked operations that are not in interval_wait, these are stacks that

In this case, we should probably not decrement interval_wait_count?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smanjara i do think that comment is consistent with the blocked_count - interval_wait_count logic in the while loop directly below - and that logic depends on tracking interval_wait_count accurately, which this PR addresses

that said, i have no idea why that loop needs special handling for interval waits

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yehudasa if any suggestion?

@qiuxinyidian qiuxinyidian Dec 8, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbodley there seems to be one case where we want to call handle_unblocked_stack() only on blocked operations without the interval_wait. Like in

* only account blocked operations that are not in interval_wait, these are stacks that

In this case, we should probably not decrement interval_wait_count?

in

void RGWCoroutinesManager::handle_unblocked_stack(set<RGWCoroutinesStack *> &context_stacks, list<RGWCoroutinesStack *> &scheduled_stacks,
RGWCompletionManager::io_completion &io, int *blocked_count)
{
ceph_assert(ceph_mutex_is_wlocked(lock));
RGWCoroutinesStack *stack = static_cast<RGWCoroutinesStack *>(io.user_info);
if (context_stacks.find(stack) == context_stacks.end())
{
return;
}
if (!stack->try_io_unblock(io.io_id))
{
return;
}
if (stack->is_io_blocked())
{
--(*blocked_count);
stack->set_io_blocked(false);
}
stack->set_interval_wait(false);
if (!stack->is_done())
{
if (!stack->is_scheduled)
{
scheduled_stacks.push_back(stack);
stack->set_is_scheduled(true);
}
}
else
{
context_stacks.erase(stack);
stack->put();
}
}

call stack->set_interval_wait(false) to change stack state to not_interval_wait, should dec interval_wait_count?

@cbodley

cbodley commented Nov 23, 2022

Copy link
Copy Markdown
Contributor

cc @smanjara @yehudasa

@mattbenjamin

Copy link
Copy Markdown
Contributor

@cbodley how relevant is this PR to current downstream work?

@cbodley

cbodley commented Nov 30, 2022

Copy link
Copy Markdown
Contributor

@mattbenjamin the fix applies to pacific/quincy too so it's worth testing

@mattbenjamin

Copy link
Copy Markdown
Contributor

@mattbenjamin the fix applies to pacific/quincy too so it's worth testing

thanks @cbodley ; @mkogan1 ^^

@mkogan1

mkogan1 commented Nov 30, 2022

Copy link
Copy Markdown
Contributor

@mattbenjamin the fix applies to pacific/quincy too so it's worth testing

thanks @cbodley ; @mkogan1 ^^

check, I will tests under load

@adamemerson
adamemerson self-requested a review November 30, 2022 19:40
@qiuxinyidian

Copy link
Copy Markdown
Contributor Author

@cbodley

int RGWCoroutinesManager::run(const DoutPrefixProvider *dpp, list<RGWCoroutinesStack *> &stacks)

call handle_unblocked_stack to deal unblocked stack, while in RGWCoroutinesManager::run(

while (blocked_count - interval_wait_count >= ops_window)
{
  lock.unlock();
  ret = completion_mgr->get_next(&io);
  lock.lock();
  if (ret < 0)
  {
    ldout(cct, 5) << "completion_mgr.get_next() returned ret=" << ret << dendl;
  }
  handle_unblocked_stack(context_stacks, scheduled_stacks, io, &blocked_count);
}

interval_wait_count only increase even overflow , blocked_count des in handle_unblocked_stack,so may cause not call handle_unblocked_stack

if interval_wait_count overflow , blocked_count is small value, and blocked_count - interval_wait_count >= ops_window,
in this case completion_mgr->get_next(&io) may cause block, not as expected.
@cbodley @adamemerson @mattbenjamin if interval_wait_count overflow, while cannot run as we expected.

@cbodley

cbodley commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

@cbodley
cbodley merged commit 500a28f into ceph:main Dec 9, 2022
@qiuxinyidian
qiuxinyidian deleted the rgw-coroutine branch December 14, 2022 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants