-
Notifications
You must be signed in to change notification settings - Fork 14
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
Error when the difference between test_by_score and tests rows is > 0 and you try to run node server
#32
Comments
node server
Regarding your question about the initTestPQ function: The current code seems to have a bug on line 125 - isSnapshot should be isKeyframe. I think this fix would have the side effect of getting rid of your error, but I don't know why your tests and test_by_score tables tables have different numbers of rows in the first place (importCassandra looks like it should be inserting the same tests into both tables). Are you getting any errors running importCassandra? I also don't know if there should ever be a test without a corresponding test_by_score - would we ever insert into the tests table through some other mechanism (other than importCassandra)? |
Hi @jjchen ! Well, did a couple of testing again and re-started everything and I was unable to reproduce the bug the way I described on the issue. However, I was able to reproduce it some other way once I decided to automate inserting a commit to importCassandra.js. I am not sure why adding the following lines makes the errors I posted above:
But it doesn't matter becuase the everything seems to be working now. Going to localhost 8001 seems to be working fine and the page doesn't seem to freak out when the database is empty so I think it works now. |
@jjchen , also, why does it need to be isKeyframe? |
I will close the issue once we agree on how to handle isKeyframe thing |
Maybe I'm missing something, but isn't the variable name isKeyframe instead
|
Sorry I've been busy with a project. I'll be sending in a pull request to fix that naming error shortly. |
Currently I was trying to run
node server
and the following error comes up:To summarize what that error means is that its trying to get the attribute .hash from an undefined object:
var lastCommit = this.commits[commitIndex].hash;
It happens on on the following line for me:
https://github.com/gwicke/testreduce/blob/master/CassandraBackend.js#L136
I am 99% certain that the error is triggered because the following line of code executes:
https://github.com/gwicke/testreduce/blob/master/CassandraBackend.js#L129
Which makes
initTestPQ
to be called again which makes indexing something out of range which returns a undefined that does not have a .hash attribute.Line 129 is called when the difference in lines between tests and test_by_score is >0. In my case I called the usual importCassandra.js to start the database.keyspace:
https://github.com/gwicke/testreduce/blob/master/articles/importCassandra.js
and then manually inserted one commit to the database with the following command:
"INSERT INTO commits (hash, tid, keyframe) VALUES ('0b5db8b91bfdeb0a304b372dd8dda123b3fd1ab6', now(), true)"
[NOTE: I inserted the ' next to the hash because otherwise, github tries to link it to some actual commit. When writing it to cqlsh, make sure to remove the ' because it should not be there as a cql command]
When I ran importCassandra, I ran it with some languages, I don't remember exactly which ones I ran but the state of my database is the following (I probably ran it with en, ar and sv languages, since those are the only abbreviations I really know):
tests table has 18592 rows and the test_by_score table has 18591.
Their difference is > 0 and that is why the code I pointed out is even running and crashing (the reason is crashing is because commitIndex = 1, and there isn't a second commit, so indexing the array returns undefined and accessing the .hash property of undefined of course fails).
On line 129 of CassandraBackend.js the difference between
numTestsLeft - results.rows.length > 0
, which is why the redo initTestPQ function runs.Not sure why the difference is positive or why it would matter. My guesses are that for each commit we want their corresponding test score, so thats why they have to have the same number of rows.
The text was updated successfully, but these errors were encountered: