-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add guard to setMode for NTEs #598
base: palantir-cassandra-2.2.18
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1543,6 +1543,13 @@ private void setMode(Mode m, boolean log) | |
@VisibleForTesting | ||
void setMode(Mode m, @Safe String msg, boolean log) | ||
{ | ||
if (operationMode == Mode.NON_TRANSIENT_ERROR && m != Mode.NON_TRANSIENT_ERROR) { | ||
if (log) | ||
logger.warn("Attempted to change mode from NTE to non-NTE", SafeArg.of("attemptedSetMode", m), SafeArg.of("msg", msg)); | ||
else | ||
logger.debug("Attempted to change mode from NTE to non-NTE", SafeArg.of("attemptedSetMode", m), SafeArg.of("msg", msg)); | ||
return; | ||
} | ||
operationMode = m; | ||
if (log) | ||
logger.info(m.toString(), SafeArg.of("msg", msg)); | ||
|
@@ -1599,9 +1606,19 @@ private boolean bootstrap(final Collection<Token> tokens) | |
ListenableFuture<StreamState> bootstrapStream = bootstrapper.bootstrap(streamStateStore, !replacing && useStrictConsistency); // handles token update | ||
try | ||
{ | ||
bootstrapStream.get(); | ||
while (true) { | ||
if (bootstrapStream.isDone()) { | ||
bootstrapStream.get(); | ||
logger.info("Bootstrap streaming completed for tokens {}", tokens); | ||
break; | ||
} | ||
if (hasNonTransientError(NonTransientError.BOOTSTRAP_ERROR)) { | ||
logger.info("Stopped waiting for bootstrap streaming to complete because detected a bootstrap error.", SafeArg.of("nonTransientErrors", getNonTransientErrors())); | ||
break; | ||
} | ||
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might be able to do less aggressive polling while keeping the reactivity by doing something like
If we stop waiting for the streams, is there a way to also notify peers/shut down stream early? Or will the following There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm, why is this less aggressive polling? if possible, i'd like to avoid using exceptions for control flow and i think i don't recognize the benefit here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
i'll test this tomorrow to see if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
isBootstrapMode = false; | ||
logger.info("Bootstrap streaming completed for tokens {}", tokens); | ||
return !StorageService.instance.hasNonTransientError(StorageServiceMBean.NonTransientError.BOOTSTRAP_ERROR); | ||
} | ||
catch (Throwable e) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify: log with warn no matter the value of
log
, I think this is always worth a warning log