This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 4b58c28 add debug log for IOTDB-1101 (#2424)
4b58c28 is described below
commit 4b58c287077ac1662aab8948ec08b18e3020875f
Author: chaow <[email protected]>
AuthorDate: Fri Jan 8 11:01:26 2021 +0800
add debug log for IOTDB-1101 (#2424)
* add debug log for IOTDB-1101
* only print log after error
---
.../org/apache/iotdb/db/tools/MLogParserTest.java | 35 ++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
b/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
index 3fd8422..99743da 100644
--- a/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/tools/MLogParserTest.java
@@ -34,6 +34,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
@@ -46,6 +48,8 @@ import java.util.Map;
public class MLogParserTest {
+ private static final Logger logger =
LoggerFactory.getLogger(MLogParserTest.class);
+
@Before
public void setUp() throws Exception {
EnvironmentUtils.envSetUp();
@@ -114,8 +118,22 @@ public class MLogParserTest {
try (BufferedReader reader = new BufferedReader(new FileReader("target" +
File.separator
+ "tmp" + File.separator + "text.mlog"))) {
int lineNum = 0;
- while (reader.readLine() != null) {
+ List<String> lines = new ArrayList<>();
+ String line;
+ while ((line = reader.readLine()) != null) {
lineNum++;
+ lines.add(line);
+ }
+ if (lineNum != 108) {
+ // We prepare 2 storage groups, each one has 5 devices, and every
device has 10 measurements.
+ // So, mlog records 2 * 5 * 10 = 100 CreateTimeSeriesPlan, and 2
SetStorageGroupPlan.
+ // Next, we do 6 operations which will be written into mlog, include
set 2 sgs, set ttl,
+ // delete timeseries, delete sg, add tags.
+ // The final operation changeAlias only change the mtree in memory, so
it will not write record to mlog.
+ // Finally, the mlog should have 100 + 2 + 6 = 108 records
+ for (String content : lines) {
+ logger.info(content);
+ }
}
Assert.assertEquals(108, lineNum);
} catch (IOException e) {
@@ -139,8 +157,21 @@ public class MLogParserTest {
try (BufferedReader reader = new BufferedReader(new FileReader("target" +
File.separator
+ "tmp" + File.separator + "text.snapshot"))) {
int lineNum = 0;
- while (reader.readLine() != null) {
+ List<String> lines = new ArrayList<>();
+ String line;
+ while ((line = reader.readLine()) != null) {
lineNum++;
+ lines.add(line);
+ }
+ if (lineNum != 113) {
+ // We prepare 2 storage groups, each one has 5 devices, and every
device has 10 measurements.
+ // So, mtree records 2 * 5 * 10 = 100 TimeSeries, and 2
SetStorageGroup, 2 * 5 devices.
+ // Next, we do 4 operations which will be record in mtree, include set
2 sgs, delete timeseries, delete sg.
+ // The snapshot should have 100 + 2 + 5 * 2 + 2 - 1 - 1 = 112 records,
and we have root record,
+ // so we have 112 + 1 = 113 records finally.
+ for (String content : lines) {
+ logger.info(content);
+ }
}
Assert.assertEquals(113, lineNum);
} catch (IOException e) {