diff --git a/KVstore/ISTree/node/ISLeafNode.cpp b/KVstore/ISTree/node/ISLeafNode.cpp index 5a1539c..796c175 100644 --- a/KVstore/ISTree/node/ISLeafNode.cpp +++ b/KVstore/ISTree/node/ISLeafNode.cpp @@ -82,6 +82,7 @@ ISLeafNode::getValue(int _index) const int num = this->getNum(); if (_index < 0 || _index >= num) { + //cout<<"null in getValue: "<<_index<getNum(); if (_index < 0 || _index >= num) { - print(string("error in setValue: Invalid index ") + Util::int2string(_index)); + //print(string("error in setValue: Invalid index ") + Util::int2string(_index)); return false; } this->values[_index].release(); //NOTICE: only used in modify @@ -146,9 +147,12 @@ bool ISLeafNode::addValue(char* _str, unsigned _len, int _index, bool ifcopy) { int num = this->getNum(); + //cout<<"addValue: "< num) { - print(string("error in addValue: Invalid index ") + Util::int2string(_index)); + //print(string("error in addValue: Invalid index ") + Util::int2string(_index)); + //cout<<"error in addValue: "<<_index<<" "<values[_index].setStr(_str); this->values[_index].setLen(_len); + //cout<<"show: "<values[_index].getLen()<<" "<values[_index].getStr()[0]<getNum(); if (_index < 0 || _index >= num) { - print(string("error in subValue: Invalid index ") + Util::int2string(_index)); + //print(string("error in subValue: Invalid index ") + Util::int2string(_index)); return false; } int i; @@ -319,8 +324,8 @@ ISLeafNode::coalesce(ISNode* _father, int _index) p->subNum(); break; default: - print("error in coalesce: Invalid case!"); - //printf("error in coalesce: Invalid case!"); + //print("error in coalesce: Invalid case!"); + cout<<"error in coalesce: Invalid case!"<setDirty(); p->setDirty(); diff --git a/KVstore/ISTree/node/ISNode.h b/KVstore/ISTree/node/ISNode.h index a5f792d..75613af 100644 --- a/KVstore/ISTree/node/ISNode.h +++ b/KVstore/ISTree/node/ISNode.h @@ -88,8 +88,8 @@ public: virtual void setPrev(ISNode* _prev) {}; virtual void setNext(ISNode* _next) {}; - virtual bool setValue(const char* _str, unsigned _len, int _index, bool ifcopy = false) { return true; }; - virtual bool addValue(const char* _str, unsigned _len, int _index, bool ifcopy = false) { return true; }; + virtual bool setValue(char* _str, unsigned _len, int _index, bool ifcopy = false) { return true; }; + virtual bool addValue(char* _str, unsigned _len, int _index, bool ifcopy = false) { return true; }; //pure virtual function virtual void Virtual() = 0; diff --git a/KVstore/ISTree/storage/ISStorage.cpp b/KVstore/ISTree/storage/ISStorage.cpp index 46c1eee..bbfb4de 100644 --- a/KVstore/ISTree/storage/ISStorage.cpp +++ b/KVstore/ISTree/storage/ISStorage.cpp @@ -401,10 +401,10 @@ ISStorage::writeNode(ISNode* _np) for (i = 0; i < num; ++i) { this->writeBstr(_np->getValue(i), &blocknum, SpecialBlock); - if(_np->getKey(0) == 0) - { - cout<<"the 0th value: "<<_np->getValue(i)->getStr()[0]<getKey(0) == 0) + //{ + //cout<<"the 0th value: "<<_np->getValue(i)->getStr()[0]<isLeaf(); // then create a new node to act as BEntryIndex's father. VNode* newNodePtr = this->createNode(is_leaf); -#ifdef DEBUG +#ifdef DEBUG_VSTREE cout<<"new node file line: "<getFileLine()<