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
1c8c628d
Commit
1c8c628d
authored
9 years ago
by
bigbes
Browse files
Options
Downloads
Patches
Plain Diff
Code review fixes
parent
bf4c4e57
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/ycsb
+2
-2
2 additions, 2 deletions
bin/ycsb
tarantool/src/main/java/com/yahoo/ycsb/db/TarantoolClient.java
+40
-27
40 additions, 27 deletions
...tool/src/main/java/com/yahoo/ycsb/db/TarantoolClient.java
with
42 additions
and
29 deletions
bin/ycsb
+
2
−
2
View file @
1c8c628d
...
...
@@ -48,8 +48,8 @@ DATABASES = {
"
nosqldb
"
:
"
com.yahoo.ycsb.db.NoSqlDbClient
"
,
"
orientdb
"
:
"
com.yahoo.ycsb.db.OrientDBClient
"
,
"
redis
"
:
"
com.yahoo.ycsb.db.RedisClient
"
,
"
tarantool
"
:
"
com.yahoo.ycsb.db.TarantoolClient
"
"
voldemort
"
:
"
com.yahoo.ycsb.db.VoldemortClient
"
,
"
tarantool
"
:
"
com.yahoo.ycsb.db.TarantoolClient
"
,
"
voldemort
"
:
"
com.yahoo.ycsb.db.VoldemortClient
"
}
OPTIONS
=
{
...
...
This diff is collapsed.
Click to expand it.
tarantool/src/main/java/com/yahoo/ycsb/db/TarantoolClient.java
+
40
−
27
View file @
1c8c628d
/**
* Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package
com.yahoo.ycsb.db
;
import
java.util.Map
;
...
...
@@ -5,17 +21,14 @@ import java.util.Set;
import
java.util.List
;
import
java.util.Arrays
;
import
java.util.Vector
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.HashMap
;
import
java.util.Properties
;
import
java.
io.IOException
;
import
java.util.logging.Level
;
import
java.
util.logging.Logger
;
import
org.tarantool.TarantoolConnection16
;
import
org.tarantool.TarantoolConnection16Impl
;
import
org.tarantool.TarantoolException
;
import
org.tarantool.CommunicationException
;
import
com.yahoo.ycsb.DB
;
import
com.yahoo.ycsb.DBException
;
...
...
@@ -23,7 +36,7 @@ import com.yahoo.ycsb.ByteIterator;
import
com.yahoo.ycsb.StringByteIterator
;
public
class
TarantoolClient
extends
DB
{
public
static
final
String
HOST_PROPERTY
=
"tarantool.host"
;
public
static
final
String
PORT_PROPERTY
=
"tarantool.port"
;
public
static
final
String
SPACE_PROPERTY
=
"tarantool.space"
;
...
...
@@ -31,9 +44,9 @@ public class TarantoolClient extends DB {
public
static
final
String
DEFAULT_HOST
=
"localhost"
;
public
static
final
int
DEFAULT_PORT
=
3301
;
public
static
final
int
DEFAULT_SPACE
=
1024
;
private
static
final
Logger
log
=
Logger
.
getLogger
(
TarantoolClient
.
class
.
getName
());
private
TarantoolConnection16
Impl
connection
;
private
static
final
Logger
log
ger
=
Logger
.
getLogger
(
TarantoolClient
.
class
.
getName
());
private
TarantoolConnection16
connection
;
private
int
spaceNo
;
public
void
init
()
throws
DBException
{
...
...
@@ -49,7 +62,7 @@ public class TarantoolClient extends DB {
if
(
host
==
null
)
{
host
=
DEFAULT_HOST
;
}
spaceNo
=
DEFAULT_SPACE
;
String
spaceString
=
props
.
getProperty
(
SPACE_PROPERTY
);
if
(
spaceString
!=
null
)
{
...
...
@@ -58,14 +71,12 @@ public class TarantoolClient extends DB {
try
{
this
.
connection
=
new
TarantoolConnection16Impl
(
host
,
port
);
}
catch
(
Exception
exc
)
{
System
.
err
.
println
(
"Can't init Tarantool connection:"
+
exc
.
toString
());
exc
.
printStackTrace
();
}
catch
(
Exception
exc
)
{
logger
.
log
(
Level
.
SEVERE
,
"Can't initialize Tarantool connection"
,
exc
);
return
;
}
}
public
void
cleanup
()
throws
DBException
{
this
.
connection
.
close
();
}
...
...
@@ -82,8 +93,8 @@ public class TarantoolClient extends DB {
}
try
{
this
.
connection
.
insert
(
this
.
spaceNo
,
tuple
);
}
catch
(
TarantoolException
e
)
{
e
.
printStackTrace
(
);
}
catch
(
TarantoolException
e
xc
)
{
logger
.
log
(
Level
.
SEVERE
,
"Can't insert element"
,
exc
);
return
1
;
}
return
0
;
...
...
@@ -108,10 +119,10 @@ public class TarantoolClient extends DB {
response
=
this
.
connection
.
select
(
this
.
spaceNo
,
0
,
Arrays
.
asList
(
key
),
0
,
1
,
0
);
result
=
tuple_convert_filter
(
response
,
fields
);
return
0
;
}
catch
(
TarantoolException
e
)
{
e
.
printStackTrace
(
);
}
catch
(
TarantoolException
e
xc
)
{
logger
.
log
(
Level
.
SEVERE
,
"Can't select element"
,
exc
);
return
1
;
}
catch
(
IndexOutOfBounds
Exception
e
)
{
}
catch
(
NullPointer
Exception
e
xc
)
{
return
1
;
}
}
...
...
@@ -123,8 +134,10 @@ public class TarantoolClient extends DB {
List
<
String
>
response
;
try
{
response
=
this
.
connection
.
select
(
this
.
spaceNo
,
0
,
Arrays
.
asList
(
startkey
),
0
,
recordcount
,
6
);
}
catch
(
TarantoolException
e
)
{
e
.
printStackTrace
();
}
catch
(
TarantoolException
exc
)
{
logger
.
log
(
Level
.
SEVERE
,
"Can't select range elements"
,
exc
);
return
1
;
}
catch
(
NullPointerException
exc
)
{
return
1
;
}
HashMap
<
String
,
ByteIterator
>
temp
=
tuple_convert_filter
(
response
,
fields
);
...
...
@@ -137,10 +150,10 @@ public class TarantoolClient extends DB {
public
int
delete
(
String
table
,
String
key
)
{
try
{
this
.
connection
.
delete
(
this
.
spaceNo
,
Arrays
.
asList
(
key
));
}
catch
(
TarantoolException
e
)
{
e
.
printStackTrace
(
);
}
catch
(
TarantoolException
e
xc
)
{
logger
.
log
(
Level
.
SEVERE
,
"Can't delete element"
,
exc
);
return
1
;
}
catch
(
IndexOutOfBounds
Exception
e
)
{
}
catch
(
NullPointer
Exception
e
)
{
return
1
;
}
return
0
;
...
...
@@ -158,8 +171,8 @@ public class TarantoolClient extends DB {
}
try
{
this
.
connection
.
replace
(
this
.
spaceNo
,
tuple
);
}
catch
(
TarantoolException
e
)
{
e
.
printStackTrace
(
);
}
catch
(
TarantoolException
e
xc
)
{
logger
.
log
(
Level
.
SEVERE
,
"Can't replace element"
,
exc
);
return
1
;
}
return
0
;
...
...
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