Repository navigation
feat(sharding): Wire OrphanDetector to DistributedCoordinator + complete Shard RPC Integration (v1.8.0, #202) - #4259
Conversation
…(v1.8.0, #202) Co-authored-by: makr-code <[email protected]>
|
@copilot Review und Code Audit. Wurden alle Aufgaben des Issue erfüllt? |
#202) Co-authored-by: makr-code <[email protected]>
Co-authored-by: makr-code <[email protected]>
Ja, alle Aufgaben des Issue sind erfüllt. Hier das vollständige Audit-Ergebnis: AC1 ✅ AC2 ✅ AC3 ✅ AC4 ✅ AC5 ✅ AC6 ✅ Performance-Targets ✅ Circuit-Breaker-Recovery-Default = 5 s ( Tests ✅ 15 Tests in CI ✅ Commit: |
Two roadmap items from Issue #202 delivered:
OrphanDetectornow queries theDistributedCoordinatorfor its authoritative in-flight transaction list, and the Shard RPC layer gains a formal retry policy, mTLS connection pool wiring, per-call metrics, and certificate-rotation drain.Description
OrphanDetector → DistributedCoordinator wiring (AC1–AC2)
OrphanDetector(Config, DistributedCoordinator*).detectOrphans()callscoordinator->listInFlightTransactions()when wired; falls back to the per-callCrossShardTransactionCoordinatorotherwise.isOrphaned()callscoordinator->getTransaction(txn_id)when wired.DistributedCoordinatorgainssetTransactionCoordinator(),listInFlightTransactions(),getTransaction()backed by a registeredCrossShardTransactionCoordinatorbehind ashared_mutex.Shard RPC Integration (AC3–AC6)
AC3 –
ShardRpcRetryPolicystruct (shard_rpc_client.h)isRetryableError()classifiesUNAVAILABLE/DEADLINE_EXCEEDEDas retryable andINVALID_ARGUMENT/ALREADY_EXISTSas non-retryable.AC4 – Connection pool wiring
ShardRPCClient::Configgainsconnection_pool(non-owningMTLSConnectionPoolManager*) andmax_pool_connections(default 50).GossipConfigManagerConfiggainsrpc_max_pool_connections(default 50) so the limit is gossip-propagated cluster-wide.AC5 – Per-call metrics instrumentation
OperationalMetrics::recordRpcCall(shard_id, method, outcome, latency_us)— delegates to existingrecordRequest().PrometheusMetrics::recordRpcCall(shard_id, method, outcome, latency_ms)— emitsthemis_cross_shard_rpc_calls_total{shard_id,method,outcome}counter andthemis_cross_shard_rpc_latency_seconds{shard_id,method}histogram.sendRequestGrpcandsendRequestInProcessrecord per-attempt latency and outcome (success/retryable_error/non_retryable_error).AC6 – Cert-rotation drain
MTLSConnectionPoolManager::onCertificateRotated()drains all idle connections so subsequent requests re-establish TLS with the new certificate; in-flight connections are not interrupted.Circuit-breaker recovery default confirmed at 5 s (
circuit_breaker_recovery_ms = 5000).Code Audit Result
A post-implementation code audit confirmed all 9 acceptance criteria are fulfilled:
listInFlightTransactions()wiredgetTransaction(txn_id)wiredShardRpcRetryPolicystruct + gRPC status classificationOperationalMetrics+PrometheusMetricsper-RPC labelsType of Change
Testing
test_orphan_detector_wired.cpp(15 tests, AC1–AC2) andtest_shard_rpc_integration.cpp(16 tests, AC3–AC6 + CB default)📚 Research & Knowledge (wenn applicable)
/docs/research/angelegt?/docs/research/implementation_influence/eingetragen?Relevante Quellen:
Checklist
Original prompt
This section details on the original issue you should resolve
<issue_title>
OrphanDetector: Wire toDistributedCoordinatorTransaction List</issue_title><issue_description>### Context
This issue implements the roadmap item '
OrphanDetector: Wire toDistributedCoordinatorTransaction List' for the sharding domain. It is sourced from the consolidated roadmap under 🟡 Medium Priority — Near-term (v1.5.0 – v1.8.0) and targets milestone v1.8.0.Primary detail section:
OrphanDetector: Wire toDistributedCoordinatorTransaction ListGoal
Deliver the scoped changes for
OrphanDetector: Wire toDistributedCoordinatorTransaction List in src/sharding/ and complete the linked detail section in a release-ready state for v1.8.0.Detailed Scope
OrphanDetector: Wire toDistributedCoordinatorTransaction ListPriority: Medium
Target Version: v1.8.0
orphan_detector.cpplines 50 and 67 have: "TODO: Access coordinator's transactions" and "TODO: Get transaction from coordinator". The orphan detector cannot inspect the coordinator's in-flight transaction list, making orphan detection non-functional.Implementation Notes:
[ ]InjectDistributedCoordinator*intoOrphanDetectorconstructor; callcoordinator->listInFlightTransactions()at line 50 to get the authoritative transaction list.[ ]At line 67: callcoordinator->getTransaction(txn_id)to fetch transaction metadata.Priority: High
Target Version: v0.9.0
Complete the RPC integration between
shard_rpc_client.cpp/shard_rpc_server.cppand the mTLS transport layer (mtls_client.cpp,mtls_connection_pool.cpp). Add automatic retry with exponential backoff and circuit-breaker integration (circuit_breaker.cpp) for all cross-shard RPC calls.Implementation Notes:
Shard RpcRetryPolicyinshard_rpc_client.cppusing the existingcircuit_breaker.cppinterface; classify gRPC status codes into retryable (UNAVAILABLE,DEADLINE_EXCEEDED) and non-retryable (INVALID_ARGUMENT,ALREADY_EXISTS).mtls_connection_pool.cppintoshard_rpc_client.cppto reuse TLS sessions; max pool size should be configurable viagossip_config_manager.cpp.operational_metrics.cppandprometheus_metrics.cppwith labels forshard_id,method, andoutcome.utils/pki_client.cppmust trigger a graceful connection drain inmtls_connection_pool.cppwithout dropping in-flight requests.Performance Targets:
Acceptance Criteria
DistributedCoordinator*intoOrphanDetectorconstructor; callcoordinator->listInFlightTransactions()at line 50 to get the authoritative transaction list.coordinator->getTransaction(txn_id)to fetch transaction metadata.Shard RpcRetryPolicyinshard_rpc_client.cppusing the existingcircuit_breaker.cppinterface; classify gRPC status codes into retryable (UNAVAILABLE,DEADLINE_EXCEEDED) and non-retryable (INVALID_ARGUMENT,ALREADY_EXISTS).mtls_connection_pool.cppintoshard_rpc_client.cppto reuse TLS sessions; max pool size should be configurable viagossip_config_manager.cpp.operational_metrics.cppandprometheus_metrics.cppwith labels forshard_id,method, andoutcome.utils/pki_client.cppmust trigger a graceful connection drain inmtls_connection_pool.cppwithout dropping in-flight requests.Relationships
References
Generated from the consolidated source roadmap. Keep the roadmap and issue in sync when scope changes.
</issue_de...
OrphanDetector: Wire toDistributedCoordinatorTransaction List #4033📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.