cznic / lldb

github.com/cznic/lldb has moved to modernc.org/lldb
https://godoc.org/modernc.org/lldb
BSD 3-Clause "New" or "Revised" License
33 stars 1 forks source link

linter produces some warnings #3

Closed ghost closed 8 years ago

ghost commented 8 years ago

Running gometalinter --deadline=10s "./..." produces the following output. Some are cosmetics, but unchecked errors, shadowed vars might be hiding bugs.

memfiler.go:16:1:warning: pgMask is unused (deadcode)
filer.go:16:1:warning: doubleTrouble is unused (deadcode)
falloc.go:1150:7:warning: n assigned and not used (ineffassign)
filer_test.go:749:3:warning: bytes assigned and not used (ineffassign)
filer_test.go:725:3:warning: bytes assigned and not used (ineffassign)
gb.go:621::warning: cyclomatic complexity 75 of function Collate() is high (> 10) (gocyclo)
falloc.go:1396::warning: cyclomatic complexity 67 of function (*Allocator).Verify() is high (> 10) (gocyclo)
falloc_test.go:781::warning: cyclomatic complexity 46 of function TestAllocatorRnd() is high (> 10) (gocyclo)
filer_test.go:395::warning: cyclomatic complexity 44 of function testInnerFiler() is high (> 10) (gocyclo)
btree_test.go:441::warning: cyclomatic complexity 42 of function TestbTreeSeek() is high (> 10) (gocyclo)
gb.go:317::warning: cyclomatic complexity 40 of function DecodeScalars() is high (> 10) (gocyclo)
2pc_test.go:96::warning: cyclomatic complexity 37 of function TestACIDFiler0() is high (> 10) (gocyclo)
filer_test.go:238::warning: cyclomatic complexity 33 of function testFilerReadAtWriteAt() is high (> 10) (gocyclo)
falloc.go:655::warning: cyclomatic complexity 32 of function (*Allocator).Get() is high (> 10) (gocyclo)
errors.go:100::warning: cyclomatic complexity 31 of function (*ErrILSEQ).Error() is high (> 10) (gocyclo)
btree_test.go:631::warning: cyclomatic complexity 30 of function TestbTreeNext() is high (> 10) (gocyclo)
gb.go:113::warning: cyclomatic complexity 30 of function EncodeScalars() is high (> 10) (gocyclo)
btree.go:1881::warning: cyclomatic complexity 29 of function (btree).put2() is high (> 10) (gocyclo)
2pc.go:222::warning: cyclomatic complexity 28 of function (*ACIDFiler0).recoverDb() is high (> 10) (gocyclo)
btree_test.go:746::warning: cyclomatic complexity 28 of function TestbTreePrev() is high (> 10) (gocyclo)
btree_test.go:33::warning: cyclomatic complexity 27 of function verifyPageLinks() is high (> 10) (gocyclo)
falloc.go:824::warning: cyclomatic complexity 26 of function (*Allocator).realloc() is high (> 10) (gocyclo)
falloc.go:1250::warning: cyclomatic complexity 23 of function (*Allocator).verifyUsed() is high (> 10) (gocyclo)
xact_test.go:248::warning: cyclomatic complexity 23 of function TestRollbackFiler4() is high (> 10) (gocyclo)
btree_test.go:138::warning: cyclomatic complexity 23 of function testBTreePut1() is high (> 10) (gocyclo)
xact_test.go:172::warning: cyclomatic complexity 23 of function TestRollbackFiler3() is high (> 10) (gocyclo)
falloc.go:520::warning: cyclomatic complexity 22 of function (*Allocator).free2() is high (> 10) (gocyclo)
falloc_test.go:1668::warning: cyclomatic complexity 22 of function TestFltFind() is high (> 10) (gocyclo)
btree.go:2044::warning: cyclomatic complexity 22 of function (btree).extract() is high (> 10) (gocyclo)
falloc.go:1949::warning: cyclomatic complexity 22 of function (*lst).audit() is high (> 10) (gocyclo)
gb.go:554::warning: cyclomatic complexity 20 of function collateType() is high (> 10) (gocyclo)
falloc_test.go:981::warning: cyclomatic complexity 19 of function TestRollbackAllocator() is high (> 10) (gocyclo)
btree_test.go:1635::warning: cyclomatic complexity 19 of function TestBTreeSeekPrev() is high (> 10) (gocyclo)
btree_test.go:1544::warning: cyclomatic complexity 19 of function TestBTreeSeekNext() is high (> 10) (gocyclo)
gb.go:269::warning: cyclomatic complexity 18 of function encInt() is high (> 10) (gocyclo)
btree_test.go:1725::warning: cyclomatic complexity 17 of function TestBTreeSeekFirst() is high (> 10) (gocyclo)
btree_test.go:1795::warning: cyclomatic complexity 17 of function TestBTreeSeekLast() is high (> 10) (gocyclo)
btree_test.go:1099::warning: cyclomatic complexity 17 of function TestseekFirst() is high (> 10) (gocyclo)
btree_test.go:1167::warning: cyclomatic complexity 17 of function TestseekLast() is high (> 10) (gocyclo)
btree.go:1025::warning: cyclomatic complexity 16 of function (btreeIndexPage).underflow() is high (> 10) (gocyclo)
2pc.go:118::warning: cyclomatic complexity 16 of function NewACIDFiler() is high (> 10) (gocyclo)
btree.go:2140::warning: cyclomatic complexity 16 of function (btree).deleteAny() is high (> 10) (gocyclo)
falloc_test.go:1740::warning: cyclomatic complexity 16 of function TestFltHead() is high (> 10) (gocyclo)
falloc.go:1178::warning: cyclomatic complexity 16 of function (*Allocator).verifyUnused() is high (> 10) (gocyclo)
btree_test.go:1037::warning: cyclomatic complexity 15 of function TestFirst() is high (> 10) (gocyclo)
btree_test.go:271::warning: cyclomatic complexity 15 of function testBTreePut2() is high (> 10) (gocyclo)
btree_test.go:1068::warning: cyclomatic complexity 15 of function TestLast() is high (> 10) (gocyclo)
filer_test.go:148::warning: cyclomatic complexity 15 of function testFilerTruncate() is high (> 10) (gocyclo)
btree_test.go:1002::warning: cyclomatic complexity 15 of function TestExtract() is high (> 10) (gocyclo)
btree.go:1508::warning: cyclomatic complexity 15 of function (btreeDataPage).overflow() is high (> 10) (gocyclo)
btree.go:141::warning: cyclomatic complexity 14 of function (*BTree).Dump() is high (> 10) (gocyclo)
gb_test.go:159::warning: cyclomatic complexity 14 of function TestCollateScalars() is high (> 10) (gocyclo)
btree.go:1438::warning: cyclomatic complexity 14 of function (btreeDataPage).split() is high (> 10) (gocyclo)
btree_test.go:1455::warning: cyclomatic complexity 14 of function testbTreeEnumeratorInvalidating() is high (> 10) (gocyclo)
btree.go:1674::warning: cyclomatic complexity 13 of function (btreeDataPage).underflow() is high (> 10) (gocyclo)
falloc_test.go:1458::warning: cyclomatic complexity 13 of function benchmarkAllocatorRndGet() is high (> 10) (gocyclo)
falloc_test.go:1257::warning: cyclomatic complexity 13 of function benchmarkAllocatorRndFree() is high (> 10) (gocyclo)
btree.go:628::warning: cyclomatic complexity 13 of function (*BTreeEnumerator).Next() is high (> 10) (gocyclo)
btree.go:1800::warning: cyclomatic complexity 12 of function (btree).String() is high (> 10) (gocyclo)
btree.go:104::warning: cyclomatic complexity 12 of function elem() is high (> 10) (gocyclo)
gb_test.go:34::warning: cyclomatic complexity 11 of function TestEncodeDecodeScalars() is high (> 10) (gocyclo)
btree.go:1735::warning: cyclomatic complexity 11 of function (btreeDataPage).concat() is high (> 10) (gocyclo)
falloc.go:984::warning: cyclomatic complexity 11 of function (*Allocator).nfo() is high (> 10) (gocyclo)
falloc.go:430::warning: cyclomatic complexity 11 of function (*Allocator).alloc() is high (> 10) (gocyclo)
btree.go:1997::warning: cyclomatic complexity 11 of function (btree).get() is high (> 10) (gocyclo)
falloc_test.go:157::warning: cyclomatic complexity 11 of function dump() is high (> 10) (gocyclo)
btree_test.go:1725::warning: duplicate of btree_test.go:1795-1863 (dupl)
btree_test.go:1795::warning: duplicate of btree_test.go:1725-1793 (dupl)
btree.go:647::warning: duplicate of btree.go:690-712 (dupl)
btree.go:690::warning: duplicate of btree.go:647-669 (dupl)
filer.go:156::warning: duplicate of filer.go:186-192 (dupl)
filer.go:186::warning: duplicate of filer.go:156-162 (dupl)
falloc_test.go:853::warning: duplicate of falloc_test.go:884-894 (dupl)
falloc_test.go:884::warning: duplicate of falloc_test.go:936-946 (dupl)
falloc_test.go:936::warning: duplicate of falloc_test.go:853-863 (dupl)
gb_test.go:305::warning: duplicate of gb_test.go:317-326 (dupl)
gb_test.go:317::warning: duplicate of gb_test.go:305-314 (dupl)
btree_test.go:68::warning: duplicate of btree_test.go:110-126 (dupl)
btree_test.go:110::warning: duplicate of btree_test.go:68-84 (dupl)
btree_test.go:1412::warning: duplicate of falloc_test.go:1214-1239 (dupl)
falloc_test.go:1214::warning: duplicate of falloc_test.go:1415-1440 (dupl)
falloc_test.go:1415::warning: duplicate of btree_test.go:1412-1437 (dupl)
gb.go:680::warning: duplicate of gb.go:702-722 (dupl)
gb.go:702::warning: duplicate of gb.go:680-700 (dupl)
falloc_test.go:627::warning: duplicate of falloc_test.go:671-713 (dupl)
falloc_test.go:671::warning: duplicate of falloc_test.go:627-669 (dupl)
btree_test.go:1037::warning: duplicate of btree_test.go:1068-1097 (dupl)
btree_test.go:1068::warning: duplicate of btree_test.go:1037-1066 (dupl)
btree_test.go:1099::warning: duplicate of btree_test.go:1167-1233 (dupl)
btree_test.go:1167::warning: duplicate of btree_test.go:1099-1165 (dupl)
falloc.go:1051::warning: duplicate of falloc.go:1072-1090 (dupl)
falloc.go:1072::warning: duplicate of falloc.go:1051-1069 (dupl)
btree.go:397::warning: duplicate of btree.go:438-455 (dupl)
btree.go:438::warning: duplicate of btree.go:397-414 (dupl)
falloc.go:728::warning: duplicate of falloc.go:763-783 (dupl)
falloc.go:763::warning: duplicate of falloc.go:728-748 (dupl)
xact.go:149::warning: duplicate of xact.go:212-225 (dupl)
xact.go:212::warning: duplicate of xact.go:149-162 (dupl)
filer_test.go:157::warning: duplicate of filer_test.go:247-257 (dupl)
filer_test.go:247::warning: duplicate of filer_test.go:409-419 (dupl)
filer_test.go:409::warning: duplicate of filer_test.go:621-631 (dupl)
filer_test.go:621::warning: duplicate of filer_test.go:157-167 (dupl)
btree_test.go:868::warning: duplicate of btree_test.go:914-920 (dupl)
btree_test.go:914::warning: duplicate of btree_test.go:868-874 (dupl)
btree_test.go:1560::warning: duplicate of btree_test.go:1651-1722 (dupl)
btree_test.go:1651::warning: duplicate of btree_test.go:1560-1632 (dupl)
2pc.go:160::warning: declaration of "err" shadows declaration at 2pc.go:138 (vetshadow)
2pc.go:283::warning: declaration of "err" shadows declaration at 2pc.go:277 (vetshadow)
2pc_test.go:152::warning: declaration of "err" shadows declaration at 2pc_test.go:101 (vetshadow)
2pc_test.go:174::warning: declaration of "err" shadows declaration at 2pc_test.go:101 (vetshadow)
2pc_test.go:179::warning: declaration of "err" shadows declaration at 2pc_test.go:101 (vetshadow)
2pc_test.go:184::warning: declaration of "err" shadows declaration at 2pc_test.go:101 (vetshadow)
2pc_test.go:246::warning: declaration of "err" shadows declaration at 2pc_test.go:101 (vetshadow)
2pc_test.go:258::warning: declaration of "err" shadows declaration at 2pc_test.go:101 (vetshadow)
btree.go:641::warning: declaration of "err" shadows declaration at btree.go:628 (vetshadow)
btree.go:1482::warning: declaration of "err" shadows declaration at btree.go:1439 (vetshadow)
btree.go:2077::warning: declaration of "err" shadows declaration at btree.go:2044 (vetshadow)
btree_test.go:45::warning: declaration of "err" shadows declaration at btree_test.go:33 (vetshadow)
btree_test.go:69::warning: declaration of "err" shadows declaration at btree_test.go:33 (vetshadow)
btree_test.go:1301::warning: declaration of "err" shadows declaration at btree_test.go:1270 (vetshadow)
btree_test.go:1732::warning: declaration of "err" shadows declaration at btree_test.go:1727 (vetshadow)
btree_test.go:1753::warning: declaration of "err" shadows declaration at btree_test.go:1727 (vetshadow)
btree_test.go:1773::warning: declaration of "err" shadows declaration at btree_test.go:1727 (vetshadow)
btree_test.go:1802::warning: declaration of "err" shadows declaration at btree_test.go:1797 (vetshadow)
btree_test.go:1823::warning: declaration of "err" shadows declaration at btree_test.go:1797 (vetshadow)
btree_test.go:1843::warning: declaration of "err" shadows declaration at btree_test.go:1797 (vetshadow)
falloc.go:707::warning: declaration of "tag" shadows declaration at falloc.go:701 (vetshadow)
falloc.go:728::warning: declaration of "tag" shadows declaration at falloc.go:701 (vetshadow)
falloc.go:763::warning: declaration of "tag" shadows declaration at falloc.go:701 (vetshadow)
falloc.go:869::warning: declaration of "err" shadows declaration at falloc.go:824 (vetshadow)
falloc_test.go:87::warning: declaration of "e" shadows declaration at falloc_test.go:86 (vetshadow)
falloc_test.go:832::warning: declaration of "i" shadows declaration at falloc_test.go:816 (vetshadow)
falloc_test.go:838::warning: declaration of "err" shadows declaration at falloc_test.go:787 (vetshadow)
falloc_test.go:920::warning: declaration of "err" shadows declaration at falloc_test.go:787 (vetshadow)
falloc_test.go:950::warning: declaration of "err" shadows declaration at falloc_test.go:787 (vetshadow)
falloc_test.go:998::warning: declaration of "err" shadows declaration at falloc_test.go:984 (vetshadow)
falloc_test.go:1043::warning: declaration of "err" shadows declaration at falloc_test.go:984 (vetshadow)
falloc_test.go:1057::warning: declaration of "err" shadows declaration at falloc_test.go:984 (vetshadow)
falloc_test.go:1103::warning: declaration of "err" shadows declaration at falloc_test.go:1083 (vetshadow)
falloc_test.go:1282::warning: declaration of "err" shadows declaration at falloc_test.go:1263 (vetshadow)
falloc_test.go:1483::warning: declaration of "err" shadows declaration at falloc_test.go:1464 (vetshadow)
filer_test.go:188::warning: declaration of "err" shadows declaration at filer_test.go:176 (vetshadow)
filer_test.go:205::warning: declaration of "err" shadows declaration at filer_test.go:176 (vetshadow)
filer_test.go:340::warning: declaration of "e" shadows declaration at filer_test.go:265 (vetshadow)
filer_test.go:360::warning: declaration of "e" shadows declaration at filer_test.go:265 (vetshadow)
filer_test.go:381::warning: declaration of "e" shadows declaration at filer_test.go:265 (vetshadow)
xact_test.go:202::warning: declaration of "err" shadows declaration at xact_test.go:180 (vetshadow)
xact_test.go:207::warning: declaration of "err" shadows declaration at xact_test.go:180 (vetshadow)
xact_test.go:217::warning: declaration of "err" shadows declaration at xact_test.go:180 (vetshadow)
xact_test.go:225::warning: declaration of "err" shadows declaration at xact_test.go:180 (vetshadow)
xact_test.go:229::warning: declaration of "err" shadows declaration at xact_test.go:180 (vetshadow)
xact_test.go:288::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
xact_test.go:299::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
xact_test.go:304::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
xact_test.go:308::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
xact_test.go:319::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
xact_test.go:328::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
xact_test.go:336::warning: declaration of "err" shadows declaration at xact_test.go:263 (vetshadow)
btree_test.go:441::error: TestbTreeSeek has malformed name: first letter after 'Test' must not be lowercase (vet)
btree_test.go:631::error: TestbTreeNext has malformed name: first letter after 'Test' must not be lowercase (vet)
btree_test.go:746::error: TestbTreePrev has malformed name: first letter after 'Test' must not be lowercase (vet)
btree_test.go:1099::error: TestseekFirst has malformed name: first letter after 'Test' must not be lowercase (vet)
btree_test.go:1167::error: TestseekLast has malformed name: first letter after 'Test' must not be lowercase (vet)
2pc.go:108:1:warning: comment on exported function NewACIDFiler should be of the form "NewACIDFiler ..." (golint)
2pc_test.go:30:40:warning: exported func NewTruncFiler returns unexported type *lldb.truncFiler, which can be annoying to use (golint)
btree.go:21:2:warning: don't use leading k in Go names; const kData should be data (golint)
btree.go:22:2:warning: don't use leading k in Go names; const kIndex should be index (golint)
btree.go:23:2:warning: don't use leading k in Go names; const kKV should be kV (golint)
btree.go:24:2:warning: don't use leading k in Go names; const kSz should be sz (golint)
btree.go:392:1:warning: comment on exported method BTree.SeekFirst should be of the form "SeekFirst ..." (golint)
btree.go:433:1:warning: comment on exported method BTree.SeekLast should be of the form "SeekLast ..." (golint)
btree.go:915:1:warning: receiver name q should be consistent with previous receiver name p for btreeIndexPage (golint)
btree.go:959:1:warning: receiver name q should be consistent with previous receiver name p for btreeIndexPage (golint)
btree.go:1246:1:warning: receiver name q should be consistent with previous receiver name p for btreeDataPage (golint)
btree.go:1271:1:warning: receiver name q should be consistent with previous receiver name p for btreeDataPage (golint)
btree.go:1557:11:warning: if block ends with a return statement, so drop this else and outdent its block (golint)
errors.go:51:1:warning: comment on exported type ErrType should be of the form "ErrType ..." (with optional leading article) (golint)
falloc.go:733:5:warning: should replace off += 1 with off++ (golint)
falloc.go:742:5:warning: should replace off += 1 with off++ (golint)
falloc.go:1064:3:warning: should replace off += 1 with off++ (golint)
filer.go:177:1:warning: comment on exported method InnerFiler.Sync should be of the form "Sync ..." (golint)
filer_test.go:397:3:warning: don't use ALL_CAPS in Go names; use CamelCase (golint)
filer_test.go:398:3:warning: don't use ALL_CAPS in Go names; use CamelCase (golint)
xact.go:401:1:warning: comment on exported method RollbackFiler.BeginUpdate should be of the form "BeginUpdate ..." (golint)
xact.go:419:1:warning: comment on exported method RollbackFiler.Close should be of the form "Close ..." (golint)
xact.go:453:1:warning: comment on exported method RollbackFiler.EndUpdate should be of the form "EndUpdate ..." (golint)
xact.go:499:1:warning: comment on exported method RollbackFiler.Name should be of the form "Name ..." (golint)
xact.go:507:1:warning: comment on exported method RollbackFiler.PunchHole should be of the form "PunchHole ..." (golint)
xact.go:527:1:warning: comment on exported method RollbackFiler.ReadAt should be of the form "ReadAt ..." (golint)
xact.go:542:1:warning: comment on exported method RollbackFiler.Rollback should be of the form "Rollback ..." (golint)
xact.go:578:1:warning: comment on exported method RollbackFiler.Size should be of the form "Size ..." (golint)
xact.go:586:1:warning: comment on exported method RollbackFiler.Sync should be of the form "Sync ..." (golint)
xact.go:594:1:warning: comment on exported method RollbackFiler.Truncate should be of the form "Truncate ..." (golint)
xact.go:606:1:warning: comment on exported method RollbackFiler.WriteAt should be of the form "WriteAt ..." (golint)
2pc.go:204:33:warning: f can be io.Reader (interfacer)
falloc.go:1723:20:warning: fi can be io.ReaderAt (interfacer)
falloc.go:1778:39:warning: fi can be io.WriterAt (interfacer)
xact.go:345:2:warning: unused struct field github.com/cznic/lldb.RollbackFiler.parent (structcheck)
2pc.go:102:2:warning: unused struct field github.com/cznic/lldb.ACIDFiler0.peakBitFilerPages (structcheck)
2pc.go:27:6:warning: struct acidWriter0 could have size 72 (currently 80) (aligncheck)
2pc.go:97:6:warning: struct ACIDFiler0 could have size 72 (currently 80) (aligncheck)
falloc.go:287:6:warning: struct Allocator could have size 328 (currently 336) (aligncheck)
xact.go:337:6:warning: struct RollbackFiler could have size 136 (currently 144) (aligncheck)
btree.go:1040:26:warning: unnecessary conversion (unconvert)
btree.go:1052:32:warning: unnecessary conversion (unconvert)
btree.go:1055:64:warning: unnecessary conversion (unconvert)
btree.go:1869:9:warning: unnecessary conversion (unconvert)
errors.go:48:58:warning: unnecessary conversion (unconvert)
falloc.go:1209:70:warning: unnecessary conversion (unconvert)
gb.go:185:25:warning: unnecessary conversion (unconvert)
memfiler.go:19:2:warning: unused global variable pgMask (varcheck)
2pc_test.go:45:17:warning: error return value not checked (f.fake.Truncate(sz)) (errcheck)
2pc_test.go:107:18:warning: error return value not checked (defer os.Remove(wal.Name())) (errcheck)
2pc_test.go:117:18:warning: error return value not checked (defer os.Remove(db.Name())) (errcheck)
all_test.go:35:16:warning: error return value not checked (os.Stderr.Sync()) (errcheck)
all_test.go:46:16:warning: error return value not checked (os.Stderr.Sync()) (errcheck)
btree.go:2328:15:warning: error return value not checked (root.clear2(a, ip.child(i))) (errcheck)
btree_test.go:373:11:warning: error return value not checked (tree.put(nil, a, bytes.Compare, k[:], v, true)) (errcheck)
btree_test.go:411:11:warning: error return value not checked (tree.put(nil, a, bytes.Compare, k[:], v, true)) (errcheck)
btree_test.go:417:11:warning: error return value not checked (tree.get(a, buf, bytes.Compare, k[:])) (errcheck)
btree_test.go:448:11:warning: error return value not checked (tree.Set(enc8(10*i), enc8(10*i+1))) (errcheck)
btree_test.go:654:11:warning: error return value not checked (tree.Set(enc8(10*i), enc8(10*i+1))) (errcheck)
btree_test.go:769:11:warning: error return value not checked (tree.Set(enc8(10*i), enc8(10*i+1))) (errcheck)
btree_test.go:988:11:warning: error return value not checked (tree.Dump(&b)) (errcheck)
btree_test.go:1004:8:warning: error return value not checked (bt.Set([]byte("a"), []byte("b"))) (errcheck)
btree_test.go:1005:8:warning: error return value not checked (bt.Set([]byte("c"), []byte("d"))) (errcheck)
btree_test.go:1006:8:warning: error return value not checked (bt.Set([]byte("e"), []byte("f"))) (errcheck)
btree_test.go:1044:8:warning: error return value not checked (bt.Set([]byte("a"), []byte("b"))) (errcheck)
btree_test.go:1045:8:warning: error return value not checked (bt.Set([]byte("c"), []byte("d"))) (errcheck)
btree_test.go:1075:8:warning: error return value not checked (bt.Set([]byte("a"), []byte("b"))) (errcheck)
btree_test.go:1076:8:warning: error return value not checked (bt.Set([]byte("c"), []byte("d"))) (errcheck)
btree_test.go:1107:8:warning: error return value not checked (bt.Set([]byte("c"), []byte("d"))) (errcheck)
btree_test.go:1132:8:warning: error return value not checked (bt.Set([]byte("a"), []byte("b"))) (errcheck)
btree_test.go:1175:8:warning: error return value not checked (bt.Set([]byte("a"), []byte("b"))) (errcheck)
btree_test.go:1200:8:warning: error return value not checked (bt.Set([]byte("c"), []byte("d"))) (errcheck)
btree_test.go:1278:14:warning: error return value not checked (f.EndUpdate()) (errcheck)
btree_test.go:1302:15:warning: error return value not checked (f.EndUpdate()) (errcheck)
btree_test.go:1337:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
btree_test.go:1344:15:warning: error return value not checked (defer f.Close()) (errcheck)
btree_test.go:1367:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
btree_test.go:1374:15:warning: error return value not checked (defer f.Close()) (errcheck)
btree_test.go:1414:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
btree_test.go:1421:15:warning: error return value not checked (defer f.Close()) (errcheck)
btree_test.go:1428:17:warning: error return value not checked (defer wal.Close()) (errcheck)
falloc.go:341:16:warning: error return value not checked (a.f.Rollback()) (errcheck)
falloc_test.go:175:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:190:15:warning: error return value not checked (defer g.Close()) (errcheck)
falloc_test.go:553:16:warning: error return value not checked (a.flt.setHead(2, 1, a.f)) (errcheck)
falloc_test.go:554:16:warning: error return value not checked (a.flt.setHead(4, 2, a.f)) (errcheck)
falloc_test.go:1104:15:warning: error return value not checked (f.EndUpdate()) (errcheck)
falloc_test.go:1139:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
falloc_test.go:1146:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:1169:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
falloc_test.go:1176:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:1216:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
falloc_test.go:1223:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:1230:17:warning: error return value not checked (defer wal.Close()) (errcheck)
falloc_test.go:1284:15:warning: error return value not checked (f.EndUpdate()) (errcheck)
falloc_test.go:1305:15:warning: error return value not checked (f.EndUpdate()) (errcheck)
falloc_test.go:1340:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
falloc_test.go:1347:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:1370:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
falloc_test.go:1377:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:1417:20:warning: error return value not checked (defer os.RemoveAll(dir)) (errcheck)
falloc_test.go:1424:15:warning: error return value not checked (defer f.Close()) (errcheck)
falloc_test.go:1431:17:warning: error return value not checked (defer wal.Close()) (errcheck)
falloc_test.go:1485:15:warning: error return value not checked (f.EndUpdate()) (errcheck)
falloc_test.go:1507:15:warning: error return value not checked (f.EndUpdate()) (errcheck)
falloc_test.go:1541:11:warning: error return value not checked (os.Remove(testDbName)) (errcheck)
falloc_test.go:1549:10:warning: error return value not checked (f.Close()) (errcheck)
falloc_test.go:1550:12:warning: error return value not checked (os.Remove(testDbName)) (errcheck)
falloc_test.go:1573:11:warning: error return value not checked (os.Remove(testDbName)) (errcheck)
falloc_test.go:1580:10:warning: error return value not checked (f.Close()) (errcheck)
falloc_test.go:1581:12:warning: error return value not checked (os.Remove(testDbName)) (errcheck)
falloc_test.go:1621:11:warning: error return value not checked (os.Remove(testDbName)) (errcheck)
falloc_test.go:1622:11:warning: error return value not checked (os.Remove(walName)) (errcheck)
falloc_test.go:1629:10:warning: error return value not checked (f.Close()) (errcheck)
falloc_test.go:1630:12:warning: error return value not checked (os.Remove(testDbName)) (errcheck)
falloc_test.go:1639:12:warning: error return value not checked (wal.Close()) (errcheck)
falloc_test.go:1640:12:warning: error return value not checked (os.Remove(walName)) (errcheck)
filer_test.go:109:10:warning: error return value not checked (f.Close()) (errcheck)
filer_test.go:120:15:warning: error return value not checked (f.BeginUpdate()) (errcheck)
filer_test.go:129:15:warning: error return value not checked (f.BeginUpdate()) (errcheck)
filer_test.go:131:10:warning: error return value not checked (f.Close()) (errcheck)
filer_test.go:726:12:warning: error return value not checked (f.WriteAt(data[:n], int64(v))) (errcheck)
filer_test.go:750:12:warning: error return value not checked (f.WriteAt(data[:n], int64(v))) (errcheck)
filer_test.go:756:11:warning: error return value not checked (f.ReadAt(data, int64(v))) (errcheck)
cznic commented 8 years ago

@deuter0n

Overhelming :-(

If you would like to volunteer and send me bite sized PRs to incrementally fix the non-cosmetic items, I would be more than happy to review, test and merge them when ok.

ghost commented 8 years ago

:) Don't worry I didn't expect anything.

I'm considering using this db for my project, I like it because I can hook block encryption in OSFiler. Added some PR #4 #5 #6 #7 #8 #9 #10 #11 .

ghost commented 8 years ago

Some questions:

for _, i := range rand.Perm(1<<20) {
    k := make([]byte, 4)
    binary.BigEndian.PutUint32(k, uint32(i))
    if e = btree.Set(k, nil); e != nil {
        log.Fatal(e)
    }
}
cznic commented 8 years ago

Added some PR #4 #5 #6 #7 #8 #9 #10 #11 .

Wow! Thank you very much. This will need some time, hopefully this weekend...

what's the intended usage of IndexSeek()

IndexSeek is like Seek but it can use a different comparator/collating function than the one used when the Btree was created. It's not yet used by none of my projects ATM, but IIRC, it's intended use is for seeking in compound indexes (by ql).

does it need vacuum ?

I would say no, but the client code must manually deallocate anything unused/unreachable otherwise the storage will leak space. However, if there is free space in the middle of a lldb DB and anything still allocated after that free space, the DB cannot shrink because the Allocator handles are always stable.

So the more precise answer is that any free space at the end of the DB is automatically freed, while any free space in the middle of a DB is hopefully eventually allocated again when the ratio of inserts to deletes gets positive again. Admittedly, that may never happen after some initial burst.

To rearrange allocated objects such that no free space is left in the middle of the DB is not directly feasible by lldb itself as it has no knowledge about any references between those objects and which would have to be updated when performing such "compacting GC". However, it would be possible to implement such generic STW collector if it is passed

and there's enough free disk space to switch to the new (out-of-place) DB.

cznic commented 8 years ago

Only now seeing the edited post with the added question, will look into it too.

Unfortunately, GitHub does not send any notifications when a post is edited and I replied to the original one only. I suggest to simply add a new message in this cases.

cznic commented 8 years ago

All PRs merged, BTree issue tracked separately in #12. Closing, but please feel free to let me know if there's some oversight. Thank you.