Remove the reset service from the ledger api and the documentation [DPP-804] (#12472)

* Remove reset service from grpc and documentation [DPP-804]

CHANGELOG_BEGIN
Remove reset service from the ledger api protocol and the documentation
CHANGELOG_END

* remove reset service from two left-over places

* remove reset service from the protobuf structure test
This commit is contained in:
mziolekda 2022-01-19 14:46:50 +01:00 committed by GitHub
parent 4885e610e6
commit 82534f9155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 8 additions and 168 deletions

View File

@ -102,8 +102,6 @@ The following table summarizes what kind of claim is required to access each Led
+-------------------------------------+----------------------------+------------------------------------------+
| PruningService | All | admin |
+-------------------------------------+----------------------------+------------------------------------------+
| ResetService | All | admin |
+-------------------------------------+----------------------------+------------------------------------------+
| TimeService | GetTime | public |
| +----------------------------+------------------------------------------+
| | SetTime | admin |

View File

@ -292,9 +292,6 @@ The following gRPC status codes have changed for submission rejections in Sandbo
|INVALID_ARGUMENT |NOT_FOUND |PARTY_NOT_KNOWN_ON_LEDGER is now returned on transaction rejections on unallocated parties. |PARTY_NOT_KNOWN_ON_LEDGER |
+-----------------------------------+---------------------------------------+--------------------------------------------------------------------------------------------+----------------------------------------+
**NOTE**: Additionally, UNAVAILABLE is now returned when trying to reset the Sandbox server during an ongoing re-initialization (was FAILED_PRECONDITION).
Daml Sandbox and VMBC
======================================

View File

@ -45,7 +45,6 @@ all cases, the Ledger API exposes the same services:
- Testing services (on Sandbox only, *not* for production ledgers)
- Use the :ref:`time service <time-service>` to obtain the time as known by the ledger.
- Use the :ref:`reset service <reset-service>` to reset the ledger state, as a quicker alternative to restarting the whole ledger application.
For full information on the services see :doc:`/app-dev/services`.

View File

@ -262,17 +262,6 @@ Use the **time service** to obtain the time as known by the ledger server.
For full details, see :ref:`the proto documentation for the service <com.daml.ledger.api.v1.testing.TimeService>`.
.. _reset-service:
Reset service
=============
Use the **reset service** to reset the ledger state, as a quicker alternative to restarting the whole ledger application.
This resets all state in the ledger, *including the ledger ID*, so clients will have to re-fetch the ledger ID from the identity service after hitting this endpoint.
For full details, see :ref:`the proto documentation for the service <com.daml.ledger.api.v1.testing.ResetService>`.
Services diagram
****************

View File

@ -12,6 +12,5 @@ import DA.Ledger.Services.LedgerIdentityService as X
import DA.Ledger.Services.PackageManagementService as X
import DA.Ledger.Services.PartyManagementService as X
import DA.Ledger.Services.PackageService as X
import DA.Ledger.Services.ResetService as X
import DA.Ledger.Services.TimeService as X
import DA.Ledger.Services.TransactionService as X

View File

@ -1,22 +0,0 @@
-- Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module DA.Ledger.Services.ResetService (reset) where
import Com.Daml.Ledger.Api.V1.Testing.ResetService
import DA.Ledger.GrpcWrapUtils
import DA.Ledger.LedgerService
import DA.Ledger.Types
import Google.Protobuf.Empty
import Network.GRPC.HighLevel.Generated
reset :: LedgerId -> LedgerService ()
reset lid =
makeLedgerService $ \timeout config mdm -> do
withGRPCClient config $ \client -> do
service <- resetServiceClient client
let ResetService {resetServiceReset=rpc} = service
let request = ResetRequest (unLedgerId lid)
response <- rpc (ClientNormalRequest request timeout mdm)
Empty{} <- unwrap response
return ()

View File

@ -46,10 +46,6 @@ type SandboxTest = WithSandbox -> TestTree
sharedSandboxTests :: FilePath -> TestTree
sharedSandboxTests testDar = testGroupWithSandbox testDar Nothing "shared sandbox"
[ tGetLedgerIdentity
-- The reset service causes a bunch of issues so for now
-- we disable these tests.
-- , tReset
-- , tMultipleResets
, tListPackages
, tGetPackage
, tGetPackageBad
@ -103,24 +99,6 @@ tGetLedgerIdentity withSandbox = testCase "getLedgerIdentity" $ run withSandbox
lid <- getLedgerIdentity
liftIO $ assertEqual "ledger-id" lid (LedgerId "my-ledger-id")
{-
tReset :: SandboxTest
tReset withSandbox = testCase "reset" $ run withSandbox $ \_ _ -> do
lid1 <- getLedgerIdentity
Ledger.reset lid1
lid2 <- getLedgerIdentity
liftIO $ assertBool "lid1 /= lid2" (lid1 /= lid2)
tMultipleResets :: SandboxTest
tMultipleResets withSandbox = testCase "multipleResets" $ run withSandbox $ \_pid _testId -> do
let resetsCount = 20
lids <- forM [1 .. resetsCount] $ \_ -> do
lid <- getLedgerIdentity
Ledger.reset lid
pure lid
liftIO $ assertEqual "Ledger IDs are unique" resetsCount (Set.size $ Set.fromList lids)
-}
tListPackages :: SandboxTest
tListPackages withSandbox = testCase "listPackages" $ run withSandbox $ \DarMetadata{mainPackageId,manifest} _testId -> do
lid <- getLedgerIdentity
@ -682,14 +660,6 @@ makeSignedJwt' :: Secret -> TestId -> String
makeSignedJwt' secret tid =
makeSignedJwt (getSecret secret) [TL.unpack $ unParty $ p tid | p <- [alice, bob]]
-- resetSandbox :: Sandbox-> IO ()
-- resetSandbox sandbox = runWithSandbox sandbox $ do
-- lid <- getLedgerIdentity
-- Ledger.reset lid
-- lid2 <- getLedgerIdentity
-- unless (lid /= lid2) $ fail "resetSandbox: reset did not change the ledger-id"
----------------------------------------------------------------------
-- misc expectation combinators

View File

@ -141,11 +141,6 @@ filegroup(
visibility = ["//visibility:private"],
)
ledger_api_haskellpb_sources_testing = [
"ResetService.hs",
"TimeService.hs",
]
genrule(
name = "ledger-api-haskellpb-sources-testing",
srcs = [
@ -153,16 +148,15 @@ genrule(
"@go_googleapis//google/rpc:status.proto",
":ledger-api-protos-fg-testing",
],
outs = ["Com/Daml/Ledger/Api/V1/Testing/" + b for b in ledger_api_haskellpb_sources_testing],
outs = ["Com/Daml/Ledger/Api/V1/Testing/TimeService.hs"],
cmd = """
for src in $(locations :ledger-api-protos-fg-testing); do
$(location @proto3-suite//:compile-proto-file) \
--includeDir """ + google_protobuf_src + """ \
--includeDir """ + google_rpc_src + """ \
--includeDir """ + ledger_api_proto_source_root + """ \
--proto com/daml/ledger/api/v1/testing/$$(basename $$src) \
--out $(@D)
done
$(location @proto3-suite//:compile-proto-file) \
--includeDir """ + google_protobuf_src + """ \
--includeDir """ + google_rpc_src + """ \
--includeDir """ + ledger_api_proto_source_root + """ \
--proto com/daml/ledger/api/v1/testing/time_service.proto \
--out $$(dirname $$(dirname $$(dirname $$(dirname $$(dirname $$(dirname $(@D)))))))
#6x dirname because @D works differently for a single output
""",
tools = [
"@proto3-suite//:compile-proto-file",

View File

@ -1,50 +0,0 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package com.daml.ledger.api.v1.testing;
import "google/protobuf/empty.proto";
option java_outer_classname = "ResetServiceOuterClass";
option java_package = "com.daml.ledger.api.v1.testing";
option csharp_namespace = "Com.Daml.Ledger.Api.V1.Testing";
// Service to reset the ledger state. The goal here is to be able to reset the state in a way
// that's much faster compared to restarting the whole ledger application (be it a sandbox
// or the real ledger server).
//
// Note that *all* state present in the ledger implementation will be reset, most importantly
// including the ledger ID. This means that clients will have to re-fetch the ledger ID
// from the identity service after hitting this endpoint.
//
// The semantics are as follows:
//
// * When the reset service returns the reset is initiated, but not completed;
// * While the reset is performed, the ledger will not accept new requests. In fact we guarantee
// that ledger stops accepting new requests by the time the response to Reset is delivered;
// * In-flight requests might be aborted, we make no guarantees on when or how quickly this
// happens;
// * The ledger might be unavailable for a period of time before the reset is complete.
//
// Given the above, the recommended mode of operation for clients of the reset endpoint is to
// call it, then call the ledger identity endpoint in a retry loop that will tolerate a brief
// window when the ledger is down, and resume operation as soon as the new ledger ID is delivered.
//
// Note that this service will be available on the sandbox and might be available in some other testing
// environments, but will *never* be available in production.
service ResetService {
// Resets the ledger state. Note that loaded DARs won't be removed -- this only rolls back the
// ledger to genesis.
rpc Reset (ResetRequest) returns (google.protobuf.Empty);
}
message ResetRequest {
// Must correspond to the ledger ID reported by the Ledger Identification Service.
// Must be a valid LedgerString (as describe in ``value.proto``).
// Optional
string ledger_id = 1;
}

View File

@ -50,8 +50,6 @@ ledgerIdMismatch:
changeExplanation: "The ledger id from the request does match the participant's ledger id."
selfServiceErrorCodeId: LEDGER_ID_MISMATCH
services:
SandboxResetService:
- reset
TimeService:
- getTimeSource
- setTime

View File

@ -62,13 +62,3 @@ SandboxClassicRejections.#invalidLedgerTime:
services:
SandboxClassic.CommandCompletionService:
- CompletionStream
SandboxClassic.resetService:
change:
- FAILED_PRECONDITION
- UNAVAILABLE
changeExplanation: "UNAVAILABLE is now returned when trying to reset the Sandbox server during an ongoing re-initialization."
selfServiceErrorCodeId: SERVICE_NOT_RUNNING
services:
SandboxClassic:
- Reset

View File

@ -54,9 +54,6 @@ trait ServiceCallAuthTests
protected def expectInvalidArgument(f: Future[Any]): Future[Assertion] =
expectFailure(f, Status.Code.INVALID_ARGUMENT)
protected def expectUnimplemented(f: Future[Any]): Future[Assertion] =
expectFailure(f, Status.Code.UNIMPLEMENTED)
protected def expectFailure(f: Future[Any], code: Status.Code): Future[Assertion] =
f.failed.collect {
case GrpcException(GrpcStatus(`code`, _), _) => succeed

View File

@ -40,7 +40,6 @@ import com.daml.ledger.api.v1.ledger_identity_service.{
LedgerIdentityServiceGrpc,
}
import com.daml.ledger.api.v1.package_service.{ListPackagesRequest, PackageServiceGrpc}
import com.daml.ledger.api.v1.testing.reset_service.{ResetRequest, ResetServiceGrpc}
import com.daml.ledger.api.v1.testing.time_service.{GetTimeRequest, TimeServiceGrpc}
import com.daml.ledger.api.v1.transaction_service.{GetLedgerEndRequest, TransactionServiceGrpc}
import io.grpc
@ -85,15 +84,6 @@ class LegacyServiceIT
}
}
private def expectUnimplemented[A](block: => A): Assertion = {
inside(Try(block)) {
case Success(_) => fail()
case Failure(exc: StatusRuntimeException) =>
exc.getStatus.getCode shouldBe Status.Code.UNIMPLEMENTED
case Failure(otherwise) => fail(otherwise)
}
}
"Ledger API Server" should {
"offer com.digitalasset.ledger.api.v1.ActiveContractsService" in {
expectNotUnimplemented {
@ -159,14 +149,6 @@ class LegacyServiceIT
}
}
"offer com.digitalasset.ledger.api.v1.testing.ResetService" in {
expectUnimplemented {
val testingReset =
ResetServiceGrpc.blockingStub(channel).withInterceptors(legacyCallInterceptor)
testingReset.reset(ResetRequest(randomLedgerId))
}
}
"offer com.digitalasset.ledger.api.v1.testing.TimeService" in {
expectNotUnimplemented {
val testingTime =

View File

@ -55,7 +55,6 @@ com/daml/ledger/api/v1/ledger_configuration_service.proto
com/daml/ledger/api/v1/ledger_identity_service.proto
com/daml/ledger/api/v1/ledger_offset.proto
com/daml/ledger/api/v1/package_service.proto
com/daml/ledger/api/v1/testing/reset_service.proto
com/daml/ledger/api/v1/testing/time_service.proto
com/daml/ledger/api/v1/transaction.proto
com/daml/ledger/api/v1/transaction_filter.proto