-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/52631/
-----------------------------------------------------------

Review request for hive, Aihua Xu, Miklos Csanady, Peter Vary, Szehon Ho, and 
Barna Zsombor Klara.


Bugs: HIVE-14839
    https://issues.apache.org/jira/browse/HIVE-14839


Repository: hive-git


Description
-------

The TestSessionManagerMetrics fails occasionally with the following error: 
org.junit.ComparisonFailure: expected:<[0]> but was:<[1]>
        at 
org.apache.hive.service.cli.session.TestSessionManagerMetrics.testThreadPoolMetrics(TestSessionManagerMetrics.java:98)

Changed the synchronization between the tasks a bit to avoid these failures.
With this patch the test would work do the following steps:
- Submit four tasks.
- Wait with the metrics verification, until the first two tasks are running.
  This is done by invoking await on the "ready" barrier.
  If, for some reason, the tasks are not started within a timeout period, make 
the test fail.
- Make the tasks wait until the metrics are checked.
  This is done by invoking await on the "completed" barrier.
- Verify the metrics.
- Let the first two tasks complete by breaking the "complete" barrier.
  When the first two tasks completed, the remaining two tasks will be removed 
from the queue and started.
- Wait until the remaining tasks are running by using the "ready" barrier again.
  Do the metrics check only if they are started to avoid the failures when the 
queue size was not 0.
  If, for some reason, the tasks are not started within a timeout period, make 
the test fail.
- Verify the metrics.
- Let the remaining tasks complete by breaking the "completed" barrier.


Diffs
-----

  
service/src/test/org/apache/hive/service/cli/session/TestSessionManagerMetrics.java
 5511c54 

Diff: https://reviews.apache.org/r/52631/diff/


Testing
-------

The change effects only a unit test.
Ran the test many times locally.
Added random sleeps to the tasks to simulate the delay when they start or 
complete and ran the test many times to see if the synch between the tasks is 
working correctly.


Thanks,

Marta Kuczora

Reply via email to