[Spread-users] SP_poll

John Robinson jr at vertica.com
Wed Jul 5 16:57:41 EDT 2006


Hi spread-lovers,

I tried creating a test based on examples/user.c, but using SP_poll (so 
I can size the receive buffer from malloc()), and noticed some odd 
results, at least when all the traffic is membership messages.  The 
SP_poll seems to return the wrong length most of the time, and sometimes 
it is too small.  See the first output log below.  [trust me that the 
program is doing what it claims it is].

So I realized that I can just use SP_receive to do the work of SP_poll, 
in effect.  The first call uses a message length or 0, and then uses the 
error in BUFFER_TOO_SHORT to get the correct size buffer.  This seems to 
have the extra advantage that for self-leave messages, no allocation is 
needed at all.

Is there any reason I shouldn't follow the second approach?

The second output log shows the results of this approach.

thanks,
/jr
--------
log 1
--------
../Linux/bin/spreadTest my 2
VSpread connected to 4803 at localhost with private group #r7921-10#vdev

=VSpread===========================
SP_poll reports a message of length 168
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 2 members, where 
I am member 1:
grp id is -1062731469 1152108506 2
Due to the JOIN of #r7921-10#vdev [me!]
  I am now a member
	#r6083-9#vdev
	#r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 48
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 1 members, where 
I am member 0:
grp id is -1062731469 1152108506 3
Due to the LEAVE of #r6083-9#vdev
  I am still a member
	#r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 48
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group V:my with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 48
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:my

=VSpread===========================
SP_poll reports a message of length 600
SP_receive reports a message of length 56
Received REGULAR membership for group V:mytwo with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 464
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:mytwo

=VSpread===========================
SP_poll reports a message of length 416
SP_receive reports a message of length 56
Received REGULAR membership for group V:my with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 280
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:my

=VSpread===========================
SP_poll reports a message of length 232
SP_receive reports a message of length 56
Received REGULAR membership for group V:mytwo with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 96
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:mytwo

=VSpread===========================
SP_poll reports a message of length 48
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group Vertica:all

=VSpread===========================
SP_poll reports a message of length 48
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 2 members, where 
I am member 1:
grp id is -1062731469 1152108506 2
Due to the JOIN of #r7921-10#vdev [me!]
  I am now a member
	#r6083-9#vdev
	#r7921-10#vdev [me!]

=VSpread===========================
SP_poll reports a message of length 48
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 1 members, where 
I am member 0:
grp id is -1062731469 1152108506 3
Due to the DISCONNECT of #r6083-9#vdev
  I am still a member
	#r7921-10#vdev [me!]

Bye.
--------
log 2
--------
../Linux/bin/spreadTest my 2
VSpread connected to 4803 at localhost with private group #r9112-9#vdev

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 1 members, where 
I am member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r9112-9#vdev [me!]
  I am now a member
	#r9112-9#vdev [me!]

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 2 members, where 
I am member 1:
grp id is -1062731469 1152108506 2
Due to the JOIN of #r3376-10#vdev
  I am still a member
	#r3376-10#vdev
	#r9112-9#vdev [me!]

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group V:my with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r9112-9#vdev [me!]

=VSpread===========================
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:my

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group V:mytwo with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r9112-9#vdev [me!]

=VSpread===========================
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:mytwo

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group V:my with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r9112-9#vdev [me!]

=VSpread===========================
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:my

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group V:mytwo with 1 members, where I am 
member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r9112-9#vdev [me!]

=VSpread===========================
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group V:mytwo

=VSpread===========================
SP_receive reports a message of length 0
received SELF-LEAVE message that I left group Vertica:all
  I am no longer a member

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 1 members, where 
I am member 0:
grp id is -1062731469 1152108506 1
Due to the JOIN of #r9112-9#vdev [me!]
  I am now a member
	#r9112-9#vdev [me!]

=VSpread===========================
SP_receive requires a message of length 56
SP_receive reports a message of length 56
Received REGULAR membership for group Vertica:all with 2 members, where 
I am member 1:
grp id is -1062731469 1152108506 2
Due to the JOIN of #r3376-10#vdev
  I am still a member
	#r3376-10#vdev
	#r9112-9#vdev [me!]

Bye.





More information about the Spread-users mailing list