OSDN Git Service

pgbench: More fix with handling default scaling factor in the default
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 21 Oct 2006 06:31:28 +0000 (06:31 +0000)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 21 Oct 2006 06:31:28 +0000 (06:31 +0000)
scenarios. With multiple clinets, only the first client got the right
scaling factor and this gave a illusion of better performance in case
of the scaling factor greater than 1.

contrib/pgbench/README.pgbench
contrib/pgbench/README.pgbench_jis
contrib/pgbench/pgbench.c

index c96f085..d576b59 100644 (file)
@@ -1,4 +1,4 @@
-pgbench README         2006/07/26 Tatsuo Ishii
+pgbench README         2006/10/21 Tatsuo Ishii
 
 o What is pgbench?
 
@@ -235,6 +235,10 @@ Basically it is same as BSD license. See pgbench.c for more details.
 
 o History
 
+2006/10/21
+       * more fix with handling default scaling factor in the default
+          scenarios
+
 2006/09/14
        * change "tps" to "scale" to avoid confusion
 
index 0faa30d..adb22af 100644 (file)
@@ -1,4 +1,4 @@
-pgbench README         2006/07/26 Tatsuo Ishii
+pgbench README         2006/10/21 Tatsuo Ishii
 
 \e$B"#\e(Bpgbench \e$B$H$O!)\e(B
 
@@ -285,6 +285,10 @@ pgbench \e$B$O@P0f\e(B \e$BC#IW$K$h$C$F=q$+$l$^$7$?!%%i%$%;%s%9>r7o$O\e(B pgbench.c
 
 \e$B"#2~DjMzNr\e(B
 
+2006/10/21
+       * \e$B99$K%G%U%)%k%H$N%9%1!<%j%s%0%U%!%/%?$r\e(Bbranches\e$B$+$i<h$C$F$3$J\e(B
+          \e$B$$%P%0$r=$@5!%\e(B
+
 2006/09/13
        * \e$BJQ?t\e(Btps\e$B$OJ6$i$o$7$$$N$G\e(Bscale\e$B$KJQ99!%%G%U%)%k%H%7%J%j%*$N;~$K!$\e(B
          \e$B%G%U%)%k%H$N%9%1!<%j%s%0%U%!%/%?$r\e(Bbranches\e$B$+$i<h$C$F$3$J$$%P%0$r=$@5!%\e(B
index 3c15346..e880f63 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.57 2006/10/07 19:25:28 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.58 2006/10/21 06:31:28 ishii Exp $
  *
  * pgbench: a simple benchmark program for PostgreSQL
  * written by Tatsuo Ishii
@@ -1352,6 +1352,8 @@ main(int argc, char **argv)
 
                memset(state + 1, 0, sizeof(*state) * (nclients - 1));
 
+               snprintf(val, sizeof(val), "%d", scale);
+
                for (i = 1; i < nclients; i++)
                {
                        int                     j;
@@ -1364,6 +1366,12 @@ main(int argc, char **argv)
                                        exit(1);
                                }
                        }
+
+                       if (putVariable(&state[i], "scale", val) == false)
+                       {
+                               fprintf(stderr, "Couldn't allocate memory for variable\n");
+                               exit(1);
+                       }
                }
        }
 
@@ -1425,6 +1433,18 @@ main(int argc, char **argv)
                        fprintf(stderr, "Couldn't allocate memory for variable\n");
                        exit(1);
                }
+
+               if (nclients > 1)
+               {
+                       for (i = 1; i < nclients; i++)
+                       {
+                               if (putVariable(&state[i], "scale", val) == false)
+                               {
+                                       fprintf(stderr, "Couldn't allocate memory for variable\n");
+                                       exit(1);
+                               }
+                       }
+               }
        }
 
        if (!is_no_vacuum)