Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YCSB
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
042f1458
Commit
042f1458
authored
9 years ago
by
Robert J. Moore
Browse files
Options
Downloads
Patches
Plain Diff
#284 - Make sure the tests work with a <= 2.4 version of MongoDB.
parent
5a3d9763
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
mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
+9
-5
9 additions, 5 deletions
mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
with
9 additions
and
5 deletions
mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
+
9
−
5
View file @
042f1458
...
...
@@ -129,7 +129,7 @@ public class MongoDbClient extends DB {
Document
query
=
new
Document
(
"_id"
,
key
);
DeleteResult
result
=
collection
.
withWriteConcern
(
writeConcern
)
.
deleteOne
(
query
);
if
(
result
.
getDeletedCount
()
==
0
)
{
if
(
result
.
wasAcknowledged
()
&&
result
.
getDeletedCount
()
==
0
)
{
System
.
err
.
println
(
"Nothing deleted for key "
+
key
);
return
1
;
}
...
...
@@ -253,11 +253,14 @@ public class MongoDbClient extends DB {
if
(
batchSize
<=
1
)
{
UpdateResult
result
=
collection
.
withWriteConcern
(
writeConcern
)
.
replaceOne
(
criteria
,
toInsert
,
UPSERT
);
if
(
result
.
getMatchedCount
()
>
0
||
result
.
getModifiedCount
()
>
0
if
(!
result
.
wasAcknowledged
()
||
result
.
getMatchedCount
()
>
0
||
(
result
.
isModifiedCountAvailable
()
&&
(
result
.
getModifiedCount
()
>
0
))
||
result
.
getUpsertedId
()
!=
null
)
{
return
0
;
}
System
.
err
.
println
(
"Nothing inserted for key "
+
key
);
return
1
;
}
...
...
@@ -272,7 +275,8 @@ public class MongoDbClient extends DB {
BulkWriteResult
result
=
collection
.
withWriteConcern
(
writeConcern
).
bulkWrite
(
bulkInserts
,
new
BulkWriteOptions
().
ordered
(
false
));
if
(
result
.
getInsertedCount
()
==
bulkInserts
.
size
())
{
if
(!
result
.
wasAcknowledged
()
||
result
.
getInsertedCount
()
==
bulkInserts
.
size
())
{
bulkInserts
.
clear
();
return
0
;
}
...
...
@@ -445,7 +449,7 @@ public class MongoDbClient extends DB {
UpdateResult
result
=
collection
.
withWriteConcern
(
writeConcern
)
.
updateOne
(
query
,
update
);
if
(
result
.
getMatchedCount
()
==
0
)
{
if
(
result
.
wasAcknowledged
()
&&
result
.
getMatchedCount
()
==
0
)
{
System
.
err
.
println
(
"Nothing updated for key "
+
key
);
return
1
;
}
...
...
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