Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-24267 Heap lock manager behave incorrectly in case of overflow #5096

Merged
merged 10 commits into from
Jan 27, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void startCluster() throws Exception {
+ " rest.port: {},\n"
+ " raft.fsync = " + fsync() + ",\n"
+ " system.partitionsLogPath = \"" + logPath() + "\",\n"
+ " failureHandler.handler: {\n"
+ " failureHandler.handler: {\n"
+ " type: \"" + StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE + "\",\n"
+ " tryStop: true,\n"
+ " timeoutMillis: 60000,\n" // 1 minute for graceful shutdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class LockManagerBenchmark {
*/
@Setup
public void setUp() {
lockManager = new HeapLockManager(DEFAULT_SLOTS, DEFAULT_SLOTS);
lockManager = new HeapLockManager(DEFAULT_SLOTS);
lockManager.start(new WaitDieDeadlockPreventionPolicy());
generator = new TransactionIdGenerator(0);
clock = new TestHybridClock(() -> 0L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class ItLockTableTest extends IgniteAbstractTest {
@InjectConfiguration
protected static StorageUpdateConfiguration storageUpdateConfiguration;

@InjectConfiguration("mock.properties: { lockMapSize: \"" + CACHE_SIZE + "\", rawSlotsMaxSize: \"131072\" }")
@InjectConfiguration("mock.properties: { lockMapSize: \"" + CACHE_SIZE + "\" }")
private static SystemLocalConfiguration systemLocalConfiguration;

@InjectExecutorService
Expand Down Expand Up @@ -180,11 +180,11 @@ public void after() throws Exception {
* Test that a lock table behaves correctly in case of lock cache overflow.
*/
@Test
public void testCollision() {
public void testTakeMoreLocksThanAfford() {
RecordView<Tuple> view = testTable.recordView();

int i = 0;
final int count = 1000;
final int count = 100;
vldpyatkov marked this conversation as resolved.
Show resolved Hide resolved
List<Transaction> txns = new ArrayList<>();
while (i++ < count) {
Transaction tx = txTestCluster.igniteTransactions().begin();
Expand All @@ -200,7 +200,7 @@ public void testCollision() {
total += slot.waitersCount();
}

return total == count && lockManager.available() == 0;
return total == CACHE_SIZE && lockManager.available() == 0;
}, 10_000), "Some lockers are missing");

int empty = 0;
Expand All @@ -212,8 +212,7 @@ public void testCollision() {
int cnt = slot.waitersCount();
if (cnt == 0) {
empty++;
}
if (cnt > 1) {
} else {
coll += cnt;
}
}
Expand All @@ -224,7 +223,7 @@ public void testCollision() {

List<CompletableFuture<?>> finishFuts = new ArrayList<>();
for (Transaction txn : txns) {
finishFuts.add(txn.commitAsync());
finishFuts.add(txn.rollbackAsync());
}

for (CompletableFuture<?> finishFut : finishFuts) {
Expand Down
Loading