Merge branch 'cassandra-4.0' into trunk

This commit is contained in:
Ekaterina Dimitrova 2021-06-04 18:42:22 -04:00
commit 4fd2124572
2 changed files with 22 additions and 4 deletions

View File

@ -30,6 +30,9 @@ import com.google.common.base.Preconditions;
/**
* Concurrent rate computation over a sliding time window.
*
* Currently not used in the Cassandra 4.0 code base. If you decide to use it, please check CASSANDRA-16713.
* There still might be a bug, flaky test to be fixed before using it again.
*/
public class SlidingTimeRate
{

View File

@ -22,10 +22,19 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
/**
* No objects are created currently from SlidingTimeRate in Cassandra 4.0.
* If you decide to use it, please check CASSANDRA-16713.
* There still might be a bug, flaky test to be fixed before using it again.
*
* Skipping all tests for running now to clean he noise before 4.0 GA release.
*/
public class SlidingTimeRateTest
{
@Ignore
@Test
public void testUpdateAndGet()
{
@ -38,8 +47,9 @@ public class SlidingTimeRateTest
Assert.assertEquals(updates, rate.get(TimeUnit.SECONDS), 0.0);
}
@Ignore
@Test
public void testUpdateAndGetBetweenWindows() throws InterruptedException
public void testUpdateAndGetBetweenWindows()
{
TestTimeSource time = new TestTimeSource();
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
@ -52,8 +62,9 @@ public class SlidingTimeRateTest
Assert.assertEquals(10, rate.get(TimeUnit.SECONDS), 0.0);
}
@Ignore
@Test
public void testUpdateAndGetPastWindowSize() throws InterruptedException
public void testUpdateAndGetPastWindowSize()
{
TestTimeSource time = new TestTimeSource();
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
@ -68,8 +79,9 @@ public class SlidingTimeRateTest
Assert.assertEquals(0, rate.get(TimeUnit.SECONDS), 0.0);
}
@Ignore
@Test
public void testUpdateAndGetToPointInTime() throws InterruptedException
public void testUpdateAndGetToPointInTime()
{
TestTimeSource time = new TestTimeSource();
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
@ -86,6 +98,7 @@ public class SlidingTimeRateTest
Assert.assertEquals(10, rate.get(1, TimeUnit.SECONDS), 0.0);
}
@Ignore
@Test
public void testDecay() throws InterruptedException
{
@ -108,8 +121,9 @@ public class SlidingTimeRateTest
Assert.assertEquals(2.5, rate.get(TimeUnit.SECONDS), 0.0);
}
@Ignore
@Test
public void testPruning() throws InterruptedException
public void testPruning()
{
TestTimeSource time = new TestTimeSource();
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
@ -123,6 +137,7 @@ public class SlidingTimeRateTest
Assert.assertEquals(0, rate.size());
}
@Ignore
@Test
public void testConcurrentUpdateAndGet() throws InterruptedException
{