-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18463. Add an integration test process data asynchronously during vectored read. #4921
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
HADOOP-18463. Add an integration test process data asynchronously during vectored read. #4921
Conversation
…ing vectored read. part of HADOOP-18103.
🎊 +1 overall
This message was automatically generated. |
} | ||
}); | ||
} | ||
if (!countDown.await(100, TimeUnit.SECONDS)) { |
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.
timeout should be a static constant and more visible
}); | ||
} | ||
if (!countDown.await(100, TimeUnit.SECONDS)) { | ||
throw new AssertionError("Error while processing vectored io results"); |
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.
declare timeout
try { | ||
readBufferValidateDataAndReturnToPool(pool, res, countDown); | ||
} catch (Exception e) { | ||
LOG.error("Error while process result for {} ", res, 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.
should be saved to a field/variable, with junit thread rethrowing if the value is non null
} | ||
} finally { | ||
pool.release(); | ||
HadoopExecutors.shutdown(dataProcessor, LOG, 100, TimeUnit.SECONDS); |
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.
use same constant as proposed for L100
throw new AssertionError("Error while processing vectored io results"); | ||
} | ||
} finally { | ||
pool.release(); |
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.
how about adding an assert on L408 that the pool has its buffers returned?
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.
Actually I shouldn't be calling pool.release() here as it is a shared pool by all the tests. Initially I started with a new pool for this specific test then moved to the common one.
CountDownLatch countDownLatch) | ||
throws IOException, TimeoutException { | ||
CompletableFuture<ByteBuffer> data = res.getData(); | ||
ByteBuffer buffer = FutureIO.awaitFuture(data, |
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.
I think we all -you, me, everyone else- needs to spend some time working with CompletableFuture and chaining them.
In this code
data.thenAccept(buffer -> {
// all the validation
});
and await() for that.
It's a mess because java's checked exceptions cripple their lambda-expression methods when IO operations are invoked. But if we trying to live in their world at least we will get more insight into how we could actually improve our own code to work better there. Though it may of course be too late by now.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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.
changes are good, some minor nits
+1 pending those
"vecRead", buffer, res.getLength(), DATASET); | ||
// return buffer to the pool once read. | ||
pool.putBuffer(buffer); | ||
}), VECTORED_READ_OPERATION_TEST_TIMEOUT_SECONDS, TimeUnit.SECONDS); |
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.
nit: put the timeout + unit on a new line
} | ||
} finally { | ||
pool.release(); | ||
HadoopExecutors.shutdown(dataProcessor, LOG, 100, TimeUnit.SECONDS); |
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.
use VECTORED_READ_OPERATION_TEST_TIMEOUT_SECONDS,
🎊 +1 overall
This message was automatically generated. |
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.
+1
…during vectored read. (#4921) part of HADOOP-18103. Contributed by: Mukund Thakur
…during vectored read. (#4921) part of HADOOP-18103. Contributed by: Mukund Thakur
…during vectored read. (apache#4921) part of HADOOP-18103. Contributed by: Mukund Thakur
part of HADOOP-18103.
Description of PR
How was this patch tested?
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?