1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00

Tracing: Implement Undo step for trace enable transaction.

Implement the undo step for trace enable transaction. This
step removes the trace configuration from the store if
written.

closes #1368

Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
This commit is contained in:
Sridhar Seshasayee
2019-01-10 13:01:19 +05:30
committed by Madhu Rajanna
parent 76a5a9f928
commit fc9596d555
3 changed files with 11 additions and 4 deletions

View File

@@ -34,5 +34,6 @@ func (p *Plugin) RestRoutes() route.Routes {
func (p *Plugin) RegisterStepFuncs() {
transaction.RegisterStepFunc(txnTracingValidateConfig, "trace-mgmt.ValidateTraceConfig")
transaction.RegisterStepFunc(txnTracingStoreConfig, "trace-mgmt.StoreTraceConfig")
transaction.RegisterStepFunc(txnTracingDeleteStoreConfig, "trace-mgmt.UndoStoreTraceConfig")
transaction.RegisterStepFunc(txnTracingApplyNewConfig, "trace-mgmt.NotifyTraceConfigChange")
}

View File

@@ -60,10 +60,10 @@ func tracingEnableHandler(w http.ResponseWriter, r *http.Request) {
Nodes: []uuid.UUID{gdctx.MyUUID},
},
{
DoFunc: "trace-mgmt.StoreTraceConfig",
//UndoFunc: "trace-mgmt.UndoStoreTraceConfig",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
DoFunc: "trace-mgmt.StoreTraceConfig",
UndoFunc: "trace-mgmt.UndoStoreTraceConfig",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "trace-mgmt.NotifyTraceConfigChange",

View File

@@ -69,6 +69,12 @@ func txnTracingStoreConfig(c transaction.TxnCtx) error {
return nil
}
// Transaction step that reverts the trace config
func txnTracingDeleteStoreConfig(c transaction.TxnCtx) error {
err := traceutils.DeleteTraceConfig()
return err
}
// Tranasaction step that reads trace config info from the store and updates
// the in-memory trace config.
func txnTracingApplyNewConfig(c transaction.TxnCtx) error {