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
de0579e6
Commit
de0579e6
authored
9 years ago
by
Biju Nair
Browse files
Options
Downloads
Patches
Plain Diff
[hbase098] Changes to use single HBase connection across all the threads
parent
6cd94e88
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
hbase098/src/main/java/com/yahoo/ycsb/db/HBaseClient.java
+14
-4
14 additions, 4 deletions
hbase098/src/main/java/com/yahoo/ycsb/db/HBaseClient.java
with
14 additions
and
4 deletions
hbase098/src/main/java/com/yahoo/ycsb/db/HBaseClient.java
+
14
−
4
View file @
de0579e6
...
...
@@ -50,6 +50,7 @@ import java.util.Properties;
import
java.util.Random
;
import
java.util.Set
;
import
java.util.Vector
;
import
java.util.concurrent.atomic.AtomicInteger
;
/**
* HBase client for YCSB framework
...
...
@@ -59,11 +60,12 @@ public class HBaseClient extends com.yahoo.ycsb.DB
// BFC: Change to fix broken build (with HBase 0.20.6)
//private static final Configuration config = HBaseConfiguration.create();
private
static
final
Configuration
config
=
HBaseConfiguration
.
create
();
//new HBaseConfiguration();
private
static
final
AtomicInteger
THREAD_COUNT
=
new
AtomicInteger
(
0
);
public
boolean
_debug
=
false
;
public
String
_table
=
""
;
p
ubl
ic
HConnection
_hConn
=
null
;
p
rivate
stat
ic
HConnection
_hConn
=
null
;
public
HTableInterface
_hTable
=
null
;
public
String
_columnFamily
=
""
;
public
byte
_columnFamilyBytes
[];
...
...
@@ -112,7 +114,12 @@ public class HBaseClient extends com.yahoo.ycsb.DB
}
}
try
{
_hConn
=
HConnectionManager
.
createConnection
(
config
);
THREAD_COUNT
.
getAndIncrement
();
synchronized
(
THREAD_COUNT
)
{
if
(
_hConn
==
null
){
_hConn
=
HConnectionManager
.
createConnection
(
config
);
}
}
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
"Connection to HBase was not successful"
);
throw
new
DBException
(
e
);
...
...
@@ -154,8 +161,11 @@ public class HBaseClient extends com.yahoo.ycsb.DB
if
(
_hTable
!=
null
)
{
_hTable
.
flushCommits
();
}
if
(
_hConn
!=
null
)
{
_hConn
.
close
();
synchronized
(
THREAD_COUNT
)
{
int
threadCount
=
THREAD_COUNT
.
decrementAndGet
();
if
(
threadCount
<=
0
&&
_hConn
!=
null
)
{
_hConn
.
close
();
}
}
long
en
=
System
.
nanoTime
();
_measurements
.
measure
(
"UPDATE"
,
(
int
)((
en
-
st
)/
1000
));
...
...
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