fix bug in DEBUG macros;

change int type to unsigned type but Query/* may not be fully changed
This commit is contained in:
bookug 2017-03-25 20:08:23 +08:00
parent 1b939b3a51
commit 8e74a29f07
26 changed files with 2055 additions and 34 deletions

View File

@ -289,7 +289,7 @@ Database::writeIDinfo()
} }
//ID alloc garbage error(LITERAL_FIRST_ID or double) add base for literal //ID alloc garbage error(LITERAL_FIRST_ID or double) add base for literal
int TYPE_ENTITY_LITERAL_ID
Database::allocEntityID() Database::allocEntityID()
{ {
//int t; //int t;
@ -301,7 +301,8 @@ Database::allocEntityID()
if (this->limitID_entity >= Util::LITERAL_FIRST_ID) if (this->limitID_entity >= Util::LITERAL_FIRST_ID)
{ {
cout << "fail to alloc id for entity" << endl; cout << "fail to alloc id for entity" << endl;
return -1; //return -1;
return INVALID;
} }
} }
else else
@ -332,7 +333,7 @@ Database::freeEntityID(TYPE_ENTITY_LITERAL_ID _id)
this->entity_num--; this->entity_num--;
} }
int TYPE_ENTITY_LITERAL_ID
Database::allocLiteralID() Database::allocLiteralID()
{ {
//int t; //int t;
@ -344,7 +345,8 @@ Database::allocLiteralID()
if (this->limitID_literal >= Util::LITERAL_FIRST_ID) if (this->limitID_literal >= Util::LITERAL_FIRST_ID)
{ {
cout << "fail to alloc id for literal" << endl; cout << "fail to alloc id for literal" << endl;
return -1; //return -1;
return INVALID;
} }
} }
else else
@ -377,7 +379,7 @@ Database::freeLiteralID(TYPE_ENTITY_LITERAL_ID _id)
this->literal_num--; this->literal_num--;
} }
int TYPE_PREDICATE_ID
Database::allocPredicateID() Database::allocPredicateID()
{ {
//int t; //int t;
@ -389,6 +391,7 @@ Database::allocPredicateID()
if (this->limitID_predicate >= Util::LITERAL_FIRST_ID) if (this->limitID_predicate >= Util::LITERAL_FIRST_ID)
{ {
cout << "fail to alloc id for predicate" << endl; cout << "fail to alloc id for predicate" << endl;
//WARN:if pid is changed to unsigned type, this must be changed
return -1; return -1;
} }
} }
@ -1361,6 +1364,7 @@ Database::sub2id_pre2id_obj2id_RDFintoSignature(const string _rdf_file, TYPE_ENT
cout << "finish initial sub2id_pre2id_obj2id" << endl; cout << "finish initial sub2id_pre2id_obj2id" << endl;
//BETTER?:close the stdio buffer sync?? //BETTER?:close the stdio buffer sync??
ifstream _fin(_rdf_file.c_str()); ifstream _fin(_rdf_file.c_str());
if (!_fin) if (!_fin)
{ {
@ -1420,8 +1424,9 @@ Database::sub2id_pre2id_obj2id_RDFintoSignature(const string _rdf_file, TYPE_ENT
//Process the Triple one by one //Process the Triple one by one
for (int i = 0; i < parse_triple_num; i++) for (int i = 0; i < parse_triple_num; i++)
{ {
//TODO+BETTER: assume that no duplicate triples in RDF for building //BETTER: assume that no duplicate triples in RDF for building
//should judge first?? //should judge first? using exist_triple()
//or sub triples_num in build_subID2values(judge if two neighbor triples are same)
this->triples_num++; this->triples_num++;
//if the _id_tuples exceeds, double the space //if the _id_tuples exceeds, double the space

View File

@ -1815,6 +1815,8 @@ Join::preFilter(int _var)
continue; continue;
} }
//TODO+BETTER: is any pre really used? do we need to losen the restrictions?
//size:m<n; time:mlgn < n-m //size:m<n; time:mlgn < n-m
//The former time is computed because the m should be small if we select this p, tending to use binary-search //The former time is computed because the m should be small if we select this p, tending to use binary-search
//when doing intersectList operation(mlgn < m+n). //when doing intersectList operation(mlgn < m+n).

View File

@ -7,9 +7,9 @@ int
main(int argc, char * argv[]) main(int argc, char * argv[])
{ {
//chdir(dirname(argv[0])); //chdir(dirname(argv[0]));
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
cout << "argc: " << argc << "\t"; cout << "argc: " << argc << "\t";
cout << "DB_store:" << argv[1] << "\t"; cout << "DB_store:" << argv[1] << "\t";

View File

@ -17,9 +17,9 @@ int
main(int argc, char * argv[]) main(int argc, char * argv[])
{ {
//chdir(dirname(argv[0])); //chdir(dirname(argv[0]));
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
if(argc < 3) //./gbuild if(argc < 3) //./gbuild
{ {
//output help info here //output help info here

View File

@ -12,9 +12,9 @@
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
//chdir(dirname(argv[0])); //chdir(dirname(argv[0]));
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
std::string ip = Socket::DEFAULT_SERVER_IP; std::string ip = Socket::DEFAULT_SERVER_IP;
unsigned short port = Socket::DEFAULT_CONNECT_PORT; unsigned short port = Socket::DEFAULT_CONNECT_PORT;
@ -38,4 +38,4 @@ int main(int argc, char * argv[])
client.run(); client.run();
return 0; return 0;
} }

View File

@ -122,9 +122,9 @@ main(int argc, char **argv)
//NOTICE:this is needed to ensure the file path is the work path //NOTICE:this is needed to ensure the file path is the work path
//chdir(dirname(argv[0])); //chdir(dirname(argv[0]));
//NOTICE:this is needed to set several debug files //NOTICE:this is needed to set several debug files
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
db_home = Util::global_config["db_home"]; db_home = Util::global_config["db_home"];

View File

@ -38,9 +38,9 @@ int
main(int argc, char * argv[]) main(int argc, char * argv[])
{ {
//chdir(dirname(argv[0])); //chdir(dirname(argv[0]));
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
if (argc == 1 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) if (argc == 1 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
{ {

View File

@ -22,9 +22,9 @@ bool stopServer();
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
string mode; string mode;
if (argc == 1) { if (argc == 1) {

View File

@ -12,9 +12,9 @@ int
main(int argc, char * argv[]) main(int argc, char * argv[])
{ {
//chdir(dirname(argv[0])); //chdir(dirname(argv[0]));
#ifdef DEBUG //#ifdef DEBUG
Util util; Util util;
#endif //#endif
cout << "argc: " << argc << "\t"; cout << "argc: " << argc << "\t";
cout << "DB_store:" << argv[1] << "\t"; cout << "DB_store:" << argv[1] << "\t";

View File

@ -2552,7 +2552,7 @@ void GeneralEvaluation::releaseResultStack()
delete results_id; delete results_id;
} }
void GeneralEvaluation::prepareUpdateTriple(QueryTree::GroupPattern &update_pattern, TripleWithObjType *&update_triple, int &update_triple_num) void GeneralEvaluation::prepareUpdateTriple(QueryTree::GroupPattern &update_pattern, TripleWithObjType *&update_triple, unsigned &update_triple_num)
{ {
update_pattern.getVarset(); update_pattern.getVarset();
@ -2613,3 +2613,4 @@ void GeneralEvaluation::prepareUpdateTriple(QueryTree::GroupPattern &update_patt
} }
} }
} }

View File

@ -239,7 +239,7 @@ class GeneralEvaluation
void getFinalResult(ResultSet &result_str); void getFinalResult(ResultSet &result_str);
void releaseResultStack(); void releaseResultStack();
void prepareUpdateTriple(QueryTree::GroupPattern &update_pattern, TripleWithObjType *&update_triple, int &update_triple_num); void prepareUpdateTriple(QueryTree::GroupPattern &update_pattern, TripleWithObjType *&update_triple, unsigned &update_triple_num);
}; };
#endif // _QUERY_GENERALEVALUATION_H #endif // _QUERY_GENERALEVALUATION_H

View File

@ -87,7 +87,7 @@ in the sparql query can point to the same node in data graph)
//#define DEBUG_STREAM //#define DEBUG_STREAM
//#define DEBUG_PRECISE 1 all information //#define DEBUG_PRECISE 1 all information
//#define DEBUG_KVSTORE 1 //in KVstore //#define DEBUG_KVSTORE 1 //in KVstore
#define DEBUG_VSTREE 1 //in Database //#define DEBUG_VSTREE 1 //in Database
//#define DEBUG_LRUCACHE 1 //#define DEBUG_LRUCACHE 1
//#define DEBUG_DATABASE 1 //in Database //#define DEBUG_DATABASE 1 //in Database
// //
@ -280,6 +280,9 @@ public:
Util(); Util();
~Util(); ~Util();
static std::string profile; static std::string profile;
//NOTICE: this function must be called out of any Database to config the basic settings
//You can call it by Util util in the first of your main program
//Another way is to build a GstoreApplication program, and do this configure in the initialization of the application
static bool configure(); //read init.conf and set the parameters for this system static bool configure(); //read init.conf and set the parameters for this system
static bool config_setting(); static bool config_setting();
static bool config_advanced(); static bool config_advanced();

2000
data/bbug.nt Normal file

File diff suppressed because it is too large Load Diff

5
data/bbug0.sql Normal file
View File

@ -0,0 +1,5 @@
INSERT DATA
{
<http://www.founder/102> <http://www.founder.20.link:52> <http://www.founder/106> .
<http://www.founder/102> <http://www.founder> <http://www.founder/73> .
}

1
data/bbug0d.sql Normal file
View File

@ -0,0 +1 @@
DELETE DATA { <http://www.founder/102> <http://www.founder.20.link:52> <http://www.founder/106> . }

1
data/bbug1.sql Normal file
View File

@ -0,0 +1 @@
select ?subject ?predict ?object WHERE { ?subject <http://www.founder.20.link:52> ?object; ?predict ?object . }

1
data/bbug2.sql Normal file
View File

@ -0,0 +1 @@
DELETE WHERE { <http://www.founder/101> ?predict ?object . }

1
data/bbug3.sql Normal file
View File

@ -0,0 +1 @@
select ?predict where {<http://www.founder/102> ?predict <http://www.founder/73> .}

5
data/bbug4.sql Normal file
View File

@ -0,0 +1,5 @@
select ?subject ?predict ?object where
{
<http://www.founder/102> <http://www.founder.20.link:52> ?object.
?subject ?predict ?object.
}

1
data/bbug5.sql Normal file
View File

@ -0,0 +1 @@
select ?subject ?predict ?object where {?subject <http://www.founder.20.link:52> <http://www.founder/106>; ?predict ?object . }

1
data/bbug6.sql Normal file
View File

@ -0,0 +1 @@
DELETE WHERE { ?subject <http://www.founder.20.link:52> ?objcet. }

1
data/error.sql Normal file
View File

@ -0,0 +1 @@
select ?a WHERE { <a> <http://www.founder.20.link:52> <b> . }

1
data/exist.sql Normal file
View File

@ -0,0 +1 @@
select ?s where { <http://www.founder/100> <http://www.founder.20.attr:dmID> "22". }

1
data/fault.sql Normal file
View File

@ -0,0 +1 @@
select ?a WHERE { <a> <http://www.founder.20.link:52> <b> . }

View File

@ -1,4 +0,0 @@
select ?p where
{
<s0> ?p <o0> .
}

View File

@ -1,5 +0,0 @@
select ?s ?o where
{
?s <p0> ?o .
?s <p1> ?o .
}