-
Notifications
You must be signed in to change notification settings - Fork 46
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
Implement Visor Vector Builder & Executor #370
Conversation
b2e13e4
to
17c8329
Compare
@@ -19,3 +19,4 @@ visor | |||
sentinel-visor | |||
|
|||
build/.* | |||
vector/data/*.json |
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.
Ensure the vector files don't get pushed to github.
// wrap the repos blockstore with a tracing implementation capturing all cid's read. | ||
capi.tbs = NewTracingBlockstore(bs) |
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.
Wrapping the API's blockstore with a TracingBlockstore
tracks CIDs read from it. The recorded CIDs are used to build the vectors CAR data.
@@ -0,0 +1,63 @@ | |||
package storage |
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.
Implement the storage interfaces backed by a map.
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.
Nice.
} | ||
|
||
func modelTypeFromTable(tableName string, expected json.RawMessage, actual []interface{}) (string, error) { | ||
// TODO: something with reflection someday |
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.
It was faster for me to just write this all out than tinker with reflection.
This method validates the data extracted while executing the test vector matches the expectation of the vector.
2d2aa0b
to
8646a14
Compare
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.
Generally LGTM. Mostly cosmetic comments.
chain/indexer.go
Outdated
ll.Debugw("tipset complete", "total_time", time.Since(start)) | ||
}() | ||
wg.Wait() |
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 will force the extraction and persistence to be locked in step, but they are supposed to be out of step. The idea is that we can be extracting a tipset while persisting the previous one (which is mostly IO wait).
Can you take this out and let's figure out a fix for #374 separately
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 have reverted this change here: 288beafa4673e74bbaf3fa024799254f06e61f1e
And applied a hacky-fix here: fb47362dbd11c562b63478b001f871691d0ef6f7
I agree this, nor the hack are the correct solution, but without one of them all vector tests fail. I believe this is because once the walker has indexed the last tipset in its walk it calls this method and exists regardless of this go routine completing its persistence work.
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.
😢
@@ -0,0 +1,63 @@ | |||
package storage |
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.
Nice.
``` | ||
Finally, execute the vector unit tests: | ||
``` | ||
$ go test -v ./vector/... |
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.
Tried these commands out and it all worked smoothly. 🏆
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.
haha, spoke too soon. One vector failed to download correctly and the file contains
<html>
<head><title>429 Too Many Requests</title></head>
<body>
<center><h1>429 Too Many Requests</h1></center>
<hr><center>openresty</center>
</body>
</html>
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.
Damn, ideally the curl command in fetch_vectors.sh
would be ipfs or ipget but I didn't want to muck with those in CI just yet. I have modified fetch_vectors.sh
to fail in the event curl
fails, and I think that should address this... 🥈
fb47362
to
e6370b8
Compare
Users may use the vector lens to capture all CID's written to and read from its API. The lens may be used in conjunction with the vector commands to produce a test vector.
Implement vector build and vector runner commands. These commands allow a user to build and execute vectors against Visor.
This reverts commit 85eb065df81f0ab2688530772c72f078344c9bab.
- will revert after a proper fix is designed.
Need to regenerate the message vector after the rebase, then should be ready for merge. |
e6370b8
to
69afaa0
Compare
Codecov Report
@@ Coverage Diff @@
## master #370 +/- ##
========================================
- Coverage 46.4% 43.9% -2.6%
========================================
Files 24 29 +5
Lines 1796 2258 +462
========================================
+ Hits 835 993 +158
- Misses 834 1083 +249
- Partials 127 182 +55 |
What
This PR adds vector creation and execution logic to Visor. A README with example usage can be viewed here: https://github.com/filecoin-project/sentinel-visor/pull/370/files?short_path=405134e#diff-405134e8ddb86a9f71f27944fd2349c9f86062c1797bce502dcfb32fb36f693f. There is a lot of room for improvement here, but given this PR's age, the churn from the past couple weeks, and changing priorities, I wanted to put a pin in this. I intend to make further improvements to this as follow-ons.
How to review
Look over the README linked above, then read commit by commit.
@iand I have created 85eb065df81f0ab2688530772c72f078344c9bab to serve as a strawman for starting a conversation on how to fix #374.
Here is a demo showing how to create and execute visor test vectors.