-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix Postgresql #2383
Fix Postgresql #2383
Conversation
Update postgresql create user table function to include salt and kdfiterations. Fix dblog function to work for both PostgreSQL and other database types. modified: src/murmur/ServerDB.cpp modified: src/murmur/ServerDB.h
Thanks for reviving this. I've written down a few notes from my first read through of the patch:
|
Oops! I have a private bitbucket repo I use for code I share with a gaming guild, and I commit to that using my gaming username. Seems I forgot to switch back to my normal name when I made the commit.
I should explain. I tried to use postgresql with mumble and found it didn't work. I noticed it needed a code change and I also found the patch with the relevant code change. I cloned the mumble repository, applied the patch and built murmurd. I found that it didn't work because the table layout had changed since the patch was made. I fixed the code and tested the server and it worked. I decided to contribute the fixed patch so I forked the repo, cloned my fork and made a new branch, copied the fixed files from the clone of the official repo to my fork, pushed and submitted a pull request crediting the patch with a link.
Ok, I can do that. I didn't actually write those parts. I think the authors intention was that those bits should be used by any of the databases that aren't officially supported.
Would using Postgresql's UPSERT (INSERT ... ON CONFLICT UPDATE) feature be acceptable? It would achieve the same thing, but do so in a single SQL statement meaning that setting up transactions wouldn't be needed. It would mean that only PostgreSQL 9.5 and upwards would work, but that's still an improvement on the current situation.
That's also code that came from the patch. Since it worked I didn't look at it in much detail. I'll look at it some more and see about removing the reconnection logic. |
Fair enough :-)
First applying the patch as one commit, and then working on with consecutive commits would be nice. Since you're not the original author of the patch, I think this approach is fine!
We don't really want to encourage that.
I took a look at using 9.5's upsert support to accomplish this, and I couldn't figure it out. The operation we're looking for is "update the record with primary key X to have these values: A, B, C, D". I couldn't figure out how to accomplish that via the upsert syntax. It seemed to require me to spell out, in the Feel free to use upsert if you can make it readable. :-) If you do, please put the PSQL-specific parts into
sections.
Yep, I know. The reconnection thing IS very important. But the current structure of ServerDB doesn't really allow for it to work safely at the moment. I hope we can refactor ServerDB's methods that use transactions into separate functions, and then do (in pseudo-code):
across the board. |
Logic was removed due to issues raised in comment mumble-voip#2383 (comment) .
Logic was removed due to issues raised in comment mumble-voip#2383 (comment) .
Logic was removed due to issues raised in comment mumble-voip#2383 (comment) .
Add patch https://sourceforge.net/p/mumble/patches/368/
Update postgresql create user table function to include salt and kdfiterations.
Fix dblog function to work for both PostgreSQL and other database types.
modified: src/murmur/ServerDB.cpp
modified: src/murmur/ServerDB.h
Addresses: #2187
Tested with Postgresql 9.5