hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrzej Bialecki ...@getopt.org>
Subject Re: how blocks are compared
Date Mon, 27 Mar 2006 10:24:10 GMT
Stefan Groschupf wrote:
> Hi,
> I do not clearly understand how the dfs compare blocks.

> I currently just miss some glue how result of a compare of two random 
> numbers can be used to decide if a block can be removed or not.
>
> Any hints what I'm missing?

Block reports are sorted according to the same compateTo (in 
TreeSet.toArray()). It's true that IDs are random, but if both oldReport 
and newReport lists are sorted, like this:

OLD      NEW
1         2
2         3
3         4
5         5

Then the sequence of compares and pointer advances looks like this

old[oldPos=0].compareTo(new[newPos=0]) == -1; remove(old[0]); oldPos++;
old[oldPos=1].compareTo(new[newPos=0]) == 0; /* nothing */; oldPos++; 
newPos++;
old[oldPos=2].compareTo(new[newPos=1]) == 0; /* nothing */; oldPos++; 
newPos++;
old[oldPos=3].compareTo(new[newPos=2]) == 1; add(new[2]); newPos++;
old[oldPos=3].compareTo(new[newPos=3]) == 0; /* nothing */; oldPos++; 
newPos++;

-- 
Best regards,
Andrzej Bialecki     <><
 ___. ___ ___ ___ _ _   __________________________________
[__ || __|__/|__||\/|  Information Retrieval, Semantic Web
___|||__||  \|  ||  |  Embedded Unix, System Integration
http://www.sigram.com  Contact: info at sigram dot com



Mime
View raw message