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

ISSUE #1390 Ensemble change on delayed write error #1395

Closed
wants to merge 3 commits into from

Conversation

jvrao
Copy link
Contributor

@jvrao jvrao commented May 5, 2018

Error on delayed writes are dropped if the addEntry
is in complete state (ack quorum satisfied).
This change records the delayed write failure and forces
ensemble change onthe next write. This saves from having
extended under replicated status on the ledger and also
avoids unnecessary build up at PCBC channel.

Signed-off-by: Venkateswararao Jujjuri (JV) vjujjuri@salesforce.com

Descriptions of the changes in this PR:

(PR description content here)...

Master Issue: #


Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

If this PR is a BookKeeper Proposal (BP):

  • Make sure the PR title is formatted like:
    <BP-#>: Description of bookkeeper proposal
    e.g. BP-1: 64 bits ledger is support
  • Attach the master issue link in the description of this PR.
  • Attach the google doc link if the BP is written in Google Doc.

Otherwise:

  • Make sure the PR title is formatted like:
    <Issue #>: Description of pull request
    e.g. Issue 123: Description ...
  • Make sure tests pass via mvn clean apache-rat:check install spotbugs:check.
  • Replace <Issue #> in the title with the actual Issue number.

Error on delayed writes are dropped if the addEntry
is in complete state (ack quorum satisfied).
This change records the delayed write failure and forces
ensemble change onthe next write. This saves from having
extended under replicated status on the ledger and also
avoids unnecessary build up at PCBC channel.

Signed-off-by: Venkateswararao Jujjuri (JV) <vjujjuri@salesforce.com>
@jvrao jvrao requested a review from sijie May 5, 2018 19:08
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is very smart.
I left some minor comment

I wonder if we should add a config option in order to enable explicitly this change, maybe we could keep it 'disabled' in 4.8 and then change default to 'enable' in 4.9

I also wonder if it is possible to use mockito based client side framework and save us from starting a real cluster in tests. (Not blocker for me)

@@ -1749,6 +1755,42 @@ EnsembleInfo replaceBookieInMetadata(final Map<Integer, BookieSocketAddress> fai
return new EnsembleInfo(newEnsemble, failedBookies, replacedBookies);
}

void handleDelayeWriteBookieFailure() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taken care

@@ -151,6 +153,10 @@
}
}

public Map<Integer, BookieSocketAddress> getDelayedWriteFailedBookies() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have to expose as 'public' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took care of it.

@@ -117,6 +118,7 @@
ScheduledFuture<?> timeoutFuture = null;

final long waitForWriteSetMs;
Map<Integer, BookieSocketAddress> delayedWriteFailedBookies = new HashMap<Integer, BookieSocketAddress>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why this is not a ConcurrentMap ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of or ordered safe executor, I thought a regular map is good enough.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the same. Just wanted to double check.

@jvrao
Copy link
Contributor Author

jvrao commented May 6, 2018

I wonder if we should add a config option in order to enable explicitly this change

@eolivelli I thought about it - Felt that it can just follow the same config path we use to make ensemble change on the failed add entry path. This patch still respects delayedEnsemble change and disableEnsembleChange configurations.

@jvrao
Copy link
Contributor Author

jvrao commented May 6, 2018

I also wonder if it is possible to use mockito based client side framework and save us from starting a real cluster in tests. (Not blocker for me)

Are you making a general comment about tests in this class? if so, maybe we can open an issue and deal with that separately?

@eolivelli
Copy link
Contributor

For me it is okay.
I would like to know @sijie 's opinion

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@eolivelli
Copy link
Contributor

Regarding the test: I did not think that this is not a new class, so okay for keeping your test as it is.

Regarding the map: okay for making it a concurrent map, in this case the map will be very small and rarely used so using a ConcurrentHashMap will not have significant impact and it makes things simpler. It can be a simple hashmap btw

Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvrao before giving a detailed review, just one general question:

any reason why we can't re-use bookieFailureHistory loading cache?

@@ -117,6 +118,7 @@
ScheduledFuture<?> timeoutFuture = null;

final long waitForWriteSetMs;
private Map<Integer, BookieSocketAddress> delayedWriteFailedBookies = new HashMap<Integer, BookieSocketAddress>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can do that; but would wait to see if you have any other comments.

@jvrao
Copy link
Contributor Author

jvrao commented May 7, 2018

any reason why we can't re-use bookieFailureHistory loading cache?

I thought the purpose is different and usage is different. In this case, it the index, not entryId that goes in with bookieIP, also this will be cleared as soon as the ensemble change attempted, and the population of this is based on the configuration parameters based on ensemble change etc etc. Moreover simple to have another field that is not bundled with something else.

Copy link
Member

@sijie sijie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jvrao looks good to me.

@sijie
Copy link
Member

sijie commented May 10, 2018

retest this please

2 similar comments
@jvrao
Copy link
Contributor Author

jvrao commented May 11, 2018

retest this please

@sijie
Copy link
Member

sijie commented May 17, 2018

retest this please

@sijie sijie closed this in a267478 May 17, 2018
ivankelly pushed a commit that referenced this pull request Aug 13, 2018
Descriptions of the changes in this PR:

The Original intent of this change is to do a best-effort ensemble change.
But this is not possible until the local metadata is completely immutable.
Until the feature "Make LedgerMetadata Immutable #610" Is complete we will use
handleBookieFailure() to handle delayed writes as regular bookie failures.

Signed-off-by: Venkateswararao Jujjuri (JV) <vjujjurisalesforce.com>

Master Issue: #1591
Relate Issue: #1395

Author: JV Jujjuri <vjujjuri@salesforce.com>
Author: Ivan Kelly <ivank@apache.org>

Reviewers: Ivan Kelly <ivank@apache.org>, Sijie Guo <sijie@apache.org>

This closes #1592 from jvrao/datalossbug
ivankelly pushed a commit that referenced this pull request Aug 13, 2018
Descriptions of the changes in this PR:

The Original intent of this change is to do a best-effort ensemble change.
But this is not possible until the local metadata is completely immutable.
Until the feature "Make LedgerMetadata Immutable #610" Is complete we will use
handleBookieFailure() to handle delayed writes as regular bookie failures.

Signed-off-by: Venkateswararao Jujjuri (JV) <vjujjurisalesforce.com>

Master Issue: #1591
Relate Issue: #1395

Author: JV Jujjuri <vjujjuri@salesforce.com>
Author: Ivan Kelly <ivank@apache.org>

Reviewers: Ivan Kelly <ivank@apache.org>, Sijie Guo <sijie@apache.org>

This closes #1592 from jvrao/datalossbug

(cherry picked from commit 3ab6e92)
Signed-off-by: Ivan Kelly <ivank@apache.org>
reddycharan pushed a commit to reddycharan/bookkeeper that referenced this pull request Aug 20, 2018
* Avoid releasing sent buffer to early in BookieClient mock

If the buffer was sent to more than one bookie with the mock, it would
be released after being sent to the first one. Each write should
retain a refCount themselves, and then release when done.

Author: Ivan Kelly <ivank@apache.org>

Reviewers: Sijie Guo <sijie@apache.org>

This closes apache#1598 from ivankelly/double-rel-mock

* (@bug W-5344681@) Delayed write ensemble change may cause dataloss

Descriptions of the changes in this PR:

The Original intent of this change is to do a best-effort ensemble change.
But this is not possible until the local metadata is completely immutable.
Until the feature "Make LedgerMetadata Immutable apache#610" Is complete we will use
handleBookieFailure() to handle delayed writes as regular bookie failures.

Signed-off-by: Venkateswararao Jujjuri (JV) <vjujjurisalesforce.com>

Master Issue: apache#1591
Relate Issue: apache#1395

Author: JV Jujjuri <vjujjuri@salesforce.com>
Author: Ivan Kelly <ivank@apache.org>

Reviewers: Ivan Kelly <ivank@apache.org>, Sijie Guo <sijie@apache.org>
@Rev Sam Just@

This closes apache#1592 from jvrao/datalossbug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants