-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,389 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.4.1 | ||
0.4.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
concourse-integration-tests/src/test/java/org/cinchapi/concourse/bugrepro/CON171.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2014 Jeff Nelson, Cinchapi Software Collective | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.cinchapi.concourse.bugrepro; | ||
|
||
import org.cinchapi.concourse.Concourse; | ||
import org.cinchapi.concourse.ConcourseIntegrationTest; | ||
import org.cinchapi.concourse.TransactionException; | ||
import org.cinchapi.concourse.thrift.Operator; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Repro of issue described in CON-171 where a phantom read is possible when | ||
* using transactions. | ||
* | ||
* @author jnelson | ||
*/ | ||
public class CON171 extends ConcourseIntegrationTest { | ||
|
||
@Test(expected=TransactionException.class) | ||
public void repro1() { | ||
Concourse client2 = Concourse.connect(SERVER_HOST, SERVER_PORT, | ||
"admin", "admin"); | ||
client.stage(); | ||
client.find("foo", Operator.EQUALS, "bar"); | ||
client2.set("foo", "bar", 1); | ||
Assert.assertTrue(client.find("foo", Operator.EQUALS, "bar").isEmpty()); | ||
} | ||
|
||
@Test(expected=TransactionException.class) | ||
public void repro2(){ | ||
Concourse client2 = Concourse.connect(SERVER_HOST, SERVER_PORT, | ||
"admin", "admin"); | ||
client.stage(); | ||
client.find("foo", Operator.EQUALS, "bar"); | ||
client2.add("foo", "bar", 1); | ||
Assert.assertTrue(client.find("foo", Operator.EQUALS, "bar").isEmpty()); | ||
} | ||
|
||
@Test(expected=TransactionException.class) | ||
public void repro3(){ | ||
Concourse client2 = Concourse.connect(SERVER_HOST, SERVER_PORT, | ||
"admin", "admin"); | ||
client.stage(); | ||
client2.add("foo", "bar", 1); | ||
client.find("foo", Operator.EQUALS, "bar"); | ||
client2.remove("foo", "bar", 1); | ||
Assert.assertFalse(client.find("foo", Operator.EQUALS, "bar").isEmpty()); | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
...ourse-integration-tests/src/test/java/org/cinchapi/concourse/perf/FindThroughputTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2013-2014 Jeff Nelson, Cinchapi Software Collective | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.cinchapi.concourse.perf; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import org.cinchapi.concourse.ConcourseIntegrationTest; | ||
import org.cinchapi.concourse.thrift.Operator; | ||
import org.junit.Test; | ||
|
||
import com.google.common.base.Stopwatch; | ||
|
||
/** | ||
* Test the speed of find queries | ||
* | ||
* @author jnelson | ||
* | ||
*/ | ||
public class FindThroughputTest extends ConcourseIntegrationTest { | ||
|
||
@Test | ||
public void testFindPerformance1() { | ||
System.out.println("Doing the testFindPerformance1 test"); | ||
int count = 20000; | ||
for (int i = 0; i < count; i++) { | ||
client.add("foo", i, i); | ||
} | ||
Stopwatch watch = Stopwatch.createStarted(); | ||
client.find("foo", Operator.GREATER_THAN_OR_EQUALS, 0); | ||
watch.stop(); | ||
TimeUnit unit = TimeUnit.MILLISECONDS; | ||
System.out.println(watch.elapsed(unit) + " " + unit); | ||
System.gc(); | ||
} | ||
|
||
@Test | ||
public void testFindPerformance2() { | ||
System.out.println("Doing the testFindPerformance2 test"); | ||
int count = 500; | ||
for (int i = 0; i < count; i++) { | ||
for (int j = 0; j <= i; j++) { | ||
client.add("foo", j, i); | ||
} | ||
} | ||
Stopwatch watch = Stopwatch.createStarted(); | ||
client.find("foo", Operator.BETWEEN, 5, 100); | ||
watch.stop(); | ||
TimeUnit unit = TimeUnit.MILLISECONDS; | ||
System.out.println(watch.elapsed(unit) + " " + unit); | ||
System.gc(); | ||
|
||
} | ||
|
||
} |
133 changes: 133 additions & 0 deletions
133
...ntegration-tests/src/test/java/org/cinchapi/concourse/perf/TransactionThroughputTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2013-2014 Jeff Nelson, Cinchapi Software Collective | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package org.cinchapi.concourse.perf; | ||
|
||
import java.util.List; | ||
import java.util.Random; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
import org.cinchapi.concourse.Concourse; | ||
import org.cinchapi.concourse.ConcourseIntegrationTest; | ||
import org.cinchapi.concourse.TransactionException; | ||
import org.junit.Test; | ||
|
||
import com.google.common.base.Throwables; | ||
import com.google.common.collect.Lists; | ||
|
||
/** | ||
* A test of transaction throughput. | ||
* | ||
* @author jnelson | ||
*/ | ||
public class TransactionThroughputTest extends ConcourseIntegrationTest { | ||
|
||
AtomicBoolean running = new AtomicBoolean(true); | ||
long stoptime = 0; | ||
AtomicLong rounds = new AtomicLong(0); | ||
AtomicLong failed = new AtomicLong(0); | ||
|
||
@Test | ||
public void test() { | ||
try { | ||
System.out.println("Doing the TransactionThroughputTest"); | ||
int size = 10; | ||
// Pre-seed the data | ||
for (int i = 0; i < size; i++) { | ||
client.clear(i); | ||
client.set("username", Integer.toString(i), i); | ||
client.set("password", Integer.toString(i), i); | ||
client.set("age", Integer.toString(i), i); | ||
} | ||
|
||
List<Concourse> connections = Lists.newArrayList(); | ||
for (int i = 0; i < size; i++) { | ||
connections.add(Concourse.connect(SERVER_HOST, SERVER_PORT, | ||
"admin", "admin")); | ||
} | ||
List<Thread> threads = Lists.newArrayList(); | ||
for (int i = 0; i < size; i++) { | ||
threads.add(new Thread(new ConcourseRunnable(connections | ||
.remove(0)))); | ||
} | ||
stoptime = System.currentTimeMillis() + 10000; | ||
for (Thread thread : threads) { | ||
thread.start(); | ||
} | ||
while (System.currentTimeMillis() < stoptime) { | ||
continue; | ||
} | ||
running.set(false); | ||
for (Thread thread : threads) { | ||
thread.join(); | ||
} | ||
System.out.println("rounds=" + rounds.get()); | ||
System.out.println("failed=" + failed.get()); | ||
client.exit(); | ||
|
||
} | ||
catch (Exception e) { | ||
throw Throwables.propagate(e); | ||
} | ||
} | ||
|
||
class ConcourseRunnable implements Runnable { | ||
|
||
private Concourse client; | ||
private Random random = new Random(); | ||
|
||
public ConcourseRunnable(Concourse client) { | ||
this.client = client; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
while (running.get()) { | ||
int id = random.nextInt(10); | ||
try { | ||
client.stage(); | ||
client.set("username", | ||
((String) client.get("username", id)) + "n", id); | ||
client.set("password", | ||
((String) client.get("password", id)) + "n", id); | ||
client.set("age", ((String) client.get("age", id)) + "n", | ||
id); | ||
if(client.commit()) { | ||
rounds.incrementAndGet(); | ||
} | ||
else { | ||
failed.incrementAndGet(); | ||
} | ||
} | ||
catch (TransactionException e) { | ||
client.abort(); | ||
failed.incrementAndGet(); | ||
} | ||
|
||
} | ||
client.exit(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.