Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Update transactions to use Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kshlm committed Dec 11, 2018
1 parent 11f0033 commit 4357e26
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions glusterd2/commands/snapshot/snapshot-activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions glusterd2/commands/snapshot/snapshot-clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions glusterd2/commands/snapshot/snapshot-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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,
},
}

Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/snapshot/snapshot-deactivate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/snapshot/snapshot-delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func snapshotDeleteHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "snap-delete.Store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/snapshot/snapshot-restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions glusterd2/commands/volumes/brick-replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ LOOP:
{
DoFunc: "brick-replace.ReplaceVolinfo",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-create.InitBricks",
Expand All @@ -175,6 +176,7 @@ LOOP:
DoFunc: "vol-create.StoreVolume",
UndoFunc: "vol-create.UndoStoreVolume",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
{
DoFunc: "vol-expand.NotifyClients",
Expand Down
4 changes: 3 additions & 1 deletion glusterd2/commands/volumes/volume-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,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",
Expand All @@ -189,6 +190,7 @@ func volumeCreateHandler(w http.ResponseWriter, r *http.Request) {
DoFunc: "vol-create.StoreVolume",
UndoFunc: "vol-create.UndoStoreVolume",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/volumes/volume-delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func volumeDeleteHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "vol-delete.Store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

Expand Down
4 changes: 4 additions & 0 deletions glusterd2/commands/volumes/volume-expand.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/volumes/volume-option.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,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",
Expand Down
2 changes: 2 additions & 0 deletions glusterd2/commands/volumes/volume-reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,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",
Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/volumes/volume-start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions glusterd2/commands/volumes/volume-stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions plugins/bitrot/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions plugins/georeplication/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
},
}

Expand Down Expand Up @@ -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,
},
}

Expand Down
2 changes: 2 additions & 0 deletions plugins/rebalance/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func rebalanceStartHandler(w http.ResponseWriter, r *http.Request) {
{
DoFunc: "rebalance-store",
Nodes: []uuid.UUID{gdctx.MyUUID},
Sync: true,
},
}

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

Expand Down

0 comments on commit 4357e26

Please sign in to comment.