From 3e8ffcbd7f9259c1aae0a87435fbee5c356e4e34 Mon Sep 17 00:00:00 2001 From: sears Date: Wed, 15 Sep 2010 22:37:50 +0000 Subject: [PATCH] Sherpa 1.10 storage/handler/unit test/ now runs to completion with the following failures: make: *** [testCachedMetadataStorerun] Error 255 make: *** [testGetCopyStatusrun] Error 255 make: *** [testGetLbStatsrun] Error 255 make: *** [testGetRecordFormatterrun] Error 255 make: *** [testGetSplitPointrun] Error 255 make: *** [testGetTabletMetadatarun] Error 255 make: *** [testKillRecordrun] Error 255 make: *** [testMySQLPersistentrun] Error 255 make: *** [testMySQLUpgrade16to18run] Error 255 make: *** [testPingrun] Error 255 make: *** [testRecordUtilsrun] Error 255 make: *** [testResetRecordMetadatarun] Error 255 make: *** [testScanTabletrun] Error 255 make: *** [testTabletrun] Error 255 git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@1151 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe --- sherpa/LSMPersistentStoreImpl.cc | 19 +++++++++++++++---- sherpa/LSMPersistentStoreImpl.h | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sherpa/LSMPersistentStoreImpl.cc b/sherpa/LSMPersistentStoreImpl.cc index b0dd426..0e00894 100644 --- a/sherpa/LSMPersistentStoreImpl.cc +++ b/sherpa/LSMPersistentStoreImpl.cc @@ -75,11 +75,17 @@ public: std::string dbg2((char*)end_key, end_key_len - 1); lsmImpl->filestr << "end lsm key = " << dbg2 << std::endl; - logstore_client_op_returns_many(lsmImpl->l_, OP_SCAN, starttup, endtup, scanLimit); + uint8_t rc = logstore_client_op_returns_many(lsmImpl->scan_l_, OP_SCAN, starttup, endtup, scanLimit); datatuple::freetuple(starttup); datatuple::freetuple(endtup); + if(rc != LOGSTORE_RESPONSE_SENDING_TUPLES) { + this->error = rc; + } else { + this->error = 0; + } + this->data = new StorageRecord(); } ~LSMIterator() { @@ -93,7 +99,9 @@ public: SuCode::ResponseCode next() { datatuple * tup; lsmImpl->filestr << "next called" << std::endl; - if((tup = logstore_client_next_tuple(lsmImpl->l_))) { + if(error) { // only catches errors during scan setup. + return SuCode::PStoreUnexpectedError; + } else if((tup = logstore_client_next_tuple(lsmImpl->scan_l_))) { lsmImpl->filestr << "found tuple, key = " << tup->key() << " datalen = " << tup->datalen() << std::endl; SuCode::ResponseCode rc = lsmImpl->tup_buf(*(this->data), tup); datatuple::freetuple(tup); @@ -107,6 +115,7 @@ public: } private: LSMPersistentStoreImpl * lsmImpl; + uint8_t error; }; // Initialize the logger @@ -315,9 +324,10 @@ LSMPersistentStoreImpl::val_buf(StorageRecord& ret, return SuCode::SuOk; } LSMPersistentStoreImpl:: -LSMPersistentStoreImpl(bool isOrdered) : isOrdered_(isOrdered), l_(NULL) { +LSMPersistentStoreImpl(bool isOrdered) : isOrdered_(isOrdered), l_(NULL), scan_l_(NULL) { filestr.open(isOrdered? "/tmp/lsm-log" : "/tmp/lsm-log-hashed", std::fstream::out | std::fstream::app); l_ = logstore_client_open("localhost", 32432, 60); // XXX hardcode none of these values + scan_l_ = logstore_client_open("localhost", 32432, 60); // XXX hardcode none of these values filestr << "LSMP constructor called" << std::endl; } @@ -326,6 +336,7 @@ LSMPersistentStoreImpl:: { filestr << "LSMP destructor called" << std::endl; logstore_client_close(l_); + logstore_client_close(scan_l_); } SuCode::ResponseCode LSMPersistentStoreImpl::initMetadataMetadata(TabletMetadata& m) { @@ -621,7 +632,7 @@ scan(const TabletMetadata& tabletMeta, const ScanContinuation& continuation, selector, /*getMetadataOnly,*/ expiryTime, scanLimit, byteLimit); - filestr << "LSMP scan returns" << std::endl; + filestr << "LSMP scan returns. Error = " << iter->error << std::endl; return StorageRecordIterator(iter); } diff --git a/sherpa/LSMPersistentStoreImpl.h b/sherpa/LSMPersistentStoreImpl.h index 598152b..7380336 100644 --- a/sherpa/LSMPersistentStoreImpl.h +++ b/sherpa/LSMPersistentStoreImpl.h @@ -176,6 +176,7 @@ private: void buf_metadata(unsigned char ** buf, size_t *len, const TabletMetadata &m); protected: logstore_handle_t * l_; + logstore_handle_t * scan_l_; // XXX make sure that one scan handle per process suffices. };