Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 06:21 AM
Merlin Moncure
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance tweak

>
> Wow, that's just great!
>
> Was that with the volatile attribute or not?
>
> //Magnus


not. However (I'm assuming) this should not greatly impact things.
Good work. QQ: Can you fix the patch? I'm done till Monday.


Merlin

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 06:21 AM
Qingqing Zhou
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance



> QQ: Can you fix the patch? I'm done till Monday.
>


Sure, thanks for testing it. Below is the revised version.

Regards,
Qingqing

---

Index: backend/port/win32/signal.c
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/backend/port/win32/signal.c,v
retrieving revision 1.12
diff -u -r1.12 signal.c
--- backend/port/win32/signal.c 15 Oct 2005 02:49:23 -0000 1.12
+++ backend/port/win32/signal.c 21 Oct 2005 05:32:52 -0000
@@ -19,11 +19,12 @@
/* pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only
* variable that can be accessed from the signal sending threads! */
static CRITICAL_SECTION pg_signal_crit_sec;
-static int pg_signal_queue;

static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
-static int pg_signal_mask;
+
+DLLIMPORT volatile int pg_signal_queue;
+DLLIMPORT int pg_signal_mask;

DLLIMPORT HANDLE pgwin32_signal_event;
HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
@@ -91,11 +92,10 @@
int i;

EnterCriticalSection(&pg_signal_crit_sec);
- while (pg_signal_queue & ~pg_signal_mask)
+ while (UNBLOCKED_SIGNAL_QUEUE())
{
/* One or more unblocked signals queued for execution */
-
- int exec_mask = pg_signal_queue & ~pg_signal_mask;
+ int exec_mask = UNBLOCKED_SIGNAL_QUEUE();

for (i = 0; i < PG_SIGNAL_COUNT; i++)
{
Index: include/port/win32.h
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.47
diff -u -r1.47 win32.h
--- include/port/win32.h 15 Oct 2005 02:49:45 -0000 1.47
+++ include/port/win32.h 21 Oct 2005 05:33:26 -0000
@@ -214,6 +214,12 @@


/* In backend/port/win32/signal.c */
+extern DLLIMPORT volatile int pg_signal_queue;
+extern DLLIMPORT int pg_signal_mask;
+
+#define UNBLOCKED_SIGNAL_QUEUE() \
+ (pg_signal_queue & ~pg_signal_mask)
+
extern DLLIMPORT HANDLE pgwin32_signal_event;
extern HANDLE pgwin32_initial_signal_pipe;

Index: include/miscadmin.h
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/include/miscadmin.h,v
retrieving revision 1.180
diff -u -r1.180 miscadmin.h
--- include/miscadmin.h 15 Oct 2005 02:49:41 -0000 1.180
+++ include/miscadmin.h 21 Oct 2005 05:33:56 -0000
@@ -87,8 +87,10 @@

#define CHECK_FOR_INTERRUPTS() \
do { \
- if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE ) == WAIT_OBJECT_0) \
- pgwin32_dispatch_queued_signals(); \
+ if (UNBLOCKED_SIGNAL_QUEUE()) { \
+ if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE ) == WAIT_OBJECT_0) \
+ pgwin32_dispatch_queued_signals(); \
+ } \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 06:21 AM
Tom Lane
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance tweak

BTW, expanding on Andrew's comment, ISTM we could move the kernel call
out of the macro, ie make it look like

#define CHECK_FOR_INTERRUPTS() \
do { \
if (UNBLOCKED_SIGNAL_QUEUE()) \
pgwin32_check_queued_signals(); \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)

where pgwin32_check_queued_signals() is just

if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE ) == WAIT_OBJECT_0)
pgwin32_dispatch_queued_signals();

This would save a few bytes at each call site while not really costing
anything in performance.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 06:21 AM
Tom Lane
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance tweak

I wrote:
> BTW, expanding on Andrew's comment, ISTM we could move the kernel call
> out of the macro, ie make it look like ...


I've applied the attached version of Qingqing's revised patch. I'm not
in a position to test it, and am about to go out for the evening, but if
anyone can check the committed version soon and verify that I didn't
break anything ...

(BTW, DLLIMPORT is only needed in extern declarations, not in the actual
definition of the variable.)

regards, tom lane

*** src/backend/port/win32/signal.c.orig Fri Oct 14 22:59:56 2005
--- src/backend/port/win32/signal.c Fri Oct 21 17:36:24 2005
***************
*** 15,32 ****

#include <libpq/pqsignal.h>

!
! /* pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only
! * variable that can be accessed from the signal sending threads! */
static CRITICAL_SECTION pg_signal_crit_sec;
- static int pg_signal_queue;

static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
- static int pg_signal_mask;
-
- DLLIMPORT HANDLE pgwin32_signal_event;
- HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;


/* Signal handling thread function */
--- 15,40 ----

#include <libpq/pqsignal.h>

! /*
! * These are exported for use by the UNBLOCKED_SIGNAL_QUEUE() macro.
! * pg_signal_queue must be volatile since it is changed by the signal
! * handling thread and inspected without any lock by the main thread.
! * pg_signal_mask is only changed by main thread so shouldn't need it.
! */
! volatile int pg_signal_queue;
! int pg_signal_mask;
!
! HANDLE pgwin32_signal_event;
! HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
!
! /*
! * pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only
! * variable that can be accessed from the signal sending threads!
! */
static CRITICAL_SECTION pg_signal_crit_sec;

static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];


/* Signal handling thread function */
***************
*** 81,101 ****
(errmsg_internal("failed to set console control handler")));
}


! /* Dispatch all signals currently queued and not blocked
* Blocked signals are ignored, and will be fired at the time of
! * the sigsetmask() call. */
void
pgwin32_dispatch_queued_signals(void)
{
int i;

EnterCriticalSection(&pg_signal_crit_sec);
! while (pg_signal_queue & ~pg_signal_mask)
{
/* One or more unblocked signals queued for execution */
!
! int exec_mask = pg_signal_queue & ~pg_signal_mask;

for (i = 0; i < PG_SIGNAL_COUNT; i++)
{
--- 89,119 ----
(errmsg_internal("failed to set console control handler")));
}

+ /*
+ * Support routine for CHECK_FOR_INTERRUPTS() macro
+ */
+ void
+ pgwin32_check_queued_signals(void)
+ {
+ if (WaitForSingleObjectEx(pgwin32_signal_event, 0, TRUE) == WAIT_OBJECT_0)
+ pgwin32_dispatch_queued_signals();
+ }

! /*
! * Dispatch all signals currently queued and not blocked
* Blocked signals are ignored, and will be fired at the time of
! * the sigsetmask() call.
! */
void
pgwin32_dispatch_queued_signals(void)
{
int i;

EnterCriticalSection(&pg_signal_crit_sec);
! while (UNBLOCKED_SIGNAL_QUEUE())
{
/* One or more unblocked signals queued for execution */
! int exec_mask = UNBLOCKED_SIGNAL_QUEUE();

for (i = 0; i < PG_SIGNAL_COUNT; i++)
{
*** src/include/miscadmin.h.orig Fri Oct 14 23:00:22 2005
--- src/include/miscadmin.h Fri Oct 21 17:36:18 2005
***************
*** 83,97 ****
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
#else /* WIN32 */

#define CHECK_FOR_INTERRUPTS() \
do { \
! if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE ) == WAIT_OBJECT_0) \
! pgwin32_dispatch_queued_signals(); \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
#endif /* WIN32 */


--- 83,99 ----
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
+
#else /* WIN32 */

#define CHECK_FOR_INTERRUPTS() \
do { \
! if (UNBLOCKED_SIGNAL_QUEUE()) \
! pgwin32_check_queued_signals(); \
if (InterruptPending) \
ProcessInterrupts(); \
} while(0)
+
#endif /* WIN32 */


*** src/include/port/win32.h.orig Fri Oct 14 23:00:30 2005
--- src/include/port/win32.h Fri Oct 21 17:36:12 2005
***************
*** 214,224 ****


/* In backend/port/win32/signal.c */
! extern DLLIMPORT HANDLE pgwin32_signal_event;
extern HANDLE pgwin32_initial_signal_pipe;

void pgwin32_signal_initialize(void);
HANDLE pgwin32_create_signal_listener(pid_t pid);
void pgwin32_dispatch_queued_signals(void);
void pg_queue_signal(int signum);

--- 214,230 ----


/* In backend/port/win32/signal.c */
! extern DLLIMPORT volatile int pg_signal_queue;
! extern DLLIMPORT int pg_signal_mask;
! extern HANDLE pgwin32_signal_event;
extern HANDLE pgwin32_initial_signal_pipe;

+ #define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask)
+
+
void pgwin32_signal_initialize(void);
HANDLE pgwin32_create_signal_listener(pid_t pid);
+ void pgwin32_check_queued_signals(void);
void pgwin32_dispatch_queued_signals(void);
void pg_queue_signal(int signum);


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 06:21 AM
Andrew Dunstan
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance


Heads up - I have seen 2 regression hangs. I am checking further. Has
anyone else run the regression suite with any version of this patch?

cheers

andrew

Tom Lane wrote:

>I wrote:
>
>
>>BTW, expanding on Andrew's comment, ISTM we could move the kernel call
>>out of the macro, ie make it look like ...
>>
>>

>
>I've applied the attached version of Qingqing's revised patch. I'm not
>in a position to test it, and am about to go out for the evening, but if
>anyone can check the committed version soon and verify that I didn't
>break anything ...
>
>(BTW, DLLIMPORT is only needed in extern declarations, not in the actual
>definition of the variable.)
>
> regards, tom lane
>
>*** src/backend/port/win32/signal.c.orig Fri Oct 14 22:59:56 2005
>--- src/backend/port/win32/signal.c Fri Oct 21 17:36:24 2005
>***************
>*** 15,32 ****
>
> #include <libpq/pqsignal.h>
>
>!
>! /* pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only
>! * variable that can be accessed from the signal sending threads! */
> static CRITICAL_SECTION pg_signal_crit_sec;
>- static int pg_signal_queue;
>
> static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
> static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
>- static int pg_signal_mask;
>-
>- DLLIMPORT HANDLE pgwin32_signal_event;
>- HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
>
>
> /* Signal handling thread function */
>--- 15,40 ----
>
> #include <libpq/pqsignal.h>
>
>! /*
>! * These are exported for use by the UNBLOCKED_SIGNAL_QUEUE() macro.
>! * pg_signal_queue must be volatile since it is changed by the signal
>! * handling thread and inspected without any lock by the main thread.
>! * pg_signal_mask is only changed by main thread so shouldn't need it.
>! */
>! volatile int pg_signal_queue;
>! int pg_signal_mask;
>!
>! HANDLE pgwin32_signal_event;
>! HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
>!
>! /*
>! * pg_signal_crit_sec is used to protect only pg_signal_queue. That is the only
>! * variable that can be accessed from the signal sending threads!
>! */
> static CRITICAL_SECTION pg_signal_crit_sec;
>
> static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
> static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
>
>
> /* Signal handling thread function */
>***************
>*** 81,101 ****
> (errmsg_internal("failed to set console control handler")));
> }
>
>
>! /* Dispatch all signals currently queued and not blocked
> * Blocked signals are ignored, and will be fired at the time of
>! * the sigsetmask() call. */
> void
> pgwin32_dispatch_queued_signals(void)
> {
> int i;
>
> EnterCriticalSection(&pg_signal_crit_sec);
>! while (pg_signal_queue & ~pg_signal_mask)
> {
> /* One or more unblocked signals queued for execution */
>!
>! int exec_mask = pg_signal_queue & ~pg_signal_mask;
>
> for (i = 0; i < PG_SIGNAL_COUNT; i++)
> {
>--- 89,119 ----
> (errmsg_internal("failed to set console control handler")));
> }
>
>+ /*
>+ * Support routine for CHECK_FOR_INTERRUPTS() macro
>+ */
>+ void
>+ pgwin32_check_queued_signals(void)
>+ {
>+ if (WaitForSingleObjectEx(pgwin32_signal_event, 0, TRUE) == WAIT_OBJECT_0)
>+ pgwin32_dispatch_queued_signals();
>+ }
>
>! /*
>! * Dispatch all signals currently queued and not blocked
> * Blocked signals are ignored, and will be fired at the time of
>! * the sigsetmask() call.
>! */
> void
> pgwin32_dispatch_queued_signals(void)
> {
> int i;
>
> EnterCriticalSection(&pg_signal_crit_sec);
>! while (UNBLOCKED_SIGNAL_QUEUE())
> {
> /* One or more unblocked signals queued for execution */
>! int exec_mask = UNBLOCKED_SIGNAL_QUEUE();
>
> for (i = 0; i < PG_SIGNAL_COUNT; i++)
> {
>*** src/include/miscadmin.h.orig Fri Oct 14 23:00:22 2005
>--- src/include/miscadmin.h Fri Oct 21 17:36:18 2005
>***************
>*** 83,97 ****
> if (InterruptPending) \
> ProcessInterrupts(); \
> } while(0)
> #else /* WIN32 */
>
> #define CHECK_FOR_INTERRUPTS() \
> do { \
>! if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE ) == WAIT_OBJECT_0) \
>! pgwin32_dispatch_queued_signals(); \
> if (InterruptPending) \
> ProcessInterrupts(); \
> } while(0)
> #endif /* WIN32 */
>
>
>--- 83,99 ----
> if (InterruptPending) \
> ProcessInterrupts(); \
> } while(0)
>+
> #else /* WIN32 */
>
> #define CHECK_FOR_INTERRUPTS() \
> do { \
>! if (UNBLOCKED_SIGNAL_QUEUE()) \
>! pgwin32_check_queued_signals(); \
> if (InterruptPending) \
> ProcessInterrupts(); \
> } while(0)
>+
> #endif /* WIN32 */
>
>
>*** src/include/port/win32.h.orig Fri Oct 14 23:00:30 2005
>--- src/include/port/win32.h Fri Oct 21 17:36:12 2005
>***************
>*** 214,224 ****
>
>
> /* In backend/port/win32/signal.c */
>! extern DLLIMPORT HANDLE pgwin32_signal_event;
> extern HANDLE pgwin32_initial_signal_pipe;
>
> void pgwin32_signal_initialize(void);
> HANDLE pgwin32_create_signal_listener(pid_t pid);
> void pgwin32_dispatch_queued_signals(void);
> void pg_queue_signal(int signum);
>
>--- 214,230 ----
>
>
> /* In backend/port/win32/signal.c */
>! extern DLLIMPORT volatile int pg_signal_queue;
>! extern DLLIMPORT int pg_signal_mask;
>! extern HANDLE pgwin32_signal_event;
> extern HANDLE pgwin32_initial_signal_pipe;
>
>+ #define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask)
>+
>+
> void pgwin32_signal_initialize(void);
> HANDLE pgwin32_create_signal_listener(pid_t pid);
>+ void pgwin32_check_queued_signals(void);
> void pgwin32_dispatch_queued_signals(void);
> void pg_queue_signal(int signum);
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
>
>


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-11-2008, 06:21 AM
Andrew Dunstan
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance


And the patch that was applied gives the same result.

What is more, I am not seeing the reported speedup - in fact I am seeing
no speedup worth mentioning.

This is on XP-Pro, with default postgres settings. The test sets were
somewhat larger than thos Magnus used - basically TPC-H lineitems and
orders tables (6m and 1.5m rows respectively).

cheers

andrew


Andrew Dunstan wrote:

>
> Heads up - I have seen 2 regression hangs. I am checking further. Has
> anyone else run the regression suite with any version of this patch?
>
> cheers
>
> andrew
>
> Tom Lane wrote:
>
>> I wrote:
>>
>>
>>> BTW, expanding on Andrew's comment, ISTM we could move the kernel call
>>> out of the macro, ie make it look like ...
>>>

>>
>>
>> I've applied the attached version of Qingqing's revised patch. I'm not
>> in a position to test it, and am about to go out for the evening, but if
>> anyone can check the committed version soon and verify that I didn't
>> break anything ...
>>
>> (BTW, DLLIMPORT is only needed in extern declarations, not in the actual
>> definition of the variable.)
>>
>> regards, tom lane
>>
>> *** src/backend/port/win32/signal.c.orig Fri Oct 14 22:59:56 2005
>> --- src/backend/port/win32/signal.c Fri Oct 21 17:36:24 2005
>> ***************
>> *** 15,32 ****
>>
>> #include <libpq/pqsignal.h>
>>
>> ! ! /* pg_signal_crit_sec is used to protect only pg_signal_queue.
>> That is the only
>> ! * variable that can be accessed from the signal sending threads! */
>> static CRITICAL_SECTION pg_signal_crit_sec;
>> - static int pg_signal_queue;
>>
>> static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
>> static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
>> - static int pg_signal_mask;
>> - - DLLIMPORT HANDLE pgwin32_signal_event;
>> - HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
>>
>>
>> /* Signal handling thread function */
>> --- 15,40 ----
>>
>> #include <libpq/pqsignal.h>
>>
>> ! /*
>> ! * These are exported for use by the UNBLOCKED_SIGNAL_QUEUE() macro.
>> ! * pg_signal_queue must be volatile since it is changed by the signal
>> ! * handling thread and inspected without any lock by the main thread.
>> ! * pg_signal_mask is only changed by main thread so shouldn't need it.
>> ! */
>> ! volatile int pg_signal_queue;
>> ! int pg_signal_mask;
>> ! ! HANDLE pgwin32_signal_event;
>> ! HANDLE pgwin32_initial_signal_pipe = INVALID_HANDLE_VALUE;
>> ! ! /*
>> ! * pg_signal_crit_sec is used to protect only pg_signal_queue. That
>> is the only
>> ! * variable that can be accessed from the signal sending threads!
>> ! */
>> static CRITICAL_SECTION pg_signal_crit_sec;
>>
>> static pqsigfunc pg_signal_array[PG_SIGNAL_COUNT];
>> static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
>>
>>
>> /* Signal handling thread function */
>> ***************
>> *** 81,101 ****
>> (errmsg_internal("failed to set console control
>> handler")));
>> }
>>
>>
>> ! /* Dispatch all signals currently queued and not blocked
>> * Blocked signals are ignored, and will be fired at the time of
>> ! * the sigsetmask() call. */
>> void
>> pgwin32_dispatch_queued_signals(void)
>> {
>> int i;
>>
>> EnterCriticalSection(&pg_signal_crit_sec);
>> ! while (pg_signal_queue & ~pg_signal_mask)
>> {
>> /* One or more unblocked signals queued for execution */
>> ! ! int exec_mask = pg_signal_queue &
>> ~pg_signal_mask;
>>
>> for (i = 0; i < PG_SIGNAL_COUNT; i++)
>> {
>> --- 89,119 ----
>> (errmsg_internal("failed to set console control
>> handler")));
>> }
>>
>> + /*
>> + * Support routine for CHECK_FOR_INTERRUPTS() macro
>> + */
>> + void
>> + pgwin32_check_queued_signals(void)
>> + {
>> + if (WaitForSingleObjectEx(pgwin32_signal_event, 0, TRUE) ==
>> WAIT_OBJECT_0)
>> + pgwin32_dispatch_queued_signals();
>> + }
>>
>> ! /*
>> ! * Dispatch all signals currently queued and not blocked
>> * Blocked signals are ignored, and will be fired at the time of
>> ! * the sigsetmask() call.
>> ! */
>> void
>> pgwin32_dispatch_queued_signals(void)
>> {
>> int i;
>>
>> EnterCriticalSection(&pg_signal_crit_sec);
>> ! while (UNBLOCKED_SIGNAL_QUEUE())
>> {
>> /* One or more unblocked signals queued for execution */
>> ! int exec_mask = UNBLOCKED_SIGNAL_QUEUE();
>>
>> for (i = 0; i < PG_SIGNAL_COUNT; i++)
>> {
>> *** src/include/miscadmin.h.orig Fri Oct 14 23:00:22 2005
>> --- src/include/miscadmin.h Fri Oct 21 17:36:18 2005
>> ***************
>> *** 83,97 ****
>> if (InterruptPending) \
>> ProcessInterrupts(); \
>> } while(0)
>> #else /* WIN32 */
>>
>> #define CHECK_FOR_INTERRUPTS() \
>> do { \
>> ! if (WaitForSingleObjectEx(pgwin32_signal_event,0,TRUE ) ==
>> WAIT_OBJECT_0) \
>> ! pgwin32_dispatch_queued_signals(); \
>> if (InterruptPending) \
>> ProcessInterrupts(); \
>> } while(0)
>> #endif /* WIN32 */
>>
>>
>> --- 83,99 ----
>> if (InterruptPending) \
>> ProcessInterrupts(); \
>> } while(0)
>> + #else /* WIN32 */
>>
>> #define CHECK_FOR_INTERRUPTS() \
>> do { \
>> ! if (UNBLOCKED_SIGNAL_QUEUE()) \
>> ! pgwin32_check_queued_signals(); \
>> if (InterruptPending) \
>> ProcessInterrupts(); \
>> } while(0)
>> + #endif /* WIN32 */
>>
>>
>> *** src/include/port/win32.h.orig Fri Oct 14 23:00:30 2005
>> --- src/include/port/win32.h Fri Oct 21 17:36:12 2005
>> ***************
>> *** 214,224 ****
>>
>>
>> /* In backend/port/win32/signal.c */
>> ! extern DLLIMPORT HANDLE pgwin32_signal_event;
>> extern HANDLE pgwin32_initial_signal_pipe;
>>
>> void pgwin32_signal_initialize(void);
>> HANDLE pgwin32_create_signal_listener(pid_t pid);
>> void pgwin32_dispatch_queued_signals(void);
>> void pg_queue_signal(int signum);
>>
>> --- 214,230 ----
>>
>>
>> /* In backend/port/win32/signal.c */
>> ! extern DLLIMPORT volatile int pg_signal_queue;
>> ! extern DLLIMPORT int pg_signal_mask;
>> ! extern HANDLE pgwin32_signal_event;
>> extern HANDLE pgwin32_initial_signal_pipe;
>>
>> + #define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue &
>> ~pg_signal_mask)
>> + + void pgwin32_signal_initialize(void);
>> HANDLE pgwin32_create_signal_listener(pid_t pid);
>> + void pgwin32_check_queued_signals(void);
>> void pgwin32_dispatch_queued_signals(void);
>> void pg_queue_signal(int signum);
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>> choose an index scan if your joining column's datatypes do not
>> match
>>
>>
>>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-11-2008, 06:21 AM
Tom Lane
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance

Andrew Dunstan <andrew@dunslane.net> writes:
> Heads up - I have seen 2 regression hangs. I am checking further. Has
> anyone else run the regression suite with any version of this patch?


Hm, anyone else? It's pretty hard to see how the patch could break
the regression tests, because they don't exercise control-C response
time.

Andrew, did you do a full rebuild after applying the patch? I don't
quite see why that would be needed either, but people have seen weird
failures from partial rebuilds before ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-11-2008, 06:21 AM
Dave Page
 
Posts: n/a
Default Re: [PATCHES] Win32 CHECK_FOR_INTERRUPTS() performance




On 22/10/05 3:45 am, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:

> Andrew Dunstan <andrew@dunslane.net> writes:
>> Heads up - I have seen 2 regression hangs. I am checking further. Has
>> anyone else run the regression suite with any version of this patch?

>
> Hm, anyone else? It's pretty hard to see how the patch could break
> the regression tests, because they don't exercise control-C response
> time.


Yeah, I had to kill the buildfarm run on Snake as it was still stuck in make
check after 8 and a bit hours. :-(

Regards, Dave



---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:02 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
UnixAdminTalk.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438