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

osd: add asock command to dump the scrub queue #12728

Merged
merged 1 commit into from
Jan 5, 2017

Conversation

liuchang0812
Copy link
Contributor

@liuchang0812 liuchang0812 commented Jan 1, 2017

  • add a public method to dumps scrubs
  • register new command to asock_admin

any comments is appreciated.

@tchaikov @liewegas @athanatos

Fixes: http://tracker.ceph.com/issues/17861

Signed-off-by: liuchang0812 liuchang0812@gmail.com

@liuchang0812
Copy link
Contributor Author

liuchang0812 commented Jan 1, 2017

FYI, result of this command:

[
    {  
      "pgid": "1.0",
        "sched_time": "2017-01-02 01:35:23.289862",
        "deadline": "2017-01-07 23:41:25.673073"
    },
    {   
        "pgid": "2.6",
        "sched_time": "2017-01-02 04:07:40.349184",
        "deadline": "2017-01-08 03:24:07.231452"
    },
    {   
        "pgid": "1.3",
        "sched_time": "2017-01-02 06:18:40.805239",
        "deadline": "2017-01-08 00:14:06.916350"
    },
    {   
        "pgid": "2.4",
        "sched_time": "2017-01-02 07:58:41.714257",
        "deadline": "2017-01-08 07:15:31.032673"
    },
    {   
        "pgid": "2.3",
        "sched_time": "2017-01-02 09:17:15.723569",
        "deadline": "2017-01-08 05:44:35.507823"
    },
    {   
        "pgid": "1.7",
        "sched_time": "2017-01-02 10:02:50.532476",
        "deadline": "2017-01-08 07:58:34.595284"
    },
    {   
        "pgid": "1.4",
        "sched_time": "2017-01-02 10:40:38.610703",
        "deadline": "2017-01-08 08:41:33.200372"
    },
    {   
        "pgid": "2.7",
        "sched_time": "2017-01-02 11:56:48.821839",
        "deadline": "2017-01-08 04:00:31.616621"
    },
    {   
        "pgid": "1.6",
        "sched_time": "2017-01-02 14:09:30.878554",
        "deadline": "2017-01-08 03:37:02.696721"
    },
    {   
        "pgid": "2.5",
        "sched_time": "2017-01-02 14:29:59.059526",
        "deadline": "2017-01-08 03:59:52.597162"
    },
    {   
        "pgid": "0.7",
        "sched_time": "2017-01-02 18:16:37.088916",
        "deadline": "2017-01-08 08:09:10.976245"
    }
]

and, xml result:

<sched scrubs>
 <scrub>
  <pgid>1.0</pgid>
  <sched_time>2017-01-02 01:35:23.289862</sched_time>
  <deadline>2017-01-07 23:41:25.673073</deadline>
 </scrub>
 <scrub>
  <pgid>2.6</pgid>
  <sched_time>2017-01-02 04:07:40.349184</sched_time>
  <deadline>2017-01-08 03:24:07.231452</deadline>
 </scrub>
 <scrub>
  <pgid>1.3</pgid>
  <sched_time>2017-01-02 06:18:40.805239</sched_time>
  <deadline>2017-01-08 00:14:06.916350</deadline>
 </scrub>
 <scrub>
  <pgid>2.4</pgid>
  <sched_time>2017-01-02 07:58:41.714257</sched_time>
  <deadline>2017-01-08 07:15:31.032673</deadline>
 </scrub>
 <scrub>
  <pgid>2.3</pgid>
  <sched_time>2017-01-02 09:17:15.723569</sched_time>
  <deadline>2017-01-08 05:44:35.507823</deadline>
 </scrub>
 <scrub>
  <pgid>1.7</pgid>
  <sched_time>2017-01-02 10:02:50.532476</sched_time>
  <deadline>2017-01-08 07:58:34.595284</deadline>
 </scrub>
 <scrub>
  <pgid>1.4</pgid>
  <sched_time>2017-01-02 10:40:38.610703</sched_time>
  <deadline>2017-01-08 08:41:33.200372</deadline>
 </scrub>
 <scrub>
  <pgid>2.7</pgid>
  <sched_time>2017-01-02 11:56:48.821839</sched_time>
  <deadline>2017-01-08 04:00:31.616621</deadline>
 </scrub>
 <scrub>
  <pgid>1.6</pgid>
  <sched_time>2017-01-02 14:09:30.878554</sched_time>
  <deadline>2017-01-08 03:37:02.696721</deadline>
 </scrub>
 <scrub>
  <pgid>2.5</pgid>
  <sched_time>2017-01-02 14:29:59.059526</sched_time>
  <deadline>2017-01-08 03:59:52.597162</deadline>
 </scrub>
 <scrub>
  <pgid>0.7</pgid>
  <sched_time>2017-01-02 18:16:37.088916</sched_time>
  <deadline>2017-01-08 08:09:10.976245</deadline>
 </scrub>
</sched scrubs>

assert(f != nullptr);
Mutex::Locker l(sched_scrub_lock);

f->open_array_section("sched scrubs");
Copy link
Contributor

Choose a reason for hiding this comment

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

an XML tag cannot contain space in it. see https://www.w3.org/TR/2008/REC-xml-20081126/#NT-NameChar.

so probably we can simply put "scrubs" as the tag name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 ok

@@ -686,7 +686,7 @@ class OSDService {
}

void dumps_scrub(Formatter *f) {
assert(f!=nullptr);
assert(f != nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

please squash this commit into the previous one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i will squash commits after review

r = admin_socket->register_command("dump_scrubs",
"dump_scrubs",
asok_hook,
"print schedlued scrubs");
Copy link
Member

Choose a reason for hiding this comment

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

s/schedlued/scheduled/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. thanks for your review

f->open_object_section("scrub");
f->dump_stream("pgid") << i.pgid;
f->dump_stream("sched_time") << i.sched_time;
f->dump_stream("deadline") << i.deadline;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can have a boolean field named "forced"? see http://tracker.ceph.com/issues/17861#note-5. i know, technically, it's redundant. but it helps user to understand this scrub. @athanatos what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it has been added. by the way, it seems that there isn't not a way to do a force scrub via ceph tools.

Copy link
Contributor

Choose a reason for hiding this comment

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

both "ceph osd scrub ${osd_num}" and "ceph pg scrub ${pg_num}" force a scrub job.

Copy link
Contributor Author

@liuchang0812 liuchang0812 left a comment

Choose a reason for hiding this comment

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

updated

r = admin_socket->register_command("dump_scrubs",
"dump_scrubs",
asok_hook,
"print schedlued scrubs");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. thanks for your review

f->open_object_section("scrub");
f->dump_stream("pgid") << i.pgid;
f->dump_stream("sched_time") << i.sched_time;
f->dump_stream("deadline") << i.deadline;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it has been added. by the way, it seems that there isn't not a way to do a force scrub via ceph tools.

@athanatos
Copy link
Contributor

This seems reasonable to me. I'm ok with it if @tchaikov is.

@tchaikov
Copy link
Contributor

tchaikov commented Jan 4, 2017

@liuchang0812

nit, the change happens in "osd" but not in any of the cli tools, might want to change the prefix of the title to "osd:".

@tchaikov tchaikov self-assigned this Jan 4, 2017
@liuchang0812
Copy link
Contributor Author

@tchaikov OK, i will change title and test again.

@liuchang0812 liuchang0812 changed the title osd/tool: add asock command to dump the scrub queue osd: add asock command to dump the scrub queue Jan 4, 2017
@tchaikov
Copy link
Contributor

tchaikov commented Jan 4, 2017

@liuchang0812 sorry for the confusion. and please note that the title of this pull request is different from the one of your commit. i recommend change the later.

@liuchang0812
Copy link
Contributor Author

😄 @tchaikov I get it now

* add a public method to dumps scrubs
* register new command "dump_scrubs" to asock_admin

Fixes: http://tracker.ceph.com/issues/17861
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
@liuchang0812
Copy link
Contributor Author

@tchaikov Updated, Waiting for test result.

@tchaikov tchaikov merged commit 0d5780c into ceph:master Jan 5, 2017
@liuchang0812 liuchang0812 deleted the fix-17861 branch January 5, 2017 14:57
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.

4 participants