Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public class BackendsProcDir implements ProcDirInterface {
.add("TotalCapacity").add("UsedCapacity").add("AvailableCapacity").add("UsedPct")
.build();

public static final int HOSTNAME_INDEX = 3;

private SystemInfoService systemInfoService;

public BackendsProcDir(SystemInfoService systemInfoService) {
Expand Down
13 changes: 0 additions & 13 deletions fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -682,19 +682,6 @@ private void handleShowProc() throws AnalysisException {
ProcNodeInterface procNode = showProcStmt.getNode();

List<List<String>> finalRows = procNode.fetchResult().getRows();
// if this is superuser, hide ip and host info form backends info proc
if (procNode instanceof BackendsProcDir) {
if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), PrivPredicate.OPERATOR)) {
// hide host info
for (List<String> row : finalRows) {
row.remove(BackendsProcDir.HOSTNAME_INDEX);
}

// mod meta data
metaData.removeColumn(BackendsProcDir.HOSTNAME_INDEX);
}
}

resultSet = new ShowResultSet(metaData, finalRows);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ suite("test_query_sys_tables", "query,p0") {
sql("GRANT SELECT_PRIV ON *.*.* TO 'test_sys_tables'")
sql("use information_schema")
qt_user_privileges """
select GRANTEE, PRIVILEGE_TYPE, IS_GRANTABLE from user_privileges where GRANTEE regexp '^\\'test'
select GRANTEE, PRIVILEGE_TYPE, IS_GRANTABLE from user_privileges where GRANTEE regexp '^\\'test_sys_tables'
"""
sql("DROP USER 'test_sys_tables'")

Expand Down
42 changes: 42 additions & 0 deletions regression-test/suites/show_p0/test_show_backends.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite("test_show_backends", "show") {

sql """drop user if exists test_show_backends_user1"""

sql """create user test_show_backends_user1 identified by '12345'"""

sql """grant ADMIN_PRIV on *.*.* to test_show_backends_user1"""

result1 = connect(user = 'test_show_backends_user1', password = '12345', url = context.config.jdbcUrl) {
sql """ show backends """
}
println result1.toString()
result2 = connect(user = 'test_show_backends_user1', password = '12345', url = context.config.jdbcUrl) {
sql """ show proc '/backends' """
}
println result2.toString()
assertEquals(result1[0][0],result2[0][0])
assertEquals(result1[0][1],result2[0][1])
assertEquals(result1[0][2],result2[0][2])
assertEquals(result1[0][3],result2[0][3])
assertEquals(result1[0][4],result2[0][4])
assertEquals(result1[0][5],result2[0][5])
assertEquals(result1[0][6],result2[0][6])
}