diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2011-06-09 17:55:52 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2011-06-09 17:55:52 -0700 |
commit | 57853e494972e7a9a6248648fd9f8479844c5348 (patch) | |
tree | 529fa00c959891e040ade860b1e5790197a22912 /org.eclipse.jgit.storage.dht | |
parent | d00f527d659c9eb1fabc434b45f94b98e221c509 (diff) | |
download | jgit-57853e494972e7a9a6248648fd9f8479844c5348.tar.gz jgit-57853e494972e7a9a6248648fd9f8479844c5348.zip |
DHT: Always have at least one recent chunk in DhtReader
The RecentChunks cache assumes there is always at least one recent
chunk in the maxSize that it receives from the DhtReaderOptions.
Ensure that is true by requiring the size to be at least 1.
Running with 0 recent chunk cache is very a bad idea, often
during commit walking the parents of a commit will be found
on the same chunk as the commit that was just accessed. In
these cases its a good idea to keep that last chunk around
so the parents can be quickly accessed.
Change-Id: I33b65286e8a4cbf6ef4ced28c547837f173e065d
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.storage.dht')
-rw-r--r-- | org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtReaderOptions.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtReaderOptions.java b/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtReaderOptions.java index 0890e39ad0..8376e2b6ba 100644 --- a/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtReaderOptions.java +++ b/org.eclipse.jgit.storage.dht/src/org/eclipse/jgit/storage/dht/DhtReaderOptions.java @@ -240,7 +240,7 @@ public class DhtReaderOptions { * @return {@code this} */ public DhtReaderOptions setRecentChunkCacheSize(int chunkCnt) { - recentChunkCacheSize = Math.max(0, chunkCnt); + recentChunkCacheSize = Math.max(1, chunkCnt); return this; } |