Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many read mmp in send !!!! #97

Closed
Cczzzz opened this issue Sep 23, 2021 · 5 comments
Closed

Too many read mmp in send !!!! #97

Cczzzz opened this issue Sep 23, 2021 · 5 comments
Labels
enhancement enhancement

Comments

@Cczzzz
Copy link
Contributor

Cczzzz commented Sep 23, 2021

Send once and take multiple times mmp.
For example ,in commit
DLedgerMmapFileStore#updateCommittedIndex updateCommittedIndex

    DLedgerEntry dLedgerEntry = get(newCommittedIndex);
    PreConditions.check(dLedgerEntry != null, DLedgerResponseCode.DISK_ERROR);
    this.committedIndex = newCommittedIndex;
    this.committedPos = dLedgerEntry.getPos() + dLedgerEntry.getSize();

just want know pos and size.but in get()

       indexSbr = indexFileList.getData(index * INDEX_UNIT_SIZE, INDEX_UNIT_SIZE);
        PreConditions.check(indexSbr != null && indexSbr.getByteBuffer() != null, DLedgerResponseCode.DISK_ERROR, "Get null index for %d", index);
        indexSbr.getByteBuffer().getInt(); //magic
        long pos = indexSbr.getByteBuffer().getLong();
        int size = indexSbr.getByteBuffer().getInt();
        dataSbr = dataFileList.getData(pos, size);
        PreConditions.check(dataSbr != null && dataSbr.getByteBuffer() != null, DLedgerResponseCode.DISK_ERROR, "Get null data for %d", index);
        DLedgerEntry dLedgerEntry = DLedgerEntryCoder.decode(dataSbr.getByteBuffer());
        PreConditions.check(pos == dLedgerEntry.getPos(), DLedgerResponseCode.DISK_ERROR, "%d != %d", pos, dLedgerEntry.getPos());

indexFileList have already known pos and size.Have to read dataFileList and
DLedgerEntryCoder.decode?decode? Is this necessary?

In my test ,dLedger is very poor performance !!!!

@Cczzzz
Copy link
Contributor Author

Cczzzz commented Sep 23, 2021

And why in doAppend need call dLedgerStore.updateCommittedIndex().Is not call in commit command?

   private void handleDoAppend(long writeIndex, PushEntryRequest request,
        CompletableFuture<PushEntryResponse> future) {
        try {
            PreConditions.check(writeIndex == request.getEntry().getIndex(), DLedgerResponseCode.INCONSISTENT_STATE);
            DLedgerEntry entry = dLedgerStore.appendAsFollower(request.getEntry(), request.getTerm(), request.getLeaderId());
            PreConditions.check(entry.getIndex() == writeIndex, DLedgerResponseCode.INCONSISTENT_STATE);
            future.complete(buildResponse(request, DLedgerResponseCode.SUCCESS.getCode()));
            dLedgerStore.updateCommittedIndex(request.getTerm(), request.getCommitIndex());
        } catch (Throwable t) {
            logger.error("[HandleDoWrite] writeIndex={}", writeIndex, t);
            future.complete(buildResponse(request, DLedgerResponseCode.INCONSISTENT_STATE.getCode()));
        }
    }

@Cczzzz
Copy link
Contributor Author

Cczzzz commented Sep 23, 2021

Can modify process append and commit In two different threads。

@RongtongJin RongtongJin added the enhancement enhancement label Sep 26, 2021
@Cczzzz
Copy link
Contributor Author

Cczzzz commented Sep 26, 2021

Can modify process append and commit In two different threads。

I see ,dledger No state machine ,so append = commit

@Cczzzz
Copy link
Contributor Author

Cczzzz commented Sep 26, 2021

Can modify process append and commit In two different threads。

I see ,dledger No state machine ,so append = commit

just send a null commit when too much behind

@Cczzzz
Copy link
Contributor Author

Cczzzz commented Sep 27, 2021

#98

@Cczzzz Cczzzz closed this as completed Sep 27, 2021
RongtongJin pushed a commit that referenced this issue Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement
Projects
None yet
Development

No branches or pull requests

2 participants