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
_lifecycle ignore previous build failure during install #1280
Conversation
/ci-run |
@@ -675,6 +675,9 @@ func (ef *ExternalFunctions) InstallChaincode(chaincodeInstallPackage []byte) (* | |||
} | |||
|
|||
buildStatus, ok := ef.BuildRegistry.BuildStatus(packageID) | |||
if buildStatus != nil && (buildStatus.Err() != nil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is racey. What if the chaincode is currently being built, and fails? Until the done channel closes, we don't know whether the result of buildStatus.Err() is error free or simply uninitialized.
We need to wait until after the build has completed, (line 682/685)
Then, if we were not the ones who initiated the build (ie ok
) and the build failed (ie Err() != nil
). Then we should reset and rebuild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still seems racey to me. If the buildStatus is non-nil, it could be that the build is still ongoing, and may yet fail, so it is not safe to read from Err() yet. We must wait until the done channel closes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the build lock by package id prevent that? We make sure that only one chaincode per package id can be built at a given time. The first caller may have a build running but they hold the buildLock. Once the buildLock is unlocked by the first caller, the second caller grabs the lock, gets the build status, and continues from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you're saying. Since we are in the new lifecycle, there should not be other competing threads trying to race to build the chaincode, other than ourselves.
Still, I think this isn't quite right. buildStatus
is never nil. So checking for non-nil is redundant. I guess I would do:
if !ok {
// Another invocation of lifecycle has concurrently installed this same package-id
<-buildStatus.Done() // this should always already be closed
if buildStatus.Err() == nil {
return nil, errors.Errorf("chaincode already successfully installed")
}
buildStatus, _ = ef.BuildRegistry.ResetBuildStatus(packageID)
}
@@ -385,21 +385,16 @@ var _ = Describe("ExternalFunctions", func() { | |||
}) | |||
}) | |||
|
|||
When("the chaincode is already being built", func() { | |||
When("the chaincode build previously failed", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have thought to leave this case the same, but split it into two scenarios, one where it does not attempt to build because the previous build was successful, and another where the previous build failed and it does.
core/container/build_registry.go
Outdated
@@ -35,6 +35,19 @@ func (br *BuildRegistry) BuildStatus(ccid string) (*BuildStatus, bool) { | |||
return bs, ok | |||
} | |||
|
|||
// ResetBuildStatus returns a new BuildStatus for the ccid, and false, | |||
// indicating that this build status is their responsibility. The caller | |||
// must call Notify with the error (or nil) upon completion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably note that it's the caller's responsibility to ensure that ResetBuildStatus
is only called when an existing build status is done. This means that the caller must use external locking to ensure that the build status is not reset between the check that the status is done, and when the build status is reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I updated the comment.
I added locking per package ID, as requested, to protect against concurrent install of the same chaincode. I'm not sure I love where everything lives/is initialized (particularly the BuildLocks map) but this is at least closer. |
d4cb97d
to
c3e5e37
Compare
@@ -675,6 +675,9 @@ func (ef *ExternalFunctions) InstallChaincode(chaincodeInstallPackage []byte) (* | |||
} | |||
|
|||
buildStatus, ok := ef.BuildRegistry.BuildStatus(packageID) | |||
if buildStatus != nil && (buildStatus.Err() != nil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still seems racey to me. If the buildStatus is non-nil, it could be that the build is still ongoing, and may yet fail, so it is not safe to read from Err() yet. We must wait until the done channel closes.
core/container/build_registry.go
Outdated
bs := NewBuildStatus() | ||
br.builds[ccid] = bs | ||
|
||
return bs, false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why return a constant false here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To incorporate resetting the status into the existing flow.
We get the build status, if ok (aka build status already exists), we then check for an error and reset the build status. We then continue to the existing logic of: if not ok, build the chaincode (which is also still applicable for the initial install/build of a chaincode).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not satisfying an interface, which I don't think it is, I can't think of a good reason to return a parameter which is a fixed constant, and has no obvious way to ever change. Essentially, we are modifying the signature of a function in another package in a non-obvious way in order to make the code look simpler, which doesn't sit well with me.
If you really want to integrate it into the existing flow, you can always do something like:
buildStatus, ok = br.ResetBuildStatus(), false
Though I'd think it would be more readable over two lines. [edit: or, looking at that logic, I think it's simpler to ignore the 'ok' variable, as its only possible value is false when it's next checked anyway]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -675,6 +675,9 @@ func (ef *ExternalFunctions) InstallChaincode(chaincodeInstallPackage []byte) (* | |||
} | |||
|
|||
buildStatus, ok := ef.BuildRegistry.BuildStatus(packageID) | |||
if buildStatus != nil && (buildStatus.Err() != nil) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you're saying. Since we are in the new lifecycle, there should not be other competing threads trying to race to build the chaincode, other than ourselves.
Still, I think this isn't quite right. buildStatus
is never nil. So checking for non-nil is redundant. I guess I would do:
if !ok {
// Another invocation of lifecycle has concurrently installed this same package-id
<-buildStatus.Done() // this should always already be closed
if buildStatus.Err() == nil {
return nil, errors.Errorf("chaincode already successfully installed")
}
buildStatus, _ = ef.BuildRegistry.ResetBuildStatus(packageID)
}
Let me know how it looks now. I took your most recent comment and incorporated it based on what I think you meant to type for some parts of the code. |
This current implementation breaks some of the existing integration tests, which rely on the DeployChaincode helper function and the fact that attempting to reinstall a chaincode that succeeded previously didn't return an error. If we think this is the correct behavior (which does match the LSCC functionality), I can update the integration tests to not install while updating the chaincode definition. We could also not return an error when a previous chaincode install succeeded. |
Actually, the easier "fix" (which I believe is still valid) for my previous comment about the integration tests was to simply not check the exit status on install. If the chaincode has not been successfully installed when expected to, the EnsureInstalled call which catch that condition and fail accordingly. |
core/container/build_registry.go
Outdated
bs := NewBuildStatus() | ||
br.builds[ccid] = bs | ||
|
||
return bs, false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not satisfying an interface, which I don't think it is, I can't think of a good reason to return a parameter which is a fixed constant, and has no obvious way to ever change. Essentially, we are modifying the signature of a function in another package in a non-obvious way in order to make the code look simpler, which doesn't sit well with me.
If you really want to integrate it into the existing flow, you can always do something like:
buildStatus, ok = br.ResetBuildStatus(), false
Though I'd think it would be more readable over two lines. [edit: or, looking at that logic, I think it's simpler to ignore the 'ok' variable, as its only possible value is false when it's next checked anyway]
return nil, errors.New("chaincode already successfully installed") | ||
} | ||
buildStatus, ok = ef.BuildRegistry.ResetBuildStatus(packageID) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why check ok here? Either, the previous ok was false, or, we just set ok to be false, since we didn't return, and ResetBuildStatus always returns false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent point. I've been looking at some of this too much and it was hard to take a step back. Fixed.
func (ef *ExternalFunctions) getBuildLock(packageID string) *sync.Mutex { | ||
ef.mutex.Lock() | ||
defer ef.mutex.Unlock() | ||
buildLock, ok := ef.BuildLocks[packageID] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you, but you could do lazy map initialization here:
if ef.BuildLocks == nil {
ef.BuildLocks = map[string]sync.Mutex{}
}
then you could skip the initialization elsewhere, but, not a requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered this but I wasn't entirely sure if it was a good practice or not. I definitely prefer this over the random empty map initialization all the way out in peer/node/start. Done.
When a chaincode build previously failed while installing the chaincode, _lifecycle should ignore the cached error and attempt to rebuild the chaincode. This is because we should assume the end user knows something about why the build may succeed on retry if they're reattempting an install. Also, update integration tests to not care about exit status of chaincode installs (since reinstalls now error). FAB-17907 Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes!
* Address more concerns highlighted by linters These changes remove dead code, add error checks, and use assign unused variables to the unnamed variable `_`. Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com> * Fixed write_first_app.rst typo Signed-off-by: pratikpatil024 <pratikspatil024@gmail.com> * FAB-17840 Ch.Part.API: Join channel REST handler (hyperledger#1305) * FAB-17840 Ch.Part.API: Join channel REST handler Implement a handler for a POST request to join a channel. Here we support requests carrying application/json, support for additional Content-Type will be added later. Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I8d09e3cba09842f2adc47fb60161eee814e33d31 * Review: simplify code Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: Iee1e8b66cb77f64b9762dee8f85304958081e0fe * Review comments: simplify code - extract error handling to separate method - extract channelID extraction to separate method, reuse - test Accept header allowed range - better comments Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I11639a3f159694019e521e180e7fd5fadb42cb4f * Review comments: support for multipart/form-data Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: Ic5a0307f56be5561f45910a02892dc7e7b9554d1 * Review comments: remove support for application/json Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I38bb3564a0e6482b7bf9dca25bd8424e6db2ac95 * Spelling: s/chainocde/chaincode/g Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Retire dormant Fabric maintainers Retire maintainers that have been inactive for the last 3 months: Jonathan Levi Srinivasan Muralidharan Note: "A maintainer removed for inactivity should be restored following a sustained resumption of contributions and reviews (a month or more) demonstrating a renewed commitment to the project." Signed-off-by: David Enyeart <enyeart@us.ibm.com> * add NOTICE file recommended per ASF and LF policy Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * Add NOTICE to license ignore list Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * Fix some typo in docs This CR fixes the following some typo in docs. - chainocode -> chaincode - chainode -> chaincode - lifecyle -> lifecycle - Hyperlegder -> Hyperledger - chanel -> channel - scructured -> structured - demostrate -> demonstrate - certficates -> certificates - how how -> how - the the -> the - a a -> a - thefollowing -> the following Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> * Remove txmgr interface This commit removes the interface TxMgr, as there is a single implementation (i.e., LockbasedTxmgr). All the dependent packages are able to use this single implementation directly. The only exception is the validation package that causes a circular dependency. the validation package uses only a single function from this interface (NewTxSimulator). The validation package uses this function for getting accessing to the TxSimulator, in order to allow for the execution a post-order transaction (only channel config transaction in the current code). For meeting this need, this commit now defines a local interface with a single function in the validation package itself. Signed-off-by: manish <manish.sethi@gmail.com> * FAB-17841: Ch.Part.API: Remove channel REST handler (hyperledger#1330) Handle DELETE request to remove a channel. - Resolve the removeStorage flag from config & query. - If system-channel exists - reject with StatusMethodNotAllowed and Allow header set to GET. - If channel does not exist - reject with StatusNotFound. - If successs - respond with StatusNoContent. Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I78581df3c7f0cb99007edddc83eb7a6dca5eba07 * Update commercial paper doc to use enrollUser.js Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com> * Use protolator from fabric-config Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Revert "Bump viper version to the last working commit" This reverts commit 5ad0a4f. Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * _lifecycle ignore previous build failure during install (hyperledger#1280) When a chaincode build previously failed while installing the chaincode, _lifecycle should ignore the cached error and attempt to rebuild the chaincode. This is because we should assume the end user knows something about why the build may succeed on retry if they're reattempting an install. Also, update integration tests to not care about exit status of chaincode installs (since reinstalls now error). FAB-17907 Signed-off-by: Will Lahti <wtlahti@us.ibm.com> * [FAB-17927] Add AllChaincodesInfo to DeployedChaincodeInfoProvider (hyperledger#1331) Implement AllChaincodesInfo to query ledger and return chaincode info for all the deployed chaincode (both new lifecycle and legacy chaincodes) on a channel. This function is needed for ledger checkpointing and deletion of channel-specific databases in statecouchdb. Signed-off-by: Wenjian Qiao <wenjianq@gmail.com> Co-authored-by: Matthew Sykes <sykesmat@us.ibm.com> Co-authored-by: pratikpatil024 <pratikspatil024@gmail.com> Co-authored-by: Yoav Tock <tock@il.ibm.com> Co-authored-by: Matthew Sykes <matthew.sykes@gmail.com> Co-authored-by: David Enyeart <enyeart@us.ibm.com> Co-authored-by: Christopher Ferris <chrisfer@us.ibm.com> Co-authored-by: Brett Logan <brett.t.logan@ibm.com> Co-authored-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> Co-authored-by: manish <manish.sethi@gmail.com> Co-authored-by: NIKHIL E GUPTA <negupta@us.ibm.com> Co-authored-by: Will Lahti <wtlahti@us.ibm.com> Co-authored-by: Wenjian Qiao <wenjianq@gmail.com>
* Address more concerns highlighted by linters These changes remove dead code, add error checks, and use assign unused variables to the unnamed variable `_`. Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com> * Fixed write_first_app.rst typo Signed-off-by: pratikpatil024 <pratikspatil024@gmail.com> * FAB-17840 Ch.Part.API: Join channel REST handler (hyperledger#1305) * FAB-17840 Ch.Part.API: Join channel REST handler Implement a handler for a POST request to join a channel. Here we support requests carrying application/json, support for additional Content-Type will be added later. Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I8d09e3cba09842f2adc47fb60161eee814e33d31 * Review: simplify code Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: Iee1e8b66cb77f64b9762dee8f85304958081e0fe * Review comments: simplify code - extract error handling to separate method - extract channelID extraction to separate method, reuse - test Accept header allowed range - better comments Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I11639a3f159694019e521e180e7fd5fadb42cb4f * Review comments: support for multipart/form-data Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: Ic5a0307f56be5561f45910a02892dc7e7b9554d1 * Review comments: remove support for application/json Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I38bb3564a0e6482b7bf9dca25bd8424e6db2ac95 * Spelling: s/chainocde/chaincode/g Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Retire dormant Fabric maintainers Retire maintainers that have been inactive for the last 3 months: Jonathan Levi Srinivasan Muralidharan Note: "A maintainer removed for inactivity should be restored following a sustained resumption of contributions and reviews (a month or more) demonstrating a renewed commitment to the project." Signed-off-by: David Enyeart <enyeart@us.ibm.com> * add NOTICE file recommended per ASF and LF policy Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * Add NOTICE to license ignore list Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * Fix some typo in docs This CR fixes the following some typo in docs. - chainocode -> chaincode - chainode -> chaincode - lifecyle -> lifecycle - Hyperlegder -> Hyperledger - chanel -> channel - scructured -> structured - demostrate -> demonstrate - certficates -> certificates - how how -> how - the the -> the - a a -> a - thefollowing -> the following Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> * Remove txmgr interface This commit removes the interface TxMgr, as there is a single implementation (i.e., LockbasedTxmgr). All the dependent packages are able to use this single implementation directly. The only exception is the validation package that causes a circular dependency. the validation package uses only a single function from this interface (NewTxSimulator). The validation package uses this function for getting accessing to the TxSimulator, in order to allow for the execution a post-order transaction (only channel config transaction in the current code). For meeting this need, this commit now defines a local interface with a single function in the validation package itself. Signed-off-by: manish <manish.sethi@gmail.com> * FAB-17841: Ch.Part.API: Remove channel REST handler (hyperledger#1330) Handle DELETE request to remove a channel. - Resolve the removeStorage flag from config & query. - If system-channel exists - reject with StatusMethodNotAllowed and Allow header set to GET. - If channel does not exist - reject with StatusNotFound. - If successs - respond with StatusNoContent. Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I78581df3c7f0cb99007edddc83eb7a6dca5eba07 * Update commercial paper doc to use enrollUser.js Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com> * Use protolator from fabric-config Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Revert "Bump viper version to the last working commit" This reverts commit 5ad0a4f. Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * _lifecycle ignore previous build failure during install (hyperledger#1280) When a chaincode build previously failed while installing the chaincode, _lifecycle should ignore the cached error and attempt to rebuild the chaincode. This is because we should assume the end user knows something about why the build may succeed on retry if they're reattempting an install. Also, update integration tests to not care about exit status of chaincode installs (since reinstalls now error). FAB-17907 Signed-off-by: Will Lahti <wtlahti@us.ibm.com> * [FAB-17927] Add AllChaincodesInfo to DeployedChaincodeInfoProvider (hyperledger#1331) Implement AllChaincodesInfo to query ledger and return chaincode info for all the deployed chaincode (both new lifecycle and legacy chaincodes) on a channel. This function is needed for ledger checkpointing and deletion of channel-specific databases in statecouchdb. Signed-off-by: Wenjian Qiao <wenjianq@gmail.com> * [FAB-17471] Fix OrdererType key to correct line SampleInsecureKafka profile tries to change consensus type to kafka using OrdererType. But it was written in the line above "<<: *OrdererDefaults". That causes the overwrite consensus type again. This CR moves OrdererType to the correct line. As a result, this CR can generate the correct ordererer type's genesis block. Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> * [FAB-17059] Add missing mspID when init MembershipProvider. Signed-off-by: Hongbin Mao <hello2mao@gmail.com> * fsync and do not generate empty files in snapshots (hyperledger#1345) This commit fixes following issues - Perform sync on the snapshot files - Does not generate empty files - Use filepath instead of path package Signed-off-by: manish <manish.sethi@gmail.com> * fix infinite loop during full range query (hyperledger#1347) We use a single scanner for achieving both paginated and non-paginated range query. We have internalQueryLimit and pageSize. For each _all_docs?startKey="XXX"&endKey="YYY" REST API call to CouchDB, we fetch atmost internalQueryLimit number of records only by appending limit=internalQueryLimit. When the requested pageSize is higher than the internalQueryLimit or the total number of records present in the given range is higher than the internalQueryLimit, iterator would execute the query again once the records fetched in the first cycle is consumed and so on. In order to do that, after an execution of the REST API in each cycle, it updates the initially passed startKey to the nextStartKey. If there is no nextStartKey, it is set to the endKey. Currently, when the nextStartKey and the endKey are the same, we still run one REST API call which is actually not needed as we always set inclusive_end=false. However, this causes infinite loop in a particular case. When we want to retrieve all the records, we would pass an empty string as the startKey and the endKey. When the startKey is an empty string, the REST API call would become _all_docs?endKey="YYY". When both are empty, it would become _all_docs Given that we set startKey to endKey when there is no nextStartKey and still execute one REST API call, it gets into infinite loop by fetching all records again and again. We avovid this infinite loop by setting scanner.exhausted = true whe the startKey and endKey become the same when there is no nextStartKey Signed-off-by: senthil <cendhu@gmail.com> * Remove unnecessary extension of osn (hyperledger#1351) In the integration test touched by this patch, cert file is read to remove and add node. It can be easily achieved by reading file bytes directly, without extending network to grab intermediate object. Signed-off-by: Jay Guo <guojiannan1101@gmail.com> * [FAB-17935] Change unnecessary warning log line to debug in gossip (hyperledger#1350) privdata Signed-off-by: Danny Cao <dcao@us.ibm.com> * [FAB-17900] Update BCCSP.PKCS11.Pin in examples - The Pin value must be quoted when specified in the yaml Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com> * [FAB-17900] Fixes numeric env variable override bug Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com> * Remove s390x, powerpc64le from RELEASE_PLATFORMS - Release automation only creates amd64 binaries for darwin, linux, and windows. - Continuous integration no longer runs on powerpc64le or s390x Also remove stale build tags related to plugins and race detection for old versions of go, s390x, and ppc64le. Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com> * Backfill test for BCCSP environment overrides... ... and consistently use SW as the key for `SwOpts` in the configuration structures. Right now tags for mapstructure and JSON do not match the tags for YAML yet our sample configuration documents (in YAML) use `SW`. Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Updates in master for v2.1.1 release Update master doc and bootstrap script for v2.1.1 release. Signed-off-by: David Enyeart <enyeart@us.ibm.com> Co-authored-by: Matthew Sykes <sykesmat@us.ibm.com> Co-authored-by: pratikpatil024 <pratikspatil024@gmail.com> Co-authored-by: Yoav Tock <tock@il.ibm.com> Co-authored-by: Matthew Sykes <matthew.sykes@gmail.com> Co-authored-by: David Enyeart <enyeart@us.ibm.com> Co-authored-by: Christopher Ferris <chrisfer@us.ibm.com> Co-authored-by: Brett Logan <brett.t.logan@ibm.com> Co-authored-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> Co-authored-by: manish <manish.sethi@gmail.com> Co-authored-by: NIKHIL E GUPTA <negupta@us.ibm.com> Co-authored-by: Will Lahti <wtlahti@us.ibm.com> Co-authored-by: Wenjian Qiao <wenjianq@gmail.com> Co-authored-by: Hongbin Mao <hello2mao@gmail.com> Co-authored-by: Senthil Nathan N <cendhu@users.noreply.github.com> Co-authored-by: Jay Guo <guojiannan1101@gmail.com> Co-authored-by: Danny Cao <dcao@us.ibm.com> Co-authored-by: Tiffany Harris <tiffany.harris@ibm.com>
* Address more concerns highlighted by linters These changes remove dead code, add error checks, and use assign unused variables to the unnamed variable `_`. Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com> * Fixed write_first_app.rst typo Signed-off-by: pratikpatil024 <pratikspatil024@gmail.com> * FAB-17840 Ch.Part.API: Join channel REST handler (hyperledger#1305) * FAB-17840 Ch.Part.API: Join channel REST handler Implement a handler for a POST request to join a channel. Here we support requests carrying application/json, support for additional Content-Type will be added later. Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I8d09e3cba09842f2adc47fb60161eee814e33d31 * Review: simplify code Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: Iee1e8b66cb77f64b9762dee8f85304958081e0fe * Review comments: simplify code - extract error handling to separate method - extract channelID extraction to separate method, reuse - test Accept header allowed range - better comments Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I11639a3f159694019e521e180e7fd5fadb42cb4f * Review comments: support for multipart/form-data Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: Ic5a0307f56be5561f45910a02892dc7e7b9554d1 * Review comments: remove support for application/json Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I38bb3564a0e6482b7bf9dca25bd8424e6db2ac95 * Spelling: s/chainocde/chaincode/g Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Retire dormant Fabric maintainers Retire maintainers that have been inactive for the last 3 months: Jonathan Levi Srinivasan Muralidharan Note: "A maintainer removed for inactivity should be restored following a sustained resumption of contributions and reviews (a month or more) demonstrating a renewed commitment to the project." Signed-off-by: David Enyeart <enyeart@us.ibm.com> * add NOTICE file recommended per ASF and LF policy Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * Add NOTICE to license ignore list Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * Fix some typo in docs This CR fixes the following some typo in docs. - chainocode -> chaincode - chainode -> chaincode - lifecyle -> lifecycle - Hyperlegder -> Hyperledger - chanel -> channel - scructured -> structured - demostrate -> demonstrate - certficates -> certificates - how how -> how - the the -> the - a a -> a - thefollowing -> the following Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> * Remove txmgr interface This commit removes the interface TxMgr, as there is a single implementation (i.e., LockbasedTxmgr). All the dependent packages are able to use this single implementation directly. The only exception is the validation package that causes a circular dependency. the validation package uses only a single function from this interface (NewTxSimulator). The validation package uses this function for getting accessing to the TxSimulator, in order to allow for the execution a post-order transaction (only channel config transaction in the current code). For meeting this need, this commit now defines a local interface with a single function in the validation package itself. Signed-off-by: manish <manish.sethi@gmail.com> * FAB-17841: Ch.Part.API: Remove channel REST handler (hyperledger#1330) Handle DELETE request to remove a channel. - Resolve the removeStorage flag from config & query. - If system-channel exists - reject with StatusMethodNotAllowed and Allow header set to GET. - If channel does not exist - reject with StatusNotFound. - If successs - respond with StatusNoContent. Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I78581df3c7f0cb99007edddc83eb7a6dca5eba07 * Update commercial paper doc to use enrollUser.js Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com> * Use protolator from fabric-config Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Revert "Bump viper version to the last working commit" This reverts commit 5ad0a4f. Signed-off-by: Brett Logan <brett.t.logan@ibm.com> * _lifecycle ignore previous build failure during install (hyperledger#1280) When a chaincode build previously failed while installing the chaincode, _lifecycle should ignore the cached error and attempt to rebuild the chaincode. This is because we should assume the end user knows something about why the build may succeed on retry if they're reattempting an install. Also, update integration tests to not care about exit status of chaincode installs (since reinstalls now error). FAB-17907 Signed-off-by: Will Lahti <wtlahti@us.ibm.com> * [FAB-17927] Add AllChaincodesInfo to DeployedChaincodeInfoProvider (hyperledger#1331) Implement AllChaincodesInfo to query ledger and return chaincode info for all the deployed chaincode (both new lifecycle and legacy chaincodes) on a channel. This function is needed for ledger checkpointing and deletion of channel-specific databases in statecouchdb. Signed-off-by: Wenjian Qiao <wenjianq@gmail.com> * [FAB-17471] Fix OrdererType key to correct line SampleInsecureKafka profile tries to change consensus type to kafka using OrdererType. But it was written in the line above "<<: *OrdererDefaults". That causes the overwrite consensus type again. This CR moves OrdererType to the correct line. As a result, this CR can generate the correct ordererer type's genesis block. Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> * [FAB-17059] Add missing mspID when init MembershipProvider. Signed-off-by: Hongbin Mao <hello2mao@gmail.com> * fsync and do not generate empty files in snapshots (hyperledger#1345) This commit fixes following issues - Perform sync on the snapshot files - Does not generate empty files - Use filepath instead of path package Signed-off-by: manish <manish.sethi@gmail.com> * fix infinite loop during full range query (hyperledger#1347) We use a single scanner for achieving both paginated and non-paginated range query. We have internalQueryLimit and pageSize. For each _all_docs?startKey="XXX"&endKey="YYY" REST API call to CouchDB, we fetch atmost internalQueryLimit number of records only by appending limit=internalQueryLimit. When the requested pageSize is higher than the internalQueryLimit or the total number of records present in the given range is higher than the internalQueryLimit, iterator would execute the query again once the records fetched in the first cycle is consumed and so on. In order to do that, after an execution of the REST API in each cycle, it updates the initially passed startKey to the nextStartKey. If there is no nextStartKey, it is set to the endKey. Currently, when the nextStartKey and the endKey are the same, we still run one REST API call which is actually not needed as we always set inclusive_end=false. However, this causes infinite loop in a particular case. When we want to retrieve all the records, we would pass an empty string as the startKey and the endKey. When the startKey is an empty string, the REST API call would become _all_docs?endKey="YYY". When both are empty, it would become _all_docs Given that we set startKey to endKey when there is no nextStartKey and still execute one REST API call, it gets into infinite loop by fetching all records again and again. We avovid this infinite loop by setting scanner.exhausted = true whe the startKey and endKey become the same when there is no nextStartKey Signed-off-by: senthil <cendhu@gmail.com> * Remove unnecessary extension of osn (hyperledger#1351) In the integration test touched by this patch, cert file is read to remove and add node. It can be easily achieved by reading file bytes directly, without extending network to grab intermediate object. Signed-off-by: Jay Guo <guojiannan1101@gmail.com> * [FAB-17935] Change unnecessary warning log line to debug in gossip (hyperledger#1350) privdata Signed-off-by: Danny Cao <dcao@us.ibm.com> * [FAB-17900] Update BCCSP.PKCS11.Pin in examples - The Pin value must be quoted when specified in the yaml Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com> * [FAB-17900] Fixes numeric env variable override bug Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com> * Remove s390x, powerpc64le from RELEASE_PLATFORMS - Release automation only creates amd64 binaries for darwin, linux, and windows. - Continuous integration no longer runs on powerpc64le or s390x Also remove stale build tags related to plugins and race detection for old versions of go, s390x, and ppc64le. Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com> * Backfill test for BCCSP environment overrides... ... and consistently use SW as the key for `SwOpts` in the configuration structures. Right now tags for mapstructure and JSON do not match the tags for YAML yet our sample configuration documents (in YAML) use `SW`. Signed-off-by: Matthew Sykes <matthew.sykes@gmail.com> * Updates in master for v2.1.1 release Update master doc and bootstrap script for v2.1.1 release. Signed-off-by: David Enyeart <enyeart@us.ibm.com> Co-authored-by: Matthew Sykes <sykesmat@us.ibm.com> Co-authored-by: pratikpatil024 <pratikspatil024@gmail.com> Co-authored-by: Yoav Tock <tock@il.ibm.com> Co-authored-by: Matthew Sykes <matthew.sykes@gmail.com> Co-authored-by: David Enyeart <enyeart@us.ibm.com> Co-authored-by: Christopher Ferris <chrisfer@us.ibm.com> Co-authored-by: Brett Logan <brett.t.logan@ibm.com> Co-authored-by: Nao Nishijima <nao.nishijima.xt@hitachi.com> Co-authored-by: manish <manish.sethi@gmail.com> Co-authored-by: NIKHIL E GUPTA <negupta@us.ibm.com> Co-authored-by: Will Lahti <wtlahti@us.ibm.com> Co-authored-by: Wenjian Qiao <wenjianq@gmail.com> Co-authored-by: Hongbin Mao <hello2mao@gmail.com> Co-authored-by: Senthil Nathan N <cendhu@users.noreply.github.com> Co-authored-by: Jay Guo <guojiannan1101@gmail.com> Co-authored-by: Danny Cao <dcao@us.ibm.com> Co-authored-by: Tiffany Harris <tiffany.harris@ibm.com>
Type of change
Description
When a chaincode build previously failed while installing the chaincode, _lifecycle should ignore the cached error and attempt to rebuild the chaincode. This is because we should assume the end user knows something about why the build may succeed on retry if they're reattempting an install.
Also, this PR updates integration tests to not care about the exit status of chaincode installs since reinstalls of previously successful installs now return an error.
Related issues
FAB-17907