[
https://issues.apache.org/jira/browse/BOOKKEEPER-315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13469284#comment-13469284
]
Ivan Kelly commented on BOOKKEEPER-315:
---------------------------------------
Sorry about taking so long to look at this.
{quote}
one clarification: are you suggesting something like below?
{code}
private void replicateBatch(LedgerHandle lh, LedgerFragment lf,
InetSocketAddress targetBookieAddress) throws InterruptedException {
final SyncCounter syncCounter = new SyncCounter();
ResultCallBack resultCallBack = new ResultCallBack(syncCounter);
syncCounter.inc();
replicate(lh, lf, resultCallBack, targetBookieAddress);
syncCounter.block(0);
}
{code}
replicateBatch, replicate are like, one will be sync call and other is async?
or you are suggesting that replicateBatch itself can be async?
{quote}
In fact, it would be better to have a
LedgerFragmentReplicator#replicateNextBatch rather than replicateBatch which
works on a iterator of fragments.
There's no need for a sync #replicate method, though the current #replicate
impl should be moved to #replicateFragmentInternal and the others should be
something like the following.
{code}
void replicate(LedgerHandle lh, final LedgerFragment ledgerFragment,
VoidCallback ledgerFragmentCb, InetSocketAddress addr) {
Set<LedgerFragment> fragments = splitIntoSubFragment(ledgerFragment, lh,
batchSize);
replicateNextBatch(lh, fragments, ledgerFragmentCb);
}
void replicateNextBatch(LedgerHandle lh, Iterator<LedgerFragment> fragments,
VoidCallback finishedCallback, InetSocketAddress addr) {
if (fragments.hasNext()) {
replicateFragmentInternal(lh, fragments.next(), addr,
new VoidCallback() {
public void operationComplete(int rc, Void v, Object ctx) {
if (rc != OK) {
finishedCallback.operationComplete(rc, null, null);
} else {
replicateNextBatch(lh, fragments, finishedCallback,
addr);
}
}
});
} else {
finishedCallback.operationComplete(OK, null, null);
}
}
private void replicateFragmentInternal(LedgerHandle lh, LedgerFragment fragment,
InetSocketAddress addr, VoidCallback cb)
{
....
}
{code}
Also, the order of the parameters in splitIntoSubFragment is inconsistent with
replicate(), they should be the same
> Ledger entries should be replicated sequentially instead of parallel.
> ---------------------------------------------------------------------
>
> Key: BOOKKEEPER-315
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-315
> Project: Bookkeeper
> Issue Type: Sub-task
> Components: bookkeeper-auto-recovery, bookkeeper-client
> Affects Versions: 4.2.0
> Reporter: Uma Maheswara Rao G
> Assignee: Uma Maheswara Rao G
> Attachments: BOOKKEEPER-315.patch, BOOKKEEPER-315.patch,
> BOOKKEEPER-315.patch
>
>
> Currently BookKeeperAdmin will copy the entries parallel.
> This may create more load on the servers. To avoid that, we can refactor the
> BKAdmin code to copy the entries sequential.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira