jojochuang commented on a change in pull request #1885:
URL: https://github.com/apache/hadoop/pull/1885#discussion_r425910217
##########
File path:
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/shortcircuit/ShortCircuitCache.java
##########
@@ -181,25 +182,49 @@ public long getRateInMs() {
@Override
public void run() {
+ if (slot == null) {
+ return;
+ }
LOG.trace("{}: about to release {}", ShortCircuitCache.this, slot);
final DfsClientShm shm = (DfsClientShm)slot.getShm();
final DomainSocket shmSock = shm.getPeer().getDomainSocket();
final String path = shmSock.getPath();
+ DataOutputStream out = null;
boolean success = false;
- try (DomainSocket sock = DomainSocket.connect(path);
- DataOutputStream out = new DataOutputStream(
- new BufferedOutputStream(sock.getOutputStream()))) {
- new Sender(out).releaseShortCircuitFds(slot.getSlotId());
- DataInputStream in = new DataInputStream(sock.getInputStream());
- ReleaseShortCircuitAccessResponseProto resp =
- ReleaseShortCircuitAccessResponseProto.parseFrom(
- PBHelperClient.vintPrefixed(in));
- if (resp.getStatus() != Status.SUCCESS) {
- String error = resp.hasError() ? resp.getError() : "(unknown)";
- throw new IOException(resp.getStatus().toString() + ": " + error);
+ int retries = 2;
+ try {
+ while (retries > 0) {
+ try {
+ if (domainSocket == null || !domainSocket.isOpen()) {
+ // we are running in single thread mode, no protection needed for
Review comment:
not that familiar with short circuit read. Is true that it's single
threaded?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]