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
91f07916
Commit
91f07916
authored
12 years ago
by
Jared Rosoff
Committed by
Robert J. Moore
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't use finalizers to close cursors
parent
218e2587
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
+6
-1
6 additions, 1 deletion
mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
with
6 additions
and
1 deletion
mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
+
6
−
1
View file @
91f07916
...
...
@@ -135,6 +135,7 @@ public class MongoDbClient extends DB {
System
.
out
.
println
(
"new database url = "
+
url
);
MongoClientOptions
options
=
MongoClientOptions
.
builder
()
.
cursorFinalizerEnabled
(
false
)
.
connectionsPerHost
(
Integer
.
parseInt
(
maxConnections
))
.
threadsAllowedToBlockForConnectionMultiplier
(
Integer
.
parseInt
(
threadsAllowedToBlockForConnectionMultiplier
))
...
...
@@ -373,6 +374,7 @@ public class MongoDbClient extends DB {
public
int
scan
(
String
table
,
String
startkey
,
int
recordcount
,
Set
<
String
>
fields
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
)
{
com
.
mongodb
.
DB
db
=
null
;
DBCursor
cursor
=
null
;
try
{
db
=
mongo
.
getDB
(
database
);
db
.
requestStart
();
...
...
@@ -380,7 +382,7 @@ public class MongoDbClient extends DB {
// { "_id":{"$gte":startKey, "$lte":{"appId":key+"\uFFFF"}} }
DBObject
scanRange
=
new
BasicDBObject
().
append
(
"$gte"
,
startkey
);
DBObject
q
=
new
BasicDBObject
().
append
(
"_id"
,
scanRange
);
DBCursor
cursor
=
collection
.
find
(
q
).
limit
(
recordcount
);
cursor
=
collection
.
find
(
q
).
limit
(
recordcount
);
while
(
cursor
.
hasNext
())
{
// toMap() returns a Map, but result.add() expects a
// Map<String,String>. Hence, the suppress warnings.
...
...
@@ -400,6 +402,9 @@ public class MongoDbClient extends DB {
}
finally
{
if
(
db
!=
null
)
{
if
(
cursor
!=
null
)
{
cursor
.
close
();
}
db
.
requestDone
();
}
}
...
...
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