You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2021/04/13 02:39:34 UTC

[GitHub] [incubator-pegasus] ZhongChaoqiang commented on issue #719: data loss

ZhongChaoqiang commented on issue #719:
URL: https://github.com/apache/incubator-pegasus/issues/719#issuecomment-818388685


   下面是分析过程:
   
   1. last_durable_decree为上一次持久化的点,打开replica时从rocksdb的数据目录中读取出来,而init_durable_decree是从.init-info文件中读取出来。.init-info文件一般是在learn的时候生成,我们继续分析日志,发现replica在发生问题前是有发生learn的操作的,并且有如下日志:
   `D2020-12-03 21:27:09.499 (1607002029499473085 7754) replica.rep_long3.0404000d000021bd: replica_learn.cpp:1075:on_copy_remote_state_completed(): 35.24@10.32.82.225:34801: on_copy_remote_state_completed[000001a600000002]: learnee = 10.32.82.16:34801, learn_duration = 5 ms, apply checkpoint/log done, err = ERR_OK, last_prepared_decree = (16369 => 16371), last_committed_decree = (16368 => 16371), app_committed_decree = (16368 => 16371), app_durable_decree = (16368 => 16368), remote_committed_decree = 16371, prepare_start_decree = -1, current_learning_status = replication::learner_status::LearningWithoutPrepare`
   
   可以发现经过learn后,last_committed_decree变成了16371,而app_durable_decree还是16368。我们继续分析代码,发现代码中learn后写入.init-info文件中的init_durable_decree的值并不是last_durable_decree的值,而是last_committed_decree的值。
   
   ```
   err = _app->update_init_info(
         this,
         _stub->_log->on_partition_reset(get_gpid(), _app->last_committed_decree()),
         _private_log->on_partition_reset(get_gpid(), _app->last_committed_decree()),
         _app->last_committed_decree());
   ```
   
   init_durable_decree应该是记录last_durable_decree的值,而不是last_committed_decree的值;last_committed_decree表示上一次已经提交的修改,但不一定已经持久化了。所以last_committed_decree总是大于或等于last_durable_decree的值的。


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org