You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Add documentation for Disruptor implementation based on LMAX Disruptor
Added JavaDoc comments to all Disruptor-related classes to clarify that this
implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
and adapted for IoTDB's Pipe module.
Modified files:
- BatchEventProcessor.java
- Disruptor.java
- EventFactory.java
- EventHandler.java
- ExceptionHandler.java
- MultiProducerSequencer.java
- RingBuffer.java
- Sequence.java
- SequenceBarrier.java
- SequenceGroups.java
Each class now includes clear documentation about:
1. Origin from LMAX Disruptor
2. Key features preserved from the original
3. Simplifications made for IoTDB's use case
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/BatchEventProcessor.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,9 +25,10 @@
25
25
/**
26
26
* Batch event processor for consuming events
27
27
*
28
-
* <p>Simplified from Disruptor (removed complex lifecycle management)
28
+
* <p>This implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
29
+
* and simplified for IoTDB's Pipe module (removed complex lifecycle management).
29
30
*
30
-
* <p>CORE algorithm (MUST preserve):
31
+
* <p>Core algorithm preserved from LMAX Disruptor:
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/Disruptor.java
+9-5Lines changed: 9 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -25,12 +25,17 @@
25
25
importjava.util.concurrent.ThreadFactory;
26
26
27
27
/**
28
-
* High-level API for setting up a lock-free event processing pipeline
28
+
* Simplified Disruptor implementation for IoTDB Pipe
29
29
*
30
-
* <p>Provides a fluent interface for configuring producers and consumers. Internally manages a
31
-
* RingBuffer and event processor thread.
30
+
* <p>This implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
31
+
* and simplified for IoTDB's specific use case in the Pipe module.
32
32
*
33
-
* <p>Configuration is simplified to multi-producer mode with blocking wait strategy.
33
+
* <p>Key simplifications:
34
+
* <ul>
35
+
* <li>Single event handler support (no complex dependency graphs)
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/EventFactory.java
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@
22
22
/**
23
23
* Event factory for pre-allocating events in RingBuffer
24
24
*
25
+
* <p>This interface is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/EventHandler.java
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@
22
22
/**
23
23
* Event handler for processing events from RingBuffer
24
24
*
25
+
* <p>This interface is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/ExceptionHandler.java
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@
22
22
/**
23
23
* Exception handler for event processing errors
24
24
*
25
+
* <p>This interface is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/MultiProducerSequencer.java
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/RingBuffer.java
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,9 @@ protected final E elementAt(long sequence) {
98
98
/**
99
99
* Lock-free ring buffer for storing pre-allocated event objects
100
100
*
101
+
* <p>This implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
102
+
* and preserves the core ring buffer algorithm for IoTDB's Pipe module.
103
+
*
101
104
* <p>Supports multi-producer concurrent access with zero-garbage design. Events are pre-allocated
102
105
* and reused, avoiding GC pressure. Uses cache line padding to prevent false sharing.
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/Sequence.java
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,14 @@ class RhsPadding extends Value {
39
39
/**
40
40
* Lock-free sequence counter with cache line padding
41
41
*
42
+
* <p>This implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
43
+
* and preserves the core sequence tracking mechanism for IoTDB's Pipe module.
44
+
*
42
45
* <p>Key design features:
43
46
*
44
47
* <ul>
45
48
* <li>Three-level inheritance ensures proper field ordering for padding
46
-
* <li>Uses volatile long with Unsafe for direct memory access
49
+
* <li>Uses AtomicLong for thread-safe atomic operations
47
50
* <li>Cache line padding prevents false sharing between CPU cores
48
51
* <li>Supports both ordered writes (cheaper) and volatile writes (stronger)
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/SequenceBarrier.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,10 @@
22
22
/**
23
23
* Sequence barrier for consumer coordination
24
24
*
25
-
* <p>Simplified from Disruptor (removed Alert mechanism - IoTDB doesn't need it)
25
+
* <p>This implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
26
+
* and simplified for IoTDB's Pipe module (removed Alert mechanism - IoTDB doesn't need it).
Copy file name to clipboardExpand all lines: iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/disruptor/SequenceGroups.java
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,11 @@
24
24
/**
25
25
* Utility for atomic management of sequence arrays
26
26
*
27
+
* <p>This implementation is based on LMAX Disruptor (https://github.com/LMAX-Exchange/disruptor)
28
+
* and adapted for IoTDB's Pipe module.
29
+
*
27
30
* <p>Provides thread-safe operations for adding and removing sequences from gating sequence arrays
0 commit comments