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
7f8fa82e
There was an error fetching the commit references. Please try again later.
Commit
7f8fa82e
authored
13 years ago
by
Swapnil Bawaskar
Browse files
Options
Downloads
Patches
Plain Diff
using ByteIterator instead of String for field values.
parent
e1297f5e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
db/gemfire/src/com/yahoo/ycsb/db/GemFireClient.java
+27
-14
27 additions, 14 deletions
db/gemfire/src/com/yahoo/ycsb/db/GemFireClient.java
with
27 additions
and
14 deletions
db/gemfire/src/com/yahoo/ycsb/db/GemFireClient.java
+
27
−
14
View file @
7f8fa82e
...
@@ -18,8 +18,11 @@ import com.gemstone.gemfire.cache.client.ClientCacheFactory;
...
@@ -18,8 +18,11 @@ import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import
com.gemstone.gemfire.cache.client.ClientRegionFactory
;
import
com.gemstone.gemfire.cache.client.ClientRegionFactory
;
import
com.gemstone.gemfire.cache.client.ClientRegionShortcut
;
import
com.gemstone.gemfire.cache.client.ClientRegionShortcut
;
import
com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId
;
import
com.gemstone.gemfire.internal.admin.remote.DistributionLocatorId
;
import
com.yahoo.ycsb.ByteArrayByteIterator
;
import
com.yahoo.ycsb.ByteIterator
;
import
com.yahoo.ycsb.DB
;
import
com.yahoo.ycsb.DB
;
import
com.yahoo.ycsb.DBException
;
import
com.yahoo.ycsb.DBException
;
import
com.yahoo.ycsb.StringByteIterator
;
/**
/**
* VMware vFabric GemFire client for the YCSB benchmark.<br />
* VMware vFabric GemFire client for the YCSB benchmark.<br />
...
@@ -124,15 +127,17 @@ public class GemFireClient extends DB {
...
@@ -124,15 +127,17 @@ public class GemFireClient extends DB {
@Override
@Override
public
int
read
(
String
table
,
String
key
,
Set
<
String
>
fields
,
public
int
read
(
String
table
,
String
key
,
Set
<
String
>
fields
,
HashMap
<
String
,
String
>
result
)
{
HashMap
<
String
,
ByteIterator
>
result
)
{
Region
<
String
,
Map
<
String
,
String
>>
r
=
getRegion
(
table
);
Region
<
String
,
Map
<
String
,
byte
[]
>>
r
=
getRegion
(
table
);
Map
<
String
,
String
>
val
=
r
.
get
(
key
);
Map
<
String
,
byte
[]
>
val
=
r
.
get
(
key
);
if
(
val
!=
null
)
{
if
(
val
!=
null
)
{
if
(
fields
==
null
)
{
if
(
fields
==
null
)
{
result
.
putAll
(
val
);
for
(
String
k
:
val
.
keySet
())
{
result
.
put
(
key
,
new
ByteArrayByteIterator
(
val
.
get
(
key
)));
}
}
else
{
}
else
{
for
(
String
field
:
fields
)
{
for
(
String
field
:
fields
)
{
result
.
put
(
field
,
val
.
get
(
field
));
result
.
put
(
field
,
new
ByteArrayByteIterator
(
val
.
get
(
field
))
)
;
}
}
}
}
return
SUCCESS
;
return
SUCCESS
;
...
@@ -142,20 +147,20 @@ public class GemFireClient extends DB {
...
@@ -142,20 +147,20 @@ public class GemFireClient extends DB {
@Override
@Override
public
int
scan
(
String
table
,
String
startkey
,
int
recordcount
,
public
int
scan
(
String
table
,
String
startkey
,
int
recordcount
,
Set
<
String
>
fields
,
Vector
<
HashMap
<
String
,
String
>>
result
)
{
Set
<
String
>
fields
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
)
{
// GemFire does not support scan
// GemFire does not support scan
return
ERROR
;
return
ERROR
;
}
}
@Override
@Override
public
int
update
(
String
table
,
String
key
,
HashMap
<
String
,
String
>
values
)
{
public
int
update
(
String
table
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
)
{
getRegion
(
table
).
put
(
key
,
values
);
getRegion
(
table
).
put
(
key
,
convertToBytearrayMap
(
values
)
)
;
return
0
;
return
0
;
}
}
@Override
@Override
public
int
insert
(
String
table
,
String
key
,
HashMap
<
String
,
String
>
values
)
{
public
int
insert
(
String
table
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
)
{
getRegion
(
table
).
put
(
key
,
values
);
getRegion
(
table
).
put
(
key
,
convertToBytearrayMap
(
values
)
)
;
return
0
;
return
0
;
}
}
...
@@ -165,15 +170,23 @@ public class GemFireClient extends DB {
...
@@ -165,15 +170,23 @@ public class GemFireClient extends DB {
return
0
;
return
0
;
}
}
private
Region
<
String
,
Map
<
String
,
String
>>
getRegion
(
String
table
)
{
private
Map
<
String
,
byte
[]>
convertToBytearrayMap
(
Map
<
String
,
ByteIterator
>
values
)
{
Region
<
String
,
Map
<
String
,
String
>>
r
=
cache
.
getRegion
(
table
);
Map
<
String
,
byte
[]>
retVal
=
new
HashMap
<
String
,
byte
[]>();
for
(
String
key
:
values
.
keySet
())
{
retVal
.
put
(
key
,
values
.
get
(
key
).
toArray
());
}
return
retVal
;
}
private
Region
<
String
,
Map
<
String
,
byte
[]>>
getRegion
(
String
table
)
{
Region
<
String
,
Map
<
String
,
byte
[]>>
r
=
cache
.
getRegion
(
table
);
if
(
r
==
null
)
{
if
(
r
==
null
)
{
try
{
try
{
if
(
isClient
)
{
if
(
isClient
)
{
ClientRegionFactory
<
String
,
Map
<
String
,
String
>>
crf
=
((
ClientCache
)
cache
).
createClientRegionFactory
(
ClientRegionShortcut
.
PROXY
);
ClientRegionFactory
<
String
,
Map
<
String
,
byte
[]
>>
crf
=
((
ClientCache
)
cache
).
createClientRegionFactory
(
ClientRegionShortcut
.
PROXY
);
r
=
crf
.
create
(
table
);
r
=
crf
.
create
(
table
);
}
else
{
}
else
{
RegionFactory
<
String
,
Map
<
String
,
String
>>
rf
=
((
Cache
)
cache
).
createRegionFactory
(
RegionShortcut
.
PARTITION
);
RegionFactory
<
String
,
Map
<
String
,
byte
[]
>>
rf
=
((
Cache
)
cache
).
createRegionFactory
(
RegionShortcut
.
PARTITION
);
r
=
rf
.
create
(
table
);
r
=
rf
.
create
(
table
);
}
}
}
catch
(
RegionExistsException
e
)
{
}
catch
(
RegionExistsException
e
)
{
...
...
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