RongtongJin commented on issue #3388:
URL: https://github.com/apache/rocketmq/issues/3388#issuecomment-932057774
> Before start up the slave,check the commigLog data is correctly by manual
is inconvenient to execute 。From the machine of slave broke down to it
repaired,we did not modify the data in the store directory of slave,this
mistake maybe due to the deletion policy as it'is not time to
deleteExpiredFiles at start up time or other reasons. so add check is necessary.
>
> add the following checks when master received slaveRequestOffset at
first,if slaveRequestOffset>maxOffset or slaveRequestOffset<minOffset,send last
commitLog file. And change slave's dispatchReadRequest method to handle a
correct offset from master. Is this idea appropriate?
>
> ```
> if (-1 == this.nextTransferFromWhere) {
> if (0 == HAConnection.this.slaveRequestOffset) {
> long masterOffset =
HAConnection.this.haService.getDefaultMessageStore().getCommitLog().getMaxOffset();
> masterOffset =
> masterOffset
> - (masterOffset %
HAConnection.this.haService.getDefaultMessageStore().getMessageStoreConfig()
> .getMapedFileSizeCommitLog());
>
> if (masterOffset < 0) {
> masterOffset = 0;
> }
> this.nextTransferFromWhere = masterOffset;
> } else {
> //changes
> long maxOffset =
HAConnection.this.haService.getDefaultMessageStore().getCommitLog().getMaxOffset();
> long minOffset =
HAConnection.this.haService.getDefaultMessageStore().getCommitLog().getMinOffset();
> if (HAConnection.this.slaveRequestOffset>
maxOffset || HAConnection.this.slaveRequestOffset< minOffset) {
> long masterOffset =
> maxOffset
> - (maxOffset %
HAConnection.this.haService.getDefaultMessageStore().getMessageStoreConfig()
>
.getMapedFileSizeCommitLog());
>
> if (masterOffset < 0) {
> masterOffset = 0;
> }
> this.nextTransferFromWhere = masterOffset;
>
> }else {
> this.nextTransferFromWhere =
HAConnection.this.slaveRequestOffset;
> }
>
> }
>
> log.info("master transfer data from " +
this.nextTransferFromWhere + " to slave[" + HAConnection.this.clientAddr
> + "], and slave request " +
HAConnection.this.slaveRequestOffset);
> }
> ```
This will cause the commitlog to be discontinuous. I think it's best to
repair it manually in this case
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]