diff --git a/packages/dht_lsm_server.run b/packages/dht_lsm_server.run index c83754a..5869737 100755 --- a/packages/dht_lsm_server.run +++ b/packages/dht_lsm_server.run @@ -6,4 +6,4 @@ # http://dist.corp.yahoo.com/by-package/daemontools_y/ # cd /home/y/var/dht_lsm_server/data -exec /home/y/bin/setuidgid nobody /home/y/bin64/lsm_server --benchmark --log-mode 2>&1 +exec /home/y/bin/setuidgid nobody /home/y/bin64/lsm_server --benchmark --log-mode 1 2>&1 diff --git a/sherpa/LSMServerHandler.cc b/sherpa/LSMServerHandler.cc index 0e77f9b..7ce1cf3 100644 --- a/sherpa/LSMServerHandler.cc +++ b/sherpa/LSMServerHandler.cc @@ -411,7 +411,7 @@ buildTuple(uint32_t databaseId, const std::string& recordName, const void* body, { uint32_t keySize = sizeof(databaseId) + recordName.size(); unsigned char* key = (unsigned char*)malloc(keySize); - *(uint32_t*)key = databaseId; + *(uint32_t*)key = htonl(databaseId); memcpy(((uint32_t*)key) + 1, recordName.c_str(), recordName.size()); datatuple *tup = datatuple::create(key, keySize, body, bodySize); std::cout << "built tuple: key: (" << std::string((const char*)(tup->strippedkey()), tup->strippedkeylen()) << ")" << std::endl; diff --git a/sherpa/main/lsm_client.cc b/sherpa/main/lsm_client.cc index 477dcc9..3e8f7cb 100644 --- a/sherpa/main/lsm_client.cc +++ b/sherpa/main/lsm_client.cc @@ -57,6 +57,23 @@ int main(int argc, char **argv) { cout << getResponse.responseCode << endl; */ + cout << "adding db one more time" << endl; + cout << client.addDatabase(db) << endl;; + + cout << client.addDatabase(db1) << endl;; + cout << client.insert(db1, "new key", "new value") << endl; + client.get(getResponse, db1, "new key"); + cout << getResponse.responseCode << endl; + cout << getResponse.value << endl; + + client.get(getResponse, db, "new key"); + cout << getResponse.responseCode << endl; + cout << getResponse.value << endl; + + cout << client.remove(db1, "new key") << endl; + client.get(getResponse, db1, "new key"); + cout << getResponse.responseCode << endl; + cout << client.remove(db1, "new key") << endl; client.scan(scanResponse, db, sherpa::ScanOrder::Ascending, "", true, "", true, 100, 100); std::vector::iterator itr; @@ -88,34 +105,5 @@ int main(int argc, char **argv) { for (itr = scanResponse.records.begin(); itr != scanResponse.records.end(); itr++) { cout << itr->key << " " << itr->value << endl; } - std::cout << std::endl; - - - cout << "adding db one more time" << endl; - cout << client.addDatabase(db) << endl;; - - cout << client.addDatabase(db1) << endl;; - cout << client.insert(db1, "new key", "new value") << endl; - client.get(getResponse, db1, "new key"); - cout << getResponse.responseCode << endl; - cout << getResponse.value << endl; - - client.get(getResponse, db, "new key"); - cout << getResponse.responseCode << endl; - cout << getResponse.value << endl; - - cout << client.remove(db1, "new key") << endl; - client.get(getResponse, db1, "new key"); - cout << getResponse.responseCode << endl; - cout << client.remove(db1, "new key") << endl; - - return 0; - - /* - cout << client.remove("michi", "k1") << endl; - client.get(getResponse, "michi", "k1"); - cout << getResponse.responseCode << endl; - transport->close(); - */ return 0; }