39 Commits

Author SHA1 Message Date
Gyu-Ho Lee
6c5dc28d0f Merge pull request #4043 from gyuho/storage_range_all_unsynced
storage: range all unsynced at once
2015-12-28 14:45:40 -07:00
Gyu-Ho Lee
ecc3e15a46 storage: delete RangeHistory
This has been replaced by operations inside `syncWatchings`.
2015-12-28 11:37:32 -08:00
Gyu-Ho Lee
df0c2e6842 storage: remove unnecessary math/rand seed
As @jonboulle pointed out at
https://github.com/coreos/etcd/pull/4070/files#r48441847:

> math/rand is unrelated to crypto/rand; the latter reads from /dev/urandom and
> is relying on the kernel's PRNG. Just remove the seed entirely.
2015-12-25 09:55:11 -08:00
Gyu-Ho Lee
84d777305d storage: use only one mutex for store struct
Mutex is a variable, which means there needs to be only one mutex
value per scope. We don't need a separate mutex inside store struct,
**if we assume that `TxnPut` and `TxnRange` are called ONLY ONCE
per transaction (between `TxnBegin` and `TxnEnd`)**, as documented.
2015-12-21 11:42:40 -08:00
Hitoshi Mitake
af2569c2d8 storage, test: unlock transaction in the retry loop 2015-12-17 10:35:03 +09:00
Gyu-Ho Lee
891cdd56b4 storage: newFakeStore to return only 1
This changes newFakeStore function to return only 1 because two other arguments
are already in the first return storage struct.
2015-12-13 17:46:47 -08:00
Gyu-Ho Lee
d55ab7798b storage: change var names from 'index'
Having the same variable name as 'index' type
can be confusing and shadowing other variables.
This gives different variable names to 'index' variables.
2015-12-12 16:37:24 -08:00
Xiang Li
a0eca5fd37 storage: make RestoreContinueUnfinishedCompaction more reliable 2015-12-04 11:48:46 -08:00
Yicheng Qin
2f74f76025 storage: remove the event concept from key-value layer
The point is to decouple the key-value storage layer and the
event notification layer clearly. It gives the watchableKV the
flexibility to define whatever event structure it wants without
breaking the ondisk format at key-value storage layer.

Changes:

1. change the format of key and value stored in backend

Store KeyValue struct instead of Event struct in backend value for
better abstraction as xiang suggests. And record the corresponded
action in the backend key.

2. Remove word 'event' from functions
2015-11-17 20:35:49 -08:00
Yicheng Qin
59b5dabc66 storage: extend wait timeout for execution
Extend timeout to pass always in traivs.
2015-10-30 17:44:31 -07:00
Xiang Li
6556bf1643 storage: remove the endRev of watcher 2015-10-17 15:59:49 -07:00
Xiang Li
21179d929f Merge pull request #3616 from yichengq/storage-txn
storage: hold batchTx lock during KV txn
2015-10-05 17:12:52 -07:00
Xiang Li
0aa2f1192a storage: add metrics for db total size 2015-10-05 16:56:30 -07:00
Yicheng Qin
c97dda766e storage: hold batchTx lock during KV txn
One txn is treated as atomic, and might contain multiple Put/Delete/Range
operations. For now, between these operations, we might call forecCommit
to sync the change to disk, or backend may commit it in background.
Thus the snapshot state might contains an unfinished multiple objects
transaction, which is dangerous if database is restored from the snapshot.

This PR makes KV txn hold batchTx lock during the process and avoids
commit to happen.
2015-10-03 16:01:05 -07:00
Yicheng Qin
36f4303fc3 storage/etcdserver: update KV.Snapshot function
When using Snapshot function, it is expected:
1. know the size of snapshot before writing data
2. split snapshot-ready phase and write-data phase. so we could cut
snapshot first and write data later.

Update its interface to fit the requirement of etcdserver.
2015-10-03 10:15:23 -07:00
Xiang Li
385e17583f storage: fix hash by iterating kv 2015-09-23 11:28:33 -07:00
Yicheng Qin
d72914c36f storage: clarify comment for store.RangeEvents and fix related bugs
Change to the function:
1. specify the meaning of startRev and endRev parameters
2. specify the meaning of returned nextRev

Moreover, it adds unit tests for the function.
2015-09-19 23:17:03 -07:00
Jonathan Boulle
7848ac3979 *: add missing license headers 2015-09-15 14:09:01 -07:00
Xiang Li
6d1f0ce89f storage: add rev into kv interface 2015-09-15 12:11:00 -07:00
Yicheng Qin
ec43e0a4c3 storage: introduce WatchableKV and watch feature
WatchableKV is an interface upon KV, and supports watch feature.
2015-09-14 23:53:03 -07:00
Xiang Li
3f18ded10a *: v3api index->revision 2015-09-04 10:41:20 -07:00
Yicheng Qin
215f27c2f5 storage: add mock tests for store struct 2015-09-04 08:53:49 -07:00
Yicheng Qin
0d38c13990 storage: use temp path to handle test file 2015-08-26 15:01:41 -07:00
Yicheng Qin
9c0c314425 storage: add functional tests for the package
It adds and reorganize tests to construct functional tests.
2015-08-23 20:59:06 -07:00
Tyler Neely
acd7a92f03 storage: reversion -> revision 2015-08-20 08:39:07 -07:00
Xiang Li
53a77fa519 *: tnx -> txn 2015-07-24 23:21:09 +08:00
Xiang Li
ccca2b04da storage: save version 2015-06-29 13:15:09 -07:00
Yicheng Qin
148394f66f storage: fix schedule compaction bug in recover process
It uses wrong schedule compaction reversion before.
2015-06-18 11:11:37 -07:00
Yicheng Qin
26a09d8479 storage: enhance TestRestore and kill TODO 2015-06-18 10:37:12 -07:00
Yicheng Qin
80a59f00b7 storage: fix limit mismatch in Range func 2015-06-17 17:43:08 -07:00
Yicheng Qin
93f477944b storage: return ErrFutureRev if rev is a future one 2015-06-17 17:42:43 -07:00
Yicheng Qin
94924d04db storage: add TestRangeBadRev 2015-06-17 16:22:28 -07:00
Yicheng Qin
9ad5e1e64f storage: kill TODO in TestRange 2015-06-17 15:58:28 -07:00
Xiang Li
ba9a46aa02 storage: initial snapshot and restore
Snapshot takes an io.Writer and writes the entire backend data to
the given writer. Snapshot writes a consistent view and does not
block other storage operations.

Restore restores the in-memory states (index and book keeping) of
the storage from the backend data.
2015-06-10 11:32:10 -07:00
Xiang Li
f47ed4a364 storage: initial compact 2015-06-05 09:22:44 -07:00
Xiang Li
d417b36e5d storage: refactor key_index 2015-05-31 15:24:04 -07:00
Xiang Li
cbb8b9bb08 stroage: add tnx id 2015-05-27 10:35:51 -07:00
Xiang Li
93ecf36855 storage: support tnx 2015-05-27 09:31:11 -07:00
Xiang Li
9db360387d storage: support Range 2015-05-27 09:31:11 -07:00