| 731 | } |
| 732 | |
| 733 | void TabletNodeImpl::Query(const QueryRequest* request, QueryResponse* response, |
| 734 | google::protobuf::Closure* done) { |
| 735 | response->set_sequence_id(request->sequence_id()); |
| 736 | response->set_status(kTabletNodeOk); |
| 737 | |
| 738 | TabletNodeInfo* ts_info = response->mutable_tabletnode_info(); |
| 739 | sysinfo_.GetTabletNodeInfo(ts_info); |
| 740 | TabletMetaList* meta_list = response->mutable_tabletmeta_list(); |
| 741 | sysinfo_.GetTabletMetaList(meta_list); |
| 742 | |
| 743 | if (request->has_is_gc_query() && request->is_gc_query()) { |
| 744 | std::vector<TabletInheritedFileInfo> inh_infos; |
| 745 | GetInheritedLiveFiles(&inh_infos); |
| 746 | for (size_t i = 0; i < inh_infos.size(); i++) { |
| 747 | TabletInheritedFileInfo* inh_info = response->add_tablet_inh_file_infos(); |
| 748 | inh_info->CopyFrom(inh_infos[i]); |
| 749 | } |
| 750 | |
| 751 | // only for compatible with old master |
| 752 | std::vector<InheritedLiveFiles> inherited; |
| 753 | GetInheritedLiveFiles(inherited); |
| 754 | for (size_t i = 0; i < inherited.size(); ++i) { |
| 755 | InheritedLiveFiles* files = response->add_inh_live_files(); |
| 756 | *files = inherited[i]; |
| 757 | } |
| 758 | } |
| 759 | |
| 760 | // if have background errors, package into 'response' and return to 'master' |
| 761 | std::vector<TabletBackgroundErrorInfo> background_errors; |
| 762 | GetBackgroundErrors(&background_errors); |
| 763 | for (auto background_error : background_errors) { |
| 764 | TabletBackgroundErrorInfo* tablet_background_error = response->add_tablet_background_errors(); |
| 765 | tablet_background_error->CopyFrom(background_error); |
| 766 | } |
| 767 | done->Run(); |
| 768 | } |
| 769 | |
| 770 | void TabletNodeImpl::RefreshAndDumpSysInfo() { |
| 771 | int64_t cur_ts = get_micros(); |