use htonl. fixed a typo in daemontools run script.

git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@2552 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
michim 2011-05-13 06:53:39 +00:00
parent 88c718c828
commit ff6e081ca1
3 changed files with 19 additions and 31 deletions

View file

@ -6,4 +6,4 @@
# http://dist.corp.yahoo.com/by-package/daemontools_y/ # http://dist.corp.yahoo.com/by-package/daemontools_y/
# #
cd /home/y/var/dht_lsm_server/data 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

View file

@ -411,7 +411,7 @@ buildTuple(uint32_t databaseId, const std::string& recordName, const void* body,
{ {
uint32_t keySize = sizeof(databaseId) + recordName.size(); uint32_t keySize = sizeof(databaseId) + recordName.size();
unsigned char* key = (unsigned char*)malloc(keySize); 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()); memcpy(((uint32_t*)key) + 1, recordName.c_str(), recordName.size());
datatuple *tup = datatuple::create(key, keySize, body, bodySize); datatuple *tup = datatuple::create(key, keySize, body, bodySize);
std::cout << "built tuple: key: (" << std::string((const char*)(tup->strippedkey()), tup->strippedkeylen()) << ")" << std::endl; std::cout << "built tuple: key: (" << std::string((const char*)(tup->strippedkey()), tup->strippedkeylen()) << ")" << std::endl;

View file

@ -57,6 +57,23 @@ int main(int argc, char **argv) {
cout << getResponse.responseCode << endl; 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); client.scan(scanResponse, db, sherpa::ScanOrder::Ascending, "", true, "", true, 100, 100);
std::vector<sherpa::Record>::iterator itr; std::vector<sherpa::Record>::iterator itr;
@ -88,34 +105,5 @@ int main(int argc, char **argv) {
for (itr = scanResponse.records.begin(); itr != scanResponse.records.end(); itr++) { for (itr = scanResponse.records.begin(); itr != scanResponse.records.end(); itr++) {
cout << itr->key << " " << itr->value << endl; 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; return 0;
} }