Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
import org.apache.hadoop.ozone.om.helpers.OmMultipartInfo;
import org.apache.hadoop.ozone.om.ratis.OzoneManagerStateMachine;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
import org.apache.ozone.test.GenericTestUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -323,7 +324,11 @@ public void testParallelDeleteBucketAndCreateKey() throws IOException,
omSM.getHandler().setInjector(injector);
thread1.start();
thread2.start();
Thread.sleep(2000);
// Wait long enough for createKey's preExecute to finish executing
GenericTestUtils.waitFor(() -> {
return getCluster().getOzoneManager().getOmServerProtocol().getLastRequestToSubmit().getCmdType().equals(
Type.CreateKey);
}, 100, 10000);
injector.resume();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public class OzoneManagerProtocolServerSideTranslatorPB implements OzoneManagerP
// always true, only used in tests
private boolean shouldFlushCache = true;

private OMRequest lastRequestToSubmit;


/**
* Constructs an instance of the server handler.
*
Expand Down Expand Up @@ -210,6 +213,7 @@ private OMResponse internalProcessRequest(OMRequest request) throws
assert (omClientRequest != null);
OMClientRequest finalOmClientRequest = omClientRequest;
requestToSubmit = preExecute(finalOmClientRequest);
this.lastRequestToSubmit = requestToSubmit;
} catch (IOException ex) {
if (omClientRequest != null) {
omClientRequest.handleRequestFailure(ozoneManager);
Expand All @@ -233,6 +237,11 @@ private OMRequest preExecute(OMClientRequest finalOmClientRequest)
() -> finalOmClientRequest.preExecute(ozoneManager));
}

@VisibleForTesting
public OMRequest getLastRequestToSubmit() {
return lastRequestToSubmit;
}

/**
* Submits request to OM's Ratis server.
*/
Expand Down