|
From: Michael P <mic...@us...> - 2010-05-17 04:52:38
|
Project "DBT-1/Postgres-XC".
The branch, master has been updated
via e8423a49d59402dad28ba1499ea3da6fc6289d92 (commit)
from 47cc46c300b3ecfb7d1bb64c0cf7d8d2746ee3e6 (commit)
- Log -----------------------------------------------------------------
commit e8423a49d59402dad28ba1499ea3da6fc6289d92
Author: Michael P <mic...@us...>
Date: Mon May 17 13:51:52 2010 +0900
DBT-1 update due to the coming release of Postgres-XC 0.9.1.
Data is now loaded in Database directly with COPY FROM.
The user has still the choice to use INSERT SQL or COPY.
diff --git a/datagen/main.c.in b/datagen/main.c.in
index 3ca732a..bbea907 100644
--- a/datagen/main.c.in
+++ b/datagen/main.c.in
@@ -112,17 +112,17 @@ int main(int argc, char *argv[])
fprintf(sequence_sql,
"%s CREATE SEQUENCE custid INCREMENT 1 START %d;\n",
exec_sql,
- 2880 * ebs + 1);
+ 3000 * ebs + 1);
fprintf(sequence_sql, "commit;");
fprintf(sequence_sql,
"%s CREATE SEQUENCE addrid INCREMENT 1 START %d;\n",
exec_sql,
- ebs * 2880 * 2 + 1);
+ ebs * 3000 * 2 + 1);
fprintf(sequence_sql, "commit;");
fprintf(sequence_sql,
"%s CREATE SEQUENCE scid INCREMENT 1 START %d;\n",
exec_sql,
- (int) ((double) ebs * 2880.0 * 0.9 + 1.0));
+ (int) ((double) ebs * 3000.0 * 0.9 + 1.0));
fprintf(sequence_sql, "commit;");
fclose(sequence_sql);
@@ -137,9 +137,9 @@ int main(int argc, char *argv[])
if (flag_item == 1)
{
gen_items();
- sprintf(cmd, "ln -fs %sitem.data /tmp/item.data\n", path);
+ sprintf(cmd, "ln -fs %s/item.data /tmp/item.data\n", path);
popen(cmd, "r");
- sprintf(cmd, "ln -fs %sstock.data /tmp/stock.data\n", path);
+ sprintf(cmd, "ln -fs %s/stock.data /tmp/stock.data\n", path);
popen(cmd, "r");
}
@@ -147,25 +147,25 @@ int main(int argc, char *argv[])
{
/* all the tables depend on ebs for the customer number */
gen_customers();
- sprintf(cmd, "ln -fs %scustomer.data /tmp/customer.data", path);
+ sprintf(cmd, "ln -fs %s/customer.data /tmp/customer.data", path);
popen(cmd, "r");
- sprintf(cmd, "ln -fs %saddress.data /tmp/address.data", path);
+ sprintf(cmd, "ln -fs %s/address.data /tmp/address.data", path);
popen(cmd, "r");
- sprintf(cmd, "ln -fs %sorders.data /tmp/orders.data", path);
+ sprintf(cmd, "ln -fs %s/orders.data /tmp/orders.data", path);
popen(cmd, "r");
- sprintf(cmd, "ln -fs %sorder_line.data /tmp/order_line.data",
+ sprintf(cmd, "ln -fs %s/order_line.data /tmp/order_line.data",
path);
popen(cmd, "r");
- sprintf(cmd, "ln -fs %scc_xacts.data /tmp/cc_xacts.data", path);
+ sprintf(cmd, "ln -fs %s/cc_xacts.data /tmp/cc_xacts.data", path);
popen(cmd, "r");
}
if (flag_author == 1)
{
gen_authors();
- sprintf(cmd, "ln -fs %sauthor.data /tmp/author.data", path);
+ sprintf(cmd, "ln -fs %s/author.data /tmp/author.data", path);
popen(cmd, "r");
}
diff --git a/scripts/pgsql/build_db.sh.in b/scripts/pgsql/build_db.sh.in
index e72a7d5..4fb3ed8 100755
--- a/scripts/pgsql/build_db.sh.in
+++ b/scripts/pgsql/build_db.sh.in
@@ -18,18 +18,17 @@ if [ "$DATAGEN_USE" = "ON" ]
else
echo "build the database without generating the data file"
fi
-if [ "$PGXC_USE" = "OFF" ]
- then
- date
- echo "drop db"
- @TOPDIR@/scripts/pgsql/drop_db.sh
- echo
- date
- echo "create db"
- @TOPDIR@/scripts/pgsql/create_db.sh
- echo
-fi
+date
+echo "drop db"
+@TOPDIR@/scripts/pgsql/drop_db.sh
+echo
+
+date
+echo "create db"
+@TOPDIR@/scripts/pgsql/create_db.sh
+echo
+
date
echo "create tables"
@TOPDIR@/scripts/pgsql/create_tables.sh
diff --git a/scripts/pgsql/build_param.sh.in b/scripts/pgsql/build_param.sh.in
index 1851b41..3de123c 100644
--- a/scripts/pgsql/build_param.sh.in
+++ b/scripts/pgsql/build_param.sh.in
@@ -7,7 +7,9 @@ SERVER_PORT=5432
DATAGEN_ITEMS=1000
DATAGEN_EUS=10
DATAGEN_RESULT=$TOPDIR/scripts/pgsql/resultsql
-PGXC_USE=ON
#as createdb and dropdb commands delicate to manipulate with Postgres-XC, this parameter skips the parts liked to that
#it can be set at ON of necessary
-DATAGEN_USE=OFF
+DATAGEN_USE=ON #permits to activate data generator
+#COPY FROM/TO is supported since Postgres-XC 0.9.1
+COPYFROM_USE=ON #activates data load with COPY at ON
+ #set at OFF, it activates data transfer
\ No newline at end of file
diff --git a/scripts/pgsql/create_fk.sh.in b/scripts/pgsql/create_fk.sh.in
index 02d1c1a..e90eb79 100755
--- a/scripts/pgsql/create_fk.sh.in
+++ b/scripts/pgsql/create_fk.sh.in
@@ -2,4 +2,4 @@
source @TOPDIR@/scripts/pgsql/build_param.sh
-psql -h $SERVER_IP -p $SERVER_PORT -f @TOPDIR@/scripts/pgsql/create_fk.sql
+psql -h $SERVER_IP -p $SERVER_PORT -f @TOPDIR@/scripts/pgsql/create_fk.sql $SID1
diff --git a/scripts/pgsql/load_db.sh.in b/scripts/pgsql/load_db.sh.in
index dc7e532..5561212 100755
--- a/scripts/pgsql/load_db.sh.in
+++ b/scripts/pgsql/load_db.sh.in
@@ -15,7 +15,7 @@ source @TOPDIR@/scripts/pgsql/build_param.sh
#data transfer, this process takes a lot of time ...;(
#all the results are put in the same folder as the *.data files
-if [ "$DATAGEN_USE" = "ON" ]
+if [ "$COPYFROM_USE" = "OFF" ]
then
sh @TOPDIR@/scripts/pgsql/data_transfer.sh @TOPDIR@/datagen/country.data.pgsql country
sh @TOPDIR@/scripts/pgsql/data_transfer.sh @TOPDIR@/scripts/pgsql/resultsql/author.data author
@@ -26,16 +26,19 @@ if [ "$DATAGEN_USE" = "ON" ]
sh @TOPDIR@/scripts/pgsql/data_transfer.sh @TOPDIR@/scripts/pgsql/resultsql/item.data item
sh @TOPDIR@/scripts/pgsql/data_transfer.sh @TOPDIR@/scripts/pgsql/resultsql/stock.data stock
sh @TOPDIR@/scripts/pgsql/data_transfer.sh @TOPDIR@/scripts/pgsql/resultsql/customer.data customer
+ #data is loaded with file transferred
+ #then load the data...
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/country.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/author.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/orders.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/order_line.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/cc_xacts.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/address.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/item.sql
+ # pgxc additional stock table
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/stock.sql
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/customer.sql
+else
+ #load data with copy... by default also
+ psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/copy.sql
fi
-
-#then load the data...
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/country.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/author.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/orders.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/order_line.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/cc_xacts.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/address.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/item.sql
-# pgxc additional stock table
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/stock.sql
-psql -p $SERVER_PORT -h $SERVER_IP -d $SID1 -f @TOPDIR@/scripts/pgsql/resultsql/customer.sql
diff --git a/scripts/pgsql/load_dbproc.sh.in b/scripts/pgsql/load_dbproc.sh.in
index 55531d8..65b7f69 100755
--- a/scripts/pgsql/load_dbproc.sh.in
+++ b/scripts/pgsql/load_dbproc.sh.in
@@ -1,5 +1,4 @@
#!/bin/sh
source @TOPDIR@/scripts/pgsql/build_param.sh
-
-psql -h $SERVER_IP -p $SERVER_PORT -d $SID1 -f /home/michael/workdbt1/scripts/pgsql/create_sequence.sql
+psql -h $SERVER_IP -p $SERVER_PORT -d $SID1 -f @TOPDIR@/scripts/pgsql/create_sequence.sql
-----------------------------------------------------------------------
Summary of changes:
datagen/main.c.in | 22 +++++++++++-----------
scripts/pgsql/build_db.sh.in | 21 ++++++++++-----------
scripts/pgsql/build_param.sh.in | 6 ++++--
scripts/pgsql/create_fk.sh.in | 2 +-
scripts/pgsql/load_db.sh.in | 29 ++++++++++++++++-------------
scripts/pgsql/load_dbproc.sh.in | 3 +--
6 files changed, 43 insertions(+), 40 deletions(-)
hooks/post-receive
--
DBT-1/Postgres-XC
|