You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "liyuheng55555 (via GitHub)" <gi...@apache.org> on 2024/07/04 04:30:13 UTC
[PR] Fix IoTConsensus sync stuck problem [iotdb]
liyuheng55555 opened a new pull request, #12856:
URL: https://github.com/apache/iotdb/pull/12856
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "liyuheng55555 (via GitHub)" <gi...@apache.org>.
liyuheng55555 commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669651154
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRepairWriterTest.java:
##########
@@ -69,8 +69,8 @@ public void testEmptyFile() throws IOException {
long firstSearchIndex = WALFileUtils.parseStartSearchIndex(logFile.getName());
WALMetaData walMetaData = new WALMetaData(firstSearchIndex, new ArrayList<>(), new HashSet<>());
// recover
- WALRecoverWriter walRecoverWriter = new WALRecoverWriter(logFile);
- walRecoverWriter.recover(walMetaData);
+ WALRepairWriter walRecoverWriter = new WALRepairWriter(logFile);
+ walRecoverWriter.repair(walMetaData);
Review Comment:
inlined these necessary var
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "liyuheng55555 (via GitHub)" <gi...@apache.org>.
liyuheng55555 commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669651625
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -2169,6 +2161,12 @@ private List<WALFlushListener> logDeletionInWAL(
walFlushListeners.add(walFlushListener);
}
}
+ // Some time the deletion operation doesn't have any related tsfile processor or memtable,
+ // but it's still necessary to write to the WAL, so that iotconsensus can synchronize the delete
+ // operation to other nodes.
+ if (walFlushListeners.isEmpty()) {
+ walFlushListeners.add(getWALNode().log(TsFileProcessor.MEMTABLE_NOT_EXIST, deleteDataNode));
+ }
Review Comment:
Indeed. Now getWALNode() return Optional.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "liyuheng55555 (via GitHub)" <gi...@apache.org>.
liyuheng55555 commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669652345
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -1063,6 +1065,10 @@ private boolean insertTabletToTsFileProcessor(
long timePartitionId) {
// return when start >= end or all measurement failed
if (start >= end || insertTabletNode.allMeasurementFailed()) {
+ logger.debug(
+ "Won't insert tablet {}, because {}",
+ insertTabletNode.getSearchIndex(),
+ start >= end ? "start >= end" : "insertTabletNode allMeasurementFailed");
Review Comment:
sure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "liyuheng55555 (via GitHub)" <gi...@apache.org>.
liyuheng55555 commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669536322
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -1063,6 +1065,10 @@ private boolean insertTabletToTsFileProcessor(
long timePartitionId) {
// return when start >= end or all measurement failed
if (start >= end || insertTabletNode.allMeasurementFailed()) {
+ logger.info(
+ "Won't insert tablet {}, because {}",
+ insertTabletNode.getSearchIndex(),
+ start >= end ? "start >= end" : "insertTabletNode allMeasurementFailed");
Review Comment:
change to logger.debug
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669589849
##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALRepairWriterTest.java:
##########
@@ -69,8 +69,8 @@ public void testEmptyFile() throws IOException {
long firstSearchIndex = WALFileUtils.parseStartSearchIndex(logFile.getName());
WALMetaData walMetaData = new WALMetaData(firstSearchIndex, new ArrayList<>(), new HashSet<>());
// recover
- WALRecoverWriter walRecoverWriter = new WALRecoverWriter(logFile);
- walRecoverWriter.recover(walMetaData);
+ WALRepairWriter walRecoverWriter = new WALRepairWriter(logFile);
+ walRecoverWriter.repair(walMetaData);
Review Comment:
```suggestion
WALRepairWriter walRepairWriter = new WALRepairWriter(logFile);
walRepairWriter.repair(walMetaData);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum commented on PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#issuecomment-2208138705
Please add description for the reason and solution
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1665217367
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -1063,6 +1065,10 @@ private boolean insertTabletToTsFileProcessor(
long timePartitionId) {
// return when start >= end or all measurement failed
if (start >= end || insertTabletNode.allMeasurementFailed()) {
+ logger.info(
+ "Won't insert tablet {}, because {}",
+ insertTabletNode.getSearchIndex(),
+ start >= end ? "start >= end" : "insertTabletNode allMeasurementFailed");
Review Comment:
This log is unnecessary I belive.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -1063,6 +1065,10 @@ private boolean insertTabletToTsFileProcessor(
long timePartitionId) {
// return when start >= end or all measurement failed
if (start >= end || insertTabletNode.allMeasurementFailed()) {
+ logger.info(
+ "Won't insert tablet {}, because {}",
+ insertTabletNode.getSearchIndex(),
+ start >= end ? "start >= end" : "insertTabletNode allMeasurementFailed");
Review Comment:
This log is unnecessary I believe.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669577046
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -1063,6 +1065,10 @@ private boolean insertTabletToTsFileProcessor(
long timePartitionId) {
// return when start >= end or all measurement failed
if (start >= end || insertTabletNode.allMeasurementFailed()) {
+ logger.debug(
+ "Won't insert tablet {}, because {}",
+ insertTabletNode.getSearchIndex(),
+ start >= end ? "start >= end" : "insertTabletNode allMeasurementFailed");
Review Comment:
```suggestion
if (logger.isDebugEnabled()) {
logger.debug(
"Won't insert tablet {}, because {}",
insertTabletNode.getSearchIndex(),
start >= end ? "start >= end" : "insertTabletNode allMeasurementFailed");
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "HTHou (via GitHub)" <gi...@apache.org>.
HTHou commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669587667
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -2169,6 +2161,12 @@ private List<WALFlushListener> logDeletionInWAL(
walFlushListeners.add(walFlushListener);
}
}
+ // Some time the deletion operation doesn't have any related tsfile processor or memtable,
+ // but it's still necessary to write to the WAL, so that iotconsensus can synchronize the delete
+ // operation to other nodes.
+ if (walFlushListeners.isEmpty()) {
+ walFlushListeners.add(getWALNode().log(TsFileProcessor.MEMTABLE_NOT_EXIST, deleteDataNode));
+ }
Review Comment:
If config.getDataRegionConsensusProtocolClass() != IOT_CONSENSUS, there will be an UnsupportedOperationException thrown from getWALNode() method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "liyuheng55555 (via GitHub)" <gi...@apache.org>.
liyuheng55555 commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1670130950
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALNodeRecoverTask.java:
##########
@@ -173,35 +172,23 @@ private long[] recoverLastFile() {
WALEntry walEntry = walReader.next();
long searchIndex = DEFAULT_SEARCH_INDEX;
if (walEntry.getType().needSearch()) {
- if (walEntry.getType() != WALEntryType.DELETE_DATA_NODE) {
- InsertNode insertNode = (InsertNode) walEntry.getValue();
- if (insertNode.getSearchIndex() != InsertNode.NO_CONSENSUS_INDEX) {
- searchIndex = insertNode.getSearchIndex();
- lastSearchIndex = Math.max(lastSearchIndex, insertNode.getSearchIndex());
- fileStatus = WALFileStatus.CONTAINS_SEARCH_INDEX;
- }
- } else {
- DeleteDataNode deleteNode = (DeleteDataNode) walEntry.getValue();
- if (deleteNode.getSearchIndex() != InsertNode.NO_CONSENSUS_INDEX) {
- searchIndex = deleteNode.getSearchIndex();
- lastSearchIndex = Math.max(lastSearchIndex, deleteNode.getSearchIndex());
- fileStatus = WALFileStatus.CONTAINS_SEARCH_INDEX;
- }
+ SearchNode searchNode = (SearchNode) walEntry.getValue();
+ if (searchNode.getSearchIndex() != SearchNode.NO_CONSENSUS_INDEX) {
+ searchIndex = searchNode.getSearchIndex();
+ lastSearchIndex = Math.max(lastSearchIndex, searchNode.getSearchIndex());
+ fileStatus = WALFileStatus.CONTAINS_SEARCH_INDEX;
}
}
metaData.setTruncateOffSet(walReader.getWALCurrentReadOffset());
- metaData.add(walEntry.serializedSize(), searchIndex, walEntry.getMemTableId());
+ if (walEntry.getMemTableId() != TsFileProcessor.MEMTABLE_NOT_EXIST) {
+ metaData.add(walEntry.serializedSize(), searchIndex, walEntry.getMemTableId());
Review Comment:
sure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1670090383
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/recover/WALNodeRecoverTask.java:
##########
@@ -173,35 +172,23 @@ private long[] recoverLastFile() {
WALEntry walEntry = walReader.next();
long searchIndex = DEFAULT_SEARCH_INDEX;
if (walEntry.getType().needSearch()) {
- if (walEntry.getType() != WALEntryType.DELETE_DATA_NODE) {
- InsertNode insertNode = (InsertNode) walEntry.getValue();
- if (insertNode.getSearchIndex() != InsertNode.NO_CONSENSUS_INDEX) {
- searchIndex = insertNode.getSearchIndex();
- lastSearchIndex = Math.max(lastSearchIndex, insertNode.getSearchIndex());
- fileStatus = WALFileStatus.CONTAINS_SEARCH_INDEX;
- }
- } else {
- DeleteDataNode deleteNode = (DeleteDataNode) walEntry.getValue();
- if (deleteNode.getSearchIndex() != InsertNode.NO_CONSENSUS_INDEX) {
- searchIndex = deleteNode.getSearchIndex();
- lastSearchIndex = Math.max(lastSearchIndex, deleteNode.getSearchIndex());
- fileStatus = WALFileStatus.CONTAINS_SEARCH_INDEX;
- }
+ SearchNode searchNode = (SearchNode) walEntry.getValue();
+ if (searchNode.getSearchIndex() != SearchNode.NO_CONSENSUS_INDEX) {
+ searchIndex = searchNode.getSearchIndex();
+ lastSearchIndex = Math.max(lastSearchIndex, searchNode.getSearchIndex());
+ fileStatus = WALFileStatus.CONTAINS_SEARCH_INDEX;
}
}
metaData.setTruncateOffSet(walReader.getWALCurrentReadOffset());
- metaData.add(walEntry.serializedSize(), searchIndex, walEntry.getMemTableId());
+ if (walEntry.getMemTableId() != TsFileProcessor.MEMTABLE_NOT_EXIST) {
+ metaData.add(walEntry.serializedSize(), searchIndex, walEntry.getMemTableId());
Review Comment:
make them consistent
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -2169,6 +2163,16 @@ private List<WALFlushListener> logDeletionInWAL(
walFlushListeners.add(walFlushListener);
}
}
+ // Some time the deletion operation doesn't have any related tsfile processor or memtable,
+ // but it's still necessary to write to the WAL, so that iotconsensus can synchronize the delete
+ // operation to other nodes.
Review Comment:
todo iotconsensusv2 deletion support
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "liyuheng55555 (via GitHub)" <gi...@apache.org>.
liyuheng55555 commented on code in PR #12856:
URL: https://github.com/apache/iotdb/pull/12856#discussion_r1669651625
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/DataRegion.java:
##########
@@ -2169,6 +2161,12 @@ private List<WALFlushListener> logDeletionInWAL(
walFlushListeners.add(walFlushListener);
}
}
+ // Some time the deletion operation doesn't have any related tsfile processor or memtable,
+ // but it's still necessary to write to the WAL, so that iotconsensus can synchronize the delete
+ // operation to other nodes.
+ if (walFlushListeners.isEmpty()) {
+ walFlushListeners.add(getWALNode().log(TsFileProcessor.MEMTABLE_NOT_EXIST, deleteDataNode));
+ }
Review Comment:
Indeed. Now getWALNode() returns Optional.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix IoTConsensus sync stuck problem [iotdb]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum merged PR #12856:
URL: https://github.com/apache/iotdb/pull/12856
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org