client-cpp icon indicating copy to clipboard operation
client-cpp copied to clipboard

cpp sdk txn.put run throw excetpion

Open xiezg opened this issue 4 years ago • 0 comments

OS: uname -a Linux x.x.x.x 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

`» config show all { "client-urls": "http://172.16.244.53:2379", "peer-urls": "http://172.16.244.53:2380", "advertise-client-urls": "http://172.16.244.53:2379", "advertise-peer-urls": "http://172.16.244.53:2380", "name": "pd1", "data-dir": "/home/zgxie/pd/bin/pd1", "force-new-cluster": false, "enable-grpc-gateway": true, "initial-cluster": "pd1=http://172.16.244.53:2380", "initial-cluster-state": "new", "initial-cluster-token": "pd-cluster", "join": "", "lease": 3, "log": { "level": "", "format": "text", "disable-timestamp": false, "file": { "filename": "", "max-size": 0, "max-days": 0, "max-backups": 0 }, "development": false, "disable-caller": false, "disable-stacktrace": false, "disable-error-verbose": true, "sampling": null }, "tso-save-interval": "3s", "tso-update-physical-interval": "50ms", "enable-local-tso": false, "metric": { "job": "pd1", "address": "", "interval": "15s" }, "schedule": { "max-snapshot-count": 3, "max-pending-peer-count": 16, "max-merge-region-size": 20, "max-merge-region-keys": 200000, "split-merge-interval": "1h0m0s", "enable-one-way-merge": "false", "enable-cross-table-merge": "true", "patrol-region-interval": "100ms", "max-store-down-time": "30m0s", "leader-schedule-limit": 4, "leader-schedule-policy": "count", "region-schedule-limit": 2048, "replica-schedule-limit": 64, "merge-schedule-limit": 8, "hot-region-schedule-limit": 4, "hot-region-cache-hits-threshold": 3, "store-limit": { "1": { "add-peer": 15, "remove-peer": 15 }, "4": { "add-peer": 15, "remove-peer": 15 } }, "tolerant-size-ratio": 0, "low-space-ratio": 0.8, "high-space-ratio": 0.7, "region-score-formula-version": "v2", "scheduler-max-waiting-operator": 5, "enable-remove-down-replica": "true", "enable-replace-offline-replica": "true", "enable-make-up-replica": "true", "enable-remove-extra-replica": "true", "enable-location-replacement": "true", "enable-debug-metrics": "false", "enable-joint-consensus": "true", "schedulers-v2": [ { "type": "balance-region", "args": null, "disable": false, "args-payload": "" }, { "type": "balance-leader", "args": null, "disable": false, "args-payload": "" }, { "type": "hot-region", "args": null, "disable": false, "args-payload": "" }, { "type": "label", "args": null, "disable": false, "args-payload": "" } ], "schedulers-payload": { "balance-hot-region-scheduler": null, "balance-leader-scheduler": { "name": "balance-leader-scheduler", "ranges": [ { "end-key": "", "start-key": "" } ] }, "balance-region-scheduler": { "name": "balance-region-scheduler", "ranges": [ { "end-key": "", "start-key": "" } ] }, "label-scheduler": { "name": "label-scheduler", "ranges": [ { "end-key": "", "start-key": "" } ] } }, "store-limit-mode": "manual" }, "replication": { "max-replicas": 3, "location-labels": "", "strictly-match-label": "false", "enable-placement-rules": "true", "isolation-level": "" }, "pd-server": { "use-region-storage": "true", "max-gap-reset-ts": "24h0m0s", "key-type": "table", "runtime-services": "", "metric-storage": "", "dashboard-address": "http://172.16.244.53:2379", "trace-region-flow": "true" }, "cluster-version": "5.1.0-alpha", "labels": {}, "quota-backend-bytes": "8GiB", "auto-compaction-mode": "periodic", "auto-compaction-retention-v2": "1h", "TickInterval": "500ms", "ElectionInterval": "3s", "PreVote": true, "security": { "cacert-path": "", "cert-path": "", "key-path": "", "cert-allowed-cn": null, "redact-info-log": false, "encryption": { "data-encryption-method": "plaintext", "data-key-rotation-period": "168h0m0s", "master-key": { "type": "plaintext", "key-id": "", "region": "", "endpoint": "", "path": "" } } }, "label-property": {}, "WarningMsgs": null, "DisableStrictReconfigCheck": false, "HeartbeatStreamBindInterval": "1m0s", "LeaderPriorityCheckInterval": "1m0s", "dashboard": { "tidb-cacert-path": "", "tidb-cert-path": "", "tidb-key-path": "", "public-path-prefix": "", "internal-proxy": false, "enable-telemetry": true, "enable-experimental": false }, "replication-mode": { "replication-mode": "majority", "dr-auto-sync": { "label-key": "", "primary": "", "dr": "", "primary-replicas": 0, "dr-replicas": 0, "wait-store-timeout": "1m0s", "wait-sync-timeout": "1m0s", "wait-async-timeout": "2m0s" } } }

» store { "count": 2, "stores": [ { "store": { "id": 1, "address": "172.16.244.53:20160", "version": "5.1.0-alpha", "status_address": "172.16.244.53:20180", "git_hash": "cd905a208293c2b0c1fca9aa2756d5c26392b38c", "start_timestamp": 1622467323, "deploy_path": "/home/zgxie/test_tikv", "last_heartbeat": 1622530962273867415, "state_name": "Up" }, "status": { "capacity": "492.1GiB", "available": "385.3GiB", "used_size": "336.3MiB", "leader_count": 35, "leader_weight": 1, "leader_score": 35, "leader_size": 3241, "region_count": 61, "region_weight": 1, "region_score": 9590.902448098743, "region_size": 5736, "start_ts": "2021-05-31T21:22:03+08:00", "last_heartbeat_ts": "2021-06-01T15:02:42.273867415+08:00", "uptime": "17h40m39.273867415s" } }, { "store": { "id": 4, "address": "172.16.244.142:20160", "version": "5.1.0-alpha", "status_address": "172.16.244.142:20180", "git_hash": "cd905a208293c2b0c1fca9aa2756d5c26392b38c", "start_timestamp": 1622467323, "deploy_path": "/home/zgxie/test_tikv", "last_heartbeat": 1622530960400607535, "state_name": "Up" }, "status": { "capacity": "492.1GiB", "available": "434.3GiB", "used_size": "320.4MiB", "leader_count": 26, "leader_weight": 1, "leader_score": 26, "leader_size": 2495, "region_count": 61, "region_weight": 1, "region_score": 9321.07932558792, "region_size": 5736, "start_ts": "2021-05-31T21:22:03+08:00", "last_heartbeat_ts": "2021-06-01T15:02:40.400607535+08:00", "uptime": "17h40m37.400607535s" } } ] }`

demo:

`void test_put( tikv_client::TransactionClient & client, int count ){

auto txn = client.begin();
for( int i=1;i<=count;i++){
    sprintf( keyName, "k%d", i );
    txn.put( keyName, keyValue );

    if(i%3000== 0){
        txn.commit();
        txn = client.begin();
    }
}

txn.commit();

}

int main( int argc, char **argv) {

tikv_client::TransactionClient client = tikv_client::TransactionClient({"172.16.244.53:2379"});
int count;
sscanf( argv[1], "%d", &count);
auto begin_tm = timeSinceEpochMillisec();
test_put( client, count );
auto end_tm = timeSinceEpochMillisec();
printf("time:%ld\n", end_tm- begin_tm);
return 0;

}`

result error: 1、terminate called after throwing an instance of 'rust::cxxbridge1::Error' what(): Failed to resolve lock 2、terminate called after throwing an instance of 'rust::cxxbridge1::Error' what(): Region error: Error { message: "raft entry is too large, region 2, entry size 21270018", not_leader: None, region_not_found: None, key_not_in_region: None, epoch_not_match: None, server_is_busy: None, stale_command: None, store_not_match: None, raft_entry_too_large: Some(RaftEntryTooLarge { region_id: 2, entry_size: 21270018 }), max_timestamp_not_synced: None, read_index_not_ready: None, proposal_in_merging_mode: None } 3、terminate called after throwing an instance of 'rust::cxxbridge1::Error' what(): gRPC error: RpcFailure: 4-DEADLINE_EXCEEDED Deadline Exceeded

xiezg avatar Jun 01 '21 07:06 xiezg