Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Practical-Cryptdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhaozhen
Practical-Cryptdb
Commits
d49b1229
Commit
d49b1229
authored
Apr 27, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/final_load and opti_load modify
parent
9fb94e3e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
59 deletions
+55
-59
final_load.cc
tools/final_load.cc
+41
-39
opti_load.cc
tools/opti_load.cc
+14
-20
No files found.
tools/final_load.cc
View file @
d49b1229
...
@@ -360,7 +360,10 @@ main(int argc, char* argv[]){
...
@@ -360,7 +360,10 @@ main(int argc, char* argv[]){
glog
<<
"====================start table: "
<<
table
<<
"============================"
<<
"
\n
"
;
glog
<<
"====================start table: "
<<
table
<<
"============================"
<<
"
\n
"
;
/*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
);
if
(
res
.
success
())
{
if
(
!
res
.
success
()){
glog
<<
"empty table
\n
"
;
continue
;
}
glog
<<
"load_files: "
<<
glog
<<
"load_files: "
<<
std
::
to_string
(
t_init
.
lap
()
/
1000000u
)
<<
std
::
to_string
(
t_init
.
lap
()
/
1000000u
)
<<
"##"
<<
std
::
to_string
(
time
(
NULL
))
<<
"
\n
"
;
"##"
<<
std
::
to_string
(
time
(
NULL
))
<<
"
\n
"
;
...
@@ -402,7 +405,6 @@ main(int argc, char* argv[]){
...
@@ -402,7 +405,6 @@ main(int argc, char* argv[]){
TypeText
<
onion
>::
toText
(
item
.
first
)
<<
"::"
<<
TypeText
<
onion
>::
toText
(
item
.
first
)
<<
"::"
<<
std
::
to_string
(
item
.
second
)
<<
"
\n
"
;
std
::
to_string
(
item
.
second
)
<<
"
\n
"
;
}
}
}
glog
<<
"====================finish table: "
<<
table
<<
"============================"
<<
"
\n
"
;
glog
<<
"====================finish table: "
<<
table
<<
"============================"
<<
"
\n
"
;
gcountMap
.
clear
();
gcountMap
.
clear
();
delete
gfb
;
delete
gfb
;
...
...
tools/opti_load.cc
View file @
d49b1229
...
@@ -18,12 +18,12 @@
...
@@ -18,12 +18,12 @@
#include "util/timer.hh"
#include "util/timer.hh"
#include "util/log.hh"
#include "util/log.hh"
using
std
::
cout
;
struct
batch
{
using
std
::
cin
;
vector
<
string
>
field_names
;
using
std
::
endl
;
vector
<
int
>
field_types
;
using
std
::
vector
;
vector
<
int
>
field_lengths
;
using
std
::
string
;
}
;
using
std
::
to_string
;
char
*
globalEsp
=
NULL
;
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.
...
@@ -36,22 +36,15 @@ std::string logfileName = logfilePrefix+constGlobalConstants.logFile+std::to_str
...
@@ -36,22 +36,15 @@ std::string logfileName = logfilePrefix+constGlobalConstants.logFile+std::to_str
static
static
logToFile
glog
(
logfileName
);
logToFile
glog
(
logfileName
);
//This connection mimics the behaviour of MySQL-Proxy
//This connection mimics the behaviour of MySQL-Proxy
Connect
*
globalConn
;
Connect
*
globalConn
;
fullBackUp
*
gfb
;
fullBackUp
*
gfb
;
struct
batch
{
std
::
map
<
onion
,
unsigned
long
>
gcountMap
;
vector
<
string
>
field_names
;
vector
<
int
>
field_types
;
vector
<
int
>
field_lengths
;
};
batch
*
ggbt
;
batch
*
ggbt
;
static
static
std
::
vector
<
std
::
string
>
std
::
vector
<
std
::
string
>
getDbTables
(
std
::
string
db
)
{
getDbTables
(
std
::
string
db
)
{
...
@@ -61,7 +54,6 @@ getDbTables(std::string db) {
...
@@ -61,7 +54,6 @@ getDbTables(std::string db) {
}
}
/*should choose the right decryption onion*/
/*should choose the right decryption onion*/
static
static
std
::
shared_ptr
<
ReturnMeta
>
getReturnMeta
(
std
::
vector
<
FieldMeta
*>
fms
,
std
::
shared_ptr
<
ReturnMeta
>
getReturnMeta
(
std
::
vector
<
FieldMeta
*>
fms
,
std
::
vector
<
FieldMetaTrans
>
&
tfds
){
std
::
vector
<
FieldMetaTrans
>
&
tfds
){
...
@@ -96,6 +88,8 @@ std::shared_ptr<ReturnMeta> getReturnMeta(std::vector<FieldMeta*> fms,
...
@@ -96,6 +88,8 @@ std::shared_ptr<ReturnMeta> getReturnMeta(std::vector<FieldMeta*> fms,
}
}
return
myReturnMeta
;
return
myReturnMeta
;
}
}
/*init global full backup. */
/*init global full backup. */
static
static
void
initGfb
(
std
::
vector
<
FieldMetaTrans
>
&
res
,
std
::
string
db
,
std
::
string
table
){
void
initGfb
(
std
::
vector
<
FieldMetaTrans
>
&
res
,
std
::
string
db
,
std
::
string
table
){
...
@@ -228,7 +222,7 @@ static ResType load_files(std::string db, std::string table){
...
@@ -228,7 +222,7 @@ static ResType load_files(std::string db, std::string table){
return
finalresults
;
return
finalresults
;
}
}
std
::
map
<
onion
,
unsigned
long
>
gcountMap
;
static
static
void
local_wrapper
(
const
Item
&
i
,
const
FieldMeta
&
fm
,
Analysis
&
a
,
void
local_wrapper
(
const
Item
&
i
,
const
FieldMeta
&
fm
,
Analysis
&
a
,
...
@@ -374,8 +368,8 @@ main(int argc, char* argv[]){
...
@@ -374,8 +368,8 @@ main(int argc, char* argv[]){
if
(
localCount
==
constGlobalConstants
.
pipelineCount
){
if
(
localCount
==
constGlobalConstants
.
pipelineCount
){
std
::
ostringstream
o
;
std
::
ostringstream
o
;
insertManyValues
(
o
,
newList
);
insertManyValues
(
o
,
newList
);
globalConn
->
execute
(
head
+
o
.
str
());
//
globalConn->execute(head+o.str());
//
std::cout<<(head+o.str())<<std::endl;
std
::
cout
<<
(
head
+
o
.
str
())
<<
std
::
endl
;
i
++
;
i
++
;
break
;
break
;
}
}
...
@@ -384,8 +378,8 @@ main(int argc, char* argv[]){
...
@@ -384,8 +378,8 @@ main(int argc, char* argv[]){
if
(
localCount
!=
constGlobalConstants
.
pipelineCount
)
{
if
(
localCount
!=
constGlobalConstants
.
pipelineCount
)
{
std
::
ostringstream
o
;
std
::
ostringstream
o
;
insertManyValues
(
o
,
newList
);
insertManyValues
(
o
,
newList
);
globalConn
->
execute
(
head
+
o
.
str
());
//
globalConn->execute(head+o.str());
//
std::cout<<(head+o.str())<<std::endl;
std
::
cout
<<
(
head
+
o
.
str
())
<<
std
::
endl
;
}
}
break
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment