lingbin commented on a change in pull request #2260: Add a tool to show segment status URL: https://github.com/apache/incubator-doris/pull/2260#discussion_r349562664
########## File path: tools/show_segment_status/be_tablet_reslover.py ########## @@ -0,0 +1,110 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import json +import time +from urllib import urlopen + +class BeTabletResolver: + def __init__(self, be_list, tablet_map): + self.tablet_map = tablet_map + self.tablet_infos = {} + + self.be_map = {} + for be in be_list: + self.be_map[be['be_id']] = be + + def debug_output(self): + print "tablet_infos:(%s), print up to ten here:" % len(self.tablet_infos) + self._print_list(self.tablet_infos.values()[0:10]) + print + + def _print_list(self, one_list): + for item in one_list: + print item + + def init(self): + self.fetch_tablet_meta() + + def fetch_tablet_meta(self): + print "fetching tablet metas from BEs..." + count = 0 + for tablet in self.tablet_map.values(): + be_id = tablet['be_id'] + be = self.be_map[be_id] + url = self._make_url(be, tablet) + print url Review comment: This is deliberate, When there are too many tablets to fetch, it may need a few minutes. For now, we can only fetch one tablet meta in each request. The URL logs are used to let us know the script is running, instead of being blocked and suspended. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
