-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Removes DrupalUrlAlias #47 and optimizes maps index #73
Conversation
Luckily we now have a development server with a fresh copy of the live DB On Thu, May 8, 2014 at 2:26 PM, sirMackk notifications@github.com wrote:
|
That's great news! Looking forward to the results and keeping my fingers crossed. |
Hi, we've had some trouble with the testing server DNS and haven't been On Fri, May 9, 2014 at 7:11 AM, sirMackk notifications@github.com wrote:
|
No worries at all, I've slowed down somewhat due to getting ready to move back home to NYC 👍. I'll be back in the game shortly :). |
Hi, sirMack - we are still debugging the big migration in the pipeline at jywarren#181, but that should be done soon (takes a while to reload the db each time). Then this is up at bat! I was wondering if you could change the "dst" column to a more legible name like "path" -- which may require renaming all instances of Node.path to something else for the time being, that function conflicts with the table name (see https://github.com/publiclab/plots2/blob/master/app/models/drupal_node.rb#L337) Alternatively now that I look at it, we might just be able to drop the path method, since your new table would just replace it. But the method has a leading slash, where DrupalUrlAlias.dst does not. So could you add leading slashes when you migrate? That could alleviate the need for sirMackk@c9c0a68#diff-506c305b074506147da2da7a9d9d6dcfR332 Sorry we let this go a little while and it's no longer automerging :-( my bad, due to the trouble getting the test server going. |
Sure thing - I'll change the the dst column to path and arrange so that it gets rid of the path function. I'll also hammer it into shape so that it automerges with the master branch 👍 . Thanks for the tips! |
I changed the I think that should do it :). Crosses fingers the migration works correctly |
OK, super, once we get the tests running after #87 we'll /about and some of the legacy ones which we're trying to continue supporting... i /tool/balloon-mapping I guess in theory we could just be storing the "slug" -- the /wiki/foo or On Thu, Jun 5, 2014 at 4:54 PM, sirMackk notifications@github.com wrote:
|
Thanks for the pointers, I'll check out the language related one today as I haven't done that yet, whereas the others resolve to wiki pages, and I'll see if I can make anything break that shouldn't :). |
Super. If you'd like to send me and On Fri, Jun 6, 2014 at 10:56 AM, sirMackk notifications@github.com wrote:
|
Oops, should've commented here; i'll repeat: http://publiclab.org/wiki/foldable-mini-spectrometer and http://publiclab.org/wiki/foldable-spec lead to the same page. Maybe there's some easy way to do this, where we create a new node but with status = 3 or something, which triggers a redirect? |
Thanks for pointing this out! I've been working on getting the migrations to work with the db on the test server. I've encountered some bugs in my code when using the real db, so I've been working on fixing those :). Do you think there's a lot of urls pointing to the same nodes? I like the idea of using redirects to keep the clone-nodes leaner, could definitely go for that. |
I think maybe a dozen or so. They were all created manually and in many
|
What if we moved all slugs to their own relation. It would contain the fields If we did it this way, there would be a one-to-many mapping between node-to-slug. One node could have many slugs, but one slug could only belong to one node. Migrating would be easy: iterate through nodes, put node's id and slug in the new table. For the few by-hand cases, we could update those with some quick inserts. Then we have to rewrite the code to use the slug relation instead of the slug field. |
@sirMackk Yeah that might be. I haven't been following the motivation for this ticket. When @jywarren said he wants a mapping from many slugs to one page, then apparently that's what url_alias table did. Perhaps the right approach would be to remove the slug field from the node tables entirely, leave url_alias, but ensure the database constraints I mentioned earlier: index on Keeping slug information in multiple places is a Drupal hack that doesn't make good use of the database. Question is whether we fix it to support 1:1 mapping (use only slug field in node) or 1:N mapping (use only url_alias). |
Having only about a dozen duplicate nodes in a 1:1 mapping wouldn't hurt the database much and would avoid an extra query. The url_alias table was had two separate indexes: id,slug,language and id,node,language so changing it to index on node, slug and making slug unique is an awesome idea for the 1:N mapping. However, as you say, the real question is whether to go with 1:1 or 1:N, especially taking into account possible future features? I'll hold off on this for a bit and focus on the consolidate_tags migration fix until I get the green light. |
@sirMackk A relation table like url_alias doesn't need an id. The relation is precisely defined by the combination of It's kind of a pet peeve of mine when people add ids where they aren't needed, but that's what I get for being in webdev ;) Yeah let's wait to see whether @jywarren thinks we're okay to stick with 1:1 or if we should do 1:N properly. |
Hi, all -- sorry to be gone from the discussion; I think the advantages of On Fri, Jun 13, 2014 at 10:09 AM, Bryan Bonvallet notifications@github.com
|
@btbonval Thanks for the lesson! Rails migrations add an auto-incremented id column by default if I remember correctly. Then it plays well with the default rails methods like @jywarren Sounds good - I'll then continue on cleaning up the migrations to finally get them working alright. Learned a thing or two with working with pretty big databases along the way. Off we go! |
If there's a simple parameter to disable adding an id, use that. Rails is Just like smoking in high school. On Fri, Jun 13, 2014 at 4:00 PM, sirMackk notifications@github.com wrote:
|
Hi, SirMackk - are you still actively working on the test server, or can I test out a new commit there in a separate branch? If you want to commit your work to a new branch, i can just do my work in a separate branch if you havent run the migration itself yet. My commit is to do with email notifications so it shouldn't conflict at all. |
Hi! The code is live on the test server and looks to be working good. However, the more eyes, the less bugs, right? |
wow cool -- yes, and perhaps we can consult a list of the likely A quick check of a couple show that https://test.publiclab.org/lists but "/licenses" works like a charm. /kits works On Thu, Jul 3, 2014 at 7:18 PM, sirMackk notifications@github.com wrote:
|
Thanks for catching those - I found the culprits, changed them, tested on the test server and now things are looking good:
|
Exciting. I'm traveling right now but should have a chance to look at these On Jul 4, 2014 5:49 PM, "sirMackk" notifications@github.com wrote:
|
Back in town, cranking away at catching up!!! OK, all the examples I could think of are working properly on test.publiclab.org. I think we should merge it and wait for complaints, if any... can you think of anything else, or any way we'd lose data in the process? Are we ready to go? |
The only thing that comes to mind would be losing certain paths to some nodes, since I didn't manually check every node url, but that can be easily fixed manually after a complaint or something in the logs. Then just gotta check out those DUPLICATE nodes - from the database dump that's on the test server, it seems like almost all are spam except 2-3 of them. Being cautious, I'd make a backup first and if time is scarce - you could just backup the So.... I'd say we're ready for launch, Houston! |
Merged and pushed live! Thanks again SirMackk and please report any errors or problems on the site here, folks -- feel free to reopen! |
Actually one extra thing -- i couldn't find the db dump of Duplicates, and couldn't find any querying around a bit. We have backups, of course, nightly. Can you post the DUPLICATES you found, and I can just look them over? Thanks! |
Whoooo! That's interesting - maybe they were removed before the migration so the migration didn't pick 'em and mark 'em? I'll check what I had on the test db first thing later today as I'm attending HOPE X atm :). |
Oh cool lots of my friends are too! Say hi to Nadya peek!
|
Will do if I run into her! :) |
I ran a quick query to get all the dupes on the test database and here's what comes up (ie.
|
Oh man, I'm glad you ran that. I really didn't want to lose the driveway makeover page. Let's make sure that is preserved, folks. I got 24 driveways to makeover and 24 notes to help me do so. |
Hm, so that means we have two nodes which have the path /wiki/gulf-coast On Sun, Jul 20, 2014 at 11:21 PM, Bryan Bonvallet notifications@github.com
|
It means that when the migration was scanning the url_alias table, it happened on two rows with the exact same dst column leading to two different nodes. Rails was using only one - I can't remember if the first or last, but the most up to date one. So the these unloved nodes, whom no one could reach, instead of getting a real-deal working Deleting them shouldn't affect anything since they weren't accessible before the migration, but I left them just in case it turns out we'd prefer to keep and expose Gulf Coast with nid 2 instead of with nid 403 (just made that number up). Deleting them won't affect the real nodes too, so we're good in that department. |
Let's leave them there, or if someone wants to delete those with nids > 6968 On Tue, Jul 22, 2014 at 6:59 AM, sirMackk notifications@github.com wrote:
|
Sounds pragmatic and good! Things have been pretty hectic on my end, but when they settle down, I'll try to check out some issues :) |
Just a weird thing - I see that on https://test.publiclab.org/wiki/balloon-mapping we see an old page, last edit 3 yrs ago, while on https://publiclab.org/wiki/balloon-mapping we see an up-to-date wiki page. Did someone import an old db? |
Oh man, gotta sit down and look at the code, I remember I changed a good deal of how |
Finishes #47.
This PR removes DrupalUrlAlias. I tried a couple of things, but the most robust way turned out to be to simply moving the url_alias.dst column into the node table, thereby making dst lookups faster and easier and reducing the amount joins one has to do. It also slimmed down the code a bit here and there.
A second, smaller part involves a minor optimization of the maps index that tangents off #33. It involves optimizing the view rendering time and in my dev environment it went from ~800ms to ~130ms.
Because this involves a central table, I'd advise checking this code in development mode using a copy of the production database to see if there are any issues. As far as I was able to check, things look to be working correctly :).