• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Distcp工具深入分析(3)

    發表于:2014-06-25來源:淘測試作者:凡提點擊數: 標簽:軟件測試
    (; sl .next(key, value); last = sl .getPosition()) { // if adding this split would put this split past the target size, // cut the last split and put this next file in the next split. if (acc + key.ge
    (; sl.next(key, value); last = sl.getPosition()) {

    // if adding this split would put this split past the target size,

    // cut the last split and put this next file in the next split.

    if (acc + key.get() > targetsize && acc != 0) {

    long splitsize = last - pos;

    splits.add(new FileSplit(src, pos, splitsize, (String[])null));

    cbrem -= splitsize;

    pos = last;

    acc = 0L;

    }

    acc += key.get();

    }

    }

    finally {

    checkAndClose(sl);

    }

      split之后就進入Mapper執行階段,map task起來后就會根據自己分配到的那段文件列表來進行點對點的拷貝,拷貝過程會保持Permission、Replication、Block Size的一致性,如果設定了-update則會做一下是否需要update的判斷,如果設定了-overwrite則會刪除已有的文件。這里Owner信息沒有保持一致,而是放到了服務端所有map執行完之后,這一點很讓我覺得糾結,為什么不在map里面拷貝完之后直接同步文件Owner呢?如果有哪位大師知道希望可以提點我一下。因為是實現了Tool接口,而Tool接口是繼承了Configurable接口的,所以-D指定的值對于DistCp來說也是可以生效的。例如設定“-Ddfs.replication=1”,那么拷貝時目標文件的replication數就將保持為1,這樣一來由于目標端需要寫入的數據變少了,拷貝速度就可以大大加快,但是不推薦這么做,因為拷貝過程中如果有一臺Datanode掛了,那么丟失的數據由于無備份,就將真正丟了,這臺機器恢復不了的話,整個distcp過程就會因為丟數據而失敗了。

      拷貝過程關鍵代碼如下:

    FSDataInputStream in = null;

    FSDataOutputStream out = null;

    try

    原文轉自:http://www.taobaotest.com/blogs/2516

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>