Skip to content
This repository was archived by the owner on Jun 7, 2021. It is now read-only.

APEXCORE-505 Heartbeat loop was blocked waiting for operator activati…#405

Merged
asfgit merged 1 commit intoapache:masterfrom
sandeshh:APEXCORE-505
Nov 14, 2016
Merged

APEXCORE-505 Heartbeat loop was blocked waiting for operator activati…#405
asfgit merged 1 commit intoapache:masterfrom
sandeshh:APEXCORE-505

Conversation

@sandeshh
Copy link
Contributor

@sandeshh sandeshh commented Oct 5, 2016

…on, the reason for this is that Stream activation(Only BufferServerSubscriber and WindowGenerator) waits for operator activation in a heartbeat thread. There is no need to have this synchronization, as Tuples are pulled from the queues by the operators.

@vrozov @tweise please review

@sandeshh sandeshh closed this Oct 5, 2016
@sandeshh sandeshh reopened this Oct 5, 2016
@sandeshh sandeshh force-pushed the APEXCORE-505 branch 2 times, most recently from 7611319 to afb1e79 Compare October 11, 2016 19:16
Copy link
Member

@vrozov vrozov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a unit test that checks that it is OK to activate BufferServerSubscriber before an operator that consumes from the reservoir.

@sandeshh
Copy link
Contributor Author

@vrozov I have added the unit test. Please review.

@vrozov
Copy link
Member

vrozov commented Oct 25, 2016

Please avoid code duplication.

@vrozov
Copy link
Member

vrozov commented Oct 25, 2016

It is necessary to test operator activation sequence.


@Test
public void testBufferServerSubscriberActivationBeforeOperator() throws InterruptedException, IOException
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delay this declaration till it can be initialized

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Test
public void testBufferServerSubscriberActivationBeforeOperator() throws InterruptedException, IOException
{
int bufferServerPort = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delay declaration till it can be initialized

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


((DefaultEventLoop)eventloop).start();
bufferServer = new Server(0); // find random port
InetSocketAddress bindAddr = bufferServer.run(eventloop);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final int bufferServerPort = bufferServer.run(eventloop).getPort();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

final StreamCodec<Object> serde = new DefaultStatefulStreamCodec<Object>();
final ArrayList<Object> list = new ArrayList<Object>();

GenericOperator go = new GenericOperator();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check if OperatorContext is required or it can be null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The context cannot be null, in the Node activation values are read from context.

issContext = new StreamContext(streamName);
issContext.setSourceId(upstreamNodeId);
issContext.setSinkId(downstreamNodeId);
issContext.setFinishedWindowId(-1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why createUnresolved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Using "localhost" to create the socket address.

oss.put(beginWindow2);
oss.put(endWindow2);
oss.put(beginWindow3);
oss.put(endWindow3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of the test is to check that BufferServerSubscriber can be activated and process tuples without a loss even if it is activated before the operator is setup and starts processing tuples. There is no guarantee that Publisher actually delivers tuples to the buffer server and buffer server sends them to the Subscriber in the test.

@sandeshh sandeshh force-pushed the APEXCORE-505 branch 3 times, most recently from 1e673f3 to e50f090 Compare November 7, 2016 17:54
SweepableReservoir tupleWait = iss.acquireReservoir("testReservoir2", 10);

iss.activate(issContext);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the condition be reversed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will change it.

…on, reason for this is that Stream activation(Only BufferServerSubscriber and WindowGenerator) waits for operator activation in heartbeat thread. After analysis and sanity testing, we don't see the need to have the synchronization between operator and stream activation
@asfgit asfgit merged commit fc3246e into apache:master Nov 14, 2016
@sandeshh sandeshh deleted the APEXCORE-505 branch November 14, 2016 18:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants