Skip to content

关于 Proposer.hasSummitQueue 使用方式的一些问题 Issue with the handling of hasSummitQueue #16

Description

@fwhdzh

Proposer.submit 方法中,有如下代码:

Value value = this.hasSummitQueue.take();
return value;

这两行代码会导致 hasSummitQueue 队列中的任何元素都被立即取出。同时,Proposer.submit 返回的 value 实际上并未被使用,而是直接被丢弃。这使得程序中维护的 hasSummitQueue 队列变得毫无意义,因为它始终为空(即便在 Proposer.onAcceptResponse 中向该队列加入了元素,也会立刻被上述代码取出并丢弃)。

虽然 Paxos 协议本身并不要求 Proposer 维护这样一个队列,但我认为在系统中保留它是有益的:开发人员可以通过该队列快速了解哪些日志项已经被完全提交。

因此,我建议移除 Proposer.submit 中的这两行代码,从而使 hasSummitQueue 能够真正维护所有已提交的日志项。我已提交一个 PR (#17 ) 来修复此问题。

祝好。


In the Proposer.submit method, there is the following code:

Value value = this.hasSummitQueue.take();
return value;

These two lines cause any element added to the hasSummitQueue to be immediately taken out. At the same time, the value returned by Proposer.submit is never actually used and is simply discarded. This makes the hasSummitQueue maintained in the program meaningless, because it is always empty (even if an element is added to the queue in Proposer.onAcceptResponse, it is quickly taken out and discarded by the above code).

Although the Paxos protocol itself does not require the Proposer to maintain such a queue, I believe it is beneficial to keep it in the system: developers can quickly see which log entries have been fully committed by inspecting this queue.

Therefore, I suggest removing these two lines from Proposer.submit, so that hasSummitQueue can serve its purpose of maintaining all committed logs. I have submitted a PR (#17 ) to fix this issue.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions