Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YCSB
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adnan Ahmad
YCSB
Commits
7233d37b
Commit
7233d37b
authored
9 years ago
by
Thomas Lopatic
Browse files
Options
Downloads
Patches
Plain Diff
[aerospike] Handle cluster overloads just like any other error.
parent
1eadd68c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aerospike/src/main/java/com/yahoo/ycsb/db/AerospikeClient.java
+8
-41
8 additions, 41 deletions
...pike/src/main/java/com/yahoo/ycsb/db/AerospikeClient.java
with
8 additions
and
41 deletions
aerospike/src/main/java/com/yahoo/ycsb/db/AerospikeClient.java
+
8
−
41
View file @
7233d37b
...
...
@@ -27,7 +27,6 @@ import com.aerospike.client.AerospikeException;
import
com.aerospike.client.Bin
;
import
com.aerospike.client.Key
;
import
com.aerospike.client.Record
;
import
com.aerospike.client.ResultCode
;
import
com.aerospike.client.policy.ClientPolicy
;
import
com.aerospike.client.policy.Policy
;
import
com.aerospike.client.policy.RecordExistsAction
;
...
...
@@ -38,8 +37,6 @@ import com.yahoo.ycsb.ByteIterator;
import
com.yahoo.ycsb.DBException
;
public
class
AerospikeClient
extends
com
.
yahoo
.
ycsb
.
DB
{
private
static
final
boolean
DEBUG
=
false
;
private
static
final
String
DEFAULT_HOST
=
"localhost"
;
private
static
final
String
DEFAULT_PORT
=
"3000"
;
private
static
final
String
DEFAULT_TIMEOUT
=
"10000"
;
...
...
@@ -48,9 +45,6 @@ public class AerospikeClient extends com.yahoo.ycsb.DB {
private
static
final
int
RESULT_OK
=
0
;
private
static
final
int
RESULT_ERROR
=
-
1
;
private
static
final
int
WRITE_OVERLOAD_DELAY
=
5
;
private
static
final
int
WRITE_OVERLOAD_TRIES
=
3
;
private
String
namespace
=
null
;
private
com
.
aerospike
.
client
.
AerospikeClient
client
=
null
;
...
...
@@ -116,10 +110,7 @@ public class AerospikeClient extends com.yahoo.ycsb.DB {
}
if
(
record
==
null
)
{
if
(
DEBUG
)
{
System
.
err
.
println
(
"Record key "
+
key
+
" not found (read)"
);
}
System
.
err
.
println
(
"Record key "
+
key
+
" not found (read)"
);
return
RESULT_ERROR
;
}
...
...
@@ -152,36 +143,15 @@ public class AerospikeClient extends com.yahoo.ycsb.DB {
++
index
;
}
int
delay
=
WRITE_OVERLOAD_DELAY
;
Key
keyObj
=
new
Key
(
namespace
,
table
,
key
);
for
(
int
tries
=
0
;
tries
<
WRITE_OVERLOAD_TRIES
;
++
tries
)
{
try
{
client
.
put
(
writePolicy
,
keyObj
,
bins
);
return
RESULT_OK
;
}
catch
(
AerospikeException
e
)
{
if
(
e
.
getResultCode
()
!=
ResultCode
.
DEVICE_OVERLOAD
)
{
System
.
err
.
println
(
"Error while writing key "
+
key
+
": "
+
e
);
return
RESULT_ERROR
;
}
try
{
Thread
.
sleep
(
delay
);
}
catch
(
InterruptedException
e2
)
{
if
(
DEBUG
)
{
System
.
err
.
println
(
"Interrupted: "
+
e2
);
}
}
delay
*=
2
;
}
}
if
(
DEBUG
)
{
System
.
err
.
println
(
"Device overload"
);
try
{
client
.
put
(
writePolicy
,
keyObj
,
bins
);
return
RESULT_OK
;
}
catch
(
AerospikeException
e
)
{
System
.
err
.
println
(
"Error while writing key "
+
key
+
": "
+
e
);
return
RESULT_ERROR
;
}
return
RESULT_ERROR
;
}
@Override
...
...
@@ -200,10 +170,7 @@ public class AerospikeClient extends com.yahoo.ycsb.DB {
public
int
delete
(
String
table
,
String
key
)
{
try
{
if
(!
client
.
delete
(
deletePolicy
,
new
Key
(
namespace
,
table
,
key
)))
{
if
(
DEBUG
)
{
System
.
err
.
println
(
"Record key "
+
key
+
" not found (delete)"
);
}
System
.
err
.
println
(
"Record key "
+
key
+
" not found (delete)"
);
return
RESULT_ERROR
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment