Alex, you're right that 1031 does not apply in Canada. What is more important in your situation, the CRA has specific requirements.
@Amber C. the article that Kenneth gave sums it up. But also, first, less than 51% has to be used for rental. Second, you must not have made any "structural changes" to make the rental portion (ie. you buy a house, build a side entrance, CRA will not consider it as portion of primary residence anymore).
Assuming you meet those two criteria, you can still claim the principal residence exemption. So important thing is that when you are filling the Form 776 for your tax return, that your "personal portion" is 51% or greater, or it'll just be a percentage that is exempt.
Unfortunately Canada (unlike many countries) does not have a 1031 exchange-type option or any other deferral methods for capital gains, but an unlimited exemption in terms of amount for primary residence is still a good thing.