-
Notifications
You must be signed in to change notification settings - Fork 34
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
IDBS-Spring20-Fudan/assignment2/readme/ #45
Comments
Will the submission upload the username and password of mysql when executing "go run main.go util.go"? |
Running The evaluation of your submission for ass2 will not touch the configuration you provided, I'll only take the three functions you wrote. |
In the first task, I have executed "$ go run main.go utils.go" for many times, however, sometime I get the answer"take xxx ms(usually between 50-100)" while sometime I get the answer "not implemented"(the same code). I am not sure whether it is a normal phenomenon and what causes this problem if my code is wrong , since I have already used closures to get the variables to avoid some mistakes. (I used go func() in the first "for".) |
Take a look at the main.go file, the not implemented error is caused by checking if the table has no data inserted. It might be concurrency problems that causes your insertion failed. |
On my device, the single-thread version takes about 9 seconds and the concurrent version I wrote takes about 1 second, only 9x. (9,800 queries) However, I didn't use sync.mutex. Instead, I simply use waitgroup. May I ask about the grading on this part? The faster, the higher grade? |
nope, as long as you made it concurrent, you will get the score. However you are encouraged to make it faster by trying more strategies. 9x speed up is not bad. My laptop has 4 cores and 8 thread, and its frequency is quite low, so concurrency has way better performance. In your case, the single thread version already performs reasonably well, the room for improvement is much more limited. |
GetSocre函数是否有指定的输出顺序? |
没有的,评价的时候不会看你的输出,而是调用 GetScore,然后读 Submission 的 score,因此顺序不重要。 |
I meet some problems about "only_full_group_by" in task2, which make my code fail, should I deal with this problem to make my code pass or just leave it and change my code? |
I didn't get what you mean, either way you have to solve the problem. If you want, you could provide the error message here. |
panic: Error 1055: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.submitter' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by I search it on Internet and find some solutions, but the solutions don't relate to the code itself, but mysql settings, so I'm not sure whether I should edit the settings to solve the problem or just change the code. |
I have never met this problem before, and I am running MySQL in the default setting. I suggest you to check your SQL more carefully, change your code is always better than change the setting. |
two slices are deeply equal requires either they point to the same initial entry of the same underlying array or their corresponding elements (up to length) are deeply equal. so "sqlResults [][]map[string]interface{}" and "reflect.DeepEqual(sub.sqlResults[i], sub2.sqlResults[i])" mean if the maps that slices point to are deeply equal, the slices are deeply equal ? while the deeply-equality of the maps have nothing to do with order, the deeply-equality of the slices have nothing to do with order? |
In Concurrent Comparison Result Insert:
However, according to
it seems that the DB is safe for concurrent use as long as we limit of the number of connections. I tried sharing a single sql.DB among all the goroutines and it did work on my computer. I wonder if this was generally considered a safe approach. |
Thanks a lot for the reminder, I was wrong. |
Instruction - IDBS-Spring20-Fudan
Course website for introduction to database systems at Fudan University
https://zfhu.ac.cn/IDBS-Spring20-Fudan/assignment2/readme/
The text was updated successfully, but these errors were encountered: