Bjoern Rabenstein
1936a40e75
Minor loging improvement.
...
Change-Id: I7875d1a58ef9c5ff149f18e36f65959a4712fea2
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
192bf52c41
Evict chunkDescs, too.
...
Change-Id: I8b70f22fbf1dfcbc49f9ec391985144649e6ce9c
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
95f392fb2c
Prevent an indexing death spiral.
...
Change-Id: I86b20cd0830d02f87b2f020767257e2d3fb2033c
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
40354eaa29
Reduce directory depth by one.
...
Change-Id: I7f89df61135ff19169ed97633a662685d414c448
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
096fa0f8b2
Squash a number of TODOs.
...
- Staleness delta is no a proper function parameter and not replicated
from package ast.
- Named type 'chunks' replaced by explicit '[]chunk' to avoid confusion.
- For the same reason, replaced 'chunkDescs' by '[]*chunkDescs'.
- Verified that math.Modf is not a speed enhancement over conversion
(actually 5x slower).
- Renamed firstTimeField, lastTimeField into chunkFirstTime and
chunkLastTime.
- Verified unpin() is sufficiently goroutine-safe.
- Decided not to update archivedFingerprintToTimeRange upon series
truncation and added a rationale why.
Change-Id: I863b8d785e5ad9f71eb63e229845eacf1bed8534
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
427c8d53a5
Fix handling of empty chunkDescs while preloading chunks.
...
Change-Id: I73ce89fe0ef90c6eda78218e5be2cbfa0207c364
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
ecee5d8281
Fix head chunk persisting and a chunkDesc race condition.
...
- Head chunk persisting only happens in evictOlderThan, so do it
there. (With the previous code, it would never happen.)
- Raw accesses to chunkDesc.chunk are now done via isEvicted (with
locking).
Change-Id: I48b07b56dfea4899b50df159b4ea566954396fcd
2014-11-25 17:09:04 +01:00
Bjoern Rabenstein
6b37e47f9e
Remove unused metrics.
...
Change-Id: Icf03ba4ce92a5e38daf12930f9661daba79c83bb
2014-11-25 17:09:03 +01:00
Bjoern Rabenstein
2b4ff620aa
Return a nop iterator for series that have been purged completely.
...
Change-Id: I6e92cac4472486feefdecba8593c17867e8c710d
2014-11-25 17:09:03 +01:00
Bjoern Rabenstein
6e3a366f91
Only archive a time series when none of its chunks is pinned.
...
Change-Id: I7e4b67c34b417b8980173bc5dc3b213bd7d698e5
2014-11-25 17:09:03 +01:00
Julius Volz
bfa64248b7
Deal with missing series in preloading.
...
Change-Id: Ibf3a57b329f40a3d5e0b98464a2f45d2f1bd07bf
2014-11-25 17:09:03 +01:00
Bjoern Rabenstein
ca42a22e20
Add safety panic to seriesMap.put.
...
Change-Id: I4d4d2e45cc0f908a33eb1ae6e3ee6796adfcbd1e
2014-11-25 17:09:03 +01:00
Bjoern Rabenstein
83b4fa868d
Fix GetBoundaryValues.
...
Change-Id: I8f8bbdb88e9b24e4c37ff869126ed9343f261ce2
2014-11-25 17:08:45 +01:00
Bjoern Rabenstein
b3ed9aa7a2
Clean up start-up and shut-down.
...
Change-Id: Idff4bbb0a15a9f879bfbb3da5b1025179cab5e2c
2014-11-25 17:08:45 +01:00
Bjoern Rabenstein
4447708c9f
Fix a race in target.go.
...
Also, fix problems in shutdown.
Starting serving and shutdown still has to be cleaned up properly.
It's a mess.
Change-Id: I51061db12064e434066446e6fceac32741c4f84c
2014-11-25 17:08:45 +01:00
Bjoern Rabenstein
fd6600850a
Fix race in chunkDesc.
...
Change-Id: Id7bae115d75886e10d44184a690a76777b1531fe
2014-11-25 17:08:45 +01:00
Bjoern Rabenstein
1c53c09558
Treat empty chunkDescs properly in preloadChunksForRange.
...
Change-Id: Ida1bd3fe1f9fb0ea2d5dbb9704be926f0824f873
2014-11-25 17:08:45 +01:00
Bjoern Rabenstein
934d09f738
Fix race during shutdown.
...
Change-Id: I2f8bf48d92a14f1e5ecde27c1b138734d7653394
2014-11-25 17:08:45 +01:00
Bjoern Rabenstein
38fc24d0ed
Fix targetpool_test.go and other tests.
...
Change-Id: I91a4dd1d39e01f174e1aaae653ce1ed7aecaa624
2014-11-25 17:08:26 +01:00
Julius Volz
7f5d3c2c29
Fix and improve the fp locker.
...
Benchmark:
$ go test -bench 'Fingerprint' -test.run 'Fingerprint' -test.cpu=1,2,4
OLD
BenchmarkFingerprintLockerParallel 500000 3618 ns/op
BenchmarkFingerprintLockerParallel-2 100000 12257 ns/op
BenchmarkFingerprintLockerParallel-4 500000 10164 ns/op
BenchmarkFingerprintLockerSerial 10000000 283 ns/op
BenchmarkFingerprintLockerSerial-2 10000000 284 ns/op
BenchmarkFingerprintLockerSerial-4 10000000 288 ns/op
NEW
BenchmarkFingerprintLockerParallel 1000000 1018 ns/op
BenchmarkFingerprintLockerParallel-2 1000000 1164 ns/op
BenchmarkFingerprintLockerParallel-4 2000000 910 ns/op
BenchmarkFingerprintLockerSerial 50000000 56.0 ns/op
BenchmarkFingerprintLockerSerial-2 50000000 47.9 ns/op
BenchmarkFingerprintLockerSerial-4 50000000 54.5 ns/op
Change-Id: I3c65a43822840e7e64c3c3cfe759e1de51272581
2014-11-25 17:07:45 +01:00
Bjoern Rabenstein
7ad55ef83c
Actually close the iterator channels.
...
Change-Id: I6f6a2aef5ff55c6b2d21ad91d02ae6b0ecba4ae8
2014-11-25 17:07:45 +01:00
Bjoern Rabenstein
8fba3302bc
Bold changes to concurrency.
...
(WIP. Probably doesn't work yet.)
Change-Id: Id1537dfcca53831a1d428078a5863ece7bdf4875
2014-11-25 17:07:45 +01:00
Bjoern Rabenstein
fcdf5a8ee7
Fix bugs in chunk evict code.
...
Also, simplify code by re-looking up metric in metric map.
Change-Id: Ib2092f9184374e5a543e87d3a9f4a74fda64b193
2014-11-25 17:07:45 +01:00
Bjoern Rabenstein
7e6a03fbf9
Fix a few concurrency issues before starting to use the new fp locker.
...
Change-Id: I8615e8816e79ef0882e123163ee590c739b79d12
2014-11-25 17:07:45 +01:00
Julius Volz
db92620163
Instrument eviction and purge durations.
...
Change-Id: Ia5b2319363ad2644674c9b7a94162a89bcc296fb
2014-11-25 17:07:45 +01:00
Julius Volz
e0ee7ec7ab
Add fingerprintLocker for locking individual fingerprints.
...
Change-Id: Id41ba555715229edf7d6543f56736b82f6eff1ef
2014-11-25 17:07:45 +01:00
Julius Volz
df1b2a2422
Fix indexing latency instrumentation.
...
Change-Id: I532c170121cd2996d1a378adbb1fd551cd5a4e38
2014-11-25 17:07:44 +01:00
Bjoern Rabenstein
01dd618a20
Fix a locking bug.
...
Change-Id: I183780785991d0b4165ce9186f53eb8201fb3ed5
2014-11-25 17:07:44 +01:00
Julius Volz
a746fbb8bc
Instrument indexing: queue length, batch sizes and latencies.
...
Change-Id: I60bcbd24b160e47d418a485d8cffa39344a257c6
2014-11-25 17:07:44 +01:00
Bjoern Rabenstein
aea32b0b4b
Avoid redundant fingerprint calculation.
...
Change-Id: Ief8a165dcfa5030226953346ec9dfe4a7787df1f
2014-11-25 17:07:44 +01:00
Bjoern Rabenstein
e9ff29c547
Comment/code cleanup.
...
Change-Id: I38736e3d0fec79759a2bafa35aecf914480ff810
2014-11-25 17:07:44 +01:00
Bjoern Rabenstein
0031a448e2
Add WaitForIndexing.
...
Change-Id: I5a5c975c4246632f937413322c855bbe63d00802
2014-11-25 17:07:44 +01:00
Bjoern Rabenstein
c7aad110fb
Add an indexing queue and batch the ops.
...
Some other improvements on the way, in particular codec -> codable
renaming and addition of LookupSet methods.
Change-Id: I978f8f3f84ca8e4d39a9d9f152ae0ad274bbf4e2
2014-11-25 17:07:44 +01:00
Bjoern Rabenstein
71206dbc06
More code cleanups.
...
Add license text everywhere.
And others....
Change-Id: I11ccde267a2ef7eb366c4788ba7aeae14ba7545c
2014-11-25 17:07:44 +01:00
Julius Volz
f0d5d4bda3
Fix bug around index purging.
...
Change-Id: I8cea00e03f72bbeead2cbd2d26b34d986059ced0
2014-11-25 17:07:44 +01:00
Julius Volz
630b5a087a
Also consider on-disk fingerprints during purge.
...
This reintroduces LevelDB iterators so that we can iterate through all
the on-disk fingerprints.
Change-Id: I007ee4638d038d2a4461bbda27f30fcaad411474
2014-11-25 17:07:35 +01:00
Bjoern Rabenstein
f5f9f3514a
Major code cleanup.
...
- Make it go-vet and golint clean.
- Add comments, TODOs, etc.
Change-Id: If1392d96f3d5b4cdde597b10c8dff1769fcfabe2
2014-11-25 17:02:53 +01:00
Bjoern Rabenstein
3592dc2359
Implement series eviction.
...
Change-Id: I7a503e0ba78aae3761d032851b06f2807122b085
2014-11-25 17:02:52 +01:00
Bjoern Rabenstein
bbf49200ab
Implement methods in persistence.go.
...
Change-Id: I804cdd0b30420e171825fd86fe1281eca0d5e638
2014-11-25 17:02:23 +01:00
Bjoern Rabenstein
5a128a04a9
Major reorganization of the storage.
...
Most important, the heads file will now persist all the chunk descs,
too. Implicitly, it will serve as the persisted form of the
fp-to-series map.
Change-Id: Ic867e78f2714d54c3b5733939cc5aef43f7bd08d
2014-11-25 17:02:01 +01:00
Bjoern Rabenstein
e7cb9ddb9f
Use a sync.pool for the staging buffer in codec.go.
...
Change-Id: I1aae6847f77b5a7c75582b07c199b1943cf90552
2014-11-25 17:02:01 +01:00
Bjoern Rabenstein
4770cf76a4
Make index package more self-contained.
...
Moved interna from diskPersistence into the indexer.
TotalIndexer now called diskIndexer.
Change-Id: I6c8c62cb171f12bbd8a5474773af7786d71ba388
2014-11-25 17:02:01 +01:00
Bjoern Rabenstein
89f10e8eb2
Move to using the standard library interfaces for encoding/decoding.
...
BinaryMarshaler instead of encodable.
BinaryUnmarshaler instead of decodable.
Left 'codable' in place for lack of a better word.
Change-Id: I8a104be7d6db916e8dbc47ff95e6ff73b845ac22
2014-11-25 17:02:01 +01:00
Bjoern Rabenstein
af77d5ef0b
Added a few missing implementations in index.go.
...
Also, added closing of persistence and mem storage.
Change-Id: Iacf0d22c3520dd2584d9546984c1f8a5ed6cd54e
2014-11-25 17:02:01 +01:00
Julius Volz
cca7ebe906
Some more cleanups / obsolete code removals.
...
Change-Id: I584144ceeeedafdb114266d8a6d2513e67b1d010
2014-11-25 17:02:00 +01:00
Julius Volz
7e85711df0
Beginnings of a tiered index implementation.
...
This reintroduces a LevelDB-based metrics index.
Change-Id: I4111540301c52255a07b2f570761707a32f72c05
2014-11-25 17:02:00 +01:00
Julius Volz
8dfaa5ecd2
Remove use of freelists for chunk bufs.
...
Change-Id: Ib887fdb61e1d96da0cd32545817b925ba88831c1
2014-11-25 17:02:00 +01:00
Julius Volz
7b35e0f0b8
Use constants from math package instead of literals.
...
Change-Id: I55427ba32c2cbb32ee42ec1e3153160965ab8b3c
2014-11-25 17:02:00 +01:00
Julius Volz
15929eece2
Unpin any already loaded chunks upon preloading error.
...
Change-Id: Ib451136e3ef21bce8b814c21b66eaab727ab341b
2014-11-25 17:02:00 +01:00
Julius Volz
fd01d07589
Check that chunk buffer length fits in 16 bit.
...
Change-Id: Id086a54aa8a1990c1979e747c1c02e53bed6d447
2014-11-25 17:02:00 +01:00