[PATCH] D64291: [clangd] Rewrite of logic to rebuild the background index serving structures.

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 6 13:42:14 PDT 2019


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: llvm-commits, jfb, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: LLVM.

Previously it was rebuilding every 5s by default, which was much too frequent
in the long run - the goal was to provide an early build. There were also some
bugs. There were also some bugs, and a dedicated thread was used in production
but not tested.

- rebuilds are triggered by #TUs built, rather than time. This should scale more sensibly to fast vs slow machines.
- there are two separate indexed-TU thresholds to trigger index build: 5 TUs for the first build, 100 for subsequent rebuilds.
- rebuild is always done on the regular indexing threads, and is affected by blockUntilIdle. This means unit/lit tests run the production configuration.
- fixed a bug where we'd rebuild after attempting to load shards, even if there were no shards.
- the BackgroundIndexTests don't really test the subtleties of the rebuild policy (for determinism, we call blockUntilIdle, so rebuild-on-idle is enough to pass the tests). Instead, we expose the rebuilder as a separate class and have fine-grained tests for it.


Repository:
  rL LLVM

https://reviews.llvm.org/D64291

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/index/Background.cpp
  clang-tools-extra/clangd/index/Background.h
  clang-tools-extra/clangd/test/background-index.test
  clang-tools-extra/clangd/tool/ClangdMain.cpp
  clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64291.208280.patch
Type: text/x-patch
Size: 20478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190706/dbf25e48/attachment.bin>


More information about the llvm-commits mailing list