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

Update transactions to use Sync

This commit is contained in:
Kaushal M
2018-12-11 16:24:12 +05:30
parent 744704d231
commit 5f889176c9
17 changed files with 35 additions and 1 deletions

View File

@@ -152,6 +152,7 @@ func snapshotActivateHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "snap-activate.StoreSnapshot",
UndoFunc: "snap-activate.UndoStoreSnapshot",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}
if err = txn.Do(); err != nil {

View File

@@ -322,6 +322,7 @@ func snapshotCloneHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "snap-clone.CreateCloneVolinfo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "snap-clone.TakeBrickSnapshots",
@@ -332,6 +333,7 @@ func snapshotCloneHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "snap-clone.StoreSnapshot",
UndoFunc: "snap-clone.UndoStoreSnapshotOnClone",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}
if err = txn.Ctx.Set("snapname", &snapname); err != nil {

View File

@@ -763,6 +763,7 @@ func snapshotCreateHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "snap-create.CreateSnapinfo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "snap-create.ActivateBarrier",
@@ -774,6 +775,8 @@ func snapshotCreateHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "snap-create.TakeBrickSnapshots",
UndoFunc: "snap-create.UndoBrickSnapshots",
Nodes: txn.Nodes,
// All bricks need to be barriered before taking a snapshot
Sync: true,
},
{
DoFunc: "snap-create.DeactivateBarrier",
@@ -784,6 +787,7 @@ func snapshotCreateHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "snap-create.StoreSnapshot",
UndoFunc: "snap-create.UndoStoreSnapshotOnCreate",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

View File

@@ -148,6 +148,7 @@ func snapshotDeactivateHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "snap-deactivate.StoreSnapshot",
UndoFunc: "snap-deactivate.UndoStoreSnapshot",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}
if err = txn.Ctx.Set("oldsnapinfo", &snapinfo); err != nil {

View File

@@ -161,6 +161,7 @@ func snapshotDeleteHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "snap-delete.Store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

View File

@@ -364,6 +364,7 @@ func snapshotRestoreHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "snap-restore.Store",
UndoFunc: "snap-restore.UndoStore",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "snap-restore.CleanBricks",

View File

@@ -161,6 +161,7 @@ LOOP:
{
DoFunc: "brick-replace.ReplaceVolinfo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-create.InitBricks",
@@ -175,6 +176,7 @@ LOOP:
DoFunc: "vol-create.StoreVolume",
UndoFunc: "vol-create.UndoStoreVolume",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-expand.NotifyClients",

View File

@@ -196,8 +196,9 @@ func volumeCreateHandler(w http.ResponseWriter, r *http.Request) {
},
{
DoFunc: "vol-create.ValidateBricks",
Sync: true,
Nodes: nodes,
// Need to wait for volinfo to be created first
Sync: true,
},
{
DoFunc: "vol-create.InitBricks",
@@ -208,6 +209,7 @@ func volumeCreateHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-create.StoreVolume",
UndoFunc: "vol-create.UndoStoreVolume",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

View File

@@ -81,6 +81,7 @@ func volumeDeleteHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "vol-delete.Store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

View File

@@ -176,6 +176,8 @@ func volumeExpandHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-expand.ValidateBricks",
Nodes: nodes,
Skip: lvmResizeOp,
// Need to wait for newly selected bricks to be set by the previous step
Sync: true,
},
{
DoFunc: "vol-expand.InitBricks",
@@ -193,11 +195,13 @@ func volumeExpandHandler(w http.ResponseWriter, r *http.Request) {
UndoFunc: "vol-create.UndoStoreVolume",
Nodes: []uuid.UUID{gdctx.MyUUID},
Skip: !lvmResizeOp,
Sync: true,
},
{
DoFunc: "vol-expand.UpdateVolinfo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Skip: lvmResizeOp,
Sync: true,
},
{
DoFunc: "vol-expand.GenerateBrickVolfiles",

View File

@@ -246,6 +246,7 @@ func volumeOptionsHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-option.UpdateVolinfo",
UndoFunc: "vol-option.UpdateVolinfo.Undo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-option.XlatorActionDoSet",

View File

@@ -167,11 +167,13 @@ func volumeResetHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-option.UpdateVolinfo",
UndoFunc: "vol-option.UpdateVolinfo.Undo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-option.GenerateBrickVolfiles",
UndoFunc: "vol-option.GenerateBrickvolfiles.Undo",
Nodes: volinfo.Nodes(),
Sync: true,
},
{
DoFunc: "vol-option.NotifyVolfileChange",

View File

@@ -171,6 +171,7 @@ func volumeStartHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-start.UpdateVolinfo",
UndoFunc: "vol-start.UpdateVolinfo.Undo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-start.XlatorActionDoVolumeStart",

View File

@@ -152,6 +152,7 @@ func volumeStopHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-stop.UpdateVolinfo",
UndoFunc: "vol-stop.UpdateVolinfo.Undo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-stop.XlatorActionDoVolumeStop",

View File

@@ -78,6 +78,8 @@ func bitrotEnableHandler(w http.ResponseWriter, r *http.Request) {
// Required because bitrot-stub should be enabled on brick side
DoFunc: "vol-option.NotifyVolfileChange",
Nodes: txn.Nodes,
// Volinfo needs to be updated before sending notifications
Sync: true,
},
{
DoFunc: "bitrot-enable.Commit",

View File

@@ -197,6 +197,8 @@ func georepCreateHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "vol-option.NotifyVolfileChange",
Nodes: txn.Nodes,
// Volinfo needs to be updated before sending notifications
Sync: true,
},
{
DoFunc: "georeplication-create.Commit",
@@ -786,6 +788,8 @@ func georepConfigSetHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "georeplication-configfilegen.Commit",
Nodes: txn.Nodes,
// Config needs to be set before config file can be generated
Sync: true,
},
}
@@ -919,6 +923,8 @@ func georepConfigResetHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "georeplication-configfilegen.Commit",
Nodes: txn.Nodes,
// Config needs to be set before config file can be generated
Sync: true,
},
}

View File

@@ -96,6 +96,7 @@ func rebalanceStartHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "rebalance-store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}
@@ -186,6 +187,7 @@ func rebalanceStopHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "rebalance-store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}