mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-4.0' into trunk
This commit is contained in:
commit
4fd2124572
|
|
@ -30,6 +30,9 @@ import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concurrent rate computation over a sliding time window.
|
* 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
|
public class SlidingTimeRate
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,19 @@ import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
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
|
public class SlidingTimeRateTest
|
||||||
{
|
{
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateAndGet()
|
public void testUpdateAndGet()
|
||||||
{
|
{
|
||||||
|
|
@ -38,8 +47,9 @@ public class SlidingTimeRateTest
|
||||||
Assert.assertEquals(updates, rate.get(TimeUnit.SECONDS), 0.0);
|
Assert.assertEquals(updates, rate.get(TimeUnit.SECONDS), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateAndGetBetweenWindows() throws InterruptedException
|
public void testUpdateAndGetBetweenWindows()
|
||||||
{
|
{
|
||||||
TestTimeSource time = new TestTimeSource();
|
TestTimeSource time = new TestTimeSource();
|
||||||
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
|
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);
|
Assert.assertEquals(10, rate.get(TimeUnit.SECONDS), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateAndGetPastWindowSize() throws InterruptedException
|
public void testUpdateAndGetPastWindowSize()
|
||||||
{
|
{
|
||||||
TestTimeSource time = new TestTimeSource();
|
TestTimeSource time = new TestTimeSource();
|
||||||
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
|
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);
|
Assert.assertEquals(0, rate.get(TimeUnit.SECONDS), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateAndGetToPointInTime() throws InterruptedException
|
public void testUpdateAndGetToPointInTime()
|
||||||
{
|
{
|
||||||
TestTimeSource time = new TestTimeSource();
|
TestTimeSource time = new TestTimeSource();
|
||||||
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
|
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);
|
Assert.assertEquals(10, rate.get(1, TimeUnit.SECONDS), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testDecay() throws InterruptedException
|
public void testDecay() throws InterruptedException
|
||||||
{
|
{
|
||||||
|
|
@ -108,8 +121,9 @@ public class SlidingTimeRateTest
|
||||||
Assert.assertEquals(2.5, rate.get(TimeUnit.SECONDS), 0.0);
|
Assert.assertEquals(2.5, rate.get(TimeUnit.SECONDS), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testPruning() throws InterruptedException
|
public void testPruning()
|
||||||
{
|
{
|
||||||
TestTimeSource time = new TestTimeSource();
|
TestTimeSource time = new TestTimeSource();
|
||||||
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
|
SlidingTimeRate rate = new SlidingTimeRate(time, 5, 1, TimeUnit.SECONDS);
|
||||||
|
|
@ -123,6 +137,7 @@ public class SlidingTimeRateTest
|
||||||
Assert.assertEquals(0, rate.size());
|
Assert.assertEquals(0, rate.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Ignore
|
||||||
@Test
|
@Test
|
||||||
public void testConcurrentUpdateAndGet() throws InterruptedException
|
public void testConcurrentUpdateAndGet() throws InterruptedException
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue