Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voldemort: not found values #19

Merged
merged 1 commit into from
Mar 27, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions db/voldemort/src/com/yahoo/ycsb/db/VoldemortClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class VoldemortClient extends DB {

public static final int OK = 0;
public static final int ERROR = -1;
public static final int NOT_FOUND = -2;

/**
* Initialize the DB layer. This accepts all properties allowed by the Voldemort client.
Expand Down Expand Up @@ -82,18 +83,17 @@ public int read(String table, String key, Set<String> fields,

Versioned<HashMap<String, String>> versionedValue = storeClient.get(key);

if (versionedValue == null)
return OK;

if ( versionedValue == null )
return NOT_FOUND;

if ( fields != null ) {
for (String field : fields) {
String val = versionedValue.getValue().get(field);
if ( val != null)
if ( val != null )
result.put(field, val);
}
} else {
result.putAll( versionedValue.getValue());
result.putAll(versionedValue.getValue());
}
return OK;
}
Expand All @@ -114,10 +114,10 @@ public int update(String table, String key, HashMap<String, String> values) {
Versioned<HashMap<String, String>> versionedValue = storeClient.get(key);
HashMap<String, String> value = new HashMap<String, String>();
VectorClock version;
if ( versionedValue != null) {
if ( versionedValue != null ) {
version = ((VectorClock) versionedValue.getVersion()).incremented(0, 1);
value = versionedValue.getValue();
for ( Entry<String, String> entry : values.entrySet()) {
for (Entry<String, String> entry : values.entrySet()) {
value.put(entry.getKey(), entry.getValue());
}
} else {
Expand All @@ -130,7 +130,7 @@ public int update(String table, String key, HashMap<String, String> values) {
}

private int checkStore(String table) {
if ( table.compareTo(storeName) != 0) {
if ( table.compareTo(storeName) != 0 ) {
try {
storeClient = socketFactory.getStoreClient(table);
if ( storeClient == null ) {
Expand Down