Commit 6fd756df authored by yiwenshao's avatar yiwenshao

add log for final_load

parent 2596e747
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include "wrapper/common.hh" #include "wrapper/common.hh"
#include "wrapper/insert_lib.hh" #include "wrapper/insert_lib.hh"
#include "util/constants.hh" #include "util/constants.hh"
#include "util/timer.hh"
#include "util/log.hh"
using std::cout; using std::cout;
using std::cin; using std::cin;
using std::endl; using std::endl;
...@@ -26,6 +29,17 @@ char * globalEsp=NULL; ...@@ -26,6 +29,17 @@ char * globalEsp=NULL;
int num_of_pipe = 4; int num_of_pipe = 4;
//global map, for each client, we have one WrapperState which contains ProxyState. //global map, for each client, we have one WrapperState which contains ProxyState.
static std::map<std::string, WrapperState*> clients; static std::map<std::string, WrapperState*> clients;
static
std::string logfilePrefix = "final_load";
static
std::string logfileName = logfilePrefix+constGlobalConstants.logFile+std::to_string(time(NULL));
static
logToFile glog(logfileName);
//This connection mimics the behaviour of MySQL-Proxy //This connection mimics the behaviour of MySQL-Proxy
Connect *globalConn; Connect *globalConn;
/*for each field, convert the format to FieldMeta_Wrapper*/ /*for each field, convert the format to FieldMeta_Wrapper*/
...@@ -279,54 +293,15 @@ main(int argc, char* argv[]){ ...@@ -279,54 +293,15 @@ main(int argc, char* argv[]){
db = std::string(argv[2]); db = std::string(argv[2]);
table = std::string(argv[3]); table = std::string(argv[3]);
} }
std::unique_ptr<SchemaInfo> schema = myLoadSchemaInfo(embeddedDir); std::unique_ptr<SchemaInfo> schema = myLoadSchemaInfo(embeddedDir);
schema.get(); schema.get();
const std::unique_ptr<AES_KEY> &TK = std::unique_ptr<AES_KEY>(getKey(std::string("113341234"))); const std::unique_ptr<AES_KEY> &TK = std::unique_ptr<AES_KEY>(getKey(std::string("113341234")));
Analysis analysis(db, *schema, TK, SECURITY_RATING::SENSITIVE); Analysis analysis(db, *schema, TK, SECURITY_RATING::SENSITIVE);
/*choose decryption onion, load and decrypt to plain text*/ /*choose decryption onion, load and decrypt to plain text*/
ResType res = load_files(db,table); ResType res = load_files(db,table);
std::string annoTableName = analysis.getTableMeta(db,table).getAnonTableName(); std::string annoTableName = analysis.getTableMeta(db,table).getAnonTableName();
const std::string head = std::string("INSERT INTO `")+db+"`.`"+annoTableName+"` "; const std::string head = std::string("INSERT INTO `")+db+"`.`"+annoTableName+"` ";
/*reencryption to get the encrypted insert!!!*/ /*reencryption to get the encrypted insert!!!*/
/* int currentCount=0;
List<List_item> newList;
for(auto &row:res.rows) {
List<Item> * newList0 = new List<Item>();
for(auto i=0u;i<res.names.size();i++) {
std::string field_name = res.names[i];
FieldMeta & fm = analysis.getFieldMeta(db,table,field_name);
local_wrapper(*row[i],fm,analysis,newList0);
}
newList.push_back(newList0);
currentCount++;
if(currentCount==constGlobalConstants.pipelineCount){
currentCount=0;
std::ostringstream o;
insertManyValues(o,newList);
std::cout<<(head+o.str())<<std::endl;
//newList = List<List_item>();
}
} */
/* if(currentCount!=0){
std::ostringstream o;
insertManyValues(o,newList);
std::cout<<(head+o.str())<<std::endl;
}*/
/* for(auto &row:res.rows) {
List<List_item> newList;
List<Item> * newList0 = processRow(row,res.names,analysis,db,table);
newList.push_back(newList0);
std::ostringstream o;
insertManyValues(o,newList);
std::cout<<(head+o.str())<<std::endl;
}
*/
unsigned int i=0u; unsigned int i=0u;
while(true){ while(true){
List<List_item> newList; List<List_item> newList;
...@@ -354,7 +329,7 @@ main(int argc, char* argv[]){ ...@@ -354,7 +329,7 @@ main(int argc, char* argv[]){
break; break;
} }
} }
// std::cout<<"gcount<<"<<gcount<<std::endl; glog<<std::string("gcount<<")<<std::to_string(gcount)<<std::string("\n");
return 0; return 0;
} }
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment