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
dce7ff24
Commit
dce7ff24
authored
Jan 03, 2018
by
yiwenshao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
able to backup and restore
parent
f3bef4b1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
169 additions
and
2 deletions
+169
-2
backup.sh
packages/operation/backup.sh
+6
-0
count.sh
packages/operation/count.sh
+10
-2
create_table.sql
packages/operation/create_table.sql
+132
-0
drop.sh
packages/operation/drop.sh
+3
-0
insert.sh
packages/operation/insert.sh
+1
-0
load_data.sh
packages/operation/load_data.sh
+2
-0
restore.sh
packages/operation/restore.sh
+15
-0
No files found.
packages/operation/backup.sh
0 → 100755
View file @
dce7ff24
name
=
"all.sql"
if
[
$#
=
1
]
;
then
name
=
$1
fi
mysqldump
-uroot
-pletmein
-h127
.0.0.1
-P3306
--no-create-info
--compact
tpcc1000
>
$name
packages/operation/
shell/
count.sh
→
packages/operation/count.sh
View file @
dce7ff24
...
@@ -16,11 +16,19 @@ function show_table_counts(){
...
@@ -16,11 +16,19 @@ function show_table_counts(){
for
((
i
=
1
;
i<
$len
;
i++
))
for
((
i
=
1
;
i<
$len
;
i++
))
do
do
res
=
`
mysql_command
"SELECT COUNT(*) AS total_count FROM
$1
.
${
arr
[
$i
]
}
"
`
res
=
`
mysql_command
"SELECT COUNT(*) AS total_count FROM
$1
.
${
arr
[
$i
]
}
"
`
echo
${
arr
[
$i
]
}
,
$res
echo
${
arr
[
$i
]
}
,
$res
>>
res
done
done
}
}
show_table_counts
$1
name
=
"tpcc1000"
if
[
$#
=
1
]
;
then
name
=
$1
fi
show_table_counts
$name
cat
res
rm
res
#res=`mysql_command 'show databases'`
#res=`mysql_command 'show databases'`
#echo $res
#echo $res
...
...
packages/operation/create_table.sql
0 → 100644
View file @
dce7ff24
drop
table
if
exists
warehouse
;
SET
sql_mode
=
''
;
create
table
warehouse
(
w_id
smallint
unsigned
,
w_name
varchar
(
10
),
w_street_1
varchar
(
20
),
w_street_2
varchar
(
20
),
w_city
varchar
(
20
),
w_state
char
(
2
),
w_zip
char
(
9
),
w_tax
integer
unsigned
,
w_ytd
integer
unsigned
)
Engine
=
InnoDB
;
drop
table
if
exists
district
;
create
table
district
(
d_id
tinyint
unsigned
,
d_w_id
smallint
unsigned
,
d_name
varchar
(
10
),
d_street_1
varchar
(
20
),
d_street_2
varchar
(
20
),
d_city
varchar
(
20
),
d_state
char
(
2
),
d_zip
char
(
9
),
d_tax
integer
unsigned
,
d_ytd
integer
unsigned
,
d_next_o_id
int
unsigned
)
Engine
=
InnoDB
;
drop
table
if
exists
customer
;
create
table
customer
(
c_id
int
unsigned
,
c_d_id
tinyint
unsigned
,
c_w_id
smallint
unsigned
,
c_first
varchar
(
16
),
c_middle
char
(
2
),
c_last
varchar
(
16
),
c_street_1
varchar
(
20
),
c_street_2
varchar
(
20
),
c_city
varchar
(
20
),
c_state
char
(
2
),
c_zip
char
(
9
),
c_phone
char
(
16
),
c_since
varchar
(
20
),
c_credit
char
(
2
),
c_credit_lim
bigint
unsigned
,
c_discount
bigint
unsigned
,
c_balance
bigint
unsigned
,
c_ytd_payment
bigint
unsigned
,
c_payment_cnt
smallint
,
c_delivery_cnt
smallint
,
c_data
VARCHAR
(
1000
))
Engine
=
InnoDB
;
drop
table
if
exists
history
;
create
table
history
(
h_c_id
int
,
h_c_d_id
tinyint
,
h_c_w_id
smallint
,
h_d_id
tinyint
,
h_w_id
smallint
,
h_date
varchar
(
20
),
h_amount
integer
unsigned
,
h_data
varchar
(
24
)
)
Engine
=
InnoDB
;
drop
table
if
exists
new_orders
;
create
table
new_orders
(
no_o_id
int
not
null
,
no_d_id
tinyint
not
null
,
no_w_id
smallint
not
null
)
Engine
=
InnoDB
;
drop
table
if
exists
orders
;
create
table
orders
(
o_id
int
not
null
,
o_d_id
tinyint
not
null
,
o_w_id
smallint
not
null
,
o_c_id
int
,
o_entry_d
varchar
(
20
),
o_carrier_id
tinyint
,
o_ol_cnt
tinyint
,
o_all_local
tinyint
)
Engine
=
InnoDB
;
drop
table
if
exists
order_line
;
create
table
order_line
(
ol_o_id
int
not
null
,
ol_d_id
tinyint
not
null
,
ol_w_id
smallint
not
null
,
ol_number
tinyint
not
null
,
ol_i_id
int
,
ol_supply_w_id
smallint
,
ol_delivery_d
varchar
(
20
),
ol_quantity
tinyint
,
ol_amount
integer
unsigned
,
ol_dist_info
char
(
24
))
Engine
=
InnoDB
;
drop
table
if
exists
item
;
create
table
item
(
i_id
int
not
null
,
i_im_id
int
,
i_name
varchar
(
24
),
i_price
integer
unsigned
,
i_data
varchar
(
50
)
)
Engine
=
InnoDB
;
drop
table
if
exists
stock
;
create
table
stock
(
s_i_id
int
not
null
,
s_w_id
smallint
not
null
,
s_quantity
smallint
,
s_dist_01
char
(
24
),
s_dist_02
char
(
24
),
s_dist_03
char
(
24
),
s_dist_04
char
(
24
),
s_dist_05
char
(
24
),
s_dist_06
char
(
24
),
s_dist_07
char
(
24
),
s_dist_08
char
(
24
),
s_dist_09
char
(
24
),
s_dist_10
char
(
24
),
s_ytd
integer
unsigned
,
s_order_cnt
smallint
,
s_remote_cnt
smallint
,
s_data
varchar
(
50
))
Engine
=
InnoDB
;
packages/operation/drop.sh
0 → 100755
View file @
dce7ff24
mysql
-uroot
-pletmein
-h127
.0.0.1
-e
"drop database if exists tpcc1000"
mysql
-uroot
-pletmein
-h127
.0.0.1
-e
"create database tpcc1000"
mysql
-uroot
-pletmein
-h127
.0.0.1 tpcc1000 < create_table.sql
packages/operation/insert.sh
View file @
dce7ff24
files
=
`
find ~/Insert/
-type
f
`
files
=
`
find ~/Insert/
-type
f
`
arrayfiles
=(
$files
)
arrayfiles
=(
$files
)
#IFS=' ' read -r -a arrayfiles <<< "$files"
#IFS=' ' read -r -a arrayfiles <<< "$files"
for
data
in
${
arrayfiles
[@]
}
for
data
in
${
arrayfiles
[@]
}
...
...
packages/operation/load_data.sh
0 → 100755
View file @
dce7ff24
mysql
-uroot
-pletmein
-h127
.0.0.1
-P3306
-e
"set @@GLOBAL.sql_mode = ''"
cd
../tls/tpcc-mysql/
;
./my_load.sh 1
packages/operation/restore.sh
0 → 100755
View file @
dce7ff24
path
=
"Insert"
if
[
$#
=
1
]
;
then
path
=
$1
fi
files
=
`
find
$path
-type
f
`
arrayfiles
=(
$files
)
for
data
in
${
arrayfiles
[@]
}
do
ss
=
"mysql -uroot -pletmein -h127.0.0.1 -P3306 tpcc1000 <
$data
"
eval
$ss
echo
$ss
done
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