You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/04/18 04:52:55 UTC

[iotdb] branch guonengtest_smooth updated (c199636142 -> 19e68142d6)

This is an automated email from the ASF dual-hosted git repository.

xingtanzjr pushed a change to branch guonengtest_smooth
in repository https://gitbox.apache.org/repos/asf/iotdb.git


 discard c199636142 add write concurrent control
     add 7333f9e149 add read loop in log
     new 19e68142d6 add write concurrent control

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (c199636142)
            \
             N -- N -- N   refs/heads/guonengtest_smooth (19e68142d6)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 example/session/src/main/java/org/apache/iotdb/ReadTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)


[iotdb] 01/01: add write concurrent control

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xingtanzjr pushed a commit to branch guonengtest_smooth
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 19e68142d62e5d0b11237676729b23c6270a1c27
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Apr 18 12:42:33 2023 +0800

    add write concurrent control
---
 example/session/src/main/java/org/apache/iotdb/WriterTest.java | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/example/session/src/main/java/org/apache/iotdb/WriterTest.java b/example/session/src/main/java/org/apache/iotdb/WriterTest.java
index 299b4dd096..1e60ac6f19 100644
--- a/example/session/src/main/java/org/apache/iotdb/WriterTest.java
+++ b/example/session/src/main/java/org/apache/iotdb/WriterTest.java
@@ -30,6 +30,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -78,14 +79,15 @@ public class WriterTest {
     protected volatile boolean needResetLatch = true;
     protected CountDownLatch latch;
     protected long currentTimestamp;
-
+    protected Semaphore semaphore;
     protected int count;
 
     protected SyncWriteSignal(int count) {
       this.count = count;
+      this.semaphore = new Semaphore(20);
     }
 
-    protected void syncCountDownBeforeInsert() {
+    protected void syncCountDownBeforeInsert() throws InterruptedException {
       if (needResetLatch) {
         synchronized (this) {
           if (needResetLatch) {
@@ -95,9 +97,11 @@ public class WriterTest {
           }
         }
       }
+      semaphore.acquire();
     }
 
     protected void finishInsertAndWait(int loopIndex) throws InterruptedException {
+      semaphore.release();
       CountDownLatch currentLatch = latch;
       synchronized (this) {
         currentLatch.countDown();
@@ -127,8 +131,8 @@ public class WriterTest {
     @Override
     public void run() {
       for (int j = 0; j < WRITE_LOOP; j++) {
-        signal.syncCountDownBeforeInsert();
         try {
+          signal.syncCountDownBeforeInsert();
           int insertDeviceCount = insertRecords(index, signal.currentTimestamp);
           totalRowNumber.addAndGet(insertDeviceCount);
           signal.finishInsertAndWait(j);