Skip to content

Commit 205f89f

Browse files
committed
Backport bugfix for missing fence on file import
First time reading an imported file, need to block until file chunk is loaded.
1 parent 6ff4dcd commit 205f89f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/water/fvec/FileVec.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,14 @@ protected FileVec(Key key, long len, byte be) {
7575
// DVec is just the raw file data with a null-compression scheme
7676
Value val2 = new Value(dkey,len,null,TypeMap.C1NCHUNK,_be);
7777
val2.setdsk(); // It is already on disk.
78+
// If not-home, then block till the Key is everywhere. Most calls here are
79+
// from the parser loading a text file, and the parser splits the work such
80+
// that most puts here are on home - so this is a simple speed optimization:
81+
// do not make a Futures nor block on it on home.
82+
Futures fs = dkey.home() ? null : new Futures();
7883
// Atomically insert: fails on a race, but then return the old version
79-
Value val3 = DKV.DputIfMatch(dkey,val2,null,null);
84+
Value val3 = DKV.DputIfMatch(dkey,val2,null,fs);
85+
if( !dkey.home() && fs != null ) fs.blockForPending();
8086
return val3 == null ? val2 : val3;
8187
}
8288
}

0 commit comments

Comments
 (0)