Skip to content

Commit

Permalink
Merge pull request #120 from afking/fix-singlenn
Browse files Browse the repository at this point in the history
Fix rpc.resolveConnection() deadlock
  • Loading branch information
colinmarc authored Jun 22, 2018
2 parents 80906ea + 3a06ea5 commit 195e2c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
4 changes: 0 additions & 4 deletions rpc/namenode.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ func (c *NamenodeConnection) resolveConnection() error {
}

for _, host := range c.hostList {
if c.host == host {
continue
}

if host.lastErrorAt.After(time.Now().Add(-backoffDuration)) {
continue
}
Expand Down
19 changes: 19 additions & 0 deletions rpc/namenode_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package rpc

import (
"io"
"testing"
"time"

"github.com/stretchr/testify/assert"
)

func TestNamenodeConnection_resolveConnection(t *testing.T) {
conn := getNamenode(t)
conn.markFailure(io.EOF)

assert.Error(t, conn.resolveConnection())
conn.host.lastErrorAt = time.Now().Add(-backoffDuration)
assert.NoError(t, conn.resolveConnection())
cachedNamenode = nil
}

0 comments on commit 195e2c7

Please sign in to comment.