Put checking dk_opfamily ahead when test equaility for locus.
The code to test dk_opfamily should be put ahead.
@@ -80,6 +80,9 @@ cdbpathlocus_equal(CdbPathLocus a, CdbPathLocus b)
DistributionKey *adistkey = (DistributionKey *) lfirst(acell);
DistributionKey *bdistkey = (DistributionKey *) lfirst(bcell);
+ if (adistkey->dk_opfamily != bdistkey->dk_opfamily)
+ return false;
+
foreach(b_ec_cell, bdistkey->dk_eclasses)
{
EquivalenceClass *b_ec = (EquivalenceClass *) lfirst(b_ec_cell);
@@ -93,9 +96,6 @@ cdbpathlocus_equal(CdbPathLocus a, CdbPathLocus b)
if (!list_member_ptr(bdistkey->dk_eclasses, a_ec))
return false;
-
- if (adistkey->dk_opfamily != bdistkey->dk_opfamily)
- return false;
}
}
return true;
