mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
handle async errors in a way that doesn't hide details
This commit is contained in:
parent
5cf0fbcaec
commit
675667eaa6
@ -36,9 +36,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.CompletionStage;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: add statement filtering
|
// TODO: add statement filtering
|
||||||
@ -121,9 +119,15 @@ public abstract class Cqld4CqlOp implements CycleOp<List<Row>>, VariableCapture,
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
return rowsStage.toCompletableFuture().get(300, TimeUnit.SECONDS);
|
return rowsStage.toCompletableFuture().get(300, TimeUnit.SECONDS);
|
||||||
} catch (Exception e) {
|
} catch (ExecutionException exe) {
|
||||||
if (e instanceof RuntimeException re) throw re;
|
Throwable ee = exe.getCause();
|
||||||
throw new RuntimeException(e);
|
if (ee instanceof RuntimeException re) {
|
||||||
|
throw re;
|
||||||
|
} else throw new NBExecutionException(exe);
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
throw new NBInterruptedException(ie);
|
||||||
|
} catch (TimeoutException e) {
|
||||||
|
throw new NBTimeoutException(e);
|
||||||
} finally {
|
} finally {
|
||||||
processors.flush();
|
processors.flush();
|
||||||
metrics.recordFetchedPages(fetchedPages);
|
metrics.recordFetchedPages(fetchedPages);
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 nosqlbench
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.nosqlbench.adapter.cqld4.optypes;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public class NBExecutionException extends RuntimeException {
|
||||||
|
private final ExecutionException exception;
|
||||||
|
|
||||||
|
public NBExecutionException(ExecutionException e) {
|
||||||
|
this.exception = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "Wrapped Exception: " + exception.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StackTraceElement[] getStackTrace() {
|
||||||
|
return exception.getStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized Throwable getCause() {
|
||||||
|
return exception.getCause();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 nosqlbench
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.nosqlbench.adapter.cqld4.optypes;
|
||||||
|
|
||||||
|
public class NBInterruptedException extends RuntimeException {
|
||||||
|
private final InterruptedException exception;
|
||||||
|
|
||||||
|
public NBInterruptedException(InterruptedException e) {
|
||||||
|
this.exception = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "Wrapped Exception: " + exception.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StackTraceElement[] getStackTrace() {
|
||||||
|
return exception.getStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized Throwable getCause() {
|
||||||
|
return exception.getCause();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 nosqlbench
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.nosqlbench.adapter.cqld4.optypes;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
|
public class NBTimeoutException extends RuntimeException {
|
||||||
|
private final TimeoutException exception;
|
||||||
|
|
||||||
|
public NBTimeoutException(TimeoutException e) {
|
||||||
|
this.exception = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "Wrapped Exception: " + exception.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StackTraceElement[] getStackTrace() {
|
||||||
|
return exception.getStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized Throwable getCause() {
|
||||||
|
return exception.getCause();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user