You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by la...@apache.org on 2022/12/15 01:54:09 UTC

[incubator-pegasus] branch master updated: refactor(idl): unify the *.thrift files used by cpp and java-client (#1290)

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

laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new 2aaf021ff refactor(idl): unify the *.thrift files used by cpp and java-client (#1290)
2aaf021ff is described below

commit 2aaf021ff580a9c3265ee4dea3f1818d484e7e84
Author: Yingchun Lai <la...@apache.org>
AuthorDate: Thu Dec 15 09:54:02 2022 +0800

    refactor(idl): unify the *.thrift files used by cpp and java-client (#1290)
---
 .github/workflows/regular-build.yml                |   2 +-
 go-client/pegasus/table_connector.go               |   2 +-
 go-client/pegasus/table_connector_test.go          |  12 +-
 go-client/session/codec.go                         |   2 +-
 go-client/session/codec_test.go                    |   2 +-
 go-client/session/meta_session.go                  |   8 +-
 go-client/session/session_test.go                  |   6 +-
 idl/backup.thrift                                  |   1 +
 idl/bulk_load.thrift                               |   1 +
 idl/dsn.layer2.thrift                              |  13 +-
 idl/dsn.thrift                                     |   1 +
 idl/duplication.thrift                             |   1 +
 idl/meta_admin.thrift                              |   1 +
 idl/metadata.thrift                                |   1 +
 idl/partition_split.thrift                         |   1 +
 idl/rrdb.thrift                                    |   8 +-
 {src/runtime/security => idl}/security.thrift      |   9 +-
 java-client/README.md                              |   8 +-
 java-client/idl/apache-licence-template            |  18 --
 java-client/idl/base.thrift                        |  42 ---
 java-client/idl/meta_admin.thrift                  |  63 ----
 java-client/idl/replication.thrift                 |  59 ----
 java-client/idl/rrdb.thrift                        | 322 ---------------------
 java-client/idl/security.thrift                    |  79 -----
 java-client/scripts/ci-test.sh                     |   2 +-
 java-client/{idl => scripts}/recompile_thrift.sh   |  18 +-
 .../org/apache/pegasus/client/PegasusScanner.java  |   2 +-
 .../pegasus/operator/create_app_operator.java      |   7 +-
 .../apache/pegasus/operator/drop_app_operator.java |   7 +-
 src/client/partition_resolver_simple.cpp           |   4 +-
 src/client/replication_ddl_client.cpp              |  19 +-
 src/client_lib/pegasus_client_impl.cpp             |   4 +-
 src/meta/duplication/meta_duplication_service.cpp  |   4 +-
 src/meta/meta_http_service.cpp                     |  12 +-
 src/meta/meta_rpc_types.h                          |   3 +-
 src/meta/meta_service.cpp                          |   2 +-
 src/meta/server_state.cpp                          |   5 +-
 src/meta/server_state.h                            |   4 +-
 src/meta/test/state_sync_test.cpp                  |   4 +-
 src/replica/duplication/replica_follower.cpp       |  30 +-
 src/replica/duplication/replica_follower.h         |   3 +-
 .../duplication/test/replica_follower_test.cpp     |   5 +-
 src/runtime/security/CMakeLists.txt                |   2 +-
 src/runtime/test/message_utils_test.cpp            |   7 +-
 src/runtime/test/rpc_holder_test.cpp               |  19 +-
 src/runtime/test/rpc_message.cpp                   |   2 +-
 46 files changed, 127 insertions(+), 700 deletions(-)

diff --git a/.github/workflows/regular-build.yml b/.github/workflows/regular-build.yml
index f46e46af7..4eb4849d1 100644
--- a/.github/workflows/regular-build.yml
+++ b/.github/workflows/regular-build.yml
@@ -153,6 +153,6 @@ jobs:
       - name: Build
         working-directory: ./java-client
         run: |
-          cd idl && bash recompile_thrift.sh && cd -
+          cd scripts && bash recompile_thrift.sh && cd -
           mvn spotless:apply
           mvn clean package -DskipTests
diff --git a/go-client/pegasus/table_connector.go b/go-client/pegasus/table_connector.go
index 4c9735150..0a000ae4b 100644
--- a/go-client/pegasus/table_connector.go
+++ b/go-client/pegasus/table_connector.go
@@ -256,7 +256,7 @@ func isPartitionValid(oldCount int, respCount int) bool {
 	return oldCount == 0 || oldCount == respCount || oldCount*2 == respCount || oldCount == respCount*2
 }
 
-func (p *pegasusTableConnector) handleQueryConfigResp(resp *replication.ConfigurationQueryByIndexResponse) error {
+func (p *pegasusTableConnector) handleQueryConfigResp(resp *replication.QueryCfgResponse) error {
 	if resp.Err.Errno != base.ERR_OK.String() {
 		return errors.New(resp.Err.Errno)
 	}
diff --git a/go-client/pegasus/table_connector_test.go b/go-client/pegasus/table_connector_test.go
index 029a191c8..4aabe5eb4 100644
--- a/go-client/pegasus/table_connector_test.go
+++ b/go-client/pegasus/table_connector_test.go
@@ -310,7 +310,7 @@ func TestPegasusTableConnector_HandleInvalidQueryConfigResp(t *testing.T) {
 	}
 
 	{
-		resp := replication.NewConfigurationQueryByIndexResponse()
+		resp := replication.NewQueryCfgResponse()
 		resp.Err = &base.ErrorCode{Errno: "ERR_BUSY"}
 
 		err := p.handleQueryConfigResp(resp)
@@ -319,7 +319,7 @@ func TestPegasusTableConnector_HandleInvalidQueryConfigResp(t *testing.T) {
 	}
 
 	{
-		resp := replication.NewConfigurationQueryByIndexResponse()
+		resp := replication.NewQueryCfgResponse()
 		resp.Err = &base.ErrorCode{Errno: "ERR_OK"}
 
 		err := p.handleQueryConfigResp(resp)
@@ -333,7 +333,7 @@ func TestPegasusTableConnector_HandleInvalidQueryConfigResp(t *testing.T) {
 	}
 
 	{
-		resp := replication.NewConfigurationQueryByIndexResponse()
+		resp := replication.NewQueryCfgResponse()
 		resp.Err = &base.ErrorCode{Errno: "ERR_OK"}
 
 		resp.Partitions = make([]*replication.PartitionConfiguration, 6)
@@ -345,7 +345,7 @@ func TestPegasusTableConnector_HandleInvalidQueryConfigResp(t *testing.T) {
 	}
 
 	{
-		resp := replication.NewConfigurationQueryByIndexResponse()
+		resp := replication.NewQueryCfgResponse()
 		resp.Err = &base.ErrorCode{Errno: "ERR_OK"}
 
 		resp.Partitions = make([]*replication.PartitionConfiguration, 2)
@@ -370,7 +370,7 @@ func TestPegasusTableConnector_QueryConfigRespWhileStartSplit(t *testing.T) {
 	ptb, _ := tb.(*pegasusTableConnector)
 
 	partitionCount := len(ptb.parts)
-	resp := replication.NewConfigurationQueryByIndexResponse()
+	resp := replication.NewQueryCfgResponse()
 	resp.Err = &base.ErrorCode{Errno: "ERR_OK"}
 	resp.AppID = ptb.appID
 	resp.PartitionCount = int32(partitionCount * 2)
@@ -417,7 +417,7 @@ func TestPegasusTableConnector_QueryConfigRespWhileCancelSplit(t *testing.T) {
 		}
 	}
 
-	resp := replication.NewConfigurationQueryByIndexResponse()
+	resp := replication.NewQueryCfgResponse()
 	resp.Err = &base.ErrorCode{Errno: "ERR_OK"}
 	resp.AppID = ptb.appID
 	resp.PartitionCount = int32(partitionCount)
diff --git a/go-client/session/codec.go b/go-client/session/codec.go
index 5b32ffb9f..07aa5ef92 100644
--- a/go-client/session/codec.go
+++ b/go-client/session/codec.go
@@ -156,7 +156,7 @@ var nameToResultMapLock sync.Mutex
 var nameToResultMap = map[string]func() RpcResponseResult{
 	"RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX_ACK": func() RpcResponseResult {
 		return &rrdb.MetaQueryCfgResult{
-			Success: replication.NewConfigurationQueryByIndexResponse(),
+			Success: replication.NewQueryCfgResponse(),
 		}
 	},
 	"RPC_CM_CREATE_APP_ACK": func() RpcResponseResult {
diff --git a/go-client/session/codec_test.go b/go-client/session/codec_test.go
index 4879b5f3a..63062d110 100644
--- a/go-client/session/codec_test.go
+++ b/go-client/session/codec_test.go
@@ -48,7 +48,7 @@ func TestCodec_Marshal(t *testing.T) {
 		0x00, 0x00,
 	}
 	arg := rrdb.NewMetaQueryCfgArgs()
-	arg.Query = replication.NewConfigurationQueryByIndexRequest()
+	arg.Query = replication.NewQueryCfgRequest()
 	arg.Query.AppName = "temp"
 	arg.Query.PartitionIndices = []int32{}
 
diff --git a/go-client/session/meta_session.go b/go-client/session/meta_session.go
index 46b60c1c5..c209cb848 100644
--- a/go-client/session/meta_session.go
+++ b/go-client/session/meta_session.go
@@ -41,11 +41,11 @@ func (ms *metaSession) call(ctx context.Context, args RpcRequestArgs, rpcName st
 	return ms.CallWithGpid(ctx, &base.Gpid{Appid: 0, PartitionIndex: 0}, 0, args, rpcName)
 }
 
-func (ms *metaSession) queryConfig(ctx context.Context, tableName string) (*replication.ConfigurationQueryByIndexResponse, error) {
+func (ms *metaSession) queryConfig(ctx context.Context, tableName string) (*replication.QueryCfgResponse, error) {
 	ms.logger.Printf("querying configuration of table(%s) from %s", tableName, ms)
 
 	arg := rrdb.NewMetaQueryCfgArgs()
-	arg.Query = replication.NewConfigurationQueryByIndexRequest()
+	arg.Query = replication.NewQueryCfgRequest()
 	arg.Query.AppName = tableName
 	arg.Query.PartitionIndices = []int32{}
 
@@ -105,13 +105,13 @@ func (m *MetaManager) call(ctx context.Context, callFunc metaCallFunc) (metaResp
 // QueryConfig queries table configuration from the leader of meta servers. If the leader was changed,
 // it retries for other servers until it finds the true leader, unless no leader exists.
 // Thread-Safe
-func (m *MetaManager) QueryConfig(ctx context.Context, tableName string) (*replication.ConfigurationQueryByIndexResponse, error) {
+func (m *MetaManager) QueryConfig(ctx context.Context, tableName string) (*replication.QueryCfgResponse, error) {
 	m.logger.Printf("querying configuration of table(%s) [metaList=%s]", tableName, m.metaIPAddrs)
 	resp, err := m.call(ctx, func(rpcCtx context.Context, ms *metaSession) (metaResponse, error) {
 		return ms.queryConfig(rpcCtx, tableName)
 	})
 	if err == nil {
-		queryCfgResp := resp.(*replication.ConfigurationQueryByIndexResponse)
+		queryCfgResp := resp.(*replication.QueryCfgResponse)
 		return queryCfgResp, nil
 	}
 	return nil, err
diff --git a/go-client/session/session_test.go b/go-client/session/session_test.go
index 380624ed4..8ec3e52cd 100644
--- a/go-client/session/session_test.go
+++ b/go-client/session/session_test.go
@@ -152,7 +152,7 @@ func TestNodeSession_WriteFailed(t *testing.T) {
 	n.tom.Go(n.loopForRequest)
 
 	arg := rrdb.NewMetaQueryCfgArgs()
-	arg.Query = replication.NewConfigurationQueryByIndexRequest()
+	arg.Query = replication.NewQueryCfgRequest()
 
 	mockCodec := &MockCodec{}
 	mockCodec.MockMarshal(func(v interface{}) ([]byte, error) {
@@ -324,7 +324,7 @@ func TestNodeSession_ReceiveErrorCode(t *testing.T) {
 	defer n.Close()
 
 	arg := rrdb.NewMetaQueryCfgArgs()
-	arg.Query = replication.NewConfigurationQueryByIndexRequest()
+	arg.Query = replication.NewQueryCfgRequest()
 
 	mockCodec := &MockCodec{}
 	n.codec = mockCodec
@@ -382,7 +382,7 @@ func TestNodeSession_Redial(t *testing.T) {
 	n.codec = mockCodec
 
 	arg := rrdb.NewMetaQueryCfgArgs()
-	arg.Query = replication.NewConfigurationQueryByIndexRequest()
+	arg.Query = replication.NewQueryCfgRequest()
 	_, err := n.CallWithGpid(context.Background(), &base.Gpid{}, 0, arg, "RPC_NAME")
 
 	assert.Equal(t, n.ConnState(), rpc.ConnStateReady)
diff --git a/idl/backup.thrift b/idl/backup.thrift
index 292f08ef4..2fdeded17 100644
--- a/idl/backup.thrift
+++ b/idl/backup.thrift
@@ -20,6 +20,7 @@ include "dsn.layer2.thrift"
 
 namespace cpp dsn.replication
 namespace go admin
+namespace java org.apache.pegasus.replication
 
 struct policy_info
 {
diff --git a/idl/bulk_load.thrift b/idl/bulk_load.thrift
index 011c946a5..90fcf5b69 100644
--- a/idl/bulk_load.thrift
+++ b/idl/bulk_load.thrift
@@ -21,6 +21,7 @@ include "metadata.thrift"
 
 namespace cpp dsn.replication
 namespace go admin
+namespace java org.apache.pegasus.replication
 
 // app partition bulk load status
 enum bulk_load_status
diff --git a/idl/dsn.layer2.thrift b/idl/dsn.layer2.thrift
index b11c95f87..205ac9e93 100644
--- a/idl/dsn.layer2.thrift
+++ b/idl/dsn.layer2.thrift
@@ -29,6 +29,7 @@ include "dsn.thrift"
 # TODO(yingchun): reuse the idls for server and all client libs
 namespace cpp dsn
 namespace go replication
+namespace java org.apache.pegasus.replication
 
 struct partition_configuration
 {
@@ -42,7 +43,7 @@ struct partition_configuration
     8:i32                    partition_flags;
 }
 
-struct configuration_query_by_index_request
+struct query_cfg_request
 {
     1:string           app_name;
     2:list<i32>        partition_indices;
@@ -50,7 +51,7 @@ struct configuration_query_by_index_request
 
 // for server version > 1.11.2, if err == ERR_FORWARD_TO_OTHERS,
 // then the forward address will be put in partitions[0].primary if exist.
-struct configuration_query_by_index_response
+struct query_cfg_response
 {
     1:dsn.error_code                err;
     2:i32                           app_id;
@@ -59,6 +60,14 @@ struct configuration_query_by_index_response
     5:list<partition_configuration> partitions;
 }
 
+struct request_meta {
+    1:i32 app_id;
+    2:i32 partition_index;
+    3:i32 client_timeout;
+    4:i64 partition_hash;
+    5:bool is_backup_request;
+}
+
 enum app_status
 {
     AS_INVALID,
diff --git a/idl/dsn.thrift b/idl/dsn.thrift
index ed9a877b2..06568dd49 100644
--- a/idl/dsn.thrift
+++ b/idl/dsn.thrift
@@ -26,6 +26,7 @@
 
 namespace cpp dsn
 namespace go base
+namespace java org.apache.pegasus.base
 
 // place holder
 struct rpc_address
diff --git a/idl/duplication.thrift b/idl/duplication.thrift
index b4861d011..90fcdfd09 100644
--- a/idl/duplication.thrift
+++ b/idl/duplication.thrift
@@ -20,6 +20,7 @@ include "dsn.layer2.thrift"
 
 namespace cpp dsn.replication
 namespace go admin
+namespace java org.apache.pegasus.replication
 
 //  - INIT  -> PREPARE
 //  - PREPARE -> APP
diff --git a/idl/meta_admin.thrift b/idl/meta_admin.thrift
index fd29a2a77..f24a1834b 100644
--- a/idl/meta_admin.thrift
+++ b/idl/meta_admin.thrift
@@ -34,6 +34,7 @@ include "partition_split.thrift"
 
 namespace cpp dsn.replication
 namespace go admin
+namespace java org.apache.pegasus.replication
 
 // This file contains the administration RPCs from client to MetaServer.
 
diff --git a/idl/metadata.thrift b/idl/metadata.thrift
index 83341efe6..7c8448bee 100644
--- a/idl/metadata.thrift
+++ b/idl/metadata.thrift
@@ -29,6 +29,7 @@ include "dsn.layer2.thrift"
 
 namespace cpp dsn.replication
 namespace go admin
+namespace java org.apache.pegasus.replication
 
 enum partition_status
 {
diff --git a/idl/partition_split.thrift b/idl/partition_split.thrift
index 7e912530b..a5724ea77 100644
--- a/idl/partition_split.thrift
+++ b/idl/partition_split.thrift
@@ -21,6 +21,7 @@ include "metadata.thrift"
 
 namespace cpp dsn.replication
 namespace go admin
+namespace java org.apache.pegasus.replication
 
 // client to meta server to start partition split
 struct start_partition_split_request
diff --git a/idl/rrdb.thrift b/idl/rrdb.thrift
index 164ee3f22..40c730deb 100644
--- a/idl/rrdb.thrift
+++ b/idl/rrdb.thrift
@@ -21,6 +21,7 @@ include "dsn.thrift"
 
 namespace cpp dsn.apps
 namespace go rrdb
+namespace java org.apache.pegasus.apps
 
 enum filter_type
 {
@@ -127,7 +128,7 @@ struct multi_remove_request
 {
     1:dsn.blob      hash_key;
     // Should not be empty
-    // Except for go-client which empty means remove all sortkeys
+    // Except for go/java-client which empty means remove all sortkeys
     // TODO(yingchun): check
     2:list<dsn.blob> sort_keys;
     3:i64           max_count; // deprecated
@@ -317,15 +318,14 @@ service rrdb
     batch_get_response batch_get(1:batch_get_request request);
     count_response sortkey_count(1:dsn.blob hash_key);
     ttl_response ttl(1:dsn.blob key);
-
     scan_response get_scanner(1:get_scanner_request request);
     scan_response scan(1:scan_request request);
     oneway void clear_scanner(1:i64 context_id);
 }
 
-// ONLY FOR GO
+// ONLY FOR GO & JAVA
 service meta
 {
-    dsn.layer2.configuration_query_by_index_response query_cfg(1:dsn.layer2.configuration_query_by_index_request query);
+    dsn.layer2.query_cfg_response query_cfg(1:dsn.layer2.query_cfg_request query);
 }
 
diff --git a/src/runtime/security/security.thrift b/idl/security.thrift
similarity index 94%
rename from src/runtime/security/security.thrift
rename to idl/security.thrift
index 0e3d4f0ce..8b4d8f64f 100644
--- a/src/runtime/security/security.thrift
+++ b/idl/security.thrift
@@ -15,9 +15,10 @@
 // specific language governing permissions and limitations
 // under the License.
 
-include "../../../idl/dsn.thrift"
+include "dsn.thrift"
 
 namespace cpp dsn.security
+namespace java org.apache.pegasus.apps
 
 // negotiation process:
 //
@@ -67,3 +68,9 @@ struct negotiation_response {
     1: negotiation_status status;
     2: dsn.blob msg;
 }
+
+// JAVA ONLY
+service security
+{
+    negotiation_response negotiate(1:negotiation_request request);
+}
diff --git a/java-client/README.md b/java-client/README.md
index 5549359fb..44a1cb393 100644
--- a/java-client/README.md
+++ b/java-client/README.md
@@ -22,7 +22,7 @@ under the License.
 ## Build
 
 ```
-cd idl && sh recompile_thrift.sh && cd -
+cd scripts && sh recompile_thrift.sh && cd -
 mvn spotless:apply
 mvn clean package -DskipTests
 ```
@@ -30,7 +30,7 @@ mvn clean package -DskipTests
 ## Install
 
 ```
-cd idl && sh recompile_thrift.sh && cd -
+cd scripts && sh recompile_thrift.sh && cd -
 mvn spotless:apply
 mvn clean install -DskipTests
 ```
@@ -40,7 +40,7 @@ mvn clean install -DskipTests
 To run test, you should start pegasus onebox firstly, and run test as:
 
 ```
-cd idl && sh recompile_thrift.sh && cd -
+cd scripts && sh recompile_thrift.sh && cd -
 mvn spotless:apply
 mvn clean package
 ```
@@ -48,7 +48,7 @@ mvn clean package
 or specify one test:
 
 ```
-cd idl && sh recompile_thrift.sh && cd -
+cd scripts && sh recompile_thrift.sh && cd -
 mvn spotless:apply
 mvn clean package -Dtest=TestPing
 ```
diff --git a/java-client/idl/apache-licence-template b/java-client/idl/apache-licence-template
deleted file mode 100644
index 722097550..000000000
--- a/java-client/idl/apache-licence-template
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * 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.
- */
\ No newline at end of file
diff --git a/java-client/idl/base.thrift b/java-client/idl/base.thrift
deleted file mode 100644
index 6c14aa288..000000000
--- a/java-client/idl/base.thrift
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-namespace cpp dsn.base
-namespace java org.apache.pegasus.base
-namespace py pypegasus.base
-
-// place holder
-struct blob
-{
-}
-
-struct error_code
-{
-}
-
-struct task_code
-{
-}
-
-struct rpc_address
-{
-}
-
-struct gpid
-{
-}
diff --git a/java-client/idl/meta_admin.thrift b/java-client/idl/meta_admin.thrift
deleted file mode 100644
index f11d3c9b4..000000000
--- a/java-client/idl/meta_admin.thrift
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- */
-include "base.thrift"
-
-namespace cpp dsn.replication
-namespace java org.apache.pegasus.replication
-
-struct create_app_options
-{
-    1:i32              partition_count;
-    2:i32              replica_count;
-    3:bool             success_if_exist;
-    4:string           app_type;
-    5:bool             is_stateful;
-    6:map<string, string>  envs;
-}
-
-// client => meta_server
-struct configuration_create_app_request
-{
-    1:string                   app_name;
-    2:create_app_options       options;
-}
-
-// meta_server => client
-struct configuration_create_app_response
-{
-    1:base.error_code  err;
-    2:i32              appid;
-}
-
-struct drop_app_options
-{
-    1:bool             success_if_not_exist;
-    2:optional i64     reserve_seconds;
-}
-
-struct configuration_drop_app_request
-{
-    1:string                   app_name;
-    2:drop_app_options         options;
-}
-
-struct configuration_drop_app_response
-{
-    1:base.error_code   err;
-}
diff --git a/java-client/idl/replication.thrift b/java-client/idl/replication.thrift
deleted file mode 100644
index 4fd13b076..000000000
--- a/java-client/idl/replication.thrift
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- */
-include "base.thrift"
-
-namespace cpp dsn.replication
-namespace java org.apache.pegasus.replication
-namespace py pypegasus.replication
-
-struct partition_configuration
-{
-    1:base.gpid pid;
-    2:i64 ballot;
-    3:i32 max_replica_count;
-    4:base.rpc_address primary;
-    5:list<base.rpc_address> secondaries;
-    6:list<base.rpc_address> last_drops;
-    7:i64 last_committed_decree;
-}
-
-struct query_cfg_request
-{
-    1:string app_name;
-    2:list<i32> partition_indices;
-}
-
-// for server version > 1.11.2, if err == ERR_FORWARD_TO_OTHERS,
-// then the forward address will be put in partitions[0].primary if exist.
-struct query_cfg_response
-{
-    1:base.error_code err;
-    2:i32 app_id;
-    3:i32 partition_count;
-    4:bool is_stateful;
-    5:list<partition_configuration> partitions;
-}
-
-struct request_meta {
-    1:i32 app_id;
-    2:i32 partition_index;
-    3:i32 client_timeout;
-    4:i64 partition_hash;
-    5:bool is_backup_request;
-}
diff --git a/java-client/idl/rrdb.thrift b/java-client/idl/rrdb.thrift
deleted file mode 100644
index e7e73da56..000000000
--- a/java-client/idl/rrdb.thrift
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * 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.
- */
-include "base.thrift"
-include "replication.thrift"
-include "meta_admin.thrift"
-
-namespace cpp dsn.apps
-namespace java org.apache.pegasus.apps
-namespace py pypegasus.rrdb
-
-enum filter_type
-{
-    FT_NO_FILTER,
-    FT_MATCH_ANYWHERE,
-    FT_MATCH_PREFIX,
-    FT_MATCH_POSTFIX
-}
-
-enum cas_check_type
-{
-    CT_NO_CHECK,
-
-    // (1~4) appearance
-    CT_VALUE_NOT_EXIST,               // value is not exist
-    CT_VALUE_NOT_EXIST_OR_EMPTY,      // value is not exist or value is empty
-    CT_VALUE_EXIST,                   // value is exist
-    CT_VALUE_NOT_EMPTY,               // value is exist and not empty
-
-    // (5~7) match
-    CT_VALUE_MATCH_ANYWHERE,          // operand matches anywhere in value
-    CT_VALUE_MATCH_PREFIX,            // operand matches prefix in value
-    CT_VALUE_MATCH_POSTFIX,           // operand matches postfix in value
-
-    // (8~12) bytes compare
-    CT_VALUE_BYTES_LESS,              // bytes compare: value < operand
-    CT_VALUE_BYTES_LESS_OR_EQUAL,     // bytes compare: value <= operand
-    CT_VALUE_BYTES_EQUAL,             // bytes compare: value == operand
-    CT_VALUE_BYTES_GREATER_OR_EQUAL,  // bytes compare: value >= operand
-    CT_VALUE_BYTES_GREATER,           // bytes compare: value > operand
-
-    // (13~17) int compare: first transfer bytes to int64 by atoi(); then compare by int value
-    CT_VALUE_INT_LESS,                // int compare: value < operand
-    CT_VALUE_INT_LESS_OR_EQUAL,       // int compare: value <= operand
-    CT_VALUE_INT_EQUAL,               // int compare: value == operand
-    CT_VALUE_INT_GREATER_OR_EQUAL,    // int compare: value >= operand
-    CT_VALUE_INT_GREATER              // int compare: value > operand
-}
-
-enum mutate_operation
-{
-    MO_PUT,
-    MO_DELETE
-}
-
-struct update_request
-{
-    1:base.blob     key;
-    2:base.blob     value;
-    3:i32           expire_ts_seconds;
-}
-
-struct update_response
-{
-    1:i32           error;
-    2:i32           app_id;
-    3:i32           partition_index;
-    4:i64           decree;
-    5:string        server;
-}
-
-struct read_response
-{
-    1:i32           error;
-    2:base.blob     value;
-    3:i32           app_id;
-    4:i32           partition_index;
-    6:string        server;
-}
-
-struct ttl_response
-{
-    1:i32           error;
-    2:i32           ttl_seconds;
-    3:i32           app_id;
-    4:i32           partition_index;
-    6:string        server;
-}
-
-struct count_response
-{
-    1:i32           error;
-    2:i64           count;
-    3:i32           app_id;
-    4:i32           partition_index;
-    6:string        server;
-}
-
-struct key_value
-{
-    1:base.blob     key;
-    2:base.blob     value;
-}
-
-struct multi_put_request
-{
-    1:base.blob     hash_key;
-    2:list<key_value> kvs; // sort_key => value
-    3:i32           expire_ts_seconds;
-}
-
-struct multi_remove_request
-{
-    1:base.blob     hash_key;
-    2:list<base.blob> sork_keys; // empty means remove all sortkeys
-    3:i64           max_count; // deprecated
-}
-
-struct multi_remove_response
-{
-    1:i32           error;
-    2:i64           count; // deleted count
-    3:i32           app_id;
-    4:i32           partition_index;
-    5:i64           decree;
-    6:string        server;
-}
-
-struct multi_get_request
-{
-    1:base.blob     hash_key;
-    2:list<base.blob> sork_keys; // not empty means only fetch specified sortkeys
-    3:i32           max_kv_count; // <= 0 means no limit
-    4:i32           max_kv_size; // <= 0 means no limit
-    5:bool          no_value; // not return value, only return sortkeys
-    6:base.blob     start_sortkey;
-    7:base.blob     stop_sortkey; // empty means fetch to the last sort key
-    8:bool          start_inclusive;
-    9:bool          stop_inclusive;
-    10:filter_type  sort_key_filter_type;
-    11:base.blob    sort_key_filter_pattern;
-    12:bool         reverse; // if search in reverse direction
-}
-
-struct multi_get_response
-{
-    1:i32           error;
-    2:list<key_value> kvs; // sort_key => value
-    3:i32           app_id;
-    4:i32           partition_index;
-    6:string        server;
-}
-
-struct batch_get_request {
-    1:list<full_key> keys;
-}
-
-struct full_key {
-    1:base.blob hash_key;
-    2:base.blob sort_key;
-}
-
-struct batch_get_response {
-    1:i32               error;
-    2:list<full_data>   data;
-    3:i32               app_id;
-    4:i32               partition_index;
-    6:string            server;
-}
-
-struct full_data {
-    1:base.blob hash_key;
-    2:base.blob sort_key;
-    3:base.blob value;
-}
-
-struct incr_request
-{
-    1:base.blob     key;
-    2:i64           increment;
-    3:i32           expire_ts_seconds; // 0 means keep original ttl
-                                       // >0 means reset to new ttl
-                                       // <0 means reset to no ttl
-}
-
-struct incr_response
-{
-    1:i32           error;
-    2:i64           new_value;
-    3:i32           app_id;
-    4:i32           partition_index;
-    5:i64           decree;
-    6:string        server;
-}
-
-struct check_and_set_request
-{
-    1:base.blob      hash_key;
-    2:base.blob      check_sort_key;
-    3:cas_check_type check_type;
-    4:base.blob      check_operand;
-    5:bool           set_diff_sort_key; // if set different sort key with check_sort_key
-    6:base.blob      set_sort_key; // used only if set_diff_sort_key is true
-    7:base.blob      set_value;
-    8:i32            set_expire_ts_seconds;
-    9:bool           return_check_value;
-}
-
-struct check_and_set_response
-{
-    1:i32            error; // return kTryAgain if check not passed
-    2:bool           check_value_returned;
-    3:bool           check_value_exist; // used only if check_value_returned is true
-    4:base.blob      check_value; // used only if check_value_returned and check_value_exist is true
-    5:i32            app_id;
-    6:i32            partition_index;
-    7:i64            decree;
-    8:string         server;
-}
-
-struct mutate
-{
-    1:mutate_operation operation;
-    2:base.blob        sort_key;
-    3:base.blob        value;
-    4:i32              set_expire_ts_seconds;
-}
-
-struct check_and_mutate_request
-{
-    1:base.blob      hash_key;
-    2:base.blob      check_sort_key;
-    3:cas_check_type check_type;
-    4:base.blob      check_operand;
-    5:list<mutate>   mutate_list;
-    6:bool           return_check_value;
-}
-
-struct check_and_mutate_response
-{
-    1:i32            error; // for errors such as kInvalidArgument etc.
-    2:bool           check_value_returned;
-    3:bool           check_value_exist; // used only if check_value_returned is true
-    4:base.blob      check_value; // used only if check_value_returned and check_value_exist is true
-    5:i32            app_id;
-    6:i32            partition_index;
-    7:i64            decree;
-    8:string         server;
-}
-
-struct get_scanner_request
-{
-    1:base.blob start_key;
-    2:base.blob stop_key;
-    3:bool      start_inclusive;
-    4:bool      stop_inclusive;
-    5:i32       batch_size;
-    6:bool      no_value; // not return value, only return sortkeys
-    7:filter_type  hash_key_filter_type;
-    8:base.blob    hash_key_filter_pattern;
-    9:filter_type  sort_key_filter_type;
-    10:base.blob   sort_key_filter_pattern;
-    11:optional bool    need_check_hash;
-    12:optional bool    return_expire_ts;
-    13:optional bool full_scan; // true means client want to build 'full scan' context with the server side, false otherwise
-}
-
-struct scan_request
-{
-    1:i64           context_id;
-}
-
-struct scan_response
-{
-    1:i32           error;
-    2:list<key_value> kvs;
-    3:i64           context_id;
-    4:i32           app_id;
-    5:i32           partition_index;
-    6:string        server;
-}
-
-service rrdb
-{
-    update_response put(1:update_request update);
-    update_response multi_put(1:multi_put_request request);
-    update_response remove(1:base.blob key);
-    multi_remove_response multi_remove(1:multi_remove_request request);
-    incr_response incr(1:incr_request request);
-    check_and_set_response check_and_set(1:check_and_set_request request);
-    check_and_mutate_response check_and_mutate(1:check_and_mutate_request request);
-    read_response get(1:base.blob key);
-    multi_get_response multi_get(1:multi_get_request request);
-    batch_get_response batch_get(1:batch_get_request request);
-    count_response sortkey_count(1:base.blob hash_key);
-    ttl_response ttl(1:base.blob key);
-    scan_response get_scanner(1:get_scanner_request request);
-    scan_response scan(1:scan_request request);
-    oneway void clear_scanner(1:i64 context_id);
-}
-
-service meta
-{
-    replication.query_cfg_response query_cfg(1:replication.query_cfg_request query);
-    meta_admin.configuration_create_app_response create_app(1:meta_admin.configuration_create_app_request request);
-    meta_admin.configuration_drop_app_response drop_app(1:meta_admin.configuration_drop_app_request request);
-}
diff --git a/java-client/idl/security.thrift b/java-client/idl/security.thrift
deleted file mode 100644
index c4c158635..000000000
--- a/java-client/idl/security.thrift
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-include "base.thrift"
-
-namespace cpp dsn.apps
-namespace java org.apache.pegasus.apps
-namespace py pypegasus.rrdb
-
-// negotiation process:
-//
-//                       client                              server
-//                          | ---    SASL_LIST_MECHANISMS     --> |
-//                          | <--  SASL_LIST_MECHANISMS_RESP  --- |
-//                          | --     SASL_SELECT_MECHANISMS   --> |
-//                          | <-- SASL_SELECT_MECHANISMS_RESP --- |
-//                          |                                     |
-//                          | ---       SASL_INITIATE         --> |
-//                          |                                     |
-//                          | <--       SASL_CHALLENGE        --- |
-//                          | ---     SASL_CHALLENGE_RESP     --> |
-//                          |                                     |
-//                          |               .....                 |
-//                          |                                     |
-//                          | <--       SASL_CHALLENGE        --- |
-//                          | ---     SASL_CHALLENGE_RESP     --> |
-//                          |                                     | (authentication will succeed
-//                          |                                     |  if all challenges passed)
-//                          | <--         SASL_SUCC           --- |
-// (client won't response   |                                     |
-// if servers says ok)      |                                     |
-//                          | ---         RPC_CALL           ---> |
-//                          | <--         RPC_RESP           ---- |
-
-enum negotiation_status {
-    INVALID
-    SASL_LIST_MECHANISMS
-    SASL_LIST_MECHANISMS_RESP
-    SASL_SELECT_MECHANISMS
-    SASL_SELECT_MECHANISMS_RESP
-    SASL_INITIATE
-    SASL_CHALLENGE
-    SASL_CHALLENGE_RESP
-    SASL_SUCC
-    SASL_AUTH_DISABLE
-    SASL_AUTH_FAIL
-}
-
-struct negotiation_request
-{
-    1: negotiation_status status;
-    2: base.blob msg;
-}
-
-struct negotiation_response
-{
-    1: negotiation_status status;
-    2: base.blob msg;
-}
-
-service security
-{
-    negotiation_response negotiate(1:negotiation_request request);
-}
diff --git a/java-client/scripts/ci-test.sh b/java-client/scripts/ci-test.sh
index 9b5cceeb7..c1b1f2346 100755
--- a/java-client/scripts/ci-test.sh
+++ b/java-client/scripts/ci-test.sh
@@ -58,7 +58,7 @@ cd $PEGASUS_PKG
 cd ../
 
 
-pushd idl
+pushd scripts
 echo "bash recompile_thrift.sh"
 bash recompile_thrift.sh
 popd
diff --git a/java-client/idl/recompile_thrift.sh b/java-client/scripts/recompile_thrift.sh
similarity index 79%
rename from java-client/idl/recompile_thrift.sh
rename to java-client/scripts/recompile_thrift.sh
index 286efd043..6efcba8fa 100755
--- a/java-client/idl/recompile_thrift.sh
+++ b/java-client/scripts/recompile_thrift.sh
@@ -52,15 +52,15 @@ TMP_DIR=./gen-java
 rm -rf $TMP_DIR
 
 mkdir -p $TMP_DIR
-$thrift --gen java rrdb.thrift
-$thrift --gen java replication.thrift
-$thrift --gen java security.thrift
-$thrift --gen java meta_admin.thrift
-
-for gen_file in `find $TMP_DIR -name "*.java"`; do
-    cat apache-licence-template $gen_file > $gen_file.tmp
-    mv $gen_file.tmp $gen_file
-done
+$thrift --gen java ../../idl/backup.thrift
+$thrift --gen java ../../idl/bulk_load.thrift
+$thrift --gen java ../../idl/dsn.layer2.thrift
+$thrift --gen java ../../idl/duplication.thrift
+$thrift --gen java ../../idl/metadata.thrift
+$thrift --gen java ../../idl/meta_admin.thrift
+$thrift --gen java ../../idl/partition_split.thrift
+$thrift --gen java ../../idl/rrdb.thrift
+$thrift --gen java ../../idl/security.thrift
 
 cp -v -r $TMP_DIR/* ../src/main/java/
 rm -rf $TMP_DIR
diff --git a/java-client/src/main/java/org/apache/pegasus/client/PegasusScanner.java b/java-client/src/main/java/org/apache/pegasus/client/PegasusScanner.java
index 91218b872..40ba98efd 100644
--- a/java-client/src/main/java/org/apache/pegasus/client/PegasusScanner.java
+++ b/java-client/src/main/java/org/apache/pegasus/client/PegasusScanner.java
@@ -217,7 +217,7 @@ public class PegasusScanner implements PegasusScannerInterface {
     request.sort_key_filter_type = filter_type.findByValue(options.sortKeyFilterType.getValue());
     request.sort_key_filter_pattern =
         (options.sortKeyFilterPattern == null ? null : new blob(options.sortKeyFilterPattern));
-    request.need_check_hash = needCheckHash;
+    request.validate_partition_hash = needCheckHash;
     request.full_scan = fullScan;
 
     rrdb_get_scanner_operator op =
diff --git a/java-client/src/main/java/org/apache/pegasus/operator/create_app_operator.java b/java-client/src/main/java/org/apache/pegasus/operator/create_app_operator.java
index e5bfba4ca..07d4531c0 100644
--- a/java-client/src/main/java/org/apache/pegasus/operator/create_app_operator.java
+++ b/java-client/src/main/java/org/apache/pegasus/operator/create_app_operator.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pegasus.operator;
 
-import org.apache.pegasus.apps.meta;
 import org.apache.pegasus.base.gpid;
 import org.apache.pegasus.replication.configuration_create_app_request;
 import org.apache.pegasus.replication.configuration_create_app_response;
@@ -42,14 +41,16 @@ public class create_app_operator extends client_operator {
   public void send_data(TProtocol oprot, int sequence_id) throws TException {
     TMessage msg = new TMessage("RPC_CM_CREATE_APP", TMessageType.CALL, sequence_id);
     oprot.writeMessageBegin(msg);
-    org.apache.pegasus.apps.meta.create_app_args args = new meta.create_app_args(request);
+    org.apache.pegasus.replication.admin_client.create_app_args args =
+        new org.apache.pegasus.replication.admin_client.create_app_args(request);
     args.write(oprot);
     oprot.writeMessageEnd();
   }
 
   @Override
   public void recv_data(TProtocol iprot) throws TException {
-    meta.create_app_result result = new meta.create_app_result();
+    org.apache.pegasus.replication.admin_client.create_app_result result =
+        new org.apache.pegasus.replication.admin_client.create_app_result();
     result.read(iprot);
     if (result.isSetSuccess()) response = result.success;
     else
diff --git a/java-client/src/main/java/org/apache/pegasus/operator/drop_app_operator.java b/java-client/src/main/java/org/apache/pegasus/operator/drop_app_operator.java
index 54795c218..3b80fe692 100644
--- a/java-client/src/main/java/org/apache/pegasus/operator/drop_app_operator.java
+++ b/java-client/src/main/java/org/apache/pegasus/operator/drop_app_operator.java
@@ -18,7 +18,6 @@
  */
 package org.apache.pegasus.operator;
 
-import org.apache.pegasus.apps.meta;
 import org.apache.pegasus.base.gpid;
 import org.apache.pegasus.replication.configuration_drop_app_request;
 import org.apache.pegasus.replication.configuration_drop_app_response;
@@ -42,14 +41,16 @@ public class drop_app_operator extends client_operator {
   public void send_data(TProtocol oprot, int sequence_id) throws TException {
     TMessage msg = new TMessage("RPC_CM_DROP_APP", TMessageType.CALL, sequence_id);
     oprot.writeMessageBegin(msg);
-    org.apache.pegasus.apps.meta.drop_app_args args = new meta.drop_app_args(request);
+    org.apache.pegasus.replication.admin_client.drop_app_args args =
+        new org.apache.pegasus.replication.admin_client.drop_app_args(request);
     args.write(oprot);
     oprot.writeMessageEnd();
   }
 
   @Override
   public void recv_data(TProtocol iprot) throws TException {
-    meta.drop_app_result result = new meta.drop_app_result();
+    org.apache.pegasus.replication.admin_client.drop_app_result result =
+        new org.apache.pegasus.replication.admin_client.drop_app_result();
     result.read(iprot);
     if (result.isSetSuccess()) response = result.success;
     else
diff --git a/src/client/partition_resolver_simple.cpp b/src/client/partition_resolver_simple.cpp
index 79351ed63..bcd631dbe 100644
--- a/src/client/partition_resolver_simple.cpp
+++ b/src/client/partition_resolver_simple.cpp
@@ -240,7 +240,7 @@ task_ptr partition_resolver_simple::query_config(int partition_index, int timeou
         timeout_ms = 0;
     auto msg = dsn::message_ex::create_request(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX, timeout_ms);
 
-    configuration_query_by_index_request req;
+    query_cfg_request req;
     req.app_name = _app_name;
     if (partition_index != -1) {
         req.partition_indices.push_back(partition_index);
@@ -264,7 +264,7 @@ void partition_resolver_simple::query_config_reply(error_code err,
     auto client_err = ERR_OK;
 
     if (err == ERR_OK) {
-        configuration_query_by_index_response resp;
+        query_cfg_response resp;
         unmarshall(response, resp);
         if (resp.err == ERR_OK) {
             zauto_write_lock l(_config_lock);
diff --git a/src/client/replication_ddl_client.cpp b/src/client/replication_ddl_client.cpp
index 63e275484..02fb7175f 100644
--- a/src/client/replication_ddl_client.cpp
+++ b/src/client/replication_ddl_client.cpp
@@ -84,12 +84,11 @@ dsn::error_code replication_ddl_client::wait_app_ready(const std::string &app_na
     while (true) {
         std::this_thread::sleep_for(std::chrono::seconds(sleep_sec));
 
-        std::shared_ptr<configuration_query_by_index_request> query_req(
-            new configuration_query_by_index_request());
+        std::shared_ptr<query_cfg_request> query_req(new query_cfg_request());
         query_req->app_name = app_name;
 
-        auto query_task = request_meta<configuration_query_by_index_request>(
-            RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX, query_req);
+        auto query_task =
+            request_meta<query_cfg_request>(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX, query_req);
         query_task->wait();
         if (query_task->error() == ERR_INVALID_STATE) {
             std::cout << app_name << " not ready yet, still waiting..." << std::endl;
@@ -103,7 +102,7 @@ dsn::error_code replication_ddl_client::wait_app_ready(const std::string &app_na
             return query_task->error();
         }
 
-        dsn::configuration_query_by_index_response query_resp;
+        dsn::query_cfg_response query_resp;
         ::dsn::unmarshall(query_task->get_response(), query_resp);
         if (query_resp.err != dsn::ERR_OK) {
             std::cout << "create app " << app_name
@@ -705,7 +704,7 @@ dsn::error_code replication_ddl_client::list_app(const std::string &app_name,
         max_replica_count = partitions[0].max_replica_count;
     }
 
-    // print configuration_query_by_index_response
+    // print query_cfg_response
     std::streambuf *buf;
     std::ofstream of;
 
@@ -820,19 +819,17 @@ dsn::error_code replication_ddl_client::list_app(const std::string &app_name,
                      (bool (*)(int))replication_ddl_client::valid_app_char))
         return ERR_INVALID_PARAMETERS;
 
-    std::shared_ptr<configuration_query_by_index_request> req(
-        new configuration_query_by_index_request());
+    std::shared_ptr<query_cfg_request> req(new query_cfg_request());
     req->app_name = app_name;
 
-    auto resp_task = request_meta<configuration_query_by_index_request>(
-        RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX, req);
+    auto resp_task = request_meta<query_cfg_request>(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX, req);
 
     resp_task->wait();
     if (resp_task->error() != dsn::ERR_OK) {
         return resp_task->error();
     }
 
-    dsn::configuration_query_by_index_response resp;
+    dsn::query_cfg_response resp;
     dsn::unmarshall(resp_task->get_response(), resp);
     if (resp.err != dsn::ERR_OK) {
         return resp.err;
diff --git a/src/client_lib/pegasus_client_impl.cpp b/src/client_lib/pegasus_client_impl.cpp
index d3e7f0cf9..d88509a84 100644
--- a/src/client_lib/pegasus_client_impl.cpp
+++ b/src/client_lib/pegasus_client_impl.cpp
@@ -1211,7 +1211,7 @@ void pegasus_client_impl::async_get_unordered_scanners(
         ::dsn::error_code err, dsn::message_ex * req, dsn::message_ex * resp)
     {
         std::vector<pegasus_scanner *> scanners;
-        configuration_query_by_index_response response;
+        query_cfg_response response;
         if (err == ERR_OK) {
             ::dsn::unmarshall(resp, response);
             if (response.err == ERR_OK) {
@@ -1236,7 +1236,7 @@ void pegasus_client_impl::async_get_unordered_scanners(
         user_callback(ret, std::move(scanners));
     };
 
-    configuration_query_by_index_request req;
+    query_cfg_request req;
     req.app_name = _app_name;
     ::dsn::rpc::call(_meta_server,
                      RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX,
diff --git a/src/meta/duplication/meta_duplication_service.cpp b/src/meta/duplication/meta_duplication_service.cpp
index b59d5e21d..36c2ec397 100644
--- a/src/meta/duplication/meta_duplication_service.cpp
+++ b/src/meta/duplication/meta_duplication_service.cpp
@@ -386,7 +386,7 @@ void meta_duplication_service::check_follower_app_if_create_completed(
     meta_servers.assign_group(dup->follower_cluster_name.c_str());
     meta_servers.group_address()->add_list(dup->follower_cluster_metas);
 
-    configuration_query_by_index_request meta_config_request;
+    query_cfg_request meta_config_request;
     meta_config_request.app_name = dup->app_name;
 
     dsn::message_ex *msg = dsn::message_ex::create_request(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
@@ -394,7 +394,7 @@ void meta_duplication_service::check_follower_app_if_create_completed(
     rpc::call(meta_servers,
               msg,
               _meta_svc->tracker(),
-              [=](error_code err, configuration_query_by_index_response &&resp) mutable {
+              [=](error_code err, query_cfg_response &&resp) mutable {
                   FAIL_POINT_INJECT_NOT_RETURN_F("create_app_ok", [&](string_view s) -> void {
                       err = ERR_OK;
                       int count = dup->partition_count;
diff --git a/src/meta/meta_http_service.cpp b/src/meta/meta_http_service.cpp
index c473552eb..c445411fe 100644
--- a/src/meta/meta_http_service.cpp
+++ b/src/meta/meta_http_service.cpp
@@ -71,8 +71,8 @@ void meta_http_service::get_app_handler(const http_request &req, http_response &
     if (!redirect_if_not_primary(req, resp))
         return;
 
-    configuration_query_by_index_request request;
-    configuration_query_by_index_response response;
+    query_cfg_request request;
+    query_cfg_response response;
 
     request.app_name = app_name;
     _service->_state->query_configuration_by_index(request, response);
@@ -288,8 +288,8 @@ void meta_http_service::list_app_handler(const http_request &req, http_response
             if (info.status != app_status::AS_AVAILABLE) {
                 continue;
             }
-            configuration_query_by_index_request request;
-            configuration_query_by_index_response response;
+            query_cfg_request request;
+            query_cfg_response response;
             request.app_name = info.app_name;
             _service->_state->query_configuration_by_index(request, response);
             CHECK_EQ(info.app_id, response.app_id);
@@ -381,8 +381,8 @@ void meta_http_service::list_node_handler(const http_request &req, http_response
         request.status = dsn::app_status::AS_AVAILABLE;
         _service->_state->list_apps(request, response);
         for (const auto &app : response.infos) {
-            configuration_query_by_index_request request_app;
-            configuration_query_by_index_response response_app;
+            query_cfg_request request_app;
+            query_cfg_response response_app;
             request_app.app_name = app.app_name;
             _service->_state->query_configuration_by_index(request_app, response_app);
             CHECK_EQ(app.app_id, response_app.app_id);
diff --git a/src/meta/meta_rpc_types.h b/src/meta/meta_rpc_types.h
index 7044e09b9..42539e89b 100644
--- a/src/meta/meta_rpc_types.h
+++ b/src/meta/meta_rpc_types.h
@@ -34,8 +34,7 @@ typedef rpc_holder<configuration_update_app_env_request, configuration_update_ap
 typedef rpc_holder<ddd_diagnose_request, ddd_diagnose_response> ddd_diagnose_rpc;
 typedef rpc_holder<configuration_query_by_node_request, configuration_query_by_node_response>
     configuration_query_by_node_rpc;
-typedef rpc_holder<configuration_query_by_index_request, configuration_query_by_index_response>
-    configuration_query_by_index_rpc;
+typedef rpc_holder<query_cfg_request, query_cfg_response> configuration_query_by_index_rpc;
 typedef rpc_holder<configuration_list_apps_request, configuration_list_apps_response>
     configuration_list_apps_rpc;
 typedef rpc_holder<configuration_list_nodes_request, configuration_list_nodes_response>
diff --git a/src/meta/meta_service.cpp b/src/meta/meta_service.cpp
index 9b1de0997..8e2a80c5c 100644
--- a/src/meta/meta_service.cpp
+++ b/src/meta/meta_service.cpp
@@ -640,7 +640,7 @@ void meta_service::on_query_cluster_info(configuration_cluster_info_rpc rpc)
 // client => meta server
 void meta_service::on_query_configuration_by_index(configuration_query_by_index_rpc rpc)
 {
-    configuration_query_by_index_response &response = rpc.response();
+    query_cfg_response &response = rpc.response();
     rpc_address forward_address;
     if (!check_status(rpc, &forward_address)) {
         if (!forward_address.is_invalid()) {
diff --git a/src/meta/server_state.cpp b/src/meta/server_state.cpp
index 475504f29..8751d6b3f 100644
--- a/src/meta/server_state.cpp
+++ b/src/meta/server_state.cpp
@@ -965,9 +965,8 @@ bool server_state::query_configuration_by_gpid(dsn::gpid id,
     return false;
 }
 
-void server_state::query_configuration_by_index(
-    const configuration_query_by_index_request &request,
-    /*out*/ configuration_query_by_index_response &response)
+void server_state::query_configuration_by_index(const query_cfg_request &request,
+                                                /*out*/ query_cfg_response &response)
 {
     zauto_read_lock l(_lock);
     auto iter = _exist_apps.find(request.app_name.c_str());
diff --git a/src/meta/server_state.h b/src/meta/server_state.h
index e761a42e0..184291571 100644
--- a/src/meta/server_state.h
+++ b/src/meta/server_state.h
@@ -136,8 +136,8 @@ public:
         return iter->second;
     }
 
-    void query_configuration_by_index(const configuration_query_by_index_request &request,
-                                      /*out*/ configuration_query_by_index_response &response);
+    void query_configuration_by_index(const query_cfg_request &request,
+                                      /*out*/ query_cfg_response &response);
     bool query_configuration_by_gpid(const dsn::gpid id, /*out*/ partition_configuration &config);
 
     // app options
diff --git a/src/meta/test/state_sync_test.cpp b/src/meta/test/state_sync_test.cpp
index 47a4afd0f..0a9c9be22 100644
--- a/src/meta/test/state_sync_test.cpp
+++ b/src/meta/test/state_sync_test.cpp
@@ -274,8 +274,8 @@ void meta_service_test_app::state_sync_test()
         }
 
         // 2.1 query configuration by index
-        dsn::configuration_query_by_index_request req;
-        dsn::configuration_query_by_index_response resp;
+        dsn::query_cfg_request req;
+        dsn::query_cfg_response resp;
         req.app_name = "test_app15";
         req.partition_indices = {-1, 1, 2, 3, 0x7fffffff};
 
diff --git a/src/replica/duplication/replica_follower.cpp b/src/replica/duplication/replica_follower.cpp
index 186de950b..434bd32ae 100644
--- a/src/replica/duplication/replica_follower.cpp
+++ b/src/replica/duplication/replica_follower.cpp
@@ -93,7 +93,7 @@ void replica_follower::async_duplicate_checkpoint_from_master_replica()
     meta_servers.assign_group(_master_cluster_name.c_str());
     meta_servers.group_address()->add_list(_master_meta_list);
 
-    configuration_query_by_index_request meta_config_request;
+    query_cfg_request meta_config_request;
     meta_config_request.app_name = _master_app_name;
     // just fetch the same partition config
     meta_config_request.partition_indices = {get_gpid().get_partition_index()};
@@ -102,27 +102,21 @@ void replica_follower::async_duplicate_checkpoint_from_master_replica()
     dsn::message_ex *msg = dsn::message_ex::create_request(
         RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX, 0, get_gpid().thread_hash());
     dsn::marshall(msg, meta_config_request);
-    rpc::call(meta_servers,
-              msg,
-              &_tracker,
-              [&](error_code err, configuration_query_by_index_response &&resp) mutable {
-                  FAIL_POINT_INJECT_F("duplicate_checkpoint_ok", [&](string_view s) -> void {
-                      _tracker.set_tasks_success();
-                      return;
-                  });
+    rpc::call(meta_servers, msg, &_tracker, [&](error_code err, query_cfg_response &&resp) mutable {
+        FAIL_POINT_INJECT_F("duplicate_checkpoint_ok", [&](string_view s) -> void {
+            _tracker.set_tasks_success();
+            return;
+        });
 
-                  FAIL_POINT_INJECT_F("duplicate_checkpoint_failed",
-                                      [&](string_view s) -> void { return; });
-                  if (update_master_replica_config(err, std::move(resp)) == ERR_OK) {
-                      copy_master_replica_checkpoint();
-                  }
-              });
+        FAIL_POINT_INJECT_F("duplicate_checkpoint_failed", [&](string_view s) -> void { return; });
+        if (update_master_replica_config(err, std::move(resp)) == ERR_OK) {
+            copy_master_replica_checkpoint();
+        }
+    });
 }
 
 // ThreadPool: THREAD_POOL_DEFAULT
-error_code
-replica_follower::update_master_replica_config(error_code err,
-                                               configuration_query_by_index_response &&resp)
+error_code replica_follower::update_master_replica_config(error_code err, query_cfg_response &&resp)
 {
     error_code err_code = err != ERR_OK ? err : resp.err;
     if (dsn_unlikely(err_code != ERR_OK)) {
diff --git a/src/replica/duplication/replica_follower.h b/src/replica/duplication/replica_follower.h
index f282dfb74..3f14392ee 100644
--- a/src/replica/duplication/replica_follower.h
+++ b/src/replica/duplication/replica_follower.h
@@ -53,8 +53,7 @@ private:
 
     void init_master_info();
     void async_duplicate_checkpoint_from_master_replica();
-    error_code update_master_replica_config(error_code err,
-                                            configuration_query_by_index_response &&resp);
+    error_code update_master_replica_config(error_code err, query_cfg_response &&resp);
     void copy_master_replica_checkpoint();
     error_code nfs_copy_checkpoint(error_code err, learn_response &&resp);
     void nfs_copy_remote_files(const rpc_address &remote_node,
diff --git a/src/replica/duplication/test/replica_follower_test.cpp b/src/replica/duplication/test/replica_follower_test.cpp
index eca1c05d4..1b194296c 100644
--- a/src/replica/duplication/test/replica_follower_test.cpp
+++ b/src/replica/duplication/test/replica_follower_test.cpp
@@ -77,8 +77,7 @@ public:
         follower->_tracker.set_tasks_success();
     }
 
-    error_code update_master_replica_config(replica_follower *follower,
-                                            configuration_query_by_index_response &resp)
+    error_code update_master_replica_config(replica_follower *follower, query_cfg_response &resp)
     {
         return follower->update_master_replica_config(ERR_OK, std::move(resp));
     }
@@ -178,7 +177,7 @@ TEST_F(replica_follower_test, test_update_master_replica_config)
     update_mock_replica(_app_info);
     auto follower = _mock_replica->get_replica_follower();
 
-    configuration_query_by_index_response resp;
+    query_cfg_response resp;
     ASSERT_EQ(update_master_replica_config(follower, resp), ERR_INCONSISTENT_STATE);
     ASSERT_EQ(master_replica_config(follower).primary, rpc_address::s_invalid_address);
 
diff --git a/src/runtime/security/CMakeLists.txt b/src/runtime/security/CMakeLists.txt
index 6c097680c..130cda6ab 100644
--- a/src/runtime/security/CMakeLists.txt
+++ b/src/runtime/security/CMakeLists.txt
@@ -20,7 +20,7 @@ set(MY_PROJ_NAME dsn.security)
 thrift_generate_cpp(
     SECURITY_THRIFT_SRCS
     SECURITY_THRIFT_HDRS
-    ${CMAKE_CURRENT_SOURCE_DIR}/security.thrift
+        ../../idl/security.thrift
 )
 
 set(MY_PROJ_SRC ${SECURITY_THRIFT_SRCS})
diff --git a/src/runtime/test/message_utils_test.cpp b/src/runtime/test/message_utils_test.cpp
index 821aab90a..79d24f06f 100644
--- a/src/runtime/test/message_utils_test.cpp
+++ b/src/runtime/test/message_utils_test.cpp
@@ -33,8 +33,7 @@ namespace dsn {
 
 DEFINE_TASK_CODE_RPC(RPC_CODE_FOR_TEST, TASK_PRIORITY_COMMON, THREAD_POOL_DEFAULT)
 
-typedef rpc_holder<configuration_query_by_index_request, configuration_query_by_index_response>
-    t_rpc;
+typedef rpc_holder<query_cfg_request, query_cfg_response> t_rpc;
 
 TEST(message_utils, msg_blob_convertion)
 {
@@ -49,7 +48,7 @@ TEST(message_utils, msg_blob_convertion)
 
 TEST(message_utils, thrift_msg_convertion)
 {
-    configuration_query_by_index_request request;
+    query_cfg_request request;
     request.app_name = "haha";
 
     message_ptr msg =
@@ -61,7 +60,7 @@ TEST(message_utils, thrift_msg_convertion)
 
 TEST(message_utils, complex_convertion)
 {
-    configuration_query_by_index_request request;
+    query_cfg_request request;
     request.app_name = "haha";
 
     message_ptr msg =
diff --git a/src/runtime/test/rpc_holder_test.cpp b/src/runtime/test/rpc_holder_test.cpp
index ca6c695d8..03690e4a7 100644
--- a/src/runtime/test/rpc_holder_test.cpp
+++ b/src/runtime/test/rpc_holder_test.cpp
@@ -32,8 +32,7 @@
 
 using namespace dsn;
 
-typedef rpc_holder<configuration_query_by_index_request, configuration_query_by_index_response>
-    t_rpc;
+typedef rpc_holder<query_cfg_request, query_cfg_response> t_rpc;
 
 DEFINE_TASK_CODE_RPC(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX,
                      TASK_PRIORITY_COMMON,
@@ -53,13 +52,13 @@ TEST(rpc_holder, construct)
     }
 
     {
-        auto request = make_unique<configuration_query_by_index_request>();
+        auto request = make_unique<query_cfg_request>();
         t_rpc rpc(std::move(request), RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
         ASSERT_TRUE(rpc.is_initialized());
     }
 
     {
-        configuration_query_by_index_request request;
+        query_cfg_request request;
         request.app_name = "test";
         dsn::message_ex *msg =
             dsn::message_ex::create_request(RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
@@ -72,7 +71,7 @@ TEST(rpc_holder, construct)
     }
 
     {
-        auto request = make_unique<configuration_query_by_index_request>();
+        auto request = make_unique<query_cfg_request>();
         t_rpc rpc(std::move(request), RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
         ASSERT_EQ(rpc.error(), ERR_OK);
         ASSERT_TRUE(rpc.is_initialized());
@@ -92,7 +91,7 @@ TEST(rpc_holder, mock_rpc_call)
         auto &mail_box = t_rpc::mail_box();
 
         for (int i = 0; i < 10; i++) {
-            auto request = make_unique<configuration_query_by_index_request>();
+            auto request = make_unique<query_cfg_request>();
             t_rpc rpc(std::move(request), RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
             rpc.call(rpc_address("127.0.0.1", 12321), nullptr, [](error_code) {});
         }
@@ -106,7 +105,7 @@ TEST(rpc_holder, mock_rpc_call)
         auto &mail_box = t_rpc::mail_box();
 
         for (int i = 0; i < 10; i++) {
-            auto request = make_unique<configuration_query_by_index_request>();
+            auto request = make_unique<query_cfg_request>();
             t_rpc rpc(std::move(request), RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
             rpc.error() = ERR_BUSY;
             rpc.call(rpc_address("127.0.0.1", 12321), nullptr, [](error_code) {});
@@ -126,7 +125,7 @@ TEST(rpc_holder, mock_rpc_call)
         ASSERT_EQ(mail_box.size(), 0);
 
         for (int i = 0; i < 10; i++) {
-            auto request = make_unique<configuration_query_by_index_request>();
+            auto request = make_unique<query_cfg_request>();
             t_rpc rpc(std::move(request), RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
             rpc.call(rpc_address("127.0.0.1", 12321), nullptr, [](error_code) {});
         }
@@ -142,7 +141,7 @@ TEST(rpc_holder, mock_rpc_reply)
         auto &mail_box = t_rpc::mail_box();
 
         for (int i = 0; i < 10; i++) {
-            configuration_query_by_index_request request;
+            query_cfg_request request;
             request.app_name = "haha";
             auto msg = from_thrift_request_to_received_message(
                 request, RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
@@ -164,7 +163,7 @@ TEST(rpc_holder, mock_rpc_forward)
         rpc_address forward_addr("127.0.0.1", 10086);
 
         for (int i = 0; i < 10; i++) {
-            configuration_query_by_index_request request;
+            query_cfg_request request;
             auto msg = from_thrift_request_to_received_message(
                 request, RPC_CM_QUERY_PARTITION_CONFIG_BY_INDEX);
             auto rpc = t_rpc::auto_reply(msg);
diff --git a/src/runtime/test/rpc_message.cpp b/src/runtime/test/rpc_message.cpp
index 9e8f00699..555a18d3d 100644
--- a/src/runtime/test/rpc_message.cpp
+++ b/src/runtime/test/rpc_message.cpp
@@ -188,7 +188,7 @@ TEST(core, message_ex)
 TEST(rpc_message, restore_read)
 {
     using namespace dsn;
-    configuration_query_by_index_request request, result;
+    query_cfg_request request, result;
     message_ptr msg = from_thrift_request_to_received_message(request, RPC_CODE_FOR_TEST);
     for (int i = 0; i < 10; i++) {
         unmarshall(msg, result);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org