Conversation
# Conflicts: # node-commons/src/main/java/org/apache/iotdb/commons/conf/IoTDBConstant.java # server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java # server/src/main/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupInfo.java # server/src/main/java/org/apache/iotdb/db/engine/storagegroup/VirtualStorageGroupProcessor.java # server/src/main/java/org/apache/iotdb/db/qp/physical/PhysicalPlan.java # server/src/main/java/org/apache/iotdb/db/qp/physical/crud/InsertRowPlan.java # server/src/main/java/org/apache/iotdb/db/service/metrics/MetricsService.java # server/src/main/java/org/apache/iotdb/db/wal/recover/file/TsFilePlanRedoer.java # server/src/main/java/org/apache/iotdb/db/writelog/manager/MultiFileLogNodeManager.java # server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java # server/src/test/java/org/apache/iotdb/db/writelog/IoTDBLogFileSizeTest.java # server/src/test/java/org/apache/iotdb/db/writelog/PerformanceTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/DeviceStringTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/LogReplayerTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/RecoverResourceFromReaderTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/SeqTsFileRecoverTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/UnseqTsFileRecoverTest.java
wangchao316
left a comment
There was a problem hiding this comment.
do not have permission to open the document. advised to put this doc to jira or confluence.
I have updated the read authority. It can be seen now. @wangchao316 |
| # The default value 0 means the storage space will not be controlled. | ||
| # Notice: If this parameter is too small, the write performance may decline. | ||
| # Datatype: int | ||
| # wal_storage_space_in_mb=0 |
There was a problem hiding this comment.
this default parameter is 0 ?
There was a problem hiding this comment.
Default 0 means the storage space will controlled by iotdb itself, you can see delete method of WALManager. Besides, related functions of this parameter is still under development.
| private String timestampPrecision = "ms"; | ||
|
|
||
| private boolean enableDiscardOutOfOrderData = false; | ||
| // region Write Ahead Log Configuration |
There was a problem hiding this comment.
Just remove it from the region of wal parameters, you can still see it in IoTDBConfig L777-L778
|
|
||
| @Override | ||
| public int getMemTableId() { | ||
| return memTableId; |
There was a problem hiding this comment.
memTableId is a fixed value, memTableIdCounter.getAndIncrement() == 0.
There was a problem hiding this comment.
Each memtable has its own id, this value is initialized at AbstractMemTable L87-L88
| /** help allocate node for users */ | ||
| private int nodeCursor = -1; | ||
| /** each wal node has a unique long value identifier */ | ||
| private long nodeIdCounter = -1; |
There was a problem hiding this comment.
nodeIdCounter should use AtomicLong.
There was a problem hiding this comment.
nodeCursor and nodeIdCounter are both protected by the nodesLock of WALManager.
|
|
||
| private void allocateBuffers() { | ||
| try { | ||
| workingBuffer = ByteBuffer.allocateDirect(WAL_BUFFER_SIZE / 2); |
There was a problem hiding this comment.
Can the number of ByteBuffer.allocateDirect be controlled? If the number of ByteBuffer.allocateDirect is infinite, the memory will be used up?
There was a problem hiding this comment.
The memory usage is controlled by the max number of wal node (each node has a wal buffer), whose corresponding parameter is max_wal_num. You can see wal nodes are reused in WALManger.
| logger.info("create folder {} for wal buffer-{}.", logDirectory, identifier); | ||
| } | ||
| currentLogWriter = | ||
| new WALWriter( |
There was a problem hiding this comment.
super class of WALWriter is AbstractWALBuffer, why new WALWriter in AbstractWALBuffer ?
There was a problem hiding this comment.
Because wal segemented buffer, another type of buffer, can reuse these code. And WALSegementedBuffer is still under development.
There was a problem hiding this comment.
Sorry, i misunderstand you. The super class of WALWriter is LogWriter, not AbstractWALBuffer.
| buffersLock.unlock(); | ||
| } | ||
| } | ||
| // endregion |
There was a problem hiding this comment.
Get lock at the beginning of this method, so it's unsafe to delete lock release code.
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
Outdated
Show resolved
Hide resolved
| @Override | ||
| public void serializeToWAL(IWALByteBufferView buffer) { | ||
| int type = PhysicalPlanType.MULTI_BATCH_INSERT.ordinal(); | ||
| buffer.put((byte) type); | ||
| buffer.putInt(insertTabletPlanList.size()); | ||
| for (InsertTabletPlan insertTabletPlan : insertTabletPlanList) { | ||
| insertTabletPlan.subSerialize(buffer); | ||
| } | ||
|
|
||
| buffer.putInt(parentInsertTabletPlanIndexList.size()); | ||
| for (Integer index : parentInsertTabletPlanIndexList) { | ||
| buffer.putInt(index); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Any differences with serializeImpl? Add some Javadoc?
There was a problem hiding this comment.
The code logic are same, but IWALByteBufferView encapsulates some actions to deal with BufferOverflowException.
There was a problem hiding this comment.
It'll be better to add some javadoc about it.
There was a problem hiding this comment.
Is current javadoc in the IWALByteBufferView interface ok?
| import java.util.Set; | ||
|
|
||
| public abstract class InsertPlan extends PhysicalPlan { | ||
| public abstract class InsertPlan extends PhysicalPlan implements WALEditValue { |
There was a problem hiding this comment.
Why implements WALEditValue?
There was a problem hiding this comment.
Use WALEditValue to manage InsertPlan, DeletePlan and IMemTable, you can see more details in the WALEdit class.
# Conflicts: # node-commons/src/main/java/org/apache/iotdb/commons/conf/IoTDBConstant.java # server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java # server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java # server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java # server/src/main/java/org/apache/iotdb/db/writelog/recover/LogReplayer.java # server/src/test/java/org/apache/iotdb/db/writelog/PerformanceTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/DeviceStringTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/LogReplayerTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/RecoverResourceFromReaderTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/SeqTsFileRecoverTest.java # server/src/test/java/org/apache/iotdb/db/writelog/recover/UnseqTsFileRecoverTest.java
server/src/main/java/org/apache/iotdb/db/engine/memtable/AbstractMemTable.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/wal/utils/WALSubmitter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/wal/buffer/WALEdit.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/wal/buffer/AbstractWALBuffer.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/wal/buffer/WALBuffer.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/apache/iotdb/db/wal/buffer/WALBuffer.java
Outdated
Show resolved
Hide resolved
# Conflicts: # server/src/main/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
# Conflicts: # library-udf/src/test/java/org/apache/iotdb/library/anomaly/AnomalyTests.java # server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java # server/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java # server/src/main/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessor.java # server/src/main/java/org/apache/iotdb/db/writelog/node/ExclusiveWriteLogNode.java # server/src/main/java/org/apache/iotdb/db/writelog/node/WriteLogNode.java
…er_meta * remotes/upstream/master: [IOTDB-2872] Rename vsg to dataRegion (apache#5470) [IOTDB-2806][InfluxDB] Compatibility of Apache IoTDB with InfluxDB - Complete UserGuide (apache#5351) [IOTDB-2658] Generate logical plan for query statement —— UT & Raw Data Query & Aggregation Query (apache#5469) [IOTDB-1614] New WAL (apache#5320) Update ContributeGuide.md (apache#5463) user SerializeDeserializeUtil in confignode/AuthorPlan (apache#5467) Modify the jdbc query time column to be empty (apache#5281) [IOTDB-2827] Batch insert in new cluster (apache#5412) [IOTDB-2801] New storage engine framework (apache#5357) [IOTDB-2807]Speed up the cross space compaction by multi-threads (apache#5415) Fix coverage check [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries (apache#5460) [IOTDB-2803]add AlterTimeSeriesNode and CreateAlignedTimeSeriesNode to PlanNodeType and its serialize and deserialize (apache#5444) [IOTDB-2841] add permission manager model (apache#5401) # Conflicts: # server/src/main/java/org/apache/iotdb/db/mpp/sql/analyze/Analyzer.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/DistributionPlanner.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/LogicalPlanner.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/PlanFragment.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/PlanNodeType.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/metedata/read/DevicesMetaScanNode.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/source/SeriesScanNode.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/source/SourceNode.java # server/src/main/java/org/apache/iotdb/db/mpp/sql/statement/StatementVisitor.java # server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/LogicalPlannerTest.java
Details are on design docs.