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
f84956ae
Commit
f84956ae
authored
9 years ago
by
Sean Busbey
Browse files
Options
Downloads
Patches
Plain Diff
[s3] updates to compile.
- version number fix - DB methods return Status objects.
parent
ff25df0f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
s3/pom.xml
+1
-1
1 addition, 1 deletion
s3/pom.xml
s3/src/main/java/com/yahoo/ycsb/db/S3Client.java
+24
-25
24 additions, 25 deletions
s3/src/main/java/com/yahoo/ycsb/db/S3Client.java
with
25 additions
and
26 deletions
s3/pom.xml
+
1
−
1
View file @
f84956ae
...
@@ -19,7 +19,7 @@ LICENSE file.
...
@@ -19,7 +19,7 @@ LICENSE file.
<parent>
<parent>
<groupId>
com.yahoo.ycsb
</groupId>
<groupId>
com.yahoo.ycsb
</groupId>
<artifactId>
binding-parent
</artifactId>
<artifactId>
binding-parent
</artifactId>
<version>
0.
5
.0-SNAPSHOT
</version>
<version>
0.
6
.0-SNAPSHOT
</version>
<relativePath>
../binding-parent
</relativePath>
<relativePath>
../binding-parent
</relativePath>
</parent>
</parent>
...
...
This diff is collapsed.
Click to expand it.
s3/src/main/java/com/yahoo/ycsb/db/S3Client.java
+
24
−
25
View file @
f84956ae
...
@@ -32,6 +32,7 @@ import com.yahoo.ycsb.ByteArrayByteIterator;
...
@@ -32,6 +32,7 @@ import com.yahoo.ycsb.ByteArrayByteIterator;
import
com.yahoo.ycsb.ByteIterator
;
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.Status
;
import
com.amazonaws.services.s3.AmazonS3Client
;
import
com.amazonaws.services.s3.AmazonS3Client
;
import
com.amazonaws.services.s3.*
;
import
com.amazonaws.services.s3.*
;
...
@@ -105,19 +106,19 @@ public class S3Client extends DB {
...
@@ -105,19 +106,19 @@ public class S3Client extends DB {
* The name of the bucket
* The name of the bucket
* @param key
* @param key
* The record key of the file to delete.
* The record key of the file to delete.
* @return
Zero
on success,
a non-zero error code on error
. See the
* @return
OK
on success,
otherwise ERROR
. See the
* {@link DB} class's description for a discussion of error codes.
* {@link DB} class's description for a discussion of error codes.
*/
*/
@Override
@Override
public
int
delete
(
String
bucket
,
String
key
)
{
public
Status
delete
(
String
bucket
,
String
key
)
{
try
{
try
{
s3Client
.
deleteObject
(
new
DeleteObjectRequest
(
bucket
,
key
));
s3Client
.
deleteObject
(
new
DeleteObjectRequest
(
bucket
,
key
));
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
System
.
err
.
println
(
"Not possible to delete the key "
+
key
);
System
.
err
.
println
(
"Not possible to delete the key "
+
key
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
}
return
0
;
return
Status
.
OK
;
}
}
/**
/**
* Initialize any state for the storage.
* Initialize any state for the storage.
...
@@ -252,11 +253,11 @@ public class S3Client extends DB {
...
@@ -252,11 +253,11 @@ public class S3Client extends DB {
* multiplied by the number of field. In this way the size
* multiplied by the number of field. In this way the size
* of the file to upload is determined by the fieldlength
* of the file to upload is determined by the fieldlength
* and fieldcount parameters.
* and fieldcount parameters.
* @return
Zero
on success,
a non-zero error code on error
. See the
* @return
OK
on success,
ERROR otherwise
. See the
* {@link DB} class's description for a discussion of error codes.
* {@link DB} class's description for a discussion of error codes.
*/
*/
@Override
@Override
public
int
insert
(
String
bucket
,
String
key
,
public
Status
insert
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
)
{
HashMap
<
String
,
ByteIterator
>
values
)
{
return
writeToStorage
(
bucket
,
key
,
values
,
true
,
sse
,
ssecKey
);
return
writeToStorage
(
bucket
,
key
,
values
,
true
,
sse
,
ssecKey
);
}
}
...
@@ -273,10 +274,10 @@ public class S3Client extends DB {
...
@@ -273,10 +274,10 @@ public class S3Client extends DB {
* it is null by default
* it is null by default
* @param result
* @param result
* A HashMap of field/value pairs for the result
* A HashMap of field/value pairs for the result
* @return
Zero
on success,
a non-zero error code on error or "not found"
.
* @return
OK
on success,
ERROR otherwise
.
*/
*/
@Override
@Override
public
int
read
(
String
bucket
,
String
key
,
Set
<
String
>
fields
,
public
Status
read
(
String
bucket
,
String
key
,
Set
<
String
>
fields
,
HashMap
<
String
,
ByteIterator
>
result
)
{
HashMap
<
String
,
ByteIterator
>
result
)
{
return
readFromStorage
(
bucket
,
key
,
result
,
ssecKey
);
return
readFromStorage
(
bucket
,
key
,
result
,
ssecKey
);
}
}
...
@@ -291,11 +292,10 @@ public class S3Client extends DB {
...
@@ -291,11 +292,10 @@ public class S3Client extends DB {
* The file key of the file to write.
* The file key of the file to write.
* @param values
* @param values
* A HashMap of field/value pairs to update in the record
* A HashMap of field/value pairs to update in the record
* @return Zero on success, a non-zero error code on error. See this class's
* @return OK on success, ERORR otherwise.
* description for a discussion of error codes.
*/
*/
@Override
@Override
public
int
update
(
String
bucket
,
String
key
,
public
Status
update
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
)
{
HashMap
<
String
,
ByteIterator
>
values
)
{
return
writeToStorage
(
bucket
,
key
,
values
,
false
,
sse
,
ssecKey
);
return
writeToStorage
(
bucket
,
key
,
values
,
false
,
sse
,
ssecKey
);
}
}
...
@@ -314,11 +314,10 @@ public class S3Client extends DB {
...
@@ -314,11 +314,10 @@ public class S3Client extends DB {
* @param result
* @param result
* A Vector of HashMaps, where each HashMap is a set field/value
* A Vector of HashMaps, where each HashMap is a set field/value
* pairs for one file
* pairs for one file
* @return Zero on success, a non-zero error code on error. See the
* @return OK on success, ERROR otherwise.
* {@link DB} class's description for a discussion of error codes.
*/
*/
@Override
@Override
public
int
scan
(
String
bucket
,
String
startkey
,
int
recordcount
,
public
Status
scan
(
String
bucket
,
String
startkey
,
int
recordcount
,
Set
<
String
>
fields
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
)
{
Set
<
String
>
fields
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
)
{
return
scanFromStorage
(
bucket
,
startkey
,
recordcount
,
result
,
ssecKey
);
return
scanFromStorage
(
bucket
,
startkey
,
recordcount
,
result
,
ssecKey
);
}
}
...
@@ -336,7 +335,7 @@ public class S3Client extends DB {
...
@@ -336,7 +335,7 @@ public class S3Client extends DB {
* to S3. If false an existing object will be re-uploaded
* to S3. If false an existing object will be re-uploaded
*
*
*/
*/
protected
int
writeToStorage
(
String
bucket
,
String
key
,
protected
Status
writeToStorage
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
values
,
Boolean
updateMarker
,
HashMap
<
String
,
ByteIterator
>
values
,
Boolean
updateMarker
,
String
sseLocal
,
SSECustomerKey
ssecLocal
)
{
String
sseLocal
,
SSECustomerKey
ssecLocal
)
{
int
totalSize
=
0
;
int
totalSize
=
0
;
...
@@ -372,7 +371,7 @@ public class S3Client extends DB {
...
@@ -372,7 +371,7 @@ public class S3Client extends DB {
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
System
.
err
.
println
(
"Not possible to get the object :"
+
key
);
System
.
err
.
println
(
"Not possible to get the object :"
+
key
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
}
}
}
byte
[]
destinationArray
=
new
byte
[
totalSize
];
byte
[]
destinationArray
=
new
byte
[
totalSize
];
...
@@ -401,7 +400,7 @@ public class S3Client extends DB {
...
@@ -401,7 +400,7 @@ public class S3Client extends DB {
PutObjectResult
res
=
PutObjectResult
res
=
s3Client
.
putObject
(
putObjectRequest
);
s3Client
.
putObject
(
putObjectRequest
);
if
(
res
.
getETag
()
==
null
)
{
if
(
res
.
getETag
()
==
null
)
{
return
1
;
return
Status
.
ERROR
;
}
else
{
}
else
{
if
(
sseLocal
.
equals
(
"true"
))
{
if
(
sseLocal
.
equals
(
"true"
))
{
System
.
out
.
println
(
"Uploaded object encryption status is "
+
System
.
out
.
println
(
"Uploaded object encryption status is "
+
...
@@ -414,14 +413,14 @@ public class S3Client extends DB {
...
@@ -414,14 +413,14 @@ public class S3Client extends DB {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Not possible to write object :"
+
key
);
System
.
err
.
println
(
"Not possible to write object :"
+
key
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
finally
{
}
finally
{
return
0
;
return
Status
.
OK
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Error in the creation of the stream :"
+
e
.
toString
());
System
.
err
.
println
(
"Error in the creation of the stream :"
+
e
.
toString
());
e
.
printStackTrace
();
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
}
}
}
...
@@ -436,7 +435,7 @@ public class S3Client extends DB {
...
@@ -436,7 +435,7 @@ public class S3Client extends DB {
* The Hash map where data from the object are written
* The Hash map where data from the object are written
*
*
*/
*/
protected
int
readFromStorage
(
String
bucket
,
String
key
,
protected
Status
readFromStorage
(
String
bucket
,
String
key
,
HashMap
<
String
,
ByteIterator
>
result
,
SSECustomerKey
ssecLocal
)
{
HashMap
<
String
,
ByteIterator
>
result
,
SSECustomerKey
ssecLocal
)
{
try
{
try
{
GetObjectRequest
getObjectRequest
=
null
;
GetObjectRequest
getObjectRequest
=
null
;
...
@@ -465,9 +464,9 @@ public class S3Client extends DB {
...
@@ -465,9 +464,9 @@ public class S3Client extends DB {
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
System
.
err
.
println
(
"Not possible to get the object "
+
key
);
System
.
err
.
println
(
"Not possible to get the object "
+
key
);
e
.
printStackTrace
();
e
.
printStackTrace
();
return
1
;
return
Status
.
ERROR
;
}
finally
{
}
finally
{
return
0
;
return
Status
.
OK
;
}
}
}
}
...
@@ -487,7 +486,7 @@ public class S3Client extends DB {
...
@@ -487,7 +486,7 @@ public class S3Client extends DB {
* pairs for one file
* pairs for one file
*
*
*/
*/
protected
int
scanFromStorage
(
String
bucket
,
String
startkey
,
protected
Status
scanFromStorage
(
String
bucket
,
String
startkey
,
int
recordcount
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
,
int
recordcount
,
Vector
<
HashMap
<
String
,
ByteIterator
>>
result
,
SSECustomerKey
ssecLocal
)
{
SSECustomerKey
ssecLocal
)
{
...
@@ -532,6 +531,6 @@ public class S3Client extends DB {
...
@@ -532,6 +531,6 @@ public class S3Client extends DB {
ssecLocal
);
ssecLocal
);
result
.
add
(
resultTemp
);
result
.
add
(
resultTemp
);
}
}
return
0
;
return
Status
.
OK
;
}
}
}
}
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