Skip to content

Commit 300987c

Browse files
Remove password history feature in iotdb. (#17436)
1 parent eaa2c38 commit 300987c

25 files changed

Lines changed: 44 additions & 717 deletions

File tree

integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ private void checkRegionDistribution(
189189
.merge(regionInfo.getDataNodeId(), 1, Integer::sum);
190190
});
191191
// The number of RegionGroups should not less than the testMinRegionGroupNum for each database
192-
// +1 for AUDIT database
193-
Assert.assertEquals(TEST_DATABASE_NUM + 1, databaseRegionCounter.size());
192+
Assert.assertEquals(TEST_DATABASE_NUM, databaseRegionCounter.size());
194193
databaseRegionCounter.forEach(
195194
(database, regionCount) ->
196195
Assert.assertTrue(
@@ -209,8 +208,7 @@ private void checkRegionDistribution(
209208
<= 1);
210209
// The maximal Region count - minimal Region count should be less than or equal to 1 for each
211210
// Database
212-
// +1 for system database
213-
Assert.assertEquals(TEST_DATABASE_NUM + 1, databaseDataNodeRegionCounter.size());
211+
Assert.assertEquals(TEST_DATABASE_NUM, databaseDataNodeRegionCounter.size());
214212
databaseDataNodeRegionCounter.forEach(
215213
(database, dataNodeRegionCount) ->
216214
Assert.assertTrue(

integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBPartitionGetterIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ public void testGetSchemaNodeManagementPartition() throws Exception {
534534
nodeManagementResp = client.getSchemaNodeManagementPartition(nodeManagementReq);
535535
Assert.assertEquals(
536536
TSStatusCode.SUCCESS_STATUS.getStatusCode(), nodeManagementResp.getStatus().getCode());
537-
// +1 for AUDIT database
538-
Assert.assertEquals(databaseNum + 1, nodeManagementResp.getMatchedNodeSize());
537+
Assert.assertEquals(databaseNum, nodeManagementResp.getMatchedNodeSize());
539538
Assert.assertNotNull(nodeManagementResp.getSchemaRegionMap());
540539
Assert.assertEquals(0, nodeManagementResp.getSchemaRegionMapSize());
541540
}

integration-test/src/test/java/org/apache/iotdb/confignode/it/procedure/IoTDBProcedureIT.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ private void recoverTest(int configNodeNum, boolean needRestartLeader) throws Ex
137137
Callable<Boolean> finalCheck =
138138
() -> {
139139
TShowDatabaseResp resp1 = newLeaderClient.showDatabase(showAllDatabasesReq);
140-
if (MAX_STATE != resp1.getDatabaseInfoMap().size() - 1) {
140+
if (resp1.getDatabaseInfoMap() == null
141+
|| MAX_STATE != resp1.getDatabaseInfoMap().size()) {
141142
return false;
142143
}
143144
resp1

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionGroupExpandAndShrinkForIoTV1IT.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ public void singleRegionTest() throws Exception {
9494
Set<Integer> allDataNodeId = getAllDataNodes(statement);
9595

9696
// expect one data region, one schema region
97-
// plus one AUDIT data region, one AUDIT schema region
98-
Assert.assertEquals(4, regionMap.size());
97+
Assert.assertEquals(2, regionMap.size());
9998

10099
// expand
101100
for (int selectedRegion : regionMap.keySet()) {
@@ -217,8 +216,7 @@ public void multiRegionNormalTest() throws Exception {
217216
Set<Integer> allDataNodeId = getAllDataNodes(statement);
218217

219218
// expect one data region, one schema region
220-
// plus one AUDIT data region, one AUDIT schema region
221-
Assert.assertEquals(4, regionMap.size());
219+
Assert.assertEquals(2, regionMap.size());
222220

223221
// select multiple regions for testing
224222
List<Integer> selectedRegions = new ArrayList<>(regionMap.keySet());

integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBRegionReconstructForIoTV1IT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void normal1C3DTest() throws Exception {
104104
Set<Integer> allDataNodeId = getAllDataNodes(statement);
105105

106106
// select datanode
107-
final int selectedRegion = 3;
107+
final int selectedRegion = 1;
108108
Assert.assertTrue(dataRegionMap.containsKey(selectedRegion));
109109
Pair<Integer, Set<Integer>> leaderAndNodeIds = dataRegionMap.get(selectedRegion);
110110
Assert.assertEquals(2, leaderAndNodeIds.right.size());

integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMiscIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public void testCompressionRatioFile() throws SQLException {
5656
statement.execute("insert into root.comprssion_ratio_file.d1(timestamp,s1) values(1,1.0)");
5757
statement.execute("flush");
5858
// one global file and two data region file (including one AUDIT region)
59-
assertEquals(3, collectCompressionRatioFiles(nodeWrapper).size());
59+
assertEquals(2, collectCompressionRatioFiles(nodeWrapper).size());
6060

6161
statement.execute("drop database root.comprssion_ratio_file");
6262
// one global file and system region file

integration-test/src/test/java/org/apache/iotdb/db/it/auth/IoTDBAuthIT.java

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
package org.apache.iotdb.db.it.auth;
2121

2222
import org.apache.iotdb.commons.auth.entity.PrivilegeType;
23-
import org.apache.iotdb.commons.conf.CommonDescriptor;
2423
import org.apache.iotdb.commons.schema.column.ColumnHeaderConstant;
25-
import org.apache.iotdb.commons.utils.AuthUtils;
2624
import org.apache.iotdb.db.it.utils.TestUtils;
2725
import org.apache.iotdb.it.env.EnvFactory;
2826
import org.apache.iotdb.it.framework.IoTDBTestRunner;
@@ -51,8 +49,6 @@
5149
import java.util.Set;
5250
import java.util.concurrent.Callable;
5351

54-
import static org.apache.iotdb.commons.auth.entity.User.INTERNAL_USER_END_ID;
55-
import static org.apache.iotdb.db.audit.DNAuditLogger.PREFIX_PASSWORD_HISTORY;
5652
import static org.apache.iotdb.db.it.utils.TestUtils.createUser;
5753
import static org.apache.iotdb.db.it.utils.TestUtils.executeNonQuery;
5854
import static org.apache.iotdb.db.it.utils.TestUtils.resultSetEqualTest;
@@ -1521,107 +1517,6 @@ public void testStrongPassword() throws SQLException {
15211517
}
15221518
}
15231519

1524-
@Test
1525-
public void testPasswordHistory() {
1526-
try (Connection connection = EnvFactory.getEnv().getConnection();
1527-
Statement statement = connection.createStatement()) {
1528-
testPasswordHistoryEncrypted(statement);
1529-
testPasswordHistoryCreateAndDrop(statement);
1530-
testPasswordHistoryAlter(statement);
1531-
} catch (SQLException e) {
1532-
e.printStackTrace();
1533-
fail(e.getMessage());
1534-
}
1535-
}
1536-
1537-
public void testPasswordHistoryEncrypted(Statement statement) throws SQLException {
1538-
ResultSet resultSet =
1539-
statement.executeQuery("SELECT password,oldPassword from root.__audit.password_history._0");
1540-
assertTrue(resultSet.next());
1541-
assertEquals(
1542-
AuthUtils.encryptPassword(CommonDescriptor.getInstance().getConfig().getAdminPassword()),
1543-
resultSet.getString("root.__audit.password_history._0.password"));
1544-
assertEquals(
1545-
AuthUtils.encryptPassword(CommonDescriptor.getInstance().getConfig().getAdminPassword()),
1546-
resultSet.getString("root.__audit.password_history._0.oldPassword"));
1547-
}
1548-
1549-
public void testPasswordHistoryCreateAndDrop(Statement statement) throws SQLException {
1550-
statement.execute("create user userA 'abcdef123456'");
1551-
1552-
long expectedUserAId = INTERNAL_USER_END_ID + 1;
1553-
try (ResultSet resultSet =
1554-
statement.executeQuery(
1555-
String.format(
1556-
"select last password from %s.`_" + expectedUserAId + "`",
1557-
PREFIX_PASSWORD_HISTORY))) {
1558-
if (!resultSet.next()) {
1559-
fail("Password history not found");
1560-
}
1561-
assertEquals(AuthUtils.encryptPassword("abcdef123456"), resultSet.getString("Value"));
1562-
}
1563-
1564-
try (ResultSet resultSet =
1565-
statement.executeQuery(
1566-
String.format(
1567-
"select last oldPassword from %s.`_" + expectedUserAId + "`",
1568-
PREFIX_PASSWORD_HISTORY))) {
1569-
if (!resultSet.next()) {
1570-
fail("Password history not found");
1571-
}
1572-
assertEquals(AuthUtils.encryptPassword("abcdef123456"), resultSet.getString("Value"));
1573-
}
1574-
1575-
statement.execute("drop user userA");
1576-
1577-
try (ResultSet resultSet =
1578-
statement.executeQuery(
1579-
String.format(
1580-
"select last password from %s.`_" + expectedUserAId + "`",
1581-
PREFIX_PASSWORD_HISTORY))) {
1582-
assertFalse(resultSet.next());
1583-
}
1584-
1585-
try (ResultSet resultSet =
1586-
statement.executeQuery(
1587-
String.format(
1588-
"select last oldPassword from %s.`_" + expectedUserAId + "`",
1589-
PREFIX_PASSWORD_HISTORY))) {
1590-
assertFalse(resultSet.next());
1591-
}
1592-
}
1593-
1594-
public void testPasswordHistoryAlter(Statement statement) throws SQLException {
1595-
statement.execute("create user userA 'abcdef123456'");
1596-
statement.execute("alter user userA set password 'abcdef654321'");
1597-
1598-
long expectedUserAId = INTERNAL_USER_END_ID + 2;
1599-
try (ResultSet resultSet =
1600-
statement.executeQuery(
1601-
String.format(
1602-
"select last password from %s.`_" + expectedUserAId + "`",
1603-
PREFIX_PASSWORD_HISTORY))) {
1604-
if (!resultSet.next()) {
1605-
fail("Password history not found");
1606-
}
1607-
assertEquals(AuthUtils.encryptPassword("abcdef654321"), resultSet.getString("Value"));
1608-
}
1609-
1610-
try (ResultSet resultSet =
1611-
statement.executeQuery(
1612-
String.format(
1613-
"select oldPassword from %s.`_" + expectedUserAId + "` order by time desc limit 1",
1614-
PREFIX_PASSWORD_HISTORY))) {
1615-
if (!resultSet.next()) {
1616-
fail("Password history not found");
1617-
}
1618-
assertEquals(
1619-
AuthUtils.encryptPassword("abcdef123456"),
1620-
resultSet.getString(
1621-
String.format("%s._" + expectedUserAId + ".oldPassword", PREFIX_PASSWORD_HISTORY)));
1622-
}
1623-
}
1624-
16251520
@Test
16261521
public void testChangeBackPassword() {
16271522
try (Connection connection = EnvFactory.getEnv().getConnection();

integration-test/src/test/java/org/apache/iotdb/db/it/mqtt/IoTDBMQTTServiceJsonIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void setUp() throws Exception {
7777
mqtt.setUserName(USER);
7878
mqtt.setPassword(PASSWORD);
7979
mqtt.setConnectAttemptsMax(3);
80-
mqtt.setReconnectDelay(10);
80+
mqtt.setReconnectDelay(1000);
8181
mqtt.setClientId("jsonClientId1");
8282

8383
connection = mqtt.blockingConnection();

integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBDeleteDatabaseIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ public void testDeleteAllDatabases() throws Exception {
159159
result.add(resultSet.getString(1));
160160
}
161161
}
162-
// One for un-deletable AUDIT database
163-
assertEquals(1, result.size());
162+
assertEquals(0, result.size());
164163
}
165164
}
166165

integration-test/src/test/java/org/apache/iotdb/pipe/it/dual/treemodel/auto/basic/IoTDBPipeLifeCycleIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public void testLifeCycleWithHistoryDisabled() throws Exception {
258258
"count(timeseries),",
259259
Collections.singleton("0,"));
260260
TestUtils.assertDataEventuallyOnEnv(
261-
receiverEnv, "count databases", "count,", Collections.singleton("4,"));
261+
receiverEnv, "count databases", "count,", Collections.singleton("3,"));
262262
}
263263
}
264264

0 commit comments

Comments
 (0)