You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/08 13:58:44 UTC

[GitHub] [doris] weizuo93 opened a new pull request, #10711: [Feature] Add interface to check tablet segment lost

weizuo93 opened a new pull request, #10711:
URL: https://github.com/apache/doris/pull/10711

   # Proposed changes
   
   Issue Number: close #10708 
   
   ## Problem Summary:
   
   There may be some exceptions that cause segment to be lost on BE node. However, the metadata shows that the tablet is normal. This abnormal replica is not detected by FE and cannot be automatically repaired.When query comes, exception information is thrown that `failed to initialize storage reader`. I think we'd better be able to check tablet segment lost.
   
   This patch add a interface to check tablet segment lost.
   ```
   curl -X GET http://be_host:webserver_port/api/check_tablet_segment_existence
   ```
   
    The return of the interface is all tablets on the current BE node that have lost segment.
   ```
   {
       msg: "Succeed to check all tablet segment",
       num: 3,
       bad_tablets: [
           11190,
           11210,
           11216
       ],
       host: "172.3.0.101"
   }
   ```
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No)
   2. Has unit tests been added: (No Need)
   3. Has document been added or modified: (Yes)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10711:
URL: https://github.com/apache/doris/pull/10711#issuecomment-1201144395

   PR approved by anyone and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] caiconghui commented on a diff in pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
caiconghui commented on code in PR #10711:
URL: https://github.com/apache/doris/pull/10711#discussion_r926577728


##########
be/src/olap/tablet_manager.cpp:
##########
@@ -1333,4 +1333,30 @@ void TabletManager::get_all_tablets_storage_format(TCheckStorageFormatResult* re
     result->__isset.v2_tablets = true;
 }
 
+std::set<int64_t> TabletManager::check_all_tablet_segment(bool repair) {
+    std::set<int64_t> bad_tablets;
+    for (const auto& tablets_shard : _tablets_shards) {
+        std::shared_lock rdlock(tablets_shard.lock);

Review Comment:
   read lock but modify tablet meta?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] weizuo93 commented on a diff in pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
weizuo93 commented on code in PR #10711:
URL: https://github.com/apache/doris/pull/10711#discussion_r926657603


##########
be/src/olap/tablet_manager.cpp:
##########
@@ -1333,4 +1333,30 @@ void TabletManager::get_all_tablets_storage_format(TCheckStorageFormatResult* re
     result->__isset.v2_tablets = true;
 }
 
+std::set<int64_t> TabletManager::check_all_tablet_segment(bool repair) {
+    std::set<int64_t> bad_tablets;
+    for (const auto& tablets_shard : _tablets_shards) {
+        std::shared_lock rdlock(tablets_shard.lock);

Review Comment:
   > read lock but modify tablet meta?
   
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] caiconghui commented on a diff in pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
caiconghui commented on code in PR #10711:
URL: https://github.com/apache/doris/pull/10711#discussion_r926578048


##########
be/src/olap/rowset/beta_rowset.cpp:
##########
@@ -228,4 +228,21 @@ bool BetaRowset::check_file_exist() {
     return true;
 }
 
+bool BetaRowset::check_current_rowset_segment() {
+    auto fs = _rowset_meta->fs();
+    if (!fs) {
+        return false;
+    }
+    for (int seg_id = 0; seg_id < num_segments(); ++seg_id) {
+        auto seg_path = segment_file_path(seg_id);
+        std::shared_ptr<segment_v2::Segment> segment;
+        auto s = segment_v2::Segment::open(fs, seg_path, seg_id, _schema, &segment);
+        if (!s.ok()) {
+            LOG(WARNING) << "Beta rowset segment Check. segment not exist. file=" << seg_path;

Review Comment:
   not ok always mean file not exist?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10711:
URL: https://github.com/apache/doris/pull/10711#issuecomment-1201144339

   PR approved by at least one committer and no changes requested.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] weizuo93 merged pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
weizuo93 merged PR #10711:
URL: https://github.com/apache/doris/pull/10711


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] weizuo93 commented on a diff in pull request #10711: [Feature] Add interface to check tablet segment lost

Posted by GitBox <gi...@apache.org>.
weizuo93 commented on code in PR #10711:
URL: https://github.com/apache/doris/pull/10711#discussion_r926658034


##########
be/src/olap/rowset/beta_rowset.cpp:
##########
@@ -228,4 +228,21 @@ bool BetaRowset::check_file_exist() {
     return true;
 }
 
+bool BetaRowset::check_current_rowset_segment() {
+    auto fs = _rowset_meta->fs();
+    if (!fs) {
+        return false;
+    }
+    for (int seg_id = 0; seg_id < num_segments(); ++seg_id) {
+        auto seg_path = segment_file_path(seg_id);
+        std::shared_ptr<segment_v2::Segment> segment;
+        auto s = segment_v2::Segment::open(fs, seg_path, seg_id, _schema, &segment);
+        if (!s.ok()) {
+            LOG(WARNING) << "Beta rowset segment Check. segment not exist. file=" << seg_path;

Review Comment:
   > not ok always mean file not exist?
   
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org