Skip to content

Fix queue invariant checks#17872

Open
Caideyipi wants to merge 3 commits into
apache:masterfrom
Caideyipi:fix-queue-capacity-invariants
Open

Fix queue invariant checks#17872
Caideyipi wants to merge 3 commits into
apache:masterfrom
Caideyipi:fix-queue-capacity-invariants

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

This PR tightens several queue/semaphore invariants:

  • reject non-positive capacities in IndexedBlockingQueue and FixedPriorityBlockingQueue
  • reject duplicate IDs before mutating indexed queue state
  • reject reserve queue repush/decrease operations when no reserved slot exists
  • reject negative capacity or initial permits in FiniteSemaphore
  • add focused unit coverage for the above cases

Tests

  • mvn -pl iotdb-core/calc-commons -DskipTests spotless:apply
  • java -Xmx128m -cp ... org.junit.runner.JUnitCore org.apache.iotdb.calc.execution.schedule.queue.IndexedBlockingQueueTest
  • java -Xms8m -Xmx32m -XX:+UseSerialGC -XX:ReservedCodeCacheSize=8m -cp ... org.junit.runner.JUnitCore org.apache.iotdb.db.utils.datastructure.FixedPriorityBlockingQueueTest
  • java -Xms8m -Xmx32m -XX:+UseSerialGC -XX:ReservedCodeCacheSize=8m -cp ... org.junit.runner.JUnitCore org.apache.iotdb.db.utils.concurrent.FiniteSemaphoreTest

Note: a later mvn -pl iotdb-core/datanode -DskipTests spotless:apply attempt could not start the JVM on this Windows machine because the page file/native memory was exhausted. git diff --check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant