Skip to content

chore: updates for v2 changes #901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions advanced/option-database-tuning.rst

This file was deleted.

24 changes: 15 additions & 9 deletions dev/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ Prerequisites
- The latest stable version of Go. The previous stable version should also
work; older versions will likely not work. This largely follows Go's
`Release Policy <https://go.dev/doc/devel/release#policy>`__.
- Git
- Usually, a C compiler. Syncthing uses SQLite for storing data and the
most common implementation is written in C.
- Git, unless you're building from a downloaded source tarball that includes
a ``RELEASE`` marker with the version information.
- If you want to build Debian packages FPM is required. See FPM's
`installation information <https://fpm.readthedocs.io/en/latest/installation.html>`__.
- To build Windows executables, installing `goversioninfo
Expand All @@ -44,11 +47,6 @@ If you're not already a Go developer, the easiest way to get going
is to download the latest version of Go as instructed in
https://go.dev/doc/install.

.. note::
Because Syncthing uses Go modules you do not need to set or care about "GOPATH".
However, the GOPATH still defaults to ``~/go`` and you'd be best to *not*
put your Syncthing source in there, for now.

Building (Unix)
---------------

Expand Down Expand Up @@ -109,7 +107,13 @@ The following ``build.go`` subcommands and options exist.
``go run build.go build``
Builds just the named target, or ``syncthing`` by default, to the current
directory. Use this when cross compiling, with parameters for what to cross
compile to: ``go run build.go --goos linux --goarch 386 build``.
compile to: ``go run build.go --goos linux --goarch 386 build``. When
cross compiling you need to have a C compiler for the target platform, and
you need to let Go know how to invoke it. The ``--cc`` flag to build.go
controls this, together with the environment variable ``CGO_ENABLED=1``.
For example, to cross build from Linux to Windows using Zig as the C
compiler, ``go run build.go -goos windows -goarch amd64 -cc "zig cc
-target x86_64-windows" build``.

``go run build.go test``
Runs the tests.
Expand All @@ -120,11 +124,13 @@ The following ``build.go`` subcommands and options exist.

``go run build.go tar``
Creates a Syncthing tar.gz dist file in the current directory. Assumes a
Unixy build.
Unixy build. Otherwise same considerations and parameters as for the
``build`` subcommand.

``go run build.go zip``
Creates a Syncthing zip dist file in the current directory. Assumes a
Windows build.
Windows build. Otherwise same considerations and parameters as for the
``build`` subcommand.

The options ``--no-upgrade``, ``--goos`` and ``--goarch`` can be given to
influence ``build``, ``tar`` and ``zip``. Examples:
Expand Down
63 changes: 6 additions & 57 deletions includes/env-vars.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ STTRACE
Main and operational facilities:
config
Configuration loading and saving.
db
The database layer.
main
Main package.
model
Expand Down Expand Up @@ -51,6 +49,8 @@ STTRACE
REST API.
sha256
SHA256 hashing package (this facility currently unused).
sqlite
The SQLite database
stats
Persistent device and folder statistics.
sync
Expand All @@ -63,65 +63,14 @@ STTRACE
all
All of the above.

STBLOCKPROFILE
Write block profiles to ``block-$pid-$timestamp.pprof`` every 20 seconds.

STCPUPROFILE
Write a CPU profile to ``cpu-$pid.pprof`` on exit.

STDEADLOCKTIMEOUT
Used for debugging internal deadlocks; sets debug sensitivity. Use only
under direction of a developer.

STLOCKTHRESHOLD
Used for debugging internal deadlocks; sets debug sensitivity. Use only
under direction of a developer.

STGUIADDRESS
Override GUI listen address. Equivalent to passing :option:`--gui-address`.

STGUIAPIKEY
Override the API key needed to access the GUI / REST API. Equivalent to
passing :option:`--gui-apikey`.

STGUIASSETS
Directory to load GUI assets from. Overrides compiled in assets. Useful for
developing webgui, commonly use ``STGUIASSETS=gui bin/syncthing``.

STHEAPPROFILE
Write heap profiles to ``heap-$pid-$timestamp.pprof`` each time heap usage
increases.

STNODEFAULTFOLDER
Don't create a default folder when starting for the first time. This
variable will be ignored anytime after the first run. Equivalent to the
:option:`--no-default-folder` flag.

STNORESTART
Equivalent to the :option:`--no-restart` flag.

STNOUPGRADE
Disable automatic upgrades. Equivalent to the :option:`--no-upgrade` flag.

STPROFILER
Set to a listen address such as "127.0.0.1:9090" to start the profiler with
HTTP access, which then can be reached at
http://localhost:9090/debug/pprof. See ``go tool pprof`` for more
information.

STPERFSTATS
Write running performance statistics to ``perf-$pid.csv``. Not supported on
Windows.

STRECHECKDBEVERY
Time before folder statistics (file, dir, ... counts) are recalculated from
scratch. The given duration must be parseable by Go's ``time.ParseDuration``. If
missing or not parseable, the default value of 1 month is used. To force
recalculation on every startup, set it to ``1s``.

STGCINDIRECTEVERY
Sets the time interval in between database garbage collection runs. The
given duration must be parseable by Go's ``time.ParseDuration``.
STVERSIONEXTRA
Add extra information to the version string in logs and the version line
in the GUI. Can be set to the name of a wrapper or tool controlling
syncthing to communicate this to the end user.

GOMAXPROCS
Set the maximum number of CPU cores to use. Defaults to all available CPU
Expand Down
3 changes: 0 additions & 3 deletions rest/system-config-get.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Returns the current configuration.
"disableSparseFiles": false,
"disableTempIndexes": false,
"paused": false,
"weakHashThresholdPct": 25,
"markerName": ".stfolder",
"copyOwnershipFromParent": false,
"modTimeWindowS": 0,
Expand Down Expand Up @@ -171,7 +170,6 @@ Returns the current configuration.
"stunServers": [
"default"
],
"databaseTuning": "auto",
"maxConcurrentIncomingRequestKiB": 0,
"announceLANAddresses": true,
"sendFullIndexOnUpgrade": false,
Expand Down Expand Up @@ -228,7 +226,6 @@ Returns the current configuration.
"disableSparseFiles": false,
"disableTempIndexes": false,
"paused": false,
"weakHashThresholdPct": 25,
"markerName": ".stfolder",
"copyOwnershipFromParent": false,
"modTimeWindowS": 0,
Expand Down
2 changes: 1 addition & 1 deletion rest/system-paths-get.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and others.
"certFile": "/home/user/.config/syncthing/cert.pem",
"config": "/home/user/.config/syncthing/config.xml",
"csrfTokens": "/home/user/.config/syncthing/csrftokens.txt",
"database": "/home/user/.local/share/syncthing/index-v0.14.0.db",
"database": "/home/user/.local/share/syncthing/index-v2",
"defFolder": "/home/user/Sync",
"guiAssets": "/home/user/src/syncthing/gui",
"httpsCertFile": "/home/user/.config/syncthing/https-cert.pem",
Expand Down
10 changes: 6 additions & 4 deletions specs/bep-v1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ Protocol Buffer Schema
}

message BlockInfo {
int64 offset = 1;
int32 size = 2;
bytes hash = 3;
uint32 weak_hash = 4;
int64 offset = 1;
int32 size = 2;
bytes hash = 3;
reserved 4;
}

message Vector {
Expand Down Expand Up @@ -511,6 +511,8 @@ Protocol Buffer Schema
int32 size = 5;
bytes hash = 6;
bool from_temporary = 7;
int32 block_no = 9;
reserved 8;
}

Fields
Expand Down
24 changes: 3 additions & 21 deletions users/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ corresponding environment variables (``$STDATADIR`` or ``STHOMEDIR``).

The database directory contains the following files, among others:

:file:`index-{*}.db`
A directory holding the database with metadata and hashes of the files
currently on disk and available from peers.
:file:`index-{*}`
The database with metadata and hashes of the files currently on disk and
available from peers.

:file:`syncthing.log`
Log output, on some systems.
Expand Down Expand Up @@ -114,7 +114,6 @@ The following shows an example of a default configuration file (IDs will differ)
<disableSparseFiles>false</disableSparseFiles>
<disableTempIndexes>false</disableTempIndexes>
<paused>false</paused>
<weakHashThresholdPct>25</weakHashThresholdPct>
<markerName>.stfolder</markerName>
<copyOwnershipFromParent>false</copyOwnershipFromParent>
<modTimeWindowS>0</modTimeWindowS>
Expand Down Expand Up @@ -188,7 +187,6 @@ The following shows an example of a default configuration file (IDs will differ)
<stunKeepaliveStartS>180</stunKeepaliveStartS>
<stunKeepaliveMinS>20</stunKeepaliveMinS>
<stunServer>default</stunServer>
<databaseTuning>auto</databaseTuning>
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
<announceLANAddresses>true</announceLANAddresses>
<sendFullIndexOnUpgrade>false</sendFullIndexOnUpgrade>
Expand Down Expand Up @@ -219,7 +217,6 @@ The following shows an example of a default configuration file (IDs will differ)
<disableSparseFiles>false</disableSparseFiles>
<disableTempIndexes>false</disableTempIndexes>
<paused>false</paused>
<weakHashThresholdPct>25</weakHashThresholdPct>
<markerName>.stfolder</markerName>
<copyOwnershipFromParent>false</copyOwnershipFromParent>
<modTimeWindowS>0</modTimeWindowS>
Expand Down Expand Up @@ -307,7 +304,6 @@ Folder Element
<disableSparseFiles>false</disableSparseFiles>
<disableTempIndexes>false</disableTempIndexes>
<paused>false</paused>
<weakHashThresholdPct>25</weakHashThresholdPct>
<markerName>.stfolder</markerName>
<copyOwnershipFromParent>false</copyOwnershipFromParent>
<modTimeWindowS>0</modTimeWindowS>
Expand Down Expand Up @@ -524,11 +520,6 @@ The following child elements may exist:

True if this folder is (temporarily) suspended.

.. option:: folder.weakHashThresholdPct

Use weak hash if more than the given percentage of the file has changed. Set
to ``-1`` to always use weak hash. Default is ``25``.

.. option:: folder.markerName

Name of a directory or file in the folder root to be used as
Expand Down Expand Up @@ -1048,7 +1039,6 @@ Options Element
<stunKeepaliveStartS>180</stunKeepaliveStartS>
<stunKeepaliveMinS>20</stunKeepaliveMinS>
<stunServer>default</stunServer>
<databaseTuning>auto</databaseTuning>
<maxConcurrentIncomingRequestKiB>0</maxConcurrentIncomingRequestKiB>
<announceLANAddresses>true</announceLANAddresses>
<sendFullIndexOnUpgrade>false</sendFullIndexOnUpgrade>
Expand Down Expand Up @@ -1300,13 +1290,6 @@ The ``options`` element contains all other global configuration options.
feature. Set ``false`` to keep Syncthing from sending panic logs on serious
troubles. Defaults to ``true``, to help the developers troubleshoot.

.. option:: options.databaseTuning

Controls how Syncthing uses the backend key-value database that stores the
index data and other persistent data it needs. The available options and
implications are explained in a :doc:`separate chapter
</advanced/option-database-tuning>`.

.. option:: options.maxConcurrentIncomingRequestKiB

This limits how many bytes we have "in the air" in the form of response data
Expand Down Expand Up @@ -1392,7 +1375,6 @@ Defaults Element
<disableSparseFiles>false</disableSparseFiles>
<disableTempIndexes>false</disableTempIndexes>
<paused>false</paused>
<weakHashThresholdPct>25</weakHashThresholdPct>
<markerName>.stfolder</markerName>
<copyOwnershipFromParent>false</copyOwnershipFromParent>
<modTimeWindowS>0</modTimeWindowS>
Expand Down
4 changes: 2 additions & 2 deletions users/syncing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ version of the file. This version is called the *global* version and is the
one that each device strives to be up to date with.

This information is kept in the *index database*, which is stored in the
configuration directory and called ``index-vx.y.z.db`` (for some version
x.y.z which may not be exactly the version of Syncthing you're running).
configuration or data directory and called ``index-*``, with some version
number in place of the asterisk.

When new index data is received from other devices Syncthing recalculates
which version for each file should be the global version, and compares this
Expand Down
Loading