Skip to content

Commit ff36633

Browse files
authored
IGNITE-24267 Heap lock manager behave incorrectly in case of overflow (#5096)
1 parent f70c7d5 commit ff36633

File tree

5 files changed

+148
-119
lines changed

5 files changed

+148
-119
lines changed

modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private void startCluster() throws Exception {
209209
+ " rest.port: {},\n"
210210
+ " raft.fsync = " + fsync() + ",\n"
211211
+ " system.partitionsLogPath = \"" + logPath() + "\",\n"
212-
+ " failureHandler.handler: {\n"
212+
+ " failureHandler.handler: {\n"
213213
+ " type: \"" + StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE + "\",\n"
214214
+ " tryStop: true,\n"
215215
+ " timeoutMillis: 60000,\n" // 1 minute for graceful shutdown

modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/LockManagerBenchmark.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class LockManagerBenchmark {
6262
*/
6363
@Setup
6464
public void setUp() {
65-
lockManager = new HeapLockManager(DEFAULT_SLOTS, DEFAULT_SLOTS);
65+
lockManager = new HeapLockManager(DEFAULT_SLOTS);
6666
lockManager.start(new WaitDieDeadlockPreventionPolicy());
6767
generator = new TransactionIdGenerator(0);
6868
clock = new TestHybridClock(() -> 0L);

modules/table/src/integrationTest/java/org/apache/ignite/distributed/ItLockTableTest.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public class ItLockTableTest extends IgniteAbstractTest {
102102
@InjectConfiguration
103103
protected static StorageUpdateConfiguration storageUpdateConfiguration;
104104

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

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

186186
int i = 0;
187-
final int count = 1000;
187+
final int count = 100;
188188
List<Transaction> txns = new ArrayList<>();
189189
while (i++ < count) {
190190
Transaction tx = txTestCluster.igniteTransactions().begin();
@@ -200,7 +200,7 @@ public void testCollision() {
200200
total += slot.waitersCount();
201201
}
202202

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

206206
int empty = 0;
@@ -212,8 +212,7 @@ public void testCollision() {
212212
int cnt = slot.waitersCount();
213213
if (cnt == 0) {
214214
empty++;
215-
}
216-
if (cnt > 1) {
215+
} else {
217216
coll += cnt;
218217
}
219218
}
@@ -224,7 +223,7 @@ public void testCollision() {
224223

225224
List<CompletableFuture<?>> finishFuts = new ArrayList<>();
226225
for (Transaction txn : txns) {
227-
finishFuts.add(txn.commitAsync());
226+
finishFuts.add(txn.rollbackAsync());
228227
}
229228

230229
for (CompletableFuture<?> finishFut : finishFuts) {

0 commit comments

Comments
 (0)