16 Commits

Author SHA1 Message Date
Ivan Valdes
9e1dadd748
etcdutl: Fix snapshot restore memory alloc issue
When running the snapshot command, allow receiving an initial memory map
allocation for the database, avoiding future memory allocation issues.

Backports commit: be2883321240340479f9e334bc4a3b2959ad7639 / PR: #17277

Co-authored-by: Fatih USTA <fatihusta86@gmail.com>
Signed-off-by: Ivan Valdes <ivan@vald.es>
2024-05-09 21:41:23 -04:00
Ivan Valdes
6abc349dc9
server: Implement WithMmapSize option for backend config
Accept a third argument for NewDefaultBackend for overrides to the
BackendConfig.
Add a new function, WithMmapSize, which modifies the backend config to
provide a custom InitiamMmapSize.

Backports commit: d69adf45f9e95661966204460f019b8164aaef12 / PR: #17277

Signed-off-by: Ivan Valdes <ivan@vald.es>
2024-05-09 21:41:16 -04:00
ahrtr
66c7aab4d3 fix the data inconsistency issue by adding a txPostLockHook into the backend
Previously the SetConsistentIndex() is called during the apply workflow,
but it's outside the db transaction. If a commit happens between SetConsistentIndex
and the following apply workflow, and etcd crashes for whatever reason right
after the commit, then etcd commits an incomplete transaction to db.
Eventually etcd runs into the data inconsistency issue.

In this commit, we move the SetConsistentIndex into a txPostLockHook, so
it will be executed inside the transaction lock.
2022-04-08 20:37:34 +08:00
Bogdan Kanivets
631fa6fd65 server/storage/backend: restore original bolt db options after defrag
Problem: Defrag was implemented before custom bolt options were added.
Currently defrag doesn't restore backend options.
For example BackendFreelistType will be unset after defrag.

Solution: save bolt db options and use them in defrag.
2022-02-15 10:56:07 -08:00
Geeta Gharpure
446f7d6b6e storage/backend: Add a gauge to indicate if defrag is active (backport from 3.6) 2021-10-06 11:01:31 -07:00
Piotr Tabor
e6baf6d751 Represent bucket as object instead of []byte name.
Thanks to this change:
  - all the maps bucket -> buffer are indexed by int's instead of
string. No need to do: byte[] -> string -> hash conversion on each
access.
  - buckets are strongly typed in backend/mvcc API.
2021-05-25 09:22:25 +02:00
Piotr Tabor
8bddbdc1d6 Rename seq to bucket2seq. 2021-05-25 09:21:07 +02:00
Wilson Wang
7a7d6f94a7 server: set multiple concurrentReadTx instances share one txReadBuffer.
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2021-05-24 16:59:42 -07:00
Piotr Tabor
d99d0df5a5 Adding etcdutl test coverage. 2021-05-17 11:54:03 +02:00
Piotr Tabor
aeb9b5fc73
Merge pull request #12855 from ptabor/20210409-backend-hooks
(no)StoreV2 (Part 4): Backend hooks:  precommit updates consistency_index
2021-05-08 09:34:31 +02:00
Piotr Tabor
9f11b16b2d backend: Hooks interface & implementation. 2021-05-04 15:38:22 +02:00
wpedrak
6623c008ee server: reapply Mlock flag after defrag 2021-05-03 11:01:02 +02:00
wpedrak
927b3a3152 server: replace mlockall with Mlock in --experimental-memory-mlock
Implementation of `--experimental-memory-mlock` backed by `mlockall` syscall is replaced by `Mlock` flag (backed by mlock syscall) of bboltDB.
2021-04-29 12:08:20 +02:00
Piotr Tabor
d7d110b5a8 mvcc/backend tests: Refactor: Do not mix testing&prod code. 2021-04-21 09:43:13 +02:00
Piotr Tabor
03f55eeb2c Make NewTmpBackend use testing tmp location (so cleanup). 2021-03-26 13:54:55 +01:00
Piotr Tabor
4a5e9d1261 server: Move server files to 'server' directory.
26  git mv mvcc wal auth etcdserver etcdmain proxy embed/ lease/ server
   36  git mv go.mod go.sum server
2020-10-26 12:57:19 +01:00