‫All right, we did the post about the get together, it will be easier, it is to get you get let's
‫get that thing right.
‫And what do we do to do it?
‫Get essentially what we are getting from the server as.
‫All right, so I'm going to do it fancier this time, right?
‫So I'm going to use the like that idea.
‫I think it's going like that is as a call, an ID.
‫I think so the your ID will be like that will be part of the URL.
‫So like if you do like to finish localhost eighty, eighty one and then you do like bleb as of now this,
‫this url now will this will be the oral idea.
‫Get it.
‫I don't get it.
‫Guys I have to, I got to spell out everything with you guys shesh or so it goes.
‫Your idea will be equal request that I think it's called forams thought you ought to lity.
‫Right then what do you do it this way.
‫I think I might be wrong.
‫So we'll check it out.
‫OK, so you are.
‫All right.
‫So we get our idea, which is this this thing.
‫Right, right.
‫So what do we do?
‫We need to query first to do the query.
‫We need to find which which database to hit.
‫And to do that, we don't need to hash because we have the hash.
‫Right.
‫ARV's, we have the meat.
‫All right.
‫So we do that because get the you all get a server and once you get the server.
‫Now we know it's over, we know which clients, so we essentially do this right.
‫Easy, easy peasy Japanese.
‫So we don't need this.
‫We just need to query and select star again.
‫Never do this right.
‫Never, ever, ever do this.
‫Your tables at what's called a zero table table.
‫Oh, so select start from your old table where you are already is equal to.
‫One, thank God.
‫What's his name, this guy who built this library?
‫I think his name is Brian.
‫Brilliant guy, man following Twitter.
‫Brilliant guy.
‫OK, so what we do you already I want to give you that so you don't have to do that nasty single codes
‫and that bad that that you don't have to do that because you'll be you'll be sequel injected.
‫And by the way, we talked about single injection because I talk about everything I want to learn in
‫this job, because I want my goals to become better software engineer every day.
‫So anything that I don't know, essentially I make a video about it, I learn it and I make a video
‫on it.
‫So it's like one direction.
‫Go check it out.
‫OK, we have our stuff.
‫What about we actually check this stuff out?
‫OK, so get this, get the results.
‫And I think I waited that thing.
‫The results have a roseau of results.
‫But Rose, I think it's called the real count.
‫Is it great.
‫And then zero.
‫Then we just send back the result, I guess.
‫And then if there is no results, what's the status code for something that is not found?
‫Good for over Sinda status since since status for all for those four four.
‫Because it's not found if it's found that I'm going to return this thing.
‫Right.
‫And what do you do already by else?
‫Elseworlds.
‫All right, so your ID let's just do the same exact thing so we don't mess up right, stay consistent,
‫consistent hashing babes, I say your it is is the same one.
‫I don't really care.
‫I want this guy and he tells me which server.
‫I want you to pick that thing up.
‫All right.
‫Looks like it's Wardo.
‫But.
‫Do it, do it only valid in async function.
‫Yes, sir, because I forgot to add async here.
‫And Gil.
‫All right.
‫Whoo!
‫Let's do this, get well, get it easy, just do this.
‫And now I need something that actually exists, right?
‫This is not found this funny.
‫It actually not sound.
‫Right, because it now is going to return for me and for forever because this dusa doesn't exist.
‫So that doesn't exist for all.
‫For not found.
‫OK, how about we find something that is actually there.
‫OK, so if I go to any server I just pick up any services.
‫Seshadri three the search server.
‫If you do this right, it's not working.
‫Or they might have some bugs.
‫Guys, that's going to check what's going on.
‫It hit it.
‫Did I get this right.
‫Yes, I get it in HCM seven.
‫Right.
‫And if I do that, I'm going to get its citizens server five, four, three, two.
‫And if I query right and I get rows count zero row count, there's no rows count, it's row count plus
‫even though I didn't get any rows back.
‫Right.
‫So let's see.
‫What would it what are we doing wrong here, guys?
‫All right, guys, I had to post the video where you found the big, huge bug on one of the implementation
‫of the old library, the consistent tache library.
‫For some reason when I practiced this video, I didn't hit it, but I had it during this video while
‫recording this video.
‫And apparently that hash ring thing, that consistent hash was not giving me the same value.
‫So it was stupid and useless.
‫It's just buggy implementation.
‫So I found another library called Hasharon, which is a correct implementation.
‫Finally, it's exactly the same.
‫Right.
‫So you're going to add the same thing or add this.
‫But now when I do, I get right with a key.
‫It's the same thing.
‫Exactly right.
‫It gives me the same value every time because that's what I want.
‫I don't want it to give me a random values that defeats the purpose of a consistent hash line.
‫I don't know what that implementation was about.
‫Right.
‫So I checked.
‫It wasn't updated for four years.
‫I was a bad idea for myself.
‫I apologize.
‫So the rest of the video will use this hash ring instead of the consistent dash hash.
‫Right.
‫I apologize for that.
‫But it's the same implementation, right?
‫The same idea.
‫Nothing changed that code will the latest code will use the hash.
‫So now if I actually so I go I went and then translated all the arrows on my oh my short.
‫Repopulated it with a brand new set of IDs.
‫Right.
‫So now.
‫I go back to get right here.
‫If I do like let's say I went back here and it's like, OK, Shahid, what, I'm short three and I want
‫E for RJ.
‫So this is what shot three, right.
‫Shot three.
‫And I did.
‫OK, go ahead and show me that for that Eid.
‫I get back at 3:00, right?
‫So let's go ahead to actually Shahd, one of the heroes and short one, OK, and let's check that out.
‫Do we give the values here?
‫So, yeah, there's a bunch of values here.
‫Pick one of them and then M.C. eight, seven, five.
‫I do that.
‫Right.
‫Let's just refresh that thing.
‫Right.
‫And if I do, give me that.
‫I'm going to Head Start one, five, four, three, two.
‫That's exactly what we want, right?
‫Powerful stuff, right?
‫So once we get that, I know which server to go right.
‫So let's go ahead and complete the query and add all that jazz.
‫Right.
‫So let's go ahead.
‫So we get the results back from the query.
‫Right.
‫If the result door row count, I think is called greater than zero, then I want to send back obviously
‫this results right, guys?
‫And I want to actually just send the rules back.
‫Right.
‫Just go ahead and send it.
‫We can just do.
‫Because we're going to get one roll back, right, this implementation, by the way, guys could have
‫duplicates, right?
‫I didn't account for duplicate, but it's easy to fix.
‫Right.
‫I'm not going to fix it here.
‫Obviously, this is a Sharding video, not a whole.
‫The URL shortener design course, Ryan.
‫So you are sure to get it.
‫Give me the idea.
‫I'm going to get the oil.
‫How do I get the oil?
‫I can do this.
‫Rose.
‫Sub-Zero and let's just do Sub-Zero.
‫I don't know the actual values there.
‫So I'm that server.
‫And then if it doesn't if you couldn't find it, we said we're going to do respons DOD send status 404.
‫OK, that is coolish.
‫Let's do it.
‫And let's just remove that breakpoint so it doesn't get annoying.
‫Oh, look at that, we got it.
‫It's already 40 and it's from server this and all that jazz.
‫Right.
‫So how about we pick another one?
‫Another one, the jihadist.
‫That's the same server, that's what we pick up, another server, another server, and that's when
‫I truncated those tables.
‫Let's go to.
‫How about that?
‫Let's pick something from short to do.
‫We prove that actually this -- is working, right.
‫Look at that shot, two, five, four, three, three, and we picked out a result of that, so I spread
‫out my databases and now my rose on my tables and now I'm always getting that stuff back.
‫Powerful stuff so we know how to write, how to read.
‫And that's essentially the basics of starting.
‫Right.
‫And now what if I do something that doesn't exist?
‫I get enough on the meter that just blew through.
‫Not found.
‫Right.
‫So a very basic implementation of a Yorka shortener with sharding giving to you guys, right.
‫Hope you enjoy it.
‫It's the cold.
‫It'll be in the description below.
‫And so it's not that bad, right?
‫Like for Sharding, that's a pretty cool if you think about it right now, guys, adding shards is not
‫something easy.
‫You cannot just add any sharp because you have to really be careful what you're doing right.
‫You have to be careful with the algorithm.
‫So the one I did is like it's fixed to that number of schadt, right?
‫So the moment I add a new shot is going to redistribute and everything is going to go to F, right.
‫So you really need to know what you're doing with this sharding.
‫A ratio is a different topic.
‫It's one of the disadvantages, actually, of of sharding.
‫All right.
‫So that's it.
‫Let's just jump back and do the slides and talk about the pros and cons of sharding.