Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
nfs4j
Commits
cf8ea4a5
Commit
cf8ea4a5
authored
Sep 09, 2020
by
Tigran Mkrtchyan
☕
Browse files
nfs-client: add a simple retry loop for transient errors
Acked-by: Paul Millar Acked-by: Lea Morschel Target: master
parent
311f34fe
Pipeline
#119
passed with stages
in 2 minutes and 41 seconds
Changes
1
Pipelines
4
Show whitespace changes
Inline
Side-by-side
basic-client/src/main/java/org/dcache/nfs/v4/client/Main.java
View file @
cf8ea4a5
...
...
@@ -42,6 +42,7 @@ import java.util.OptionalLong;
import
java.util.UUID
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ThreadLocalRandom
;
import
java.util.concurrent.TimeUnit
;
import
org.jline.reader.EndOfFileException
;
...
...
@@ -1052,10 +1053,7 @@ public class Main {
*/
do
{
compound4res
=
_nfsClient
.
NFSPROC4_COMPOUND_4
(
compound4args
);
if
(
compound4res
.
status
==
nfsstat
.
NFSERR_GRACE
)
{
System
.
out
.
println
(
"Server in GRACE period....retry"
);
}
}
while
(
compound4res
.
status
==
nfsstat
.
NFSERR_GRACE
);
}
while
(
canRetry
(
compound4res
.
status
,
compound4args
.
tag
.
toString
()));
nfsstat
.
throwIfNeeded
(
compound4res
.
status
);
return
compound4res
;
...
...
@@ -1098,10 +1096,7 @@ public class Main {
compound4res
=
_nfsClient
.
NFSPROC4_COMPOUND_4
(
compound4args
);
_lastUpdate
=
System
.
currentTimeMillis
();
if
(
compound4res
.
status
==
nfsstat
.
NFSERR_GRACE
)
{
System
.
out
.
println
(
"Server in GRACE period....retry"
);
}
}
while
(
compound4res
.
status
==
nfsstat
.
NFSERR_GRACE
);
}
while
(
canRetry
(
compound4res
.
status
,
compound4args
.
tag
.
toString
()));
nfsstat
.
throwIfNeeded
(
compound4res
.
status
);
return
compound4res
;
...
...
@@ -1110,6 +1105,27 @@ public class Main {
}
}
private
boolean
canRetry
(
int
status
,
String
compound
)
{
switch
(
status
)
{
case
nfsstat
.
NFSERR_DELAY
:
case
nfsstat
.
NFSERR_LAYOUTTRYLATER
:
case
nfsstat
.
NFSERR_GRACE
:
System
.
out
.
println
(
"Retrying "
+
compound
+
" on "
+
nfsstat
.
toString
(
status
));
try
{
TimeUnit
.
SECONDS
.
sleep
(
ThreadLocalRandom
.
current
().
nextInt
(
5
));
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
return
false
;
}
return
true
;
default
:
return
false
;
}
}
private
void
get_deviceinfo
(
deviceid4
deviceId
)
throws
OncRpcException
,
IOException
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment