Commit da3ab97d authored by yiwenshao's avatar yiwenshao

able to insert small data

parent 5fb9030d
...@@ -28,3 +28,5 @@ packages/tls/mysqlWrapper/backFieldsToFiles ...@@ -28,3 +28,5 @@ packages/tls/mysqlWrapper/backFieldsToFiles
packages/tls/mysqlWrapper/createInsert packages/tls/mysqlWrapper/createInsert
packages/tls/mysqlWrapper/createSelect packages/tls/mysqlWrapper/createSelect
packages/tls/mysqlWrapper/main packages/tls/mysqlWrapper/main
*allTables*
*pipelinefile*
...@@ -13,3 +13,26 @@ std::pair<long,uint64_t> ASHE::encrypt(unsigned long plaintext){ ...@@ -13,3 +13,26 @@ std::pair<long,uint64_t> ASHE::encrypt(unsigned long plaintext){
unsigned long ASHE::decrypt(long ciphertext){ unsigned long ASHE::decrypt(long ciphertext){
return (ciphertext + bf.encrypt(IV) - bf.encrypt(IV-1))%ASHE_MAX; return (ciphertext + bf.encrypt(IV) - bf.encrypt(IV-1))%ASHE_MAX;
} }
/*Cannot declare member function ...to have static linkage*/
std::pair<long,std::vector<uint64_t>> ASHE::sum(std::vector<std::pair<long,uint64_t>> input){
std::vector<uint64_t> IVs;
long res = 0;
for(auto &item:input){
res+=item.first;
IVs.push_back(item.second);
}
return std::make_pair(res,IVs);
}
unsigned long ASHE::decrypt_sum(std::pair<long,std::vector<uint64_t>> input){
long res = input.first;
for(auto item:input.second){
item++;
res++;
}
return res;
}
...@@ -12,4 +12,6 @@ public: ...@@ -12,4 +12,6 @@ public:
std::pair<long,uint64_t> encrypt(unsigned long plaintext); std::pair<long,uint64_t> encrypt(unsigned long plaintext);
int getIV(); int getIV();
unsigned long decrypt(long ciphertext); unsigned long decrypt(long ciphertext);
static std::pair<long,std::vector<uint64_t>> sum(std::vector<std::pair<long,uint64_t>> input);
static unsigned long decrypt_sum(std::pair<long,std::vector<uint64_t>> input);
}; };
files=`find ~/Insert/ -type f` dir="~/Insert/"
arrayfiles=($files) cur_dir=`pwd`
cdb_test_dir="../../"
target_db="tdb2"
cd ${cdb_test_dir}
#IFS=' ' read -r -a arrayfiles <<< "$files" if [ $#=1 ];then
dir=${cur_dir}/$1
fi
files=`find ${dir} -type f`
arrayfiles=($files)
for data in ${arrayfiles[@]} for data in ${arrayfiles[@]}
do do
ss="cdb_test tpcc1000 < $data" ss="./obj/main/cdb_test ${target_db} < $data"
eval $ss ## eval $ss
echo $ss echo $ss
done done
#backup data with limited pipecount #backup data with limited pipecount
current_dir=`pwd` current_dir=`pwd`
db=tpcc1000 db=tdb2
pipe=100 pipe=100
tables=`mysql -uroot -h127.0.0.1 -P3306 $db -e "show tables" | awk '{print $1}'` tables=`mysql -h127.0.0.1 -P3306 $db -e "show tables" | awk '{print $1}'`
table_array=($tables) table_array=($tables)
len=${#table_array[@]} len=${#table_array[@]}
back_dir=pipe_$pipe back_dir=pipelinefile_$pipe
rm -rf $back_dir rm -rf $back_dir
mkdir $back_dir mkdir $back_dir
cd ../tls/mysql_wrapper/ cd ../tls/mysql_wrapper/
......
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