Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FAB-17039] Skip retrieving pvtdata from transient store if txid is empty #2183

Merged
merged 1 commit into from
Dec 8, 2020

Conversation

wenjianqiao
Copy link
Contributor

@wenjianqiao wenjianqiao commented Dec 2, 2020

Signed-off-by: Wenjian Qiao wenjianq@gmail.com

Type of change

  • Bug fix

Description

Skip calling fromTransientStore when txid is empty. This could happen for a reconciliation request.

Related issues

https://jira.hyperledger.org/browse/FAB-17039

@wenjianqiao wenjianqiao requested a review from a team as a code owner December 2, 2020 19:34
@wenjianqiao wenjianqiao changed the title [FAB-17039] Skip retrieving from transient store when txid is empty (reconciliation msg) [FAB-17039] Skip retrieving pvtdata from transient store for reconciliation requests Dec 3, 2020
results := make(Dig2PvtRWSetWithConfig)
for _, dig := range digests {
// skip retrieving from transient store for reconciliation requests
if isReconciliationRequest(dig) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Though this is correct that txID is not included in the case of reconciliation at the caller side, but drawing this conclusion at this function which the the sender side, breaks the principal of isolation. I find previous patch more suitable here that if caller does not supply txID (for whatever reason), skip looking in the transient store. We can certainly write a comment when this can happen but the caller code is free to change in general. For instance, caller is free not to send txID even in the case of commit path. In fact, commit path/ reconciliation terms are meaningful only at the caller side. This place is just getting asked for data either by txID, or by blockNum:TxNum (or both).

Also, having this if condition in a loop, may give someone a wrong impression that the requests for reconciliation and commit path gets combined on the caller side.

@ale-linux - second thought?

Copy link
Contributor

Choose a reason for hiding this comment

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

I trust your judgement since you certainly understand the pvtdata code better than I do. I just don't like these less-than-transparent conditions where the behaviour of a function is determined by special values of a field that otherwise plays a completely different role in the system (case in point, the txid's principal meaning is to avoid replay attacks and provide a unique handle to a transaction, and it is here used to determine whether data should be retrieved from storage).

These non-obvious relationships (here between txis(=uniquness) and behaviour of pvt data retrieval) tend to be quickly forgotten and make the code hard to maintain.

That said, if you believe this to be the right approach, I won't stand in the way.

gossip/privdata/dataretriever.go Outdated Show resolved Hide resolved
@wenjianqiao wenjianqiao changed the title [FAB-17039] Skip retrieving pvtdata from transient store for reconciliation requests [FAB-17039] Skip retrieving pvtdata from transient store if txid is empty Dec 7, 2020
… missing

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
@manish-sethi manish-sethi merged commit 72d5cc8 into hyperledger:master Dec 8, 2020
@lindluni
Copy link
Contributor

lindluni commented Dec 8, 2020

@Mergifyio backport release-2.3

@lindluni
Copy link
Contributor

lindluni commented Dec 8, 2020

@Mergifyio backport release-2.2

@mergify
Copy link

mergify bot commented Dec 8, 2020

Command backport release-2.3: success

Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 8, 2020
… missing (#2183)

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
(cherry picked from commit 72d5cc8)
@mergify
Copy link

mergify bot commented Dec 8, 2020

Command backport release-2.3: success

Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 8, 2020
… missing (#2183)

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
(cherry picked from commit 72d5cc8)
@mergify
Copy link

mergify bot commented Dec 8, 2020

Command backport release-2.2: success

Backports have been created

@mergify
Copy link

mergify bot commented Dec 8, 2020

Command backport release-2.2: success

Backports have been created

manish-sethi pushed a commit that referenced this pull request Dec 8, 2020
… missing (#2183) (#2201)

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
(cherry picked from commit 72d5cc8)

Co-authored-by: Wenjian Qiao <wenjianq@gmail.com>
wenjianqiao added a commit to wenjianqiao/fabric that referenced this pull request Dec 8, 2020
…when txid is missing (bp hyperledger#2183)

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
manish-sethi pushed a commit that referenced this pull request Dec 8, 2020
… missing (#2183) (#2200)

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
(cherry picked from commit 72d5cc8)

Co-authored-by: Wenjian Qiao <wenjianq@gmail.com>
manish-sethi pushed a commit that referenced this pull request Dec 9, 2020
…when txid is missing (bp #2183) (#2203)

Check if txid is available before retrieving private data from the transient store

Signed-off-by: Wenjian Qiao <wenjianq@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants