Delay inserter.flush in WalkFetchConnection
Spawn an ObjectReader from the ObjectInserter, so the flush can be delayed at the end of the fetch. Change-Id: I35fe8c8370c06c25262645202aec2b1318057c19 Signed-off-by: Zhen Chen <czhen@google.com>
This commit is contained in:
parent
1bafc304c8
commit
0212a623f8
|
@ -195,7 +195,7 @@ class WalkFetchConnection extends BaseFetchConnection {
|
||||||
local = wt.local;
|
local = wt.local;
|
||||||
objCheck = wt.getObjectChecker();
|
objCheck = wt.getObjectChecker();
|
||||||
inserter = local.newObjectInserter();
|
inserter = local.newObjectInserter();
|
||||||
reader = local.newObjectReader();
|
reader = inserter.newReader();
|
||||||
|
|
||||||
remotes = new ArrayList<WalkRemoteObjectDatabase>();
|
remotes = new ArrayList<WalkRemoteObjectDatabase>();
|
||||||
remotes.add(w);
|
remotes.add(w);
|
||||||
|
@ -240,6 +240,12 @@ protected void doFetch(final ProgressMonitor monitor,
|
||||||
downloadObject(monitor, id);
|
downloadObject(monitor, id);
|
||||||
process(id);
|
process(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
inserter.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new TransportException(e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<PackLock> getPackLocks() {
|
public Collection<PackLock> getPackLocks() {
|
||||||
|
@ -652,7 +658,6 @@ private void verifyAndInsertLooseObject(final AnyObjectId id,
|
||||||
Constants.typeString(type),
|
Constants.typeString(type),
|
||||||
Integer.valueOf(compressed.length)));
|
Integer.valueOf(compressed.length)));
|
||||||
}
|
}
|
||||||
inserter.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Collection<WalkRemoteObjectDatabase> expandOneAlternate(
|
private Collection<WalkRemoteObjectDatabase> expandOneAlternate(
|
||||||
|
@ -883,7 +888,6 @@ void downloadPack(final ProgressMonitor monitor) throws IOException {
|
||||||
PackLock lock = parser.parse(monitor);
|
PackLock lock = parser.parse(monitor);
|
||||||
if (lock != null)
|
if (lock != null)
|
||||||
packLocks.add(lock);
|
packLocks.add(lock);
|
||||||
inserter.flush();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue