Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Tom Lane
Amit Kapila writes: > oops, I just saw that you have already pushed a fix for it. I am not > sure if we should try to do anything about walrcv_receive's output > still uses pgsocket instead of int as the usage in itself doesn't have > any problem. I see a few places where we're still assigning P

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Amit Kapila
On Sun, Apr 1, 2018 at 8:59 AM, Amit Kapila wrote: > On Sat, Mar 31, 2018 at 11:33 PM, Tom Lane wrote: >> ... Oh, just to make things even more fun, PQsocket() returns int, not >> pgsocket; see its header comment. Therefore, that test is correctly >> coded as-is (though it's still useless), and

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Amit Kapila
On Sat, Mar 31, 2018 at 11:33 PM, Tom Lane wrote: > ... Oh, just to make things even more fun, PQsocket() returns int, not > pgsocket; see its header comment. Therefore, that test is correctly > coded as-is (though it's still useless), and the real problem is that > ParallelSlot.sock ought to be

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Tom Lane
... Oh, just to make things even more fun, PQsocket() returns int, not pgsocket; see its header comment. Therefore, that test is correctly coded as-is (though it's still useless), and the real problem is that ParallelSlot.sock ought to be declared int not pgsocket. If you look around at our other

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread CharSyam
Hi, Tom, Thank you for your review. so Do you think it is better to remove if statement like below diff --git src/bin/scripts/vacuumdb.c src/bin/scripts/vacuumdb.c index 887fa48fbd..243d842d06 100644 --- src/bin/scripts/vacuumdb.c +++ src/bin/scripts/vacuumdb.c @@ -947,13 +947,6 @@ init_slot(Paral

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Tom Lane
CharSyam writes: > [ simple_check.patch ] This is a good catch. However, it looks to me like the reason nobody has noticed a problem here is that actually, this error test is useless; we can never get here with a bad connection, because connectDatabase would have failed. I'm inclined to think w

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Amit Kapila
On Sat, Mar 31, 2018 at 6:08 PM, CharSyam wrote: > Thanks Amit. > I had a mistake. Thank you again to point it out :) > Thanks, your new patch looks good. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread CharSyam
Thanks Amit. I had a mistake. Thank you again to point it out :) 2018-03-31 19:33 GMT+09:00 Amit Kapila : > On Sat, Mar 31, 2018 at 12:05 PM, CharSyam wrote: >> Amit, I agree with you. >> >> I changed my patch :) to remove old check. >> > > - if (slot->sock < 0) > + if (slot->sock == PGINVALID_S

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-31 Thread Amit Kapila
On Sat, Mar 31, 2018 at 12:05 PM, CharSyam wrote: > Amit, I agree with you. > > I changed my patch :) to remove old check. > - if (slot->sock < 0) + if (slot->sock == PGINVALID_SOCKET || slot->sock < 0) I still see the same check. I think by mistake you have attached old patch. -- With Regards

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-30 Thread CharSyam
Amit, I agree with you. I changed my patch :) to remove old check. 2018-03-31 15:17 GMT+09:00 Amit Kapila : > On Sat, Mar 31, 2018 at 11:42 AM, CharSyam wrote: >> Hi, Amit, It's good question. I also thought about it. >> >> But, I want to leave original code intention. >> >> Actually I think the

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-30 Thread Amit Kapila
On Sat, Mar 31, 2018 at 11:42 AM, CharSyam wrote: > Hi, Amit, It's good question. I also thought about it. > > But, I want to leave original code intention. > > Actually I think there is no case ( slot->sock is not PGINVALID_SOCKET > and slot->sock < 0) > > but if original code want to check (sock

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-30 Thread CharSyam
Hi, Amit, It's good question. I also thought about it. But, I want to leave original code intention. Actually I think there is no case ( slot->sock is not PGINVALID_SOCKET and slot->sock < 0) but if original code want to check (sock < -1) I think it is better to leave that condition. but I thi

Re: [HACKERS][PATCH] adding simple sock check for windows

2018-03-30 Thread Amit Kapila
On Fri, Mar 30, 2018 at 8:10 PM, CharSyam wrote: > Hi, I found some missing check for windows int init_slot function in > vacuumdb.c > > in windows > SOCKET is unsigned type. so > > slot->sock < 0 never can be under 0. > > so this patch just check using slot->sock == PGINVALID_SOCKET > - if (slo

[HACKERS][PATCH] adding simple sock check for windows

2018-03-30 Thread CharSyam
Hi, I found some missing check for windows int init_slot function in vacuumdb.c in windows SOCKET is unsigned type. so slot->sock < 0 never can be under 0. so this patch just check using slot->sock == PGINVALID_SOCKET Thanks. simple_check.patch Description: Binary data