c*****t 发帖数: 1879 | 1 I am writing a P2P application which involves database query
of peers' data.
Say, P1 (peer 1) has following rows in table "serve"
abc1
abc2
ddd1
...
...
hundreds if not thousands of entries.
Peer 2 (P2) perform a broadcast query to all peers in a group
and expect to obtain the queries. I used a dumb query like:
SELECT * FROM serve
and P1 would return the entire table to P2. However, later
P2 does the query again, since P2 is interested in updates | b***s 发帖数: 14 | 2 one straight forward solution (probably not the best) would be creating
another table with peer information. Assume each peer has a unique ID,
the table can be as simple as:
peerID LatestTupleSentToThisPeer
===================================
Also, you need to make sure the clocks on each peer are synchronized
(google "lamport clock").
【在 c*****t 的大作中提到】 : I am writing a P2P application which involves database query : of peers' data. : Say, P1 (peer 1) has following rows in table "serve" : abc1 : abc2 : ddd1 : ... : ... : hundreds if not thousands of entries. : Peer 2 (P2) perform a broadcast query to all peers in a group
| t***y 发帖数: 22 | 3 I am not so clear about your problem.
But I know there is a mechanism about cache coherent problems
If any P want to update, it should send a request to owner of the data, the owner
will invalid any other peers' copies and send "Yes or No" to P.
then P update it locally. If any p query the data from the owner, the owner then
will update the copy first and then send out the updated information..
It is similiar as the snoopy cache coherent problem.
【在 c*****t 的大作中提到】 : I am writing a P2P application which involves database query : of peers' data. : Say, P1 (peer 1) has following rows in table "serve" : abc1 : abc2 : ddd1 : ... : ... : hundreds if not thousands of entries. : Peer 2 (P2) perform a broadcast query to all peers in a group
| t******t 发帖数: 51 | 4 This kind of queries are called 'continuous queries', search by this keyword
you can find a ton of information from the web.
【在 c*****t 的大作中提到】 : I am writing a P2P application which involves database query : of peers' data. : Say, P1 (peer 1) has following rows in table "serve" : abc1 : abc2 : ddd1 : ... : ... : hundreds if not thousands of entries. : Peer 2 (P2) perform a broadcast query to all peers in a group
|
|