Remove unused code/cleanup engine package

pull/9349/head
Edd Robinson 2018-01-20 13:56:45 +00:00
parent 030fdc7966
commit 90903fa6ed
10 changed files with 11 additions and 158 deletions

View File

@ -10,14 +10,9 @@ import (
"fmt"
)
const (
// booleanUncompressed is an uncompressed boolean format.
// Not yet implemented.
booleanUncompressed = 0
// booleanCompressedBitPacked is an bit packed format using 1 bit per boolean
booleanCompressedBitPacked = 1
)
// Note: an uncompressed boolean format is not yet implemented.
// booleanCompressedBitPacked is a bit packed format using 1 bit per boolean
const booleanCompressedBitPacked = 1
// BooleanEncoder encodes a series of booleans to an in-memory buffer.
type BooleanEncoder struct {

View File

@ -514,15 +514,6 @@ func (c *Cache) Split(n int) []*Cache {
return caches
}
// unsortedKeys returns a slice of all keys under management by the cache. The
// keys are not sorted.
func (c *Cache) unsortedKeys() [][]byte {
c.mu.RLock()
store := c.store
c.mu.RUnlock()
return store.keys(false)
}
// Values returns a copy of all values, deduped and sorted, for the given key.
func (c *Cache) Values(key []byte) Values {
var snapshotEntries *entry

View File

@ -443,7 +443,7 @@ func TestCache_CacheSnapshot(t *testing.T) {
}
// Create another snapshot
snapshot, err = c.Snapshot()
_, err = c.Snapshot()
if err != nil {
t.Fatalf("failed to snapshot cache: %v", err)
}
@ -454,7 +454,7 @@ func TestCache_CacheSnapshot(t *testing.T) {
c.ClearSnapshot(true)
snapshot, err = c.Snapshot()
_, err = c.Snapshot()
if err != nil {
t.Fatalf("failed to snapshot cache: %v", err)
}

View File

@ -122,15 +122,3 @@ func Digest(dir string, w io.WriteCloser) error {
MaxTime: math.MaxInt64,
}, w)
}
type rwPair struct {
r *TSMReader
w TSMWriter
outf *os.File
}
func (rw *rwPair) close() {
rw.r.Close()
rw.w.Close()
rw.outf.Close()
}

View File

@ -1233,7 +1233,6 @@ func (e *Engine) DeleteSeriesRange(itr tsdb.SeriesIterator, min, max int64) erro
if err := e.deleteSeriesRange(batch, min, max); err != nil {
return err
}
batch = batch[:0]
}
e.index.Rebuild()
@ -2771,40 +2770,6 @@ func SeriesAndFieldFromCompositeKey(key []byte) ([]byte, []byte) {
return key[:sep], key[sep+len(keyFieldSeparator):]
}
// readDir recursively reads all files from a path.
func readDir(root, rel string) ([]string, error) {
// Open root.
f, err := os.Open(filepath.Join(root, rel))
if err != nil {
return nil, err
}
defer f.Close()
// Read all files.
fis, err := f.Readdir(-1)
if err != nil {
return nil, err
}
// Read all subdirectories and append to the end.
var paths []string
for _, fi := range fis {
// Simply append if it's a file.
if !fi.IsDir() {
paths = append(paths, filepath.Join(rel, fi.Name()))
continue
}
// Read and append nested file paths.
children, err := readDir(root, filepath.Join(rel, fi.Name()))
if err != nil {
return nil, err
}
paths = append(paths, children...)
}
return paths, nil
}
func varRefSliceContains(a []influxql.VarRef, v string) bool {
for _, ref := range a {
if ref.Val == v {

View File

@ -815,37 +815,6 @@ func (f *FileStore) BlockCount(path string, idx int) int {
return 0
}
// walkFiles calls fn for each file in filestore in parallel.
func (f *FileStore) walkFiles(fn func(f TSMFile) error) error {
// Copy the current TSM files to prevent a slow walker from
// blocking other operations.
f.mu.RLock()
files := make([]TSMFile, len(f.files))
copy(files, f.files)
f.mu.RUnlock()
// struct to hold the result of opening each reader in a goroutine
errC := make(chan error, len(files))
for _, f := range files {
go func(tsm TSMFile) {
if err := fn(tsm); err != nil {
errC <- fmt.Errorf("file %s: %s", tsm.Path(), err)
return
}
errC <- nil
}(f)
}
for i := 0; i < cap(errC); i++ {
res := <-errC
if res != nil {
return res
}
}
return nil
}
// We need to determine the possible files that may be accessed by this query given
// the time range.
func (f *FileStore) cost(key []byte, min, max int64) query.IteratorCost {
@ -1125,23 +1094,6 @@ func (c *KeyCursor) Close() {
c.current = nil
}
// hasOverlappingBlocks returns true if blocks have overlapping time ranges.
// This result is computed once and stored as the "duplicates" field.
func (c *KeyCursor) hasOverlappingBlocks() bool {
if len(c.seeks) == 0 {
return false
}
for i := 1; i < len(c.seeks); i++ {
prev := c.seeks[i-1]
cur := c.seeks[i]
if prev.entry.MaxTime >= cur.entry.MinTime {
return true
}
}
return false
}
// seek positions the cursor at the given time.
func (c *KeyCursor) seek(t int64) {
if len(c.seeks) == 0 {
@ -1353,11 +1305,6 @@ func (a tsmReaders) Len() int { return len(a) }
func (a tsmReaders) Less(i, j int) bool { return a[i].Path() < a[j].Path() }
func (a tsmReaders) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
type stream struct {
c chan seriesKey
v seriesKey
}
type seriesKey struct {
key []byte
typ byte

View File

@ -18,14 +18,9 @@ import (
"github.com/influxdata/influxdb/pkg/bits"
)
const (
// floatUncompressed is an uncompressed format using 8 bytes per value.
// Not yet implemented.
floatUncompressed = 0
// floatCompressedGorilla is a compressed format using the gorilla paper encoding
floatCompressedGorilla = 1
)
// Note: an uncompressed format is not yet implemented.
// floatCompressedGorilla is a compressed format using the gorilla paper encoding
const floatCompressedGorilla = 1
// uvnan is the constant returned from math.NaN().
const uvnan = 0x7FF8000000000001

View File

@ -12,14 +12,10 @@ import (
"github.com/golang/snappy"
)
const (
// stringUncompressed is a an uncompressed format encoding strings as raw bytes.
// Not yet implemented.
stringUncompressed = 0
// Note: an uncompressed format is not yet implemented.
// stringCompressedSnappy is a compressed encoding using Snappy compression
stringCompressedSnappy = 1
)
// stringCompressedSnappy is a compressed encoding using Snappy compression
const stringCompressedSnappy = 1
// StringEncoder encodes multiple strings into a byte slice.
type StringEncoder struct {

View File

@ -341,24 +341,6 @@ func (t *Tombstoner) prepareV4() error {
return nil
}
// writeTombstoneV4 writes v3 files that are concatenated together. A v4 header is
// written to indicated this is a v4 file.
func (t *Tombstoner) writeTombstoneV4(tombstones []Tombstone) error {
if err := t.prepareV4(); err == errIncompatibleVersion {
return t.writeTombstoneV3(tombstones)
} else if err != nil {
return err
}
for _, ts := range tombstones {
if err := t.writeTombstone(t.gz, ts); err != nil {
return err
}
}
return t.commit()
}
func (t *Tombstoner) commit() error {
// No pending writes
if t.pendingFile == nil {

View File

@ -246,12 +246,6 @@ func NewDiskIndexWriter(f *os.File) IndexWriter {
return &directIndex{fd: f, w: bufio.NewWriterSize(f, 1024*1024)}
}
// indexBlock represent an index information for a series within a TSM file.
type indexBlock struct {
key []byte
entries *indexEntries
}
type syncer interface {
Name() string
Sync() error