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

Rename transactionv2 to transaction #1424

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

kshlm
Copy link
Member

@kshlm kshlm commented Dec 18, 2018

This commit does 3 things,

  1. Move required types and functions from the old transaction package to
    the transactionv2 package.
  2. Remove the old transaction package.
  3. Rename the transactionv2 package to transaction

@ghost ghost assigned kshlm Dec 18, 2018
@ghost ghost added the in progress label Dec 18, 2018
@Madhu-1
Copy link
Member

Madhu-1 commented Dec 18, 2018

21:05:04 --- FAIL: TestBitrot (18.01s)
21:05:04 --- FAIL: TestBitrot/Replica-volume (1.10s)
21:05:04 require.go:765:
21:05:04 Error Trace: bitrot_test.go:138
21:05:04 bitrot_test.go:69
21:05:04 utils_test.go:33
21:05:04 Error: Expected nil, but got: &errors.errorString{s:"strconv.Atoi: parsing "": invalid syntax"}
21:05:04 Test: TestBitrot/Replica-volume
21:05:04 --- FAIL: TestBitrot/Dist-volume (0.76s)
21:05:04 require.go:765:
21:05:04 Error Trace: bitrot_test.go:138
21:05:04 bitrot_test.go:110
21:05:04 utils_test.go:33
21:05:04 Error: Expected nil, but got: &errors.errorString{s:"dial unix /tmp/gd2_func_test/TestBitrot/w2/run/gluster/scrub-9b92170c67980722.socket: connect: connection refused"}
21:05:04 Test: TestBitrot/Dist-volume
21:05:04 === RUN TestBrickMux
21:05:14 --- FAIL: TestBrickMux (9.94s)
21:05:14 require.go:765:
21:05:14 Error Trace: brickmux_test.go:122
21:05:14 Error: Expected nil, but got: &errors.errorString{s:"os: process not initialized"}
21:05:14 Test: TestBrickMux
21:05:14 Messages: failed to kill bricks: os: process not initialized

@kshlm CI failure

@@ -139,7 +137,7 @@ func (c *Tctx) Commit() error {
return err
}

expTxn.Add("txn_ctx_store_commit", 1)
//expTxn.Add("txn_ctx_store_commit", 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

@@ -208,7 +206,7 @@ func (c *Tctx) Delete(key string) error {
"failed to delete key")
return err
}
expTxn.Add("txn_ctx_store_delete", 1)
//expTxn.Add("txn_ctx_store_delete", 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Nodes []uuid.UUID
OrigCtx context.Context
Nodes []uuid.UUID `json:"nodes"`
StorePrefix string `json:"store_prefix"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

json value should not contain _, use - store_prefix to store-prefix

StartTime time.Time `json:"start_time"`

success chan struct{}
error chan error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error is a package name, can we rename this variable name to something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error here is a member of the Txn struct, and doesn't affect the error name in the global namespace.

t.Ctx.Logger().Debug("new transaction created")
return t
}

// NewTxnWithLocks returns an empty Txn with locks obtained on given lockIDs
func NewTxnWithLocks(ctx context.Context, lockIDs ...string) (*Txn, error) {
t := NewTxn(ctx)
t.Locks = lockIDs
return t, nil
Copy link
Member

@Madhu-1 Madhu-1 Dec 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we discard returning error from this function?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Madhu-1 then we have to make changes in all files where this function has been called. Maybe we can take this up later.

}

expTxn.Add("initiated_txn_in_progress", -1)
}

func (t *Txn) checkAlive() error {
Copy link

@oshankkumar oshankkumar Dec 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please move nodes union logic from checkAlive() to txn.Do()

if len(t.Nodes) == 0 {
		for _, s := range t.Steps {
			t.Nodes = append(t.Nodes, s.Nodes...)
		}
	}
	t.Nodes = nodesUnion(t.Nodes)

In case if some user set txn.DontCheckAlive as true, and don't provide the Nodes information in Txn Object then we need nodes union logic before starting the transaction to fill the Nodes info in Txn object.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

due to this only some e2e tests are failing

@kshlm
Copy link
Member Author

kshlm commented Dec 20, 2018

3 tests keep failing.

  1. TestBitrot/Replica-volume
  2. TestBitrot/Dist-volume
  3. TestSnapshot/StatusAndForceActivate

TestBitrot/Replica-volume fails because the RPC done to the scrub daemon to fetch status, returns
an empty dict. Even though the RPC is successful. I'm not sure why this happens yet.

TestBitrot/Dist-volume fails as the scrub daemon isn't running. GD2 isn't able to connect to the daemon to send the status request.

These two tests switch the failures depending on the order they run. The first test always fails because of empty dict, and the second fails because of failure to connect.

The Snapshot test fetches a list of snapshots, and the list returned is empty. This causes a out-of-index panic later when the first item in the list is accessed. This happens even though the previous tests are successful and snapshots should be present.

What is surprising to me is that all of these pass without this PR. This PR essentially doesn't change anything about the execution of transaction steps. The steps should still continue to execute as before and should work. I need to look into this more to get to the cause.

@atinmu
Copy link
Contributor

atinmu commented Jan 7, 2019

retest this please

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants