Skip to content

Commit

Permalink
Revert "change the error outstream to the standard outstream"
Browse files Browse the repository at this point in the history
This reverts commit 4d8da27.
  • Loading branch information
WenJieLiHnu committed Nov 24, 2019
1 parent 4bf0514 commit 7ad4794
Show file tree
Hide file tree
Showing 32 changed files with 425 additions and 425 deletions.
22 changes: 11 additions & 11 deletions Database/Database.cpp
Expand Up @@ -857,7 +857,7 @@ Database::load_cache()
}
cout << "Value File Preload used " << Util::get_cur_time() - t0 << " ms" << endl;
/*
cout << "Get in" << endl;
cerr << "Get in" << endl;
{
pid_t p = getpid();
char file[64] = { 0 };//�ļ���
Expand Down Expand Up @@ -1384,7 +1384,7 @@ bool Database::save()
this->stringindex->flush();
this->clear_update_log();

//cout<<"database checkpoint: "<<this->getName()<<endl;
//cerr<<"database checkpoint: "<<this->getName()<<endl;

return true;
}
Expand Down Expand Up @@ -3348,7 +3348,7 @@ Database::insert(const TripleWithObjType* _triples, TYPE_TRIPLE_NUM _triple_num,
out.open(path.c_str(), ios::out | ios::app);
out_all.open(path_all.c_str(), ios::out | ios::app);
if (!out || !out_all) {
cout << "Failed to open update log. Insertion aborted." << endl;
cerr << "Failed to open update log. Insertion aborted." << endl;
return 0;
}
for (int i = 0; i < _triple_num; i++) {
Expand Down Expand Up @@ -3865,7 +3865,7 @@ Database::remove(const TripleWithObjType* _triples, TYPE_TRIPLE_NUM _triple_num,
out.open(path.c_str(), ios::out | ios::app);
out_all.open(path_all.c_str(), ios::out | ios::app);
if (!out || !out_all) {
cout << "Failed to open update log. Removal aborted." << endl;
cerr << "Failed to open update log. Removal aborted." << endl;
return 0;
}
for (int i = 0; i < _triple_num; i++) {
Expand Down Expand Up @@ -4318,7 +4318,7 @@ Database::restore()
string backup_path = Util::backup_path + this->store_path;
if (!Util::dir_exist(Util::backup_path))
{
cout << "Failed to restore!" << endl;
cerr << "Failed to restore!" << endl;
return false;
}

Expand All @@ -4340,7 +4340,7 @@ Database::restore()
if (!this->load())
{
this->clear();
cout << "Failed to restore from backup file." << endl;
cerr << "Failed to restore from backup file." << endl;
return false;
}

Expand All @@ -4355,7 +4355,7 @@ Database::restore()

if (!this->restore_update(insertions, removals))
{
cout << "Failed to restore updates" << endl;
cerr << "Failed to restore updates" << endl;
return false;
}

Expand All @@ -4373,7 +4373,7 @@ Database::read_update_log(const string _path, multiset<string>& _i, multiset<str
#endif
in.open(_path.c_str(), ios::in);
if (!in) {
cout << "Failed to read update log." << endl;
cerr << "Failed to read update log." << endl;
return 0;
}

Expand All @@ -4395,7 +4395,7 @@ Database::read_update_log(const string _path, multiset<string>& _i, multiset<str
_r.insert(triple);
break;
default:
cout << "Bad line in update log!" << endl;
cerr << "Bad line in update log!" << endl;
}
in.getline(buffer, buffer_size);
}
Expand Down Expand Up @@ -4432,7 +4432,7 @@ Database::restore_update(multiset<string>& _i, multiset<string>& _r)
ofstream out_i;
out_i.open(tmp_path.c_str(), ios::out);
if (!out_i) {
cout << "Failed to open temp file, restore failed!" << endl;
cerr << "Failed to open temp file, restore failed!" << endl;
return false;
}
for (multiset<string>::iterator it = _i.begin(); it != _i.end(); it++) {
Expand All @@ -4448,7 +4448,7 @@ Database::restore_update(multiset<string>& _i, multiset<string>& _r)
ofstream out_r;
out_r.open(tmp_path.c_str(), ios::out);
if (!out_r) {
cout << "Failed to open temp file!" << endl;
cerr << "Failed to open temp file!" << endl;
return false;
}
for (multiset<string>::iterator it = _r.begin(); it != _r.end(); it++) {
Expand Down
2 changes: 1 addition & 1 deletion KVstore/ISTree/ISTree.cpp
Expand Up @@ -275,7 +275,7 @@ ISTree::modify(unsigned _key, char* _str, unsigned _len)
ISNode* ret = this->find(_key, &store, true);
if (ret == NULL || store == -1 || _key != ret->getKey(store)) //tree is empty or not found
{
cout << "tree is empty or not found" << endl;
cerr << "tree is empty or not found" << endl;
return false;
}
//cout<<"ISTree::modify() - key is found, now to remove"<<endl;
Expand Down
2 changes: 1 addition & 1 deletion KVstore/IVTree/IVTree.cpp
Expand Up @@ -280,7 +280,7 @@ IVTree::modify(unsigned _key, char* _str, unsigned _len)
IVNode* ret = this->find(_key, &store, true);
if (ret == NULL || store == -1 || _key != ret->getKey(store)) //tree is empty or not found
{
cout << "tree is empty or not found" << endl;
cerr << "tree is empty or not found" << endl;
return false;
}
//cout<<"IVTree::modify() - key is found, now to remove"<<endl;
Expand Down
28 changes: 14 additions & 14 deletions KVstore/KVstore.cpp
Expand Up @@ -1093,7 +1093,7 @@ KVstore::open_entity2id(int _mode)
}
else
{
cout << "Invalid open mode in open_entity2id, mode = " << _mode << endl;
cerr << "Invalid open mode in open_entity2id, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1166,7 +1166,7 @@ KVstore::open_id2entity(int _mode)
}
else
{
cout << "Invalid open mode in open_id2entity, mode = " << _mode << endl;
cerr << "Invalid open mode in open_id2entity, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1265,7 +1265,7 @@ KVstore::open_predicate2id(int _mode)
}
else
{
cout << "Invalid open mode in open_predicate2id, mode = " << _mode << endl;
cerr << "Invalid open mode in open_predicate2id, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1332,7 +1332,7 @@ KVstore::open_id2predicate(int _mode)
}
else
{
cout << "Invalid open mode in open_id2predicate, mode = " << _mode << endl;
cerr << "Invalid open mode in open_id2predicate, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1413,7 +1413,7 @@ KVstore::open_literal2id(int _mode)
}
else
{
cout << "Invalid open mode in open_literal2id, mode = " << _mode << endl;
cerr << "Invalid open mode in open_literal2id, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1488,7 +1488,7 @@ KVstore::open_id2literal(int _mode)
}
else
{
cout << "Invalid open mode in open_id2literal, mode = " << _mode << endl;
cerr << "Invalid open mode in open_id2literal, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1567,7 +1567,7 @@ KVstore::open_subID2values(int _mode, TYPE_ENTITY_LITERAL_ID _entity_num)
}
else
{
cout << "Invalid open mode in open_subID2values, mode = " << _mode << endl;
cerr << "Invalid open mode in open_subID2values, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -1871,7 +1871,7 @@ KVstore::open_objID2values(int _mode, TYPE_ENTITY_LITERAL_ID _entity_num, TYPE_E
}
else
{
cout << "Invalid open mode in open_objID2values, mode = " << _mode << endl;
cerr << "Invalid open mode in open_objID2values, mode = " << _mode << endl;
return false;
}

Expand Down Expand Up @@ -2132,7 +2132,7 @@ KVstore::open_preID2values(int _mode, TYPE_PREDICATE_ID _pre_num)
buffer_size = Util::MAX_BUFFER_SIZE * buffer_pID2values_query;
}
else {
cout << "Invalid open mode in open_preID2values, mode = " << _mode << endl;
cerr << "Invalid open mode in open_preID2values, mode = " << _mode << endl;
return false;
}
return this->open(this->preID2values, KVstore::s_pID2values, _mode, buffer_size, _pre_num);
Expand Down Expand Up @@ -2419,7 +2419,7 @@ KVstore::open(SITree*& _p_btree, string _tree_name, int _mode, unsigned long lon
smode = "open";
}
else {
cout << "Invalid open mode of: " << _tree_name << " mode = " << _mode << endl;
cerr << "Invalid open mode of: " << _tree_name << " mode = " << _mode << endl;
return false;
}
_p_btree = new SITree(this->store_path, _tree_name, smode, _buffer_size);
Expand All @@ -2440,7 +2440,7 @@ KVstore::open(ISTree*& _p_btree, string _tree_name, int _mode, unsigned long lon
smode = "open";
}
else {
cout << "Invalid open mode of: " << _tree_name << " mode = " << _mode << endl;
cerr << "Invalid open mode of: " << _tree_name << " mode = " << _mode << endl;
return false;
}
_p_btree = new ISTree(this->store_path, _tree_name, smode, _buffer_size);
Expand All @@ -2461,7 +2461,7 @@ KVstore::open(ISArray*& _array, string _name, int _mode, unsigned long long _buf
smode = "open";
}
else {
cout << "Invalid open mode of: " << _name << " mode = " << _mode << endl;
cerr << "Invalid open mode of: " << _name << " mode = " << _mode << endl;
return false;
}
_array = new ISArray(this->store_path, _name, smode, _buffer_size, _key_num);
Expand All @@ -2482,7 +2482,7 @@ KVstore::open(IVTree*& _p_btree, string _tree_name, int _mode, unsigned long lon
smode = "open";
}
else {
cout << "Invalid open mode of: " << _tree_name << " mode = " << _mode << endl;
cerr << "Invalid open mode of: " << _tree_name << " mode = " << _mode << endl;
return false;
}
_p_btree = new IVTree(this->store_path, _tree_name, smode, _buffer_size);
Expand All @@ -2508,7 +2508,7 @@ KVstore::open(IVArray*& _array, string _name, int _mode, unsigned long long _buf
}
else
{
cout << "Invalid open mode of: " << _name << " mode = " << _mode << endl;
cerr << "Invalid open mode of: " << _name << " mode = " << _mode << endl;
return false;
}
_array = new IVArray(this->store_path, _name, smode, _buffer_size, _key_num);
Expand Down

0 comments on commit 7ad4794

Please sign in to comment.