You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/07/12 09:34:47 UTC
[iotdb] 01/02: Add back the logic of blocking insert before holding writelock
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch blockInsertOutsideOfWriteLock
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 5929d81047b56ed40c100efbc3e89eadbda9fd17
Author: HTHou <hh...@outlook.com>
AuthorDate: Tue Jul 12 17:28:51 2022 +0800
Add back the logic of blocking insert before holding writelock
---
.../org/apache/iotdb/db/engine/storagegroup/DataRegion.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
index a419f18373..3fdc1f2991 100755
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
@@ -56,6 +56,7 @@ import org.apache.iotdb.db.exception.BatchProcessException;
import org.apache.iotdb.db.exception.DataRegionException;
import org.apache.iotdb.db.exception.DiskSpaceInsufficientException;
import org.apache.iotdb.db.exception.LoadFileException;
+import org.apache.iotdb.db.exception.StorageEngineException;
import org.apache.iotdb.db.exception.TriggerExecutionException;
import org.apache.iotdb.db.exception.TsFileProcessorException;
import org.apache.iotdb.db.exception.WriteProcessException;
@@ -896,6 +897,9 @@ public class DataRegion {
if (!isAlive(insertRowNode.getTime())) {
throw new OutOfTTLException(insertRowNode.getTime(), (System.currentTimeMillis() - dataTTL));
}
+ if (enableMemControl) {
+ StorageEngineV2.blockInsertionIfReject(null);
+ }
writeLock("InsertRow");
try {
// init map
@@ -1054,7 +1058,9 @@ public class DataRegion {
@SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
public void insertTablet(InsertTabletNode insertTabletNode)
throws TriggerExecutionException, BatchProcessException, WriteProcessException {
-
+ if (enableMemControl) {
+ StorageEngineV2.blockInsertionIfReject(null);
+ }
writeLock("insertTablet");
try {
TSStatus[] results = new TSStatus[insertTabletNode.getRowCount()];
@@ -3433,6 +3439,9 @@ public class DataRegion {
*/
public void insert(InsertRowsOfOneDeviceNode insertRowsOfOneDeviceNode)
throws WriteProcessException, TriggerExecutionException, BatchProcessException {
+ if (enableMemControl) {
+ StorageEngineV2.blockInsertionIfReject(null);
+ }
writeLock("InsertRowsOfOneDevice");
try {
boolean isSequence = false;