Skip to content

Commit

Permalink
fixup! Fix: Kill existing jobs before retry to prevent JobAlreadyExis…
Browse files Browse the repository at this point in the history
…ts errors
  • Loading branch information
Philipp Bogensberger committed Jul 1, 2015
1 parent 83f85e5 commit b9efcf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ public void onFailure(final @Nonnull Throwable t) {
if (t instanceof CancellationException) {
message = Constants.KILLED_MESSAGE;
logger.debug("KILLED: [{}]", request.stmt());
} else if ((Exceptions.unwrap(t) instanceof IndexShardMissingException )
&& attempt <= MAX_SHARD_MISSING_RETRIES) {
} else if (Exceptions.unwrap(t) instanceof IndexShardMissingException && attempt <= MAX_SHARD_MISSING_RETRIES) {
logger.debug("FAILED ({}/{} attempts) - Retry: [{}]", attempt, MAX_SHARD_MISSING_RETRIES, request.stmt());
killJobs(ImmutableList.of(plan.jobId()), new FutureCallback<Long>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,7 @@ public void testSelectWhileShardsAreRelocating() throws Throwable {
new Object[] { "Trillian", "a" },
});
execute("refresh table t");
execute("set global stats.enabled=true");

final AtomicReference<Throwable> lastThrowable = new AtomicReference<>();
final CountDownLatch selects = new CountDownLatch(100);
Expand All @@ -1917,8 +1918,6 @@ public void run() {
execute("select * from t");
} catch (Throwable t) {
// The failed job should have three started operations
execute("reset global stats.enabled");
execute("set global stats.enabled=true");
SQLResponse res = execute("select id from sys.jobs_log where error is not null order by started desc limit 1");
if (res.rowCount() > 0) {
String id = (String) res.rows()[0][0];
Expand Down Expand Up @@ -1951,7 +1950,7 @@ public void run() {
nodeSwap.put(nodeIds.get(0), nodeIds.get(1));
nodeSwap.put(nodeIds.get(1), nodeIds.get(0));

final CountDownLatch relocations = new CountDownLatch(10);
final CountDownLatch relocations = new CountDownLatch(20);
Thread relocatingThread = new Thread(new Runnable() {
@Override
public void run() {
Expand Down

0 comments on commit b9efcf3

Please sign in to comment.