A non-transitory computer-readable storage medium containing computer-executable instructions for, when executed by one or more processors, performing a social networking relationships processing method, the method comprising:
- accessing a first forward-relationships set corresponding to a user identification of a first user in multiple data centers, wherein relationship information of each user in a social network includes a forward-relationships set and a reverse-relationships set, the forward-relationships set including identifications of users added by the corresponding user as contacts, and the reverse-relationships set including identifications of users that added the corresponding user as a contact, the forward-relationships set and the reverse-relationships set of the first user are maintained and updated by a first data center of the multiple data centers, and another data center of the multiple data centers stores copies of the forward-relationships set and the reverse-relationships set of the first user;
- searching, by a relation chain logic server in a current data center, in reverse-relationships sets of all users locally stored in the current data center, the identification of the first user, to find one or more reverse-relationships sets of one or more users that contain the identification of the first user, and forming an inverted-reverse-relationships set of the first user at the current data center by user identifications of the found one or more users whose reverse-relationships sets contain the identification of the first user;
- determining, by a relation chain repair server, whether a difference between the first forward-relationships set of the first user and the inverted-reverse-relationship set corresponding to the user identification exists, comprising:
- obtaining, from the multiple data centers, first Exclusive OR (XOR) values, each first XOR value being separately and locally generated by performing a first XOR operation on user identifications in forward-relationships set of the first user locally-stored at each center;
- obtaining, from the multiple data centers, second XOR values, each second XOR value being separately and locally generated by performing a second XOR operation on user identifications in the inverted-reverse-relationships set corresponding to the first user locally-found at each data center;
- obtaining a first comparison value according to the first XOR values;
- obtaining a second comparison value according to the second XOR values;
- and
- determining whether the difference between the forward-relationships set and the inverted-reverse-relationships set exists by determining whether the first comparison value is consistent with the second comparison value, such that only the first and second XOR values needs to be transmitted from the multiple data centers to recognize the difference without gathering all data of the forward-relationships set and the reverse-relationships set stored in the multiple data centers to the relation chain repair server, thereby reducing occupation on network bandwidth;
- in response to determining that the difference between the forward-relationships set and the inverted-reverse-relationships set exits, identifying, by the relation chain repair server, a second user that causes the difference;
- respectively accessing, by the relation chain repair server, first relationship information of the first user and second relationship information of the second user stored in associated data centers;
- and
- updating, by the relation chain repair server, at least one of the first forward-relationships set of the first user or a second reverse-relationships set of the second user according to the relationship information of the first user and the second user from the associated data centers.