-
Notifications
You must be signed in to change notification settings - Fork 455
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
implements interuption of compactions and adds an IT to verify compaction cancels on tablet migration #5395
Open
keith-turner
wants to merge
4
commits into
apache:2.1
Choose a base branch
from
keith-turner:compaction-cancel-it
base: 2.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cd894c5
adds an IT to verify compaction cancels on tablet migration
keith-turner b6d2f42
updates test and adds compaction interruption
keith-turner 4e24af0
fix compiler warning
keith-turner 7d39c8d
moved compaction thread interruption to FileCompactor
keith-turner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,6 @@ | |
*/ | ||
package org.apache.accumulo.test.functional; | ||
|
||
import static org.apache.accumulo.core.util.UtilWaitThread.sleepUninterruptibly; | ||
|
||
import java.io.IOException; | ||
import java.util.Collection; | ||
import java.util.Map; | ||
|
@@ -33,14 +31,17 @@ | |
import org.apache.accumulo.core.iterators.IteratorEnvironment; | ||
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; | ||
import org.apache.accumulo.core.iterators.WrappingIterator; | ||
import org.apache.accumulo.core.util.UtilWaitThread; | ||
|
||
public class SlowIterator extends WrappingIterator { | ||
|
||
private static final String SLEEP_TIME = "sleepTime"; | ||
private static final String SEEK_SLEEP_TIME = "seekSleepTime"; | ||
private static final String SLEEP_UNINTERRUPTIBLY = "sleepUninterruptibly"; | ||
|
||
private long sleepTime = 0; | ||
private long seekSleepTime = 0; | ||
private boolean sleepUninterruptibly = true; | ||
|
||
public static void setSleepTime(IteratorSetting is, long millis) { | ||
is.addOption(SLEEP_TIME, Long.toString(millis)); | ||
|
@@ -50,21 +51,37 @@ public static void setSeekSleepTime(IteratorSetting is, long t) { | |
is.addOption(SEEK_SLEEP_TIME, Long.toString(t)); | ||
} | ||
|
||
public static void sleepUninterruptibly(IteratorSetting is, boolean b) { | ||
is.addOption(SLEEP_UNINTERRUPTIBLY, Boolean.toString(b)); | ||
} | ||
|
||
private void sleep(long time) throws IOException { | ||
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 checked these changes by jstacking a tablet server running the new test and verifying that compaction threads were sleeping both ways. |
||
if (sleepUninterruptibly) { | ||
UtilWaitThread.sleepUninterruptibly(time, TimeUnit.MILLISECONDS); | ||
} else { | ||
try { | ||
Thread.sleep(sleepTime); | ||
} catch (InterruptedException e) { | ||
throw new IOException(e); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public void next() throws IOException { | ||
sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS); | ||
sleep(sleepTime); | ||
super.next(); | ||
} | ||
|
||
@Override | ||
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) | ||
throws IOException { | ||
sleepUninterruptibly(seekSleepTime, TimeUnit.MILLISECONDS); | ||
sleep(seekSleepTime); | ||
super.seek(range, columnFamilies, inclusive); | ||
} | ||
|
||
|
@@ -79,6 +96,10 @@ public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> op | |
if (options.containsKey(SEEK_SLEEP_TIME)) { | ||
seekSleepTime = Long.parseLong(options.get(SEEK_SLEEP_TIME)); | ||
} | ||
|
||
if (options.containsKey(SLEEP_UNINTERRUPTIBLY)) { | ||
sleepUninterruptibly = Boolean.parseBoolean(options.get(SLEEP_UNINTERRUPTIBLY)); | ||
} | ||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This test usually passes for me, every once in a while it will get stuck here w/ less than the expected 40 compactions. Probably some issue w/ the propagation of compaction config changes.