Use readExplicitLAC instead of readEntry in order to get current LastAddConfirmed#1572
Use readExplicitLAC instead of readEntry in order to get current LastAddConfirmed#1572eolivelli wants to merge 6 commits into
Conversation
5918517 to
5f5ed5c
Compare
1 similar comment
|
@eolivelli sorry I missed your comment. I typically ignore any WIP PRs... |
sijie
left a comment
There was a problem hiding this comment.
the approach seems to be okay to me.
one general comment: why it is only applied to asyncTryReadLastConfirmed?
| }; | ||
|
|
||
| new ReadLastConfirmedOp(this, innercb).initiate(); | ||
| asyncReadExplicitLastConfirmed(cb, ctx); |
There was a problem hiding this comment.
@sijie here I am changing also asyncReadLastConfirmed
This is actually the core of the change.
I had to re implement asyncTryReadLastConfirmed because there is no existing support for explicitLAC
42b5a25 to
0872243
Compare
|
@sijie @jvrao @ivankelly I have rebased this patch onto current master. I only have to add unit tests. All current tests about readLastAddConfirmed() and tryReadLastAddConfirmed() are passing even by enabling the feature by default. |
| } | ||
| } | ||
|
|
||
| private void asyncReadLastConfirmedInternal(final ReadLastConfirmedCallback cb, final Object ctx) { |
There was a problem hiding this comment.
asyncReadLastConfirmedInternal is a bad name. I would prefer calling it asyncReadPiggybackLastConfirmed (in contrast to asyncReadExplicitLastConfirmed.
| */ | ||
|
|
||
| public void asyncReadLastConfirmed(final ReadLastConfirmedCallback cb, final Object ctx) { | ||
| if (clientCtx.getConf().useExplicitLacForReads) { |
There was a problem hiding this comment.
I am not sure using a flag is the best choice here. the bookkeeper client should be smart to figure out whether it should be reading explicit lac or piggybacked lac.
There was a problem hiding this comment.
Maybe the name is misleading but it is already here.
This function will compose explicit and piggybacked LAC.
So actually it would be better to use always readExplicitLAC RPC, but we cannot enable it by default because it works only with recent bookies and with v3 protocol
There was a problem hiding this comment.
Client knows it is using V3 protocol or not; so why not use the explicitLAC for >= v3 automatically without a conf option?
There was a problem hiding this comment.
ExplicitLAC is since 4.5. V3 protocol was already present. So we have bookies which talk v3 and do not know ExplicitLAC protocol: we will break compatibility from 4.9 clients and 4.4 bookies.
Honestly I don't think this is a real production problem because 4.4 is very old, but we don't have a clear EOL policy.
There was a problem hiding this comment.
@eolivelli I don't understand your comment here. if a bookie doesn't know ExplicitLAC, the request will be rejected and the client will know about that, right? when client know that, it can fallback to disable using explicit lac, no?
There was a problem hiding this comment.
@sijie so you are suggesting to fallback to piggybackLac in case of "UnsupportedOperation" error from bookie.
We should keep track of this per-bookie. I think this is very tricky, we need to add a lot of code and runtime overhead for the sake of compatibility with very old bookies (4.4).
We can have this configuration flag, enabled by default in 4.9 in case of v3+ protocol and disable for v2 protocol, and then drop it as soon as we decide to drop support for compatibility with such old versions.
There was a problem hiding this comment.
you are suggesting to fallback to piggybackLac in case of "UnupportedOperation" error from bookie.
yes.
We should keep track of this per-bookie.
probably yes.
We can have this configuration flag, enabled by default in 4.9 in case of v3+ protocol and disable for v2 protocol,
my main concern is with this change, we have so many different variants of reading lac operations in the main repo. it is very confusing and hard to maintain. I would suggest us holding on merging this PR and thinking of a better solution for it, rather than rushing at merging this and make things hard to maintain in future.
There was a problem hiding this comment.
@sijie I see your concern. There is no hurry, we can work on this topic for 4.10.
I think that current asyncReadExplicitLastConfirmed() is better because it is actually merging the two values (piggy backed + explicit)
I think this is the future, I am not dropping the legacy method only for compatibility with 4.4.
The best would be to not have the flag, not perform any compatibility effort, and say that 4.9 clients are able to read from 4.4 bookies only using v2 protocol (in v2 protocol we don't have ExplicitLAC so we cannot use PendingReadLacOp)
PendingReadLacOp is already here, I am not adding it, I am only suggesting to use PendingReadLacOp for regular readLastAddConfirmed() instead of ReadLastConfirmedOp.
Ideally we should merge PendingReadLacOp with ReadLastConfirmedOp and drop PendingReadLacOp, but it is greater work, because ReadLastConfirmedOp handles fencing stuff
| // Extract lac from last entry on the disk | ||
| if (lastEntryBuffer != null && lastEntryBuffer.readableBytes() > 0) { | ||
| RecoveryData recoveryData = lh.macManager.verifyDigestAndReturnLastConfirmed(lastEntryBuffer); | ||
| long recoveredLac = recoveryData.getLastAddConfirmed(); |
There was a problem hiding this comment.
isn't it called piggyBackedLAC?
There was a problem hiding this comment.
renamed to newLac, it is clearer, thanks
|
|
||
| /** | ||
| * This op is try to read last confirmed without involving quorum coverage checking. | ||
| * Use {@link PendingLacOp} if you need quorum coverage checking. |
There was a problem hiding this comment.
I am not sure if we ever need quorum for LAC. LAC means it has quorum, so we can take greatest LAC.
There was a problem hiding this comment.
If we take out the coverageSet.checkCovered() check from PendingReadLacOp, then we don't need this right? I don't know why we have the quorum check in there, What scenario needs LAC to be quorum checked? @sijie ?
There was a problem hiding this comment.
Haven't looked at this patch, but this coverage check is there because fencing is piggybacked on the LAC read.
There was a problem hiding this comment.
@jvrao @ivankelly @sijie
This feature has the same semantics as TryReadLastConfirmedOp:
TryPendingReadLacOp -> PendingReadLacOp
TryReadLastConfirmedOp -> ReadLastConfirmedOp
We are trying to advance LAC and return as soon as we have an useful value, without full coverage checks.
AFAIK This feature is a used for Long-Poll reads, which I am not going to implement soon, at least not within 4.9 timeline.
In Long Poll reads tests I have found this API asyncTryReadLastConfirmed and for consistency I have created a similar one for ExplicitLAC based reads.
There was a problem hiding this comment.
without full coverage checks.
This is what I am trying to understand. Once we have LAC updated (either piggy-back or explicit) it means that it has met Write Quorum. So I don't understand what is the additional coverage check needed. This is not a fencing read or reading beyond LAC, this operation reads LAC which must have been updated by the writer after write quorum, hence it is persisted. If we need latest LAC we need quorum (for fencing) but for reads, you don't need.
| RecoveryData recoveryData = lh.macManager.verifyDigestAndReturnLastConfirmed(lastEntryBuffer); | ||
| long recoveredLac = recoveryData.getLastAddConfirmed(); | ||
| if (recoveredLac > maxLac) { | ||
| newLac = recoveredLac; |
|
For what is worth... I think this is a great step forward for BK usability |
|
Ping @sijie |
sijie
left a comment
There was a problem hiding this comment.
I still don't understand why we can't merge explicit lac and piggybacked lac into one read operations. my concern is after this change, we ended up having many variants of reading last confirmed. what is your plan for that in long term?
| */ | ||
|
|
||
| public void asyncReadLastConfirmed(final ReadLastConfirmedCallback cb, final Object ctx) { | ||
| if (clientCtx.getConf().useExplicitLacForReads) { |
There was a problem hiding this comment.
@eolivelli I don't understand your comment here. if a bookie doesn't know ExplicitLAC, the request will be rejected and the client will know about that, right? when client know that, it can fallback to disable using explicit lac, no?
| if (clientCtx.getConf().useExplicitLacForReads) { | ||
| asyncTryReadExplicitLastConfirmed(cb, ctx); | ||
| } else { | ||
| asyncTryReadLastConfirmedInternal(cb, ctx); |
There was a problem hiding this comment.
Why the name here is not consistent with asyncReadPiggybackLastConfirmed?
There was a problem hiding this comment.
@sijie I missed to renamed this method as well.
done
|
@sijie @jvrao @ivankelly |
Motivation
Readers have to explicitly call readExplicitLastConfirmed in order to leverage ExplicitLAC.
I would like to have a unified way to read LastAddConfirmed.
Changes
This change makes the client use internally readExplicitLastConfirmed instead of using readLastAddConfirmed.
We need to introduce something similar to tryReadLastAddConfirmed in order to make it consistent with readLastAddConfirmed.
It lacks support for Long Poll Reads, notably we would have to listen on ExplicitLAC modifications on the bookie side in order to wake up the readers even in case of setExplicitLAC from the writer and we would need to change protocol for readLastAddConfirmedAndEntry in order to return the ExplicitLAC.
We cannot support v2 clients.