Message ID | d699ad597d2c40cd2c0fe8abbf75b5386d4cf0f2.1617291666.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Builtin FSMonitor Feature | expand |
On 4/1/2021 11:41 AM, Jeff Hostetler via GitGitGadget wrote:... > + /* > + * If the fsmonitor response and the subsequent scan of the disk > + * did not cause the in-memory index to be marked dirty, then force > + * it so that we advance the fsmonitor token in our extension, so > + * that future requests don't keep re-requesting the same range. > + */ > + if (istate->fsmonitor_last_update && > + strcmp(istate->fsmonitor_last_update, last_update_token.buf)) > + istate->cache_changed |= FSMONITOR_CHANGED; > + This could lead to extra index writes that don't normally happen in the case without the FS Monitor feature. I'm particularly sensitive to this because of my sparse-index work is trying to solve for the I/O cost of large indexes, but perhaps this cost is worth the benefit. I'll keep an eye out as I do performance testing. Thanks, -Stolee
diff --git a/fsmonitor.c b/fsmonitor.c index d7e18fc8cd47..8b544e31f29f 100644 --- a/fsmonitor.c +++ b/fsmonitor.c @@ -353,6 +353,16 @@ void refresh_fsmonitor(struct index_state *istate) } strbuf_release(&query_result); + /* + * If the fsmonitor response and the subsequent scan of the disk + * did not cause the in-memory index to be marked dirty, then force + * it so that we advance the fsmonitor token in our extension, so + * that future requests don't keep re-requesting the same range. + */ + if (istate->fsmonitor_last_update && + strcmp(istate->fsmonitor_last_update, last_update_token.buf)) + istate->cache_changed |= FSMONITOR_CHANGED; + /* Now that we've updated istate, save the last_update_token */ FREE_AND_NULL(istate->fsmonitor_last_update); istate->fsmonitor_last_update = strbuf_detach(&last_update_token, NULL);