hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Groschupf ...@media-style.com>
Subject how blocks are compared
Date Sun, 26 Mar 2006 23:48:55 GMT
Hi,
I do not clearly understand how the dfs compare blocks.

The blockId is randomly generated but the compare method looks like:

    if (getBlockId() < b.getBlockId()) {
             return -1;
         } else if (getBlockId() == b.getBlockId()) {
             return 0;
         } else {
             return 1;
         }

That wouldn't be a big problem if this would be used in the  
FSNamesystem#processBlock
   if (cmp == 0) {
                 // Do nothing, blocks are the same
...
} else if (cmp < 0) {
                 // The old report has a block the new one does not
                 removeStoredBlock(oldReport[oldPos], node);
...
   } else {
                 // The new report has a block the old one does not
                 addStoredBlock(newReport[newPos], node);

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?

Thanks.
Stefan



---------------------------------------------
blog: http://www.find23.org
company: http://www.media-style.com



Mime
View raw message