Compare commits

..

4486 commits

Author SHA1 Message Date
Fletcher Haynes
c38210bef5
Add version checkin (#2413)
* Initial commit of code to do a version check-in on startup

* Add json tag to the response struct for version check

* Adjusted version check response types

* Changed error message in version check-in goroutine to use the logger. Changed URL to prod from dev.

* Updated version checkin URL to be analytics

Co-authored-by: Fletcher Haynes <fletcher.haynes@featurebase.com>
2023-01-19 10:52:04 -08:00
Pat Okeeffe
7386f13159
implement left join (fb-1888) (#2420)
* implement left join

* fixed failing test
2023-01-19 10:05:34 -06:00
Jacob Brinlee
17cdc58d80
SUP-288 (#2414)
* adding kafka consumer config options (--kafka-max-poll-interval, --kafka-session-timeout,  --kafka-group-instance-id, --kafka-socket-keepalive-enable, and --consumer-close-timeout)

* wrapping consumer.Close() in timeout. Will wait consumer-close-timeout seconds before forcing consumer to exit

* clean up logs
2023-01-18 17:42:19 -06:00
Travis Turner
cf72bfa16f
Refactor CLI (#2417)
This commit moves the cli out of the `ctl` package and into its own
`cli` package. It also adds some basic tests for expected input.

Finally, it fixes a bug which was causing intentional line feeds to be
ignored, which was a problem with the BULK INSERT command.
2023-01-18 14:27:45 -06:00
pokeeffe-molecula
b6e642338a
make the count....count (#2416) 2023-01-18 10:35:14 -06:00
HHans09
2fccb87dcf
Fb 1876 : Implement Replicate() func (#2410)
* fb-1876 : creating Replicate fun

* fb-1876: creating string replicate func

* Fb-1876: String Replicate func

* Fb-1876: String Replicate func
2023-01-17 16:58:55 -05:00
Travis Turner
d971cfc269
Database isolation: Balancer (#2407)
* Database isolation: Balancer

Remove naive Balancer

remove debugging lines

Thread dax.Transaction through Controller

Change role to roleType

Swap out Balancer interface with new one

Standardize InvalidTransaction error

Add some interface comments

* Remove type.Worker; replace with type.Address

* Remove database validate from Queryer

This is already being handled in the `CreateTable()` method. Prior
to doing that validation, we were getting a panic, but that's no longer
the case.

* Remove dax.TableQualifier; replace with dax.QualifiedDatabaseID

* Update IDK test to create database
2023-01-17 11:57:58 -06:00
pokeeffe-molecula
c620aae350
implement CREATE/ALTER/DROP VIEW (fb-1592) (#2408)
* implement CREATE/ALTER/DROP VIEW

* fixed failing test

* another failing test

* fixed some broken serverless tests
2023-01-13 18:57:31 -06:00
rachithrr
f99be656df
FB-1827: Implement Len() (#2406) 2023-01-12 18:01:06 -05:00
tgruben
4cd3cb02a2
string support for dataframe (#2405)
* String support for arrow
2023-01-12 12:58:19 -06:00
pokeeffe-molecula
7f6ea0e6e5
introduce performance counters and system table fanout, plus refactor metrics (#2363)
* performance counters

* first cut of perf counters and system table fanout and a wire protocol
* significantly refactored prometheus support; removed statsd and exprvar

* removed node_id

* put dax subquery test back

* Change Translator.TranslateFieldIDs method to take a dax.TableKeyer

There are a bunch of other calls to the Translator interface methods
with currently take an `index string`, and those need to be converted to
dax.TableKeyer as well. But I need to review each call, because in at
least one place I noticed one being called with `result.Index` instead
of with the qtbl available. And I don't yet know how those could be
different.

Co-authored-by: Travis Turner <travis@molecula.com>
2023-01-11 20:37:00 -06:00
Коrd Campbell
17cb2cbb77
fixes FB-1873 (#2400)
Co-authored-by: Kord Campbell <kord@Bob.local>
Co-authored-by: Fletcher Haynes <fletcher@capitalprawn.com>
2023-01-11 16:48:03 -08:00
pokeeffe-molecula
af475a27f2
fix sum aggregate (fb-1874) (#2404)
* handle sum aggregates with ints; handle escaped quotes in blob literals

* added test ceoverage

* skip subquery test for dax
2023-01-11 15:46:41 -06:00
rachithrr
f590227471
FB-1814: Implement ASCII() (#2378)
* FB-1814: Implement ASCII()
2023-01-11 12:32:27 -05:00
Julio Martinez
3f91cc3dd1
Create main log with 640 permissions, leave all other logs the same. (#2402)
Co-authored-by: Julio <julio.martinez@featurebase.com>
2023-01-10 14:52:33 -08:00
Julio Martinez
581a4d19a4
Add dd tracer and associated config options (#2403)
Co-authored-by: Julio <julio.martinez@featurebase.com>
2023-01-10 14:06:09 -08:00
pokeeffe-molecula
4750c2215f
include space_used column in show table output (#2401) 2023-01-10 11:03:57 -06:00
Lory Cloutier
da74f0a312
Implement SPACE() function for SQL3 (#2399)
FB-1861
2023-01-09 12:20:04 -06:00
pokeeffe-molecula
18fe6a35f6
handle insert into timequantum fields with default 'now' time (fb-1868) (#2398)
* handle insert into timequantum fields with default 'now' time

* allocate on the stack
2023-01-06 16:58:37 -06:00
Jacob Brinlee
c9ce26ce96
adding more error handling for rbf (#2395)
* adding more error handling for rbf

Co-authored-by: Jacob Brinlee <jacobbrinlee@Jacobs-MBP.attlocal.net>
2023-01-06 14:04:17 -06:00
pokeeffe-molecula
164aac509e
added space_used columns (#2397)
added space_used columns to show tables and fb_cluster_nodes
2023-01-06 11:43:17 -06:00
pokeeffe-molecula
9f042216a7
Bug fix round up (fb-1841, fb-1819, fb-1867) (#2396)
* check root operator after optimize

* round of bug fixes
2023-01-05 20:13:26 -06:00
Travis Turner
b5dd3ea02e
Change JSON tag name on WireQueryResponse from execution-time to exec_time (#2394)
* Change JSON response name from exec_time to execution-time

Execution time stopped working in the CLI because it uses the latest
json tag.

* Wait, don't break the interface.

* Add a test for the sql response json tags.

This is to make sure that if someone like Travis just goes and changes a
tag name to be more consistent, that we perhaps catch that before it
gets to the end user.

* Change exec_time to execution-time after all
2023-01-05 18:34:01 -06:00
tgruben
e8505d8a53
[FB-1831] distribute bulk insert to owning node (#2391)
* distribute bulk insert to owning node
2023-01-04 14:26:08 -06:00
pokeeffe-molecula
f030d58d95
implemented DISTINCT (fb-1562) (#2388)
* implemented distinct

* implemented distinct
* uses first cut of a buffer pool, and extendible hashing with thresholded spill to disk
* tests
* cleaned up some stuff around query plan output to make developing tooling easier
* added optimization to call PQL Distinct()

* fixed test

* fix for passing wrong index name in orchestrator

* back out change to DistinctTimestamp

* fix other instance of wrong table name being passed

* use full index name instead of abbreviated one for translation. sigh.

* removed some unused code

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2023-01-03 22:13:31 -06:00
Matthew Jaffee
4cc1667399 clean up TODOs. adds a control channel for on-demand snapshotting 2023-01-03 15:31:32 -06:00
Matthew Jaffee
bc9057f492 first cut at removing all the shard/field/partition versioning
some cleanup needed
2023-01-03 15:31:32 -06:00
Travis Turner
33bc69ccc6
Small adjustments to support the Serverless cloud merge (#2385)
This just changes a make target and the CLI setup. Nothing in
featurebase is actually affected.
2022-12-22 12:22:09 -06:00
Matthew Jaffee
c8242684f1 dax/test/dax need an image now that they're running under Docker 2022-12-21 07:42:04 -06:00
Matthew Jaffee
b8b08bc9eb first cut at automatic snapshotting
- had to make sure we don't snapshot until directive is fully applied
on a computer... otherwise there's races between loading the files and
truncating the write log.

- added a dirty bit to resources and a bool return to incrementing the
write log... don't snapshot if it returns false because that means
there's been no writes. (but make sure you close the storage transaction!)

- added the actually snapshotting routine which just fires every
<timeout> and serially snapshots everything.

- tweaked some logging

- added ability to get all tables in an org/db or literally all. I
think I just needed the "literally all", but it was natural to allow
it to be scoped to org or DB as well.
2022-12-21 07:42:04 -06:00
pokeeffe-molecula
9dda3ff215
Consistency in error handling (fb-1799) (#2383)
* return 200 once plan compilation starts; if error, return error in response.

* removed some commented out code that is definitely not needed.
2022-12-20 09:32:19 -06:00
Matthew Jaffee
3693b9950a
Expose translation mvcc (#2381)
* expose Transaction on TranslateStore for DAX Snapshotting

* try to fix ramdisk nonsense

apparently, we were running in either a shell env or docker env
randomly, so this could sometimes pass and sometimes fail since the
shell env had the ramdisk set up and docker didn't.

Now we force to run in docker always and set up ramdisk explicitly.

* ramdisk mount should be defined on gitlab runner config now

* debug ramdisk issue?

* fix tests... and a buncha other stuff

Took retry out of CI config because I think it's doing more harm than
good at this point.

The executor test I modified failed when I changed DefaultPartitionN
to 8, but just because stuff was out of order so I made it more
robust.

I edited some data gen stuff to make shorter lines because it was
making grep results unusable.

the actual fix is in translate_boltdb_test.go

* clean up, fix code review feedback
2022-12-20 07:45:32 -06:00
pokeeffe-molecula
021219935f
Implement DELETE (fb 1557) (#2382)
* delete implementation with test coverage

* optimize IN expressions; stop linter complaining

* fixed some uncovered query cases

* skip test in DAX for now
2022-12-19 16:34:28 -06:00
Bruce Baranowski
d19f3e81da
Fb 1818 Implement PREFIX() and SUFFIX() (#2371)
* Implement Prefix and Suffix
* Update substring out-of-index handling
2022-12-19 16:31:27 -05:00
tgruben
72d03602e0
Force make to use bash (#2380) 2022-12-19 13:41:24 -06:00
Matthew Jaffee
1e2e698225 "fix" backup tar test by just comparing lengths not byte for byte 2022-12-17 13:10:46 -06:00
Matthew Jaffee
aeb2ddbf61 update ramdisk mount 2022-12-17 13:10:46 -06:00
Matthew Jaffee
7ab117f5d1 remove in mem translate store
going to try making a ramdisk in CI to run tests
2022-12-17 13:10:46 -06:00
Matthew Jaffee
a58299def4 use separate qcx for write/read in test
now that min/max queries don't use a write Tx it seems we need to
separate read and write in the tests. Not sure I 100% understand this.
2022-12-16 17:05:38 -06:00
Matthew Jaffee
53a8f58e91 set transactions to writable: false for Max/Min/Value calls. these were mistakenly set to true during cleanup 2022-12-16 17:05:38 -06:00
tgruben
6d96a1474e
[FB-1822] Change dataframe disk format to Arrow from parquet (#2376)
* change default backend to arrow file format instead of parquet
2022-12-16 14:42:39 -06:00
Fletcher Haynes
f65367ab46
This fixes a bug with displaying errors returned from the SQL3 endpoint (#2374)
Co-authored-by: Fletcher Haynes <fletcher.haynes@generalassemb.ly>
2022-12-16 08:22:27 -08:00
Lory Cloutier
b1f5264a4b
Fix bulk ingest queries on multi-node databases (#2375)
CLOUD-1252
Implemented Jaffee's fix of checking for b.useShardTransactionalEndpoint
and only running the start/finish transaction block if it's false. Moved
stats timing to a separate defer so it could stay out of the if.
2022-12-15 19:36:53 -06:00
rachithrr
27963441ab
FB-1815: Implement CHAR() (#2369) 2022-12-15 22:04:51 +05:30
Travis Turner
4e8fe488de
Fix PQL distinct in dax (#2360)
* Fix PQL distinct in dax

When issuing a PQL Distinct() call (or any other call with a "index=" arg),
this commit will attempt to convert the value in the index arg with a
TableKeyer.

* Apply change to call.Children as well

* Add some PQL Distinct (join) test coverage
2022-12-15 07:59:20 -06:00
pokeeffe-molecula
15d2ee8b07
add allow_missing_values option to bulk insert (fb-1823) (#2372)
* add allow_missing_values option to bulk insert

* test coverage

* review feedback
2022-12-14 18:32:27 -06:00
pokeeffe-molecula
843312dfc9
handling missing epoch constraint correctly (#2366) 2022-12-14 17:53:17 -06:00
pokeeffe-molecula
3528ec8fc0
enable handling string representations of integers (#2367) 2022-12-14 16:58:18 -06:00
pokeeffe-molecula
c88d60c9ab
SHOW CREATE TABLE issues (fb-1810) (#2365)
* fixed ddl issues with cache type/size; removed shardwidth option; improved error message
2022-12-14 16:27:55 -06:00
Matthew Jaffee
033be81799 rename stupid manager names
ManagerManager -> ResourceManager
Manager -> Resource
2022-12-14 14:23:12 -06:00
Matthew Jaffee
cf1c9dae9a code review tweaks 2022-12-14 14:23:12 -06:00
Matthew Jaffee
4366ad41fb remove version/directive stuff from other snapshot endpoints 2022-12-14 14:23:12 -06:00
Matthew Jaffee
3ddf79160f clean up unused code/comments 2022-12-14 14:23:12 -06:00
Matthew Jaffee
bee666c07c fix dumb issue on storage manager test
changed empty snapshots/writelogs to return nil which was causing NPE
2022-12-14 14:23:12 -06:00
Matthew Jaffee
797b8bc31f fix lint 2022-12-14 14:23:12 -06:00
Matthew Jaffee
87d1c31607 several fixes and debug logging
- check that serverlessStorage is not nil before closing it
- check that we don't already hold a lock on a serverless storage
  Manager before trying to load it. This fixed at least one test failure.
2022-12-14 14:23:12 -06:00
Matthew Jaffee
dbb6d53f9d implement closing on dax, remove all locks when shutting down 2022-12-14 14:23:12 -06:00
Matthew Jaffee
bbaa7dd0f1 more WIP 2022-12-14 14:23:12 -06:00
Matthew Jaffee
35c472a54f extremely WIP 2022-12-14 14:23:12 -06:00
Matthew Jaffee
690a9370e9 remove alpha director (unused) 2022-12-14 14:23:12 -06:00
rachithrr
a4f18fb25f
FB-1812: implement stringsplit() (#2362) 2022-12-15 01:11:29 +05:30
Garrison Davis
3059529759
Upload rpms to Nexus and trigger m-cloud-images
Also upload arm builds
2022-12-14 12:09:03 -07:00
Garrison Davis
664ec83524
Remove manual jobs from CI
These jobs all need TLC and to be moved to the new ansible platform. For
now, we're removing them because if they accidentally get triggered,
they cost a lot of money very quickly, and don't necessarily get us
anything useful if they pass or fail.

Revert "Updating any AWS shape instance to use"
...our existing reserved instance types.  This simply ensures if we ever
do run one of these tests it is against existing reserved instances.  If
the tests get removed thats OK also."

This reverts commit 69be968d6d.
2022-12-14 11:30:39 -07:00
HHans09
c1dbc48fb2
fb-1809: SQL3 RTrim & LTrim func for strings (#2361) 2022-12-14 13:21:45 -05:00
Jason Allison
69be968d6d Updating any AWS shape instance to use our existing reserved instance types. This simply ensures if we ever do run one of these tests it is against existing reserved instances. If the tests get removed thats OK also. 2022-12-14 12:25:05 -05:00
pokeeffe-molecula
9759602f94
added updated_at column to show tables output (#2364) 2022-12-14 10:15:42 -06:00
pokeeffe-molecula
eca3168d63
implement having; create view experiment (#2357) 2022-12-13 17:43:37 -06:00
Bruce Baranowski
4773aabc4e
FB-1719: implement SQL3 lower() (#2358)
* Implemented SQL3 LOWER()
2022-12-13 14:59:05 -05:00
Lory Cloutier
a8996a149d
Prevent file corruption when writing tar backup to stdout (#2344)
* Prevent file corruption when writing tar backup to stdout

FB-1794

Tar backups written to stdout were coming out corrupt. This turned
out to be due to log messages getting written to stdout and ending
up in the tar file. We now check to see if the tar file and the log
are both going to stdout, and if they are, send the logs to stderr
instead.

Testing did not have any kind of consistency or validity check. We
now compare a tar file sent to a file and a tar file sent to stdout
to make sure they're the same. This does not guarantee correctness
but does at least catch this form of corruption.

* trying different index name

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: Todd Gruben <todd@molecula.com>
2022-12-13 13:03:16 -06:00
pokeeffe-molecula
2146f407c3
fixed csv bugs (#2355) 2022-12-12 17:14:10 -06:00
Travis Turner
e572c8f2c1
Fix dax docker-compose (dc-up) which was broken by ServiceManager (#2356) 2022-12-12 15:42:57 -06:00
tgruben
f2a13c8bde
Fb 1874 dataframe-csv-loader featurebase subcommand (#2341)
Embeded dataframe-csv-loader command as featurebase subservice
2022-12-12 15:13:58 -06:00
HHans09
ac3ffac8e6
fb-1802 : Trim functionality (#2353)
* fb-1802 : Trim functionality

rebase

* fb-1802 : trim - updated as per review
2022-12-12 15:43:14 -05:00
Travis Turner
14f1930004
Make interfaces more specific than "MDS" (#2352)
* Make interfaces more specific than "MDS"

- Introduce `dax.Schemar` interface
- Introduce `dax.Noder` interface
- The rest is generally to standardize on the new interfaces.
- Remove `pilosa.SchemaInfoAPI` interface
- Move `TranslateNode` and `ComputeNode` types from controller to dax package
- Remove `queryer.FeatureBaseImporter`
- Remove `queryer.MDS` interface
- Remove `queryer.Importer` interface
- Identify types using an "MDS" interface and split into Noder/Schemar as necessary
- Changed `Queryer.orchestrator` to a `map[qual]*qualifiedOrchestrator` because we can't share an orchestrator across quals

* Convert orchestrator to use TableKeyer
2022-12-12 13:14:17 -06:00
Travis Turner
63cfdb5078
Thread Owner, UpdatedAt, UpdatedBy through SchemaAPI (#2351)
* Fix "qualifer" misspellings

* Remove `track_existence` and `shard_width` from SHOW TABLES output

* Thread Owner, UpdatedAt, UpdatedBy through SchemaAPI

I took the liberty of renaming "LastUpdatedUser" to "UpdateBy" to align
with "UpdatedAt".
2022-12-12 12:36:37 -06:00
rachithrr
9548e71f46
FB-1805: implement REPLACEALL() (#2349) 2022-12-12 22:42:53 +05:30
Travis Turner
a61d1a9571
Introduce TableKeyer interface; use in Execute() calls as "index" (#2350)
This commit introduces an interface called `TableKeyer` which anything that means to represent a "table"
can implement. Examples are `dax.QualifiedTable`, `dax.Table`, and `string` (for legacy pilosa calls
where Execute simply took `index string`).

In the case of `orchestrator.Execute()` and `qualifiedOrchestrator.Execute()`, we are intentionally strict
about which type of `TableKeyer` the respective method accepts. If we find, in the future, this is too
restrictive, we can loosen that; but for now it helps us understand what is expected.
2022-12-11 11:45:10 -06:00
Travis Turner
5110405f2f
Remove trackExistence check in batch (i.e. always build _exists) data. (#2348) 2022-12-09 17:30:10 -06:00
Travis Turner
12d608c80d
Move batch.Importer interface to pilosa.Importer (#2347)
* Move batch.Importer interface to pilosa.Importer

In addition to moving the interface, it updates all the methods to use
dax.TableID (for example) intead of a string pilosa index name.

* Change unused onPremImporter methods to no-op.

onPremImporter is a wrapper around API which implements the Importer
interface. This is currently only used by sql3 running locally in standard
(i.e not "serverless") mode. Because sql3 always sets
`useShardTransactionalEndpoint = true`, There are several methods which this
implemtation of the Importer interface does not use, and therefore they
intentionally no-op.
2022-12-09 14:24:47 -06:00
HHans09
57ce7c4c0e
Fb:1787 - Clean up (#2339)
* Fb:1787 - Clean up

* fb-1787 : String upper function

* Formatting the files
2022-12-09 14:19:17 -05:00
Travis Turner
734477aaee
Add Table.Description, Table.CreatedAt, Field.CreatedAt support to SchemaAPI (#2340)
* Thread Table.Description through SchemaAPI

* Thread Table.CreatedAt through SchemaAPI

* Thread Field.CreatedAt through SchemaAPI
2022-12-08 22:50:41 -06:00
rachithrr
aa2a62fda0
FB-1800: Implement SUBSTRING() (#2343)
substring(string, startIndex,length).
2022-12-09 05:20:15 +05:30
pokeeffe-molecula
728b1dc9f5
handle int-->bool map type conversions; handle single value-->(id|string)set map type conversions (#2342) 2022-12-08 15:41:11 -06:00
Fletcher Haynes
7ab453e289
This adds in support to the lattice UI application to use the SQL3 (#2338)
* This adds in support to the lattice UI application to use the SQL3
endpoint. If the `/sql` endpoint returns 404, it will use the SQL1
endpoint. If the `/sql` endpoint is available, it will send SQL queries
to that. It does not try the SQL1 endpoint if the SQL3 endpoint returns
an error processing the query. That is, it is all SQL3 or SQL1.

- Below are the specific changes:
- Adds a file that contains functions for interacting with http services as opposed to just grpc/event-based services. As of this commit, it is only the SQL3 endpoint.
- This adds a variable to track if we are using the SQL3 endpoint or not
- This adds a function to handle the response from the SQL3 endpoint
- Adds a function to eventServices to query the sql3 HTTP endpoint
- Fixed a missing semicolon in grpcServices


Co-authored-by: Fletcher Haynes <fletcher.haynes@generalassemb.ly>
2022-12-08 12:47:21 -08:00
Travis Turner
a15783cb49
Convert SchemaAPI interface to use dax.Table instead of pilosa.IndexInfo (#2336)
* WIP: Convert SchemaAPI to be DAX-centric

* Tables(), CreateField()

* CreateTable(), DeleteTable(), DeleteField()

* More cleanup

* Remove the old SchemaAPI
2022-12-08 11:35:17 -06:00
rachithrr
d33bf4811f
FB-1795: Implement REVERSE() scalar string function (#2335) 2022-12-08 04:01:30 +05:30
pokeeffe-molecula
e599f12ee4
you should be able to cast an id as a string (#2334) 2022-12-07 14:27:01 -06:00
rachithrr
ad350c2d49
FB-1739: Add ability to add a description to a table on creation (#2332)
* FB-1739: Add ability to add a description to a table on creation

- Added CommentOption to handle text after COMMENT option.
- added description field in the createtable plan.
- The description is stored in the existing index metadata.
2022-12-07 21:05:54 +05:30
Travis Turner
969bf055b2
Rename some interfaces. Remove the ComputeAPI (#2333)
* Clean up dax service interfaces

Rename some of the `computer` interfaces and organize them in the
appropriate files.
Remove `dax/computer/alpha` package

* Remove ComputeAPI (it was replaced by batch.Importer)

* add nss-tools dependecy to smoke test
2022-12-07 09:02:39 -06:00
pokeeffe-molecula
d2eba5bd8d
handle decimal without scale correctly; handle bulk insert dupe columns correctly; handle decimal->string & float->string type conversions in bulk insert (#2331) 2022-12-06 13:32:49 -06:00
pokeeffe-molecula
e392ce3460
enforce int min/max constraints on insert (fb-1772) (#2325)
* moved the debug code to the right spot

* enforce int min/max constraints on inserts

* add a check for decimal min and max

* fixed borked tests

* fix the decimal to int conversion in constraint check

Co-authored-by: Travis Turner <travis@molecula.com>
2022-12-05 22:51:42 -06:00
pokeeffe-molecula
f62313762c
implemented extract ddl; tightened up type related stuff (#2329)
* implemented extract ddl; tightened up type related stuff

* added some test coverage

* review feedback
2022-12-05 16:50:30 -06:00
Travis Turner
2843f218bc
Introduce ServiceManager and Refactor DAX Integration tests (#2320)
* Introduce ServiceManager and Refactor DAX Integration tests

The ServiceManager provides an interface with which to manage
featurebase (dax) services (mds, queryer, computer). It replaces the
confusing interface implementations in /dax/server/server.go (which
optionally used pointers to in-process objects to satisfy an interface)
with (for now) http implementations. The thought is that even if we're
running all services in-process, we should communicate between services
over http in order to mirror what we would do in a production
environment where the services are running on different nodes.

This batch of commits does quit a lot, most of which is captured here:

- Added `path` support to `dax.Address`. Address is now a string of the form [scheme]://[host]:[port]/[path].
- Added `Holder.directiveApplied` to determine (in tests) if the computer has completed applying the latest directive. This is somewhat temporary until we improve the mds-to-computer logic.
- Removed the "service prefix" code which was prepending client URL paths with the prefix. Instead, the serviceType (mds, queryer, computer[n] is now part of `dax.Address`).
- Removed, from the dax config, the top level `StorageMethod` and `StorageDSN` and now just have `MDS.Config.DataDir`.
- Added `Computer.Config.N` to specify the number of computers to run in-process.
- Moved the `pilosa.MDS` interface to `computer.Registrar`. This is an example of getting the interfaces defined in the right packages.
- Added `SnapshotTable()` method to the mds client (to align with its API).
- Changed `Balancer.AddJob()` to `Balancer.AddJobs()` to support, for example, adding 256 partitions in a single call. Refactored some of the naive Balancer to account for this.
- Added a `Seed` to the top-level config. It's not really useful because of package `crypto/rand`.
- Added an in-memory implementation of the DisCo interface and disabled etcd in a computer service.
- Create sepearte data-dirs for each in-process computer.
- Disabled grpc in dax.
- Modified the sql3 test definition format to support multiple insert steps and separate query results (to align with those steps).

* Changes necessary to get multiple computer instance running in-process

For now the config looks like this:

```
[computer]
run = true
n = 4
```

but we can probably just change that to be something like:

```
[computer]
run = 4
```

*Issues found running multiple "computers" in-process*
- grpc was trying to bind on the same port
  - changed GRPCListener from `*net.TCPListener` to `net.Listener`
  - created a nopListener and set to that for now (i.e. disabled grpc)
- etcd was starting more than once
  - changed dax to use in-memory implementations of the disco interfaces (i.e. stop using etcd)
- IDAllocator (which uses boltdb) was trying to open the `idalloc.db` file more than once
  - realized we have to set separate data-dirs for each holder. that fixed it.

* Port dax integration tests to ManagedCommand

* Modify Balancer-related methods like AddJob to AddJobs

There were (and still are) a lot of places where we were adding on job
at a time, even when we had a long list of jobs to add. This resulted in
every job add (for example adding 1 of 256 shards) taking ~40ms, or over
10s to create a keyed table. One reason was because each job add was
making multiple boltdb transactions.

* Port over more dax integration test stuff

* Add DirectiveApplied to signify that snapshot/writes have loaded.

We use this in tests to avoid using sleeps.
This should be considered temporary; we're going to need a more robust
solution for determining when a computer node is ready to serve complete
data.

* Finish porting dax integration tests

* Improve godocs

* Remove docker-based DAX integration tests.

* go mod tidy

* Move test/managed.go to avoid package conflicts

* Modify IDK integration tests to work with ServiceManager changes

This is really just computer -> computer0
And the MDS DataDir config change.

* cleanup found during review

* echo $CI_COMMIT_REF_SLUG in CI

* remove docker image arg, use build instead
2022-12-05 14:49:17 -06:00
pokeeffe-molecula
0be0c42b66
non-sql aggregation, top, decimal and sundries (#2328)
* fixed a bunch of issues with non-pql aggregation; moved some decimal related functionality; made top actually top (for the non-pql case); experimental create function

* drive up test coverage
2022-12-03 20:39:57 -06:00
pokeeffe-molecula
47d8be26f5
implement fb_exec_requests system table (#2327)
implements an fb_exec_requests system table. The purpose of this table is to allow access to internal state to see what queries are running and have been run.
Co-authored-by: Travis Turner <travis@molecula.com>
2022-12-02 16:42:45 -06:00
Garrison Davis
be619fa60d Make SOURCE_DATE_EPOCH changes for idk 2022-12-02 09:48:12 -07:00
Garrison Davis
fd93fc99c9 Use SOURCE_DATE_EPOCH to make reproducible builds
Reproducible builds are something we should be doing, and we are there
as far as making them in CI is concerned with this change.

The changes to the Dockerfile/Makefile do nothing if the
SOURCE_DATE_EPOCH environment variable is not set before `make build`
happens, or if the build arg is not passed in to docker.
2022-12-02 09:48:12 -07:00
pokeeffe-molecula
1ce3a1c103
produce a better error when a user tries to sort something unsortable (#2324) 2022-12-01 12:49:40 -06:00
pokeeffe-molecula
e0d6b292bc
(fb-1779) make optimizer smarter with top operators and aggregate queries (#2323)
* updated optimizer to be smarter when trying to push a top operator down; added test coverage

* skip a dax sql test that keeps failing
2022-12-01 10:33:49 -06:00
pokeeffe-molecula
3c2c8c6011
fixed error messages for alter table add and drop; added test coverage (#2322)
* fixed error messages for alter table add and drop; added test coverage
* Removed two CI tests that are failing intermittently for no known reason.
2022-12-01 09:28:14 -06:00
Lory Cloutier
775fd0b08c Don't use reflect.DeepEqual to compare errors.
FB-1771

In api_test.go, it was being used to make sure that incorrect input
produced the right errors; this is now handled by making sure the
error isn't nil and then checking its string against the expected
error string.

In executor_test.go and internal_client_test.go, it was being used
to compare QueryResponse structures, which contain an error.
handler.go now has a function specifically for comparing them,
which can provide additional detail if necessary.

Added a test for SameAs to handler_test.go.
2022-11-30 14:47:39 -06:00
tgruben
04b19c066a
[FB-1776] support for marshaling ExtractedIDMatrixSorted (#2319)
support for marshaling ExtractedIDMatrixSorted
2022-11-30 13:47:26 -06:00
pokeeffe-molecula
158cc669d9
Tighten up ORDER BY (fb 507) (#2318)
* tighten up checks for order by expressions fixed ordering by expressions

* added testing to cover order by cases

* Add DecimalAgg member to proto GroupCount definition

In DAX, where we have split the orchestrator from the executor, and the
orchestrator can run on a different host, there are cases where
`GroupCount`s can travel over the wire via the Internal Client. In these
cases, when the group count contains a decimal aggregate, we need to
send that value as the appropriate type.

* fixed missing cases in order by and case block eval

Co-authored-by: Travis Turner <travis@molecula.com>
2022-11-30 11:32:37 -06:00
Lory Cloutier
f627199acb FB-1766: cleaning up the CmdIO objects passing alternate stdin/
stdout/stderr around

A lot of functions in the cmd and ctl packages were passing these
around and barely using them. Replaced them with a logger for most
functions. Some functions get an io.Writer instead so that their
tests can find the output they're looking for.

More cleanup on fb-1766: reworked the tests that were using io.Pipe
or os.Pipe to check their results so they now use a bytes.Buffer.

Unexported some variables that didn't need to be exported.
Fixed NewConfigCommand to use the provided stderr, not os.Stderr.
Added tests for rbf_dump, rbf_page, and keygen, since those weren't
being tested at all.

Added chksum_test, final cleanup.
2022-11-29 12:49:36 -06:00
tgruben
a98b9144cb
upgrade to immutable 0.4.0(generics) (#2317) 2022-11-28 12:12:03 -06:00
pokeeffe-molecula
df829c592f
handle filters on _id columns (fb-1765) (#2313)
* handle filters on _id columns using ConstRow
* handle keyed and un-keyed _id columns
* tests!
2022-11-23 15:26:04 -06:00
pokeeffe-molecula
d3f10be743
fixed top(x) where top cannot be pushed down into pql query (#2311)
* fixed top(x) where top cannot be pushed down into pql query

* review feedback
2022-11-22 19:21:47 -06:00
Travis Turner
5bf5b5364d
Fix more of the SQL tests in dax (#2310)
There are now only four tests remaining which do not pass.

One is related to error format mismatch.
Two require orchestrator work.
One won't pass until table name conversion is supported for multiple
tables.
2022-11-22 15:51:41 -06:00
Travis Turner
6740bc250e
Prepend header bytes to WriteLog messages for backward compatibility (#2309)
MarshalLogMessage serializes the log message and prepends additional encoding
information to each message. Currently, we prepend three bytes to each log
message:
byte[0]: encodeVersion - this is currently a constant within the code. If we
modify structs such that they encode differently, we'll have to change the
constant and keep previous versions of structs for deserialization.
byte[1]: encodeType (e.g. "json", etc.)
byte[2]: logMessageType

If we get into a situation where we want more flexibility in these message
header bytes—for example, if we want to use more than three bytes—we could do
something with the first bit of the encodeVersion: if it's 1, that could
indicate that there are additional header bytes, and the following seven bits
could indicate how many.
2022-11-22 15:20:47 -06:00
Travis Turner
f4385df2cf
Fix formatting in CLI results with custom SQLResonse.UnmarshalJSON (#2305)
* Fix formatting in CLI results with custom SQLResonse.UnmarshalJSON

When I started this, it was meant to be a quick fix to address the confusing
result formats we were seeing in the CLI. For example, all large integer values
were displayed in scientifc notation. This is because we were passing the result
types from JSON (in this case, float64) into pretty print. Similarly, `IDSets`
and `StringSets` where being printed using the default go Stringer for the types
[]int64 and []string respectively.

I started by writing a customer UnmarshalJSON() method for the `SQLResponse`
type. Part of this (the part which converts data types based on header types)
was already being used in dax tests, so this just formalizes that logic as part
of the `SQLResponse` type.

Then I realized that the sql3 tests (run against the `sql3` package) were
failing because sql3 is not actually returning the `IDSets` and `StringSets`
types. A future task is to formalize return types, define them, and modify sql3
to return them. Once that is done, we can remove the "typed" switch in the
`SQLResponse` json unmarshaller.

Another significant change is the modification to the `ExprDataType` interface:
```
type ExprDataType interface {
	exprDataType()
	TypeName() string
	TypeDescription() string
	TypeInfo() map[string]interface{}
}
```
I added two more methods in order to distinguish between a type (`DECIMAL`), its
description (`DECIMAL(2)`), and its type info (`"scale": int64(2)`). Currently,
the description can be used as the field definition in a CREATE TABLE statement,
but we may want to re-think that. Also, Decimal is the only type currently using
TypeInfo.

Finally, I tried to consilidate things around `dax.FieldType` instead of
comparing against parser types outside of sql3. We still have some sql3 parser
and planner types lurking about, but we can address those in future commits.

* Add some test coverage

* smoke test expected INT, now int

* minor fixes

* Introduce WireQueryResponse and related types

This also changes dax.FieldType to dax.BaseType.

* Populate WireQueryResponse correctly

Currently this is in the http handler, and in the queryer.

* Convert sql3 and dax tests to expect pilosa.WireQueryField in results

* fix PQL tests in the SQL defs

* Address a few of the skipped sql tests in dax
2022-11-21 18:43:53 -06:00
tgruben
2f1beaf119
Dataframe (#2241)
* Dataframe
2022-11-21 17:38:48 -06:00
pokeeffe-molecula
cca319fbe5
Fb 1767 (#2308)
* identifiers can now have the '-' character
* skip some integration tests
2022-11-21 15:58:00 -06:00
pokeeffe-molecula
5f662d2bce
fixed join bugs by fixing query optimizer (fb-1699, fb-1700) (#2307)
this commit changes the way the plan is retrieved; implements Stringer on types.PlanExpression in preparation for HAVING support; removes last vestiges internal float64 arithmetic; implements a filter on PlanOpFilter; fixes various bugs in the PlanOptimizer when rewriting qualified references

* fixed selects with unqualified identifiers

* handle bad and non-existent query param inputs more appropriately

* added test coverage for PlanExpression Stringer

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2022-11-21 14:31:45 -06:00
Travis Turner
10e8aa5c45
Make sure table stub is valid as a pilosa.Index name (#2306)
We use part of the dax.TableName in the pilosa.Index.Name.
This just ensure that we don't let invalid characters get through.
2022-11-19 20:54:37 -06:00
Kord Campbell
875c7492fe fixes FB-1768, two entries for the holder command 2022-11-18 13:41:45 -06:00
Seebs
bd2b9ac225 improve coverage in tests 2022-11-18 13:41:45 -06:00
Seebs
d0ccf8e4e4 write header before body
This produces an http warning that doesn't make the test fail.
2022-11-18 13:41:45 -06:00
Seebs
93153a97db actually honor provided stdin/stdout
the BackupTar and RestoreTar functionality was ignoring provided
readers, which doesn't matter for real usage but breaks tests
by making them dump raw tar binaries to stdout.
2022-11-18 13:41:45 -06:00
Seebs
c681642734 Distinguish between usage errors and other errors
Cobra automatically displays usage messages, and also a gratuitous
"Error: [...]" line in some cases, when any error at all occurs
running a command. To suppress the usage message, you have to set
cmd.SilenceUsage to true. But the code that would do this doesn't
have access to it. To address this, we introduce a category of
"usage error", implemented with stdlib error wrapping (%w) and
use errors.Is to check for it. There's also utility functions
to do this checking automatically, or indeed, to handle wrapping
of the ctl.SomethingCommand and handle running it with a suitable
context and everything.

In fact, several of the places we're checking for usage errors,
we can never actually report one, but we're checking consistently
so that if we want to report usage errors, we can.

For instance, server.Start and (dax)server.Start don't ever
return usage errors, right now, but we're checking their responses
anyway.
2022-11-18 13:41:45 -06:00
Garrison Davis
cf5a8c8382 Cache lattice in CI
The `build lattice` job is a source of frustration because it is a
dependency for building additional jobs in CI, has a wildly varying
runtime--anywhere from 2-7 minutes to finish--and doing a yarn install
&& yarn build is the most CPU/memory hungry part of our CI pipeline.

To address this, I'm hashing the lattice directory, and using the hash
to look for an artifact in S3 which can be downloaded instead of
building the web ui from scratch each commit.

This cache happy path (cached file exists in S3) cuts the time of this
job down to somewhere below 2 minutes even with many concurrent jobs and
pipelines running.

This also gives us the ability to pull built versions of lattice
associated with the commits that produced them, because each new file in
S3 also gets a zero-byte file with the long name of the git revision
(e.g., a zero-byte file called
`924a152ae92372a178bd0fc32b411612b995a6a1` will be stored in S3 so it is
possible to know which commit changed the lattice directory.)

Invalidating this build cache is as simple as deleting a specific key
(or all keys) at s3://molecula-artifact-storage/lattice/<hash> (or
s3://molecula-artifact-storage/lattice/*).
2022-11-18 12:55:17 -06:00
Garrison Davis
4d75eda557 Add back ability to make on-demand instances
Also addressed the couple TODOs I left behind in the terraform.
2022-11-18 12:12:09 -06:00
Garrison Davis
d028b6bc4b Make tflint and terraform fmt changes 2022-11-18 12:12:09 -06:00
Garrison Davis
3bfb65eb58 Make spot instance selection dynamic
The idea behind this is to give AWS more information about what
instances we can let it actually instantitate, rather than have it be
one fixed instance type.

e.g., in this case, we are okay with any Graviton instance with at least
2 vCPU and 8 GiB memory.

The easist way to do that is to instead use a launch template, with
ec2_fleets or spot fleets.

I took out the part where we even support on-demand instances. This can
be readded later if it is necessary.
2022-11-18 12:12:09 -06:00
Travis Turner
49d0e0fbc8
rename shard partition field (#2302)
* Rename dax.Shard to dax.VersionedShard

* Rename dax.Partition to dax.VersionedPartition

* Rename dax.FieldVersion to dax.VersionedField

* Rename go files to a standard
2022-11-16 15:58:20 -06:00
Matthew Jaffee
12dd3c5996 run just the batch tests for the batch tests 2022-11-16 15:31:06 -06:00
Seebs
79e02d9c61 drop fancy setup for IDK tests
The IDK tests had extra setup because they needed to work
when not in this tree. They don't still need it. Drop them to
align them with the updated batch tests.
2022-11-16 15:31:06 -06:00
Seebs
da4fb4ab4e stop uploading test results to sonarcloud, stop telling it we did
This gets complicated. For coverage output, sonarcloud supports wildcards.
For test output, it doesn't. So we weren't getting meaningful results,
just weird error messages. I fixed that, and got thousands of lines of
other error messages because it wasn't finding the test source files.
That looked like this:

	WARN: Failed to find test file for package
	github.com/molecula/featurebase/v3 and test
	TestTranslation_Primary

But we don't actually need the test reports sent to SonarCloud, because
"which parts of your test suite are being run" is sort of inherently
"basically all of them" with go test. So rather than continuing to do
that, we drop it.

Since we're dropping that, we don't need the JSON output from go test
anymore, so we drop that too, and the tee commands, and the "artifacts"
from the tee commands, and now our test output is human-readable and
slightly faster.

We also bump SonarCloud to 4.7.

We also fix the tests to use GOVERSION sometimes and GOFUTURE other
times, and bump from 1.19.2 to 1.19.3.

Also a couple of minor cleanup (adding explanatory comments,
combining adjacent grep commands, etc.)
2022-11-16 15:31:06 -06:00
Seebs
ab543adbe3 drop invalid UTF8 encoding from encoding tests
Testing unicode is great, but we appear to have had a couple
of cases where we were using strings that weren't valid UTF8.

Weirdly, other instances of these strings work -- I think because
they're in raw quotes (backticks) rather than strings. Anyway,
this is what SonarCloud fusses about.
2022-11-16 15:31:06 -06:00
Travis
20a8b5713a Add DAX - full list of squashed commits below
In this commit, the Directive is mocked; it doesn't actually reach out
to a controller.

Limits key translation to only those partitions (per index) specified in
the Directive. Attempting to create or find a key (or ID) for a
partition which is not handled by this node will result in an error;
translation requests are no longer forwarded to other nodes.

Limits import into only those shards specified, per index, by the
Directive. Attempting to import into a shard which is not handled by
this node will result in an error.

Stub out /directive endpoint

The `applyDirective()` method still needs to be implemented.

Update mds references to use the new /mds/types structure

In mds, we moved the shared types to mds/types. FeatureBase needs to
reference those instead.

This also bumps the mds version in go.mod.

Implement the Add/Remove Index part of Holder.ApplyDirective()

This adds functionality to `Holder.ApplyDirective()` which adds or
removes indexes (tables) based on those provided in the Directive. Still
to be implemented here: shards and partitions.

WIP: remove client from Batch

Move Batch into its own package: batch

Also, in order to avoid import loops, this introduces packages:
/batch/types
/client/types

Reorganize the Importer-related code

Moved the Importer interface to package: batch
Move the "pilosa client" implementation of the Importer interface to
package: client

Modify batch.NewBatch to take an Importer (not client)

This commit modifies the batch.NewBatch() function to use a functinal
option on Batch to inject an Importer into the Batch. Prior to this,
NewBatch() took a pointer to a client, which was a little too
restrictive. Now, MDS can implement an Importer which uses information
from MDS to determine to which node(s) the import calls should be directed.

Add client.SetAuthToken() method to satisfy SchemaManager interface

Update ApplyDirective logic to include fields.

This needs more work, but it was enough to get a basic test passing.

Move Transaction type into /types package.

Add interface check on batch.Importer no-op implementation

Updated ApplyDirective to create all currently support Field types

There are still the following TODOs:
- [ ] impolement field options (ex: decimal scale, int min/max, etc).
- [ ] `time` fields

Added support for Decimal.Scale in ApplyDirective

Update mds dependency

Add /health endpoint

Update to use dax (dax/mds) instead of mds.

After moving the mds repository into the dax repository as a
sub-package, this commit changes everything in FeatureBase to use the
dax repo instead of the now abandoned mds repo.

Introduce and implment the WriteLogger interfaces.

This adds both a `WriteLogReader` and `WriteLogWriter` interface. They
are both implemented by the implementation: `fileWriteLogger`. The
`fileWriteLogger` uses the dax/writelogger API to append log messages to
files on disk.

Add WriteLogWriter.ImportRoaring method to interface

This commit adds the `ImportRoaring` method to the `WriteLogWriter`
interface. Still to implement are the `Import` and `ImportValue`
methods.

Reorganize the ApplyDirective code

The primary goal was to cache the incoming Directive on the Holder prior
to applying all of the changes in the directive (i.e. loading data from
the WriteLogger) because applying those changes often validated against
the accepted state of the node.

Implement all of the WriteLogger read/write methods

Implement the HTTP WriteLogger implementation

WIP: Introduce shard.Version. Implement snapshotter.

Add HTTP Snapshotter implementation

This also recofigures server to use the HTTPSnapshotter instead of the
FileSnapshotter.

Implement snapshotter: TableKeys

Implement snapshotter: FieldKeys

Dependency dance

last of the dependency dance

Add support for prototype

This adds the Makefile targets to build the docker container and push it
to ECR.

SQL3 changes which break with dax changes

Missed TODO: implement FieldVersion version to WriteLogger

Address bug causing missing TranslateStores to error

Originally, we tried to limit the TranslateStores which get allocated to
only those for which the node is responsible. This works when adding a
new table. But if a table already exists, there's no logic to start
missing TranslateStores.

This reverts back to the old FeatureBase logic which brutishly allocates
a TranslateStore for every partition, even if one is not needed.

We need to address this by allowing the ApplyDirective logic to
initialize TranslateStores when they don't yet exist.

Move the ImportRoaringShardRequest type to the types package

Since the ImportRoaringShardRequest object is part of the Importer
interface, we need to move it to a non-root (i.e. pilosa) package. All
the other interface types are either concrete types or part of a
sub-package (such as roaring). We do this to prevent an implementer of
the interface from having to import the entire pilosa package and risk
circular imports.

buncha changes to support latest dax stuff

Move dax related types to /dax sub-package

This commit moves all the common "dax" types into the /dax sub-package.
The idea is to ensure that featurebase does not import dax at all.
It's ok if dax imports featurebase.
In the future, we might need to split the dax sub-package (common data
types used by muliple molecula data-plan services) into it's own repo.

Add type: dax.Schema

This isn't currently being used; I started to use is as a replacement
for pilosa_client.Schema, but then deferred that. But we'll need to do
it eventually, so it doesn't hurt to have this type in place.

Export RowIDs.Merge() method for use in orchestrator.

Add CreateSQL method to dax.Table type

The CreateSQL() method will return the "CREATE TABLE" statement required
to create the dax.Table.

Comment out confusing writelogger log message.

We need to revisit this, but for now, this log message is confusing.

Also, rename daxSharder to versionStore.

Remove hard-coded AWS account

Implement more FieldOptions such as Epoch

Some of the FieldOption logic was stubbed out in the dax package. This
commit fills that out more; specifically, it adds the
dax.Field.Options.Epoch parameter.

export stuff needed for TopK in orchestrator

export ValCount stuff to implement Percentile in orchestrator

export more stuff to support less code in orchestrator, shared objs

Port dax repo over to featurebase/dax (run all as sub-services)

This commit does ALOT. Sorry.
It introduces a `featurebase dax` sub-command which can be configured to
run the various dax services as sub-services within the same process, or
individually as the lone service in process.

It also changes all the URL paths to be prefixed with the service name.
So for example, instead of calling localhost:8080/status, you would now
call localhost:8080/featurebase/status.

Also, note that all services provide a /health endpoint to confirm they
are running in process.

Clean up integration tests. Remove PILOSA_ config prefix.

Remove duplicate clients (mistake from porting dax to featurebase)

Rename sub-service "featurebase" to "computer"

In the places where we have hard-coded the sub-service name into a URI
path, I've tried to tag the line with a comment containing:
`// #SERVICEPATHPREFIX`

Update copilot manifest files to reference "computer"

Port dax/README.md from dax repository

Separate (toml) Queryer Config from Injections

We needed to separate the toml config from the configuration required to
inject sub-services into the Queryer. I'm not sure this is the best
solution, but it's *a* solution. So here we are.

Clean up (i.e. remove) the queryer "implementations" package

Remove old test file

Run WriteLogger and Snapshotter as local sub-services.

Prior to this commit, the writelogger and snapshotter services only
worked when run as separate services. This allows them to be run in the
same process as all the other dax services.

There is still some naming issues that we should address, but it's
functional for now.

Clean up (i.e. organize) the intra-service interfaces.

Implement alpha Director for local messages from MDS to Computer

Prior to this commit, messages from MDS to the computer service were
still going over http. This commit introduces an interface
implementation which registers the local computer command, and use that
command's API to directly reference methods used by the Director.

Clean up a few more interface names

Add Queryer OpenAPI document.

Update copilot manifests to reflect latest changes

Add OpenAPI documents for WriteLogger and Snapshotter

Add OpenAPI document for MDS service

Add OpenAPI document for Computer service

Consolidate errors to use fb/errors package.

This commit is a first pass at trying to ensure that all of the DAX code
uses:
"github.com/molecula/featurebase/v3/errors"

This package is a wrapper for "github.com/pkg/errors", so going forward
we want to avoid importing that package.

The only method which isn't backward-compatible is `New()`; the
New() method in the featurebase/errors package takes an errors.Code. If
this becomes a problem, we could change this by reverting New() and then
introducing something like NewCoded(). But for now I think it might
actually discourage someone from just creating a New() error without
thinking about how it should be coded.

Introduce VersionStore interface

Move the existing VersionStore code to the `inmem` package as the
in-memory implementation of the new dax.VersionStore interface.

Introduce NodeService interface

With this, the Controller can maintain a registry of nodes by using this
NodeService interface as opposed to an in-memory map of nodes on the
Controller struct.

This also adds an inmem implementation of the NodeService interface.

Introduce controller.Balancer interface

This moves the existing balancer package to controller/naive package.
The idea is to allow us to add a different Balancer implementation in
the future.

Introduce DirectiveVersion interface

This commit also includes *A LOT* of refactoring to use dax.Worker and
dax.Job types everywhere instead of strings.

Introduce Schemar interface

The previous `Schemar` struct was moved to the `schemar/inmem` package,
and `Schemar` is now an interface implemented by that inmem package.

Remove unused type `nUnit`

Add boltdb implementation of VersionStore interface.

This removed the previous sqlite implementation; we decided not to use
sqlite for now (as a basic, local disk implementation) because it
requires CGO.

--------------------------------------------
No longer applicable:

Add sqlite implementation of VersionStore interface.

This commit implements the VersionStore interface using sqlite. Sqlite
requires CGO, so this may not be something we want to include, but it's
implemented here to get a feel for how an external implementation might
be used; the next step will be to determine how the user configured
FeatureBase to run using sqlite as a backing store for services like
MDS.

Add boltdb implementation of NodeService and DirectiveVersion interfaces.

Add boltdb implementation of naive Balancer interfaces.

This includes the two interfaces defined in `naive/balancer.go`:
- WorkerJobService
- FreeJobService

Add boltdb implementation of Schemar interface.

clean up a linter issue

Thread context.Context through all the interfaces.

Some of the interface implementations are going to use context, so we
need to make that part of the interface. The boltdb implementations, for
example, take a context. This is probably so we can do things like
cancel or timeout operations.

Update interfaces to return error; remove `panic(err)` everywhere.

Down-rev grpc version to 1.38.0

Later versions (after 1.42.0?) cause MustRunCluster.Close() in tests to
deadlock.

This commit also adds an `isComputeNode` feature flag around some of the
write log and shard/partition check functionality so that it doesn't run
under normal conditions (this is excercised by running the sql3 tests
for example).

Add MDS_Persistence test to cover meta data persistence

This adds a basic test which configures the MDS container to use boltdb
as its persistence storage, saved on a docker volume. Then, the mds
container is stopped/replaced, and we confirm that the data stored on
the volume is availble to the new MDS container.

Fix a few things after rebase with sql-experiment branch

The lastest version of sql-experiment contains a fairly significan
refactor of the way query iteration works. This commit adjusts for those
changes.

pull dax IDK changes in to FB IDK (#2177)

* pull dax IDK changes in to FB IDK

* Move docker-related IDK build stuff to featurebase root

Building the docker image required the root level go.mod and vendor
directory. This change moves the make targets to the root level
Makefile, and the Dockerfiles now copy the root level vendor directory
(and everything else in the root for that matter).

* Fix batch- and client-related tests

* InitializePoller on MDS restart/replacement

Prior to this change, if MDS was restarted, its internal poller (which
maintains an in-memory list of nodes to poll) is empty. This is bad,
because it doesn't know about nodes that it should be polling.

This change fixes that. Upon MDS startup, it intializes the poller with
the list of nodes that MDS keeps in persistent storage (currently:
boltdb).

* Add EFS volume to MDS Copilot manifest

This allows us to use MDS's persistent storage (via boltdb) in the
Copilot demo by saving metadata in a boltdb file on EFS.

* Thread logger.Logger through all dax components

* Revert some of the breaking changes from DAX development.

When we first started prototyping DAX, we made changes to the
featurebase core code which would have broken the existing featurebase
functionality. This commit reverts some of those changes. Anywhere that
we need to modify core featurebase functionilty, we put it behind some
kind of feature flag. This flag is typically determined by whether the
running node is a "compute" node (i.e. DAX.COMPUTER.RUN = true).

Co-authored-by: Travis Turner <travis@molecula.com>

add packaging for DAX

need cgo for datagen build

bind to 0.0.0.0, pass GOOS and GOARCH explicitly

not sure if the explicit GOOS/GOARCH is actually necessary...

Get INSERT INTO (aka ingest) working through SQL3

This commit does a few things which I'll try do describe here.

- Introduces a Qctx interface. The existing Qcx is an implementation of
  this interface, and can be used exactly how it has been. But this
  allows us to abstract away the notion of Qcx in the Queryer (which is
  handling SQL3) until we're ready to address that. As an example, the
  Qcx has a notion of a featurebase Holder, but that doesn't make sense
  when we're at the Queryer layer. For now, the Qctx used in the Queryer
  is a no-op.

- Adds a ComputeAPI interface implementation for the Queryer. This is
  effectively the Import() and ImportValues() methods used for ingest.
  The logic here handles the incoming ImportRequest by first doing any
  necessary column and row translation for the entire request, then it
  splits the records by shard, and generates a new ImportRequest per
  shard with only the shard-appropriate records.

- Changes the mds.Importer to take an MDS interface implementation
  (which can be an mds client) instead of an mdsAddress. This allows us
  to use a localy MDS implementation rather than assuming we need a
  client to make calls over a network.

Add queryer.Importer interface to handle ingest via SQL (#2203)

* Add queryer.Importer interface to handle ingest via SQL

This is meant to support ingest through SQL when the queryer and the
compute services are running in the same process, or when they are on
seperate processes and need to talk via http client.

* remove datagen from RPM

was originally added as a convenience to generate test data, but is
unused and annoying because datagen doesn't easily cross-compile due
to cgo

* add marshalUnmarshal to controller to avoid passing pointers

passing pointers across API boundaries can cause unpredictable things
in local vs remote configurations.

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>

"fix" a few issues with wrong default partition numbers

these still need to be properly fixed and actually get the correct
data from MDS

go mod tidy

Introduce TableQualifier (OrganizationID/DatabaseID) (#2220)

* add check in ApplyDirective that version is increasing

fix TestAPIDirective to make version always increasing

* fix docker image build and break out dax test in CI

We have to run the DAX integration tests separately as they call out
to Docker, and so it isn't easy to run them in a Docker container as
the other tests do. So we run them directly on the CI runner which has
Docker and Go installed.

We also explicitly exclude these tests from running during the other
tests.

Also my editor was automatically reformatting some comments badly
which is why I added the "data" thing in those two places

* add timeout to poller

* give Poller a default Logger

apparently we can NPE sometimes, seen in CI: https://gitlab.com/molecula/featurebase/-/jobs/3028286364

* bunch of testing fixes, mostly IDK/DAX related

make MDS error if sendDirectives errors, don't just
log. sendDirectives can error if computer nodes disagree about the
validity of a schema (for example), in which case it might need to get
deleted and user notified somehow. very messy, needs more thought.

re-introduce old env prefix to maintain compatibility with master
branch

make self-contained dax container for IDK testing

build IDK images from source (now that all the source is available
since it's in the same repo)

catch errors in DoExtractQuery in idktest.go

fix IDK bug where prefix path was hardcoded in all cases rather than
only when useMDS was true

fix TestBatchTargetMDS... needed to add field options and catch error
when creating table. also needed an _id field

* fix env prefix in tests

* WIP getting tests to pass, wanna see CI

* don't error if we get a zero version directive and we don't have a

directive yet

* cleanup debugging junk

* "fix" future.rename thing, run IDK tests

* Introduce TableQualifier (OrganizationID/DatabaseID)

This commit introduces a lot of new types (in dax/table.go) related to
TableQualifer (which is made up of OrganizationID and DatabaseID), as
well as things like TableID and TableKey.

For the most part, we try to thread a QualifiedTableID through the
entirety of DAX. There are some places (for example in the Balancers,
which are just aware of string keys) which use a string TableKey
(tbl__org__db__tableid).

* Remove some debugging comments

* Add Org/DB support to CLI.

This commit adds support for special commands:

SET
SET ORG acme
SET DB db1
USE db1

* remove ".pulled" from IDK Makefile

I don't think we need it any more as most things can be built
locally. I think it was only there to refresh the FeatureBase images
that were tagged as master, but we don't need to do that any more.

* Change DAX json tags to kebab-case (i.e. hyphenated)

This commit also renames some struct arguments to more accurately
reflect their type: for example, renaming `Table` to `TableKey` when the
type is TableKey.

* Return DAX TableName in SHOW TABLES (instead of Index.Name)

There are cases where SchemaAPI is used to return DAX friendly table
names (as opposed to featurebase index names, which are DAX TableKey).

This is an attempt to do that. With that said, it's not ideal because
anything could call those API methods and expect the other type.

* Fix a bug which wasn't completely dropping a table.

When using boltdb as a backend, DROP TABLE wasn't removing the
reverse-lookup key for the table in boltdb.

* Remove idk/testenv/certs which got accidentally committed.

also update .gitignore to include those.

* Fix IDK ingest tests to be TableQualifier aware.

* Add example Table types to dax/table.com godoc.

* ignore idk.Main fields for flags, upgrade commandeer

* go mod tidy

* Fix DAX integration tests: ingester using wrong ENV VARs

We change from ORGANIZATION_ID to ORG_ID
and from DATABASE_ID to DB_ID

* Clarify things around idk (docker) tests

* Stop running TestKafkaSourceIntegration with t.Parallel()

This test can't be run in parallel as it's currently written. Doing so
allows for interleaving of messages to the same kafka topic between
tests.

I didn't attempt to modify the test so it could be run in parallel. That
could be done, but left for someone more ambitious.

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>

Require Directive.Version be a non-zero value. (#2227)

Because the directive cached on the holder is not a pointer, its default
version is 0. In order to avoid having to compare against that, we just
require that Directive.Version start at 1.

General, non-invasive code cleanup and comment adjustment.

Move ImportRoaringShardRequest out of the types package

Early on in the DAX development, I moved ImportRoaringShardRequest into
a types package. There must have been some import loop going on, but
since that is not longer the case, it's safe to move this back into the
core featurebase (er... pilosa) package.

Move Transaction struct back into the pilosa package (from types)

Revert some name changes (cli -> client)

Add DAX Handler CloseTimeout

This was implemented in htt_handler.go, but it had been commented out in
the DAX handler. This just uncomments that and finishes the
implementation.

Remove Qcx from queryer.Importer interface

This sets us up to revert the Qctx interface that was initially
introduced to allow us to abstract away the need for a Qcx when calling
the ComputeAPI from a remote service (i.e. the queryer).

Add some go-doc comments and remove unused code.

Move SchemaManager setup from datagen to idk.Main (#2233)

The set for idk.SchemaManager (for dax implementations) was previously
in datagen. This may have been because of some import loop problem
during development, but that's no longer an issue.

The setup for this should be in idk.Main so anything using that can
leverage the MDS-specific SchemaManager setup.

Fix issues around nil TxFactory

First, don't return a nil. Rather return a new *TxFactory (with no
holder).

Second, don't call `f.holder` in the testhook outside of checking if
`f.holder` is nil.

Wrap all bare errors

Make service prefixes constants

Instead of having `"computer"` throughout the code, use instead a
constant: `dax.ServicePrefixComputer`.

MDS skip errors when sending empty directives

also add in the docker-login and ecr-push changes for serverless DAX

Fix the logic in Directive.IsEmpty() (#2236)

Update the cached value for Index.translatePartitions

In the case where a node already knows about an index, but its
assignment of partitions for that index changes (for example, when
another node goes down and the node in question is now responsible for
more partitions than it previously was), then we need to update the
cached value of Index.translatePartitions because that's used in
translation checks.

minor fixes for IDK-related bugs

WIP: tokenize CLI to access cloud

FB CLI cloud support with automatic token refresh

Also adds support for a GET command which allows making HTTP GET
queries to cloud CP which can be handy for debugging stuff. E.g. GET /v2/databases

buncha little fixes working on writelogger stuff

fix writelogger/snapshotter setup bugs

implement writelogging for importRoaringShard

add debug endpoint to MDS

use shard transactional endpoint in MDS datagen

add debugging to API related to writelogger

revert handleroption change

clean up big PR

remove "GET" command from CLI for making arbitrary HTTP request to
cloud control plane (was a messy hack and not that useful)

remove json tags from FB objects where we had to duplicate the object
elsewhere due to import loops and weren't actually json encoding it

unexport handlerOption which was exported to try to avoid doing
certain things if we're in DAX mode, but I didn't end up merging that code.

remove (hopefully) unecessary extra call to api.indexField

fix some formatting, unexport some vars, godoc, etc

oops, fix build failure

Update FeatureBase CLI to support a standard deployment

The standard deployment uses a different endpoint and request payload.
This commit tries to detect is the standard deployment is being used,
and if so, it uses a standard-specific FBQueryer.

It also modifies the auto-detection logic to try standard featurebase
and dax ports in the case where a port was not provided.

MDS API refactor (#2259)

* MDS API refactor

table IDs are exposed but only created server side

also cleaned up dax Makefile

* clean up review feedback

Co-authored-by: Travis Turner <travis@pilosa.com>

* remove TablesByName

* rip out inmem implementations and use boltdb everywhere

* remove inmem balancer, create bolt tempfile by default on startup

* WIP on snapshot table impl and test

* Minor comment and code layout adjustments.

This commit also adds the `Equals` method to `QualifiedTableID` for
equality comparisons. It's no longer safe to compare struct (two structs
might still be equal even if one of the structs doesn't have a `Name`
value.

* Use a unique docker network for each dax test

Ocassionally we would see some test failures due to a network already
existing. This shouldn't happen, but to avoid that, this commit
generates a unique name for each sub test (which gets deleted at the end
of every test).

* Fix one instance of NewQualifiedTableID losing Name

We should probably check the other instances and see if Name is getting
lost.

* simplify unique network stuff and fix api directive tests

* Remove TableIDRequest and TableIDResponse types for /table-id (#2267)

For the mds/table-id http requests, just use dax.QualifiedTableID as
both the request and response types.

* remove lattice from dax, no error on node re-reg, dax docker-compose

* various updates

* WIP: mds-refactor branch review

* no-op on SnapshotTableKeys if table is not keyed

* Makefile helpers

* add doWeCare so controller doesn't fail unnecessarily

* clean up table creation (#2272)

* Strip underscores from TableID stub name

* fix boltdb versionstore tests: generate unique, sorted tables

* fix controller test related to reregistering a node

* JobSet -> generic Set

Co-authored-by: Travis Turner <travis@pilosa.com>
Co-authored-by: Travis Turner <travis@molecula.com>

Cleanup after rebase on master

The latest rebase on master entailed all the client/batch changes as
well as some of the qcx refactoring. It made for a hairy rebase. This
commit fixes some of the tests that were failing after that rebase.

Fix batch/client import loop missed during rebase (#2280)

It's not surprising that `batch` can't import `client`. It was doing
that here (importing an error type from the `client` package). What is
surprising is that it's okay for `batch_test.go` to import `client` even
though `batch_test.go` is an internal test and therefore part of the
`batch` package.

different boltDB's for schemar/controller, explicit balancers

nice helpers for dax docker-compose, make build really fast

build FB binary outside of docker, then create Docker image with its
working dir in an empty subdirectory so it doesn't send a GB of
context to the daemon.

error on unassigned jobs and use client with timeout

fix CR feedback

deregister batch of nodes

also make removal faster via director dial timeout

implement WorkersForJobPrefix so orchestrator doesn't make up shards

also fix some godocs and remove unused method

Run sub-tasks of a Directive concurrently in a worker pool. (#2275)

* Run sub-tasks of a Directive concurrently in a worker pool.

This allows the compute node to concurrently load shapshot and writelog
data concurrently, instead of one keyset/partition/shard at a time.

It introduces a config parameter called `DirectiveWorkerPoolSize`.

* code review cleanup

* Use unique container names in DAX integration tests

We were seeing "container already exists" errors in CI, so just to be
safe, this commit constructs a unique container name for every container
in the DAX integration test run.

Stub in SystemAPI to Queryer (note: will not work if used)

This just makes is so that dax can compile. Actually implementing
system-table functionality for dax will take some planning.

Tlt/dax merge prep (#2282)

* Remove copilot directory

* Remove Dockerfile-datagen-long

* Remove orphaned RegisterNodeRequest

This type is not defined in the dax/mds/http package.

* implement TIMEQUANTUM and TTL in Table.Field type

* Remove the "service" misdirection in queryer/writelogger/snapshotter.

We had originally used an additional layer, er.. package, for a "service".
The main distinction was that the Config differed in that it was
internal, unlike the Config that we need to provide for the top-level
server config (i.e. toml). Having that additional layer just to support
a different Config seemed premature at best. So I'm removing it.

* Remove dax docker containers no longer used in tests

Since we run everything as "featurebase", we don't have multiple
container types anymore.

* Some minor comment updates

* Remove nfpm stuff related to dax

* Fix linter issues

Fix "duplicate" issues raised by sonarcloud.

run docker components of dax integration tests with coverage

trying to get dax integration coverage

add coverate volume mounts throughout dax integration tests

add a lock, tweak dax Makefile, remote flag on query handler

remove some unused code

convert batch tests to use clustertests to get coverage

maybe fix clustertests

more authclustertests fixes, test is failing locally

but also seems to have been silently failing in CI prior to these
changes... let's see if it's still silent

fix some lint to kick CI

just re-running the job wasn't working... strange behavior

remove RetryLogic test and pipe which don't work

RetryLogic test removed due to etcd changes. Seebs thinks we shouldn't
test this here.

Pipe was being ignored since we're no longer using "bash -c" to
execute the command. If we need to generate that output file we'll
either have to reintroduce bash -c and set -o pipefail so that it
actually fails properly, or figure out some other solution.

shooting into the dark...

first cut at bulk node registration

remove unused stuff from batch tests, set coverpkg to ../...

batch registration timeout and fix tests

disable most tests and don't run fb background batch test

debuggin!!!!!!!!!

and then he tried this....

Implement importer (for INSERT INTO) in the Queryer

Prior to this, we we passing a nil value in for the importer to the
planner.NewExecutionPlanner in the Queryer. This meant that INSERT INTO
statements didn't work. Now they should.

It uses the importer that we build for IDK in /idk/mds/importer.go, and
wrapps that with a type that can determine if the provided string
"index" is of the form indexName or TableKey.

turn off debug mode, fix log saving

Run sql3 test definitions in a dax integration test

There are currently 22 tests which are not passing. They are skipped in
the "skips" slice.

WIP, not working, pql queries to tests

Add TableQualifier to PQL query logic in the Queryer

Add more PQL tests to the keyed table

Allow instant node registration if registration-batch-timeout=0

When running dax services in process, we don't want to wait 3s for the
compute node to register; we know it's there because it's in the same
process.

Fixes related to IncludesColumn PQL test.

Tests for ConstRow and FieldValue

cleanup

add UnionRows and Options, better error reporting on bad queries

delete unused schemar client.go, clean up unused in batch test CI

move test timeouts into more reasonable territory

apparently this had already been done, but got merge-stommped at some point

move dax bolt test helpers into dax package

Add computer CheckIn routine (#2296)

* Add computer CheckIn routine

This adds a background routine which sends a "check-in" request to MDS
every <interval>. This is to address the case where the poller has
removed a computer node from the node list (due to a network fault, for
example), but the node is still healthy and becomes available again. In
that case, the node needs to "check-in" to tell MDS it is still there.
MDS will likely send the node a new directive with Method=reset telling
the node to delete all of its data an apply the latest directive.

* Don't send directives to Deregistered (i.e. removed) nodes

We have an issue where we're locking on sendDirective in the
controller, and when the node is unavailable, the send hangs and never
releases the lock. This is a temporary fix for that until we address the
real problem.

Fix .gitlab-ci.yml after rebase

fix some indentation shenanigans
2022-11-16 11:19:40 -06:00
Bruce Baranowski
ba70bee875
Re-allowed concurrency for molecula-consumer-csv when not using '--auto-generate' (#2294)
Concurrency was previously fully disabled due to duplication when using '--auto-generate' but testing has shown that it works correctly when not using that flag. Added the required check and updated help text
2022-11-15 15:55:57 -05:00
Seebs
f1a68f8a82 bump timeout on overlapping write requests test
At 50ms, we see sporadic failures in CI. So much for "this should
only need a couple milliseconds". Bumped timeout to avoid that.

The challenge here is that we have some tests which *want* to hit
the timeout to confirm that we aren't allowing things we shouldn't.
But we don't want the test to hang forever. But we want to be sure
it is actually stuck and not just being slow...
2022-11-15 13:31:37 -06:00
Seebs
ebd0fa85fa shuffle some CI stages, improve IDK test determination
mark IDK tests and batch tests as "nonblocking" so we don't wait
on them before doing builds. this risks running builds when the
IDK or batch tests could fail. It also unrisks spending an
extra five minutes in CI waiting for the last "test" phase thing
to run in a long dependency chain, which is potentially more
significant.

Make IDK tests run for changes to idk, client, or batch directories,
because at least one IDK thing uses the batch importer. Also,
make that actually work, we think -- verified that the IDK tests
got run when there were changes in that directory, but there
aren't any now, so we don't expect to see them.

Also, move the "IDK changed" rules into their own heading and
incorporate them by reference, and simplify the conditional because
it seemed to be Acting Up, but also make it check against
refs/heads/master, rather than possibly just the parent commit,
since that seems to be more consistent.

Finally, we combine four of the tests (go tests, go tests future,
go tests future plg, go tests shardwidth22) into two tests, both
using the "future" compiler, one for plg, one for shardwidth22,
so we don't need as many parallel runners and are less likely
to end up waiting on them.

At this point, the largest delay in CI is the chain through
building lattice, which blocks some tasks for a fairly long
time because they just have to wait for us to have built a
container we can use as the server container in tests that need
a server to work against.
2022-11-15 13:31:37 -06:00
pokeeffe-molecula
8f660a5033
SQL BULK INSERT (fb-1749) (#2291)
SQL BULK INSERT

This change is to support a BULK INSERT/REPLACE statement that adds the ability to 1) take its input from a file, url or in-line blob 2) to map from the input source to the target columns
3) to transform data (using sql expressions) before inserting
4) support csv and ndjson formats

* improving test coverage

* increase test coverage again

* refactoring for handling transformation with types other than id and int
2022-11-15 09:25:40 -06:00
Travis Turner
eec278893a
Move SQL3 test definitions into sql3/test/defs package (#2289)
This so other packages can import and use them in their own tests.
2022-11-11 13:20:40 -06:00
Julio Martinez
e25e395bab
Packaging improvements to improve mcloud updates (#2288)
* Update package scripts so they restart services based on the operation (update vs install)

Co-authored-by: Julio Martinez <julio.martinez@logicmonitor.com>
2022-11-10 11:13:06 -08:00
Seebs
3a8d08fed5 rename protobuf interface
For unrelated reasons, we renamed the protobuf interface from
package "pilosa" to package "proto". This means our GRPC endpoints
need to live under "proto.Pilosa" instead of "pilosa.Pilosa". This
means lattice needs to be configured the same way.
2022-11-09 11:01:45 -06:00
pokeeffe-molecula
45067b4e32
fb-1744 implement system tables (#2276)
* implement system tables that contain internal state information from FeatureBase

* review feedback

* review feedback

* removed sys prefixes
2022-11-07 17:48:00 -06:00
tgruben
0d6a92aeaf
enable staticcheck in ci; remove dead code (#2281) 2022-11-07 13:45:19 -06:00
tgruben
0aa5efcc51
staticcheck fixes (#2278) 2022-11-07 10:51:55 -06:00
Garrison Davis
407d52baa0 Fix server.GetIndexes userInfo logic
userInfo at the relevant line can be nil here. We check later if the
userInfo != nil (and assure it passes authn/authz) or if userInfo == nil
then we return all the indexes we can find.
2022-11-04 15:01:40 -06:00
Garrison Davis
0f5a56c958 Stop using string keys in contexts
This fixes the OriginalIP and RequestUserID in the main featurebase
package, and the Access and Refresh tokens, the UserInfo, and the
[]string of Indexes passed with context.Context(s) in the authn package.

An empty struct was used for all of these keys (and relevant helper
functions we added) to avoid allocations where possible while still
using the context functionality.

Some of the logic in the server.GetIndexes function was fixed.
2022-11-04 15:01:40 -06:00
Bruce Baranowski
6800e52a39
Makefile Cleanup
A cleanup pass to remove unused or broken makefile commands, this will help make the Makefile more clear and useful.
Removed unused makefile entries:
- release-build
- test-release-build
- check-clean
- release
- release-sans-ui
- plg
- install-bench
- generate-stringer
- pilosa-keydump
- pilosa-chk
- pilosa-fsck
- docker-test
- topt
- topt-race
- gometalinter
- install-stringer
- install-protoc-gen-go
- install-gometalinter
2022-11-04 16:15:09 -04:00
Seebs
0c904b3fae finish removing traces of ingest API
A couple of helper functions and types were left over from
the ingest API. Thanks, staticcheck!
2022-11-04 14:08:23 -05:00
Seebs
7b434cd11c initial implementation of RBF backend
This provides us with most of the existing Tx interface, split
across QueryRead and QueryWrite. The functions not included here
are the ones that are used *only* for anti-entropy (ForEach
and ForEachRange).

We add additional testing to verify that TxStores are getting
closed correctly, to go with cleaning up the test directories they're
made in.

We also introduce some test wrappers that can automatically
fail tests on error, so tests don't need to be full of error
checks.

Also, now that I'm starting to think more about the flow of
writing tests using QueryScope, we add the missing "full
database" scope option, and make the Add methods return
their operand so (1) you can chain them, (2) you can use
the AddIndex(...) inline in a NewWriteQueryContext.

Also addressed a plausible performance concern in shardList,
and some comments that were stale or incorrect.

The test coverage here is skimpy on the actual RBF-calling
functions because those are trivial. We do, however, significantly
expand coverage in the random write requests, which are now
a mix of random writes and random reads, and add test cases
that at least hit a lot of the error checks once.

The Error() method is changed to be like (testing.T).Error(),
taking ...interface{} and using fmt.Sprint on them.

There's also some minor tweaks such as making the visualizations
more consistent, testing visualization generation on two kinds
of keysplitter, and so on.
2022-11-04 14:08:23 -05:00
Seebs
b4eb1b8bdc use Fatalf instead of Fatal(Sprintf) 2022-11-04 14:08:23 -05:00
Seebs
e9a40cdc35 drop unused CreateDirIfNotExist function
I was wondering why this is exported, and the answer is, if it
weren't exported, staticcheck would have reported that it was unused,
which it is. We don't need a wrapper on os.MkdirAll that we never
use.
2022-11-04 14:08:23 -05:00
Seebs
fff9ddc1f5 drop anti-entropy feature, since it doesn't work
The anti-entropy feature has never actually worked. We've been
talking about removing it or replacing it for ages, but haven't
had a concrete motivation.

But the anti-entropy interface is the sole user of several components
of the Tx interface, and now that we're trying to replace that
interface, being able to drop those components has some appeal, so
let's remove the one thing that used them, in the hopes that this
will simplify life.

This also lets us drop ForEach and ForEachRange, which were
barely used at all. The one surviving usage (CSV export) can be
handled by using the container iterator we already have, and
making ContainerCallback exported so we can use it to just call
things for every bit.
2022-11-04 14:08:23 -05:00
Jacob Brinlee
dd30168b1c
updating topic/partition/offset order (#2250)
* updating order of topic/partition/offset in log message
2022-11-03 09:20:49 -05:00
Jacob Brinlee
ca16e7f8fa
SUP-286 - update lattice config (#2273)
* comment out configs
2022-11-02 16:53:10 -05:00
pokeeffe-molecula
193ef7cba1
Test expression eval for tuple values in inserts (fb-1555) (#2270)
refactored comparison, equality and arithmetic expr eval for decimal data types and added a test to cover expression eval for inserts

fixed failing test
2022-11-01 20:46:34 -05:00
Seebs
16ccbc461a Drop the ingest subpackage and related endpoints.
The internal/ingest and internal/schema endpoints were developed with
intent that they'd be the primary interface new users would work with,
because they were Easy To Use, and did not require any kind of setup,
the counterpoint being that ingest done this way had performance issues
because it ended up with huge amounts of JSON parsing to reformat
things into our native format. But this was understood to be the price
of providing a new-user-friendly JSON ingest experience.

A year later, we have no evidence that it's ever been used. We never
even moved it out of the `/internal` path. It's a lot of very complex
fiddly code and we don't seem to be using it, and at this point, our
anticipation is that if we really need something, we'll use CSV, which
we already have working, or something in the new SQL code. Either way,
we don't seem to be using this.
2022-11-01 13:08:44 -05:00
Seebs
4104577f6d make smoketest setup check for empty strings
Apparently terraform can give us output saying that it succeded,
but give us an empty string for an IP address, which doesn't actually
let us use the IP address. Check for that case too in our overly
fancy setup.

This is a precursor to figuring out what's going wrong in a way
that lets us fix it more properly.

Also, request values, but don't instant-exit if they aren't present,
so we can actually do the retries.
2022-11-01 11:47:17 -05:00
Seebs
e4177d24d6 improve attempt to save pilosa logs after IDK/batch test failures
The save-%-logs and shutdown targets live in the IDK directory,
so we need to change directory to run those targets. (Same for
the batch directory.)
2022-11-01 11:47:17 -05:00
Seebs
164dec1703 stop ignoring degraded/down states
We think etcd's tendency to mistakenly mark nodes down may have
been addressed. We can't find out without checking for it.

The exact pool of methods in methodsDegraded may have bitrotted
some; for instance, it didn't have PastQueries or PartitionNodes
in it, but it looks like it reasonably should.

We rework the Replica1/Replica2 server tests to reflect the
intended semantics again.
2022-11-01 11:47:17 -05:00
Seebs
52d3329434 drop Starting cluster state
The special case of Starting allowed us to make sure every node in a
cluster waited for the whole cluster to come up, but caused problems
later if a node died and came back. We drop the Starting state for
clusters, treating a STARTING node as equivalent to an UNKNOWN (or
DOWN) node for purposes of cluster state, so clusters will go from
Down to Degraded to Normal as nodes come up. We now wait for the
Normal state during initial bringup. We would previously have accepted
Degraded, if you could reach it, for instance if a node came up and
then went down again before another node finished starting, but I'm
pretty sure that was unintentional.

This solves a problem where while a node was down, we'd accept
queries that we could handle in a degraded state, but then we'd
*stop* accepting them when the node started coming back up.
2022-11-01 11:47:17 -05:00
tgruben
f987009406
add flag to bypass space check (#2265) 2022-10-31 11:08:01 -05:00
Travis Turner
00ef2380e5
Batch insert via SQL (multiple tuples) (#2243)
* Formatting adjustments made during code review.

While reviewing the BULK INSERT logic (in order to decide how best to
approach "ingest via sql" in the cloud), I made a few formatting and
comment changes. I'm just adding them here as a separate commit so they
don't muddy up my actual work.

* Parser modifications to support mulitple tuples in INSERT INTO

This commit doesn't include all of the changes required in the
planner. Fow now, the planner is simply modified to continue supporting
a single tuple (the first tuple in the list).

* Update the planner to handle multiple INSERT INTO tuples

This is part 1. It's still using the existing logic which builds an
ImportRequest for every record (and every field!).

The next step will involve using a client.Batch to handle the records.

* Introduce client.Importer interface (used by client.Batch)

Instead of the Batch having a pointer to a client, this puts an
interface there instead (which the client implements). It also allows us
to inject a different importer (i.e. other than a featurebase.client)
into the Batch.

* Decouple batch from client

This commit pulls batch-specific code out of the client package and into
a new batch package. It introduces the batch.Importer interface, the
methods of which replace all the calls that batch was previously making
directly to client methods.

Finally, it contains two implementations of the batch.Importer
interface: one is a wrapper around client, and the other is a wrapper
around featurebase.API.

* Use docker (instead of MustRunCluster) for internal batch tests

Because the `batch` package tests are internal, using
test.MustRunCluster() resulted in an import loop (because it eventually
imports `server`, and we can't have that). So this commit replaces the
use of `test.MustRunCluster()` with docker. The setup is basically the
same as that used in the idk docker tests.

Here we also remove all client-side references to `UseIngestAPI`, which
is an experimental (json) ingest api. It's still suppored on the server,
but here we remove the external usage of it.

* cherry-pick fix

* Use batch.Import() for sql3 INSERT INTO statements

* Thread logger into sql3

* fix batch test

* Fix some shadowing complaint by linter

* Address some test issues related to stringsets

* Exclude batch integration tests from CI

* Address PR feedback

- Added description to batch.README
- Consolidated grep commands in .gitlab-ci.yml
- Removed some debugging comments
- Replaces some inadvertantly removed license headers

* Add batch package to gitlab CI

* Updated CI for batch package

Updated CI include path

Update gitlab ci

Update CI

Update CI

Trying new include path for ci

Updated gitlab ci include path

Made idk race job optional for sonarcloud upload

add testdata directory

remove testenv from dockercompose file

use GIT_STRATEGY clone in batch CI

add testdata volume to dockercompose

Co-authored-by: Fletcher Haynes <fletcher.haynes@generalassemb.ly>
2022-10-29 14:24:33 -05:00
Seebs
e3d137f29c initial implementation of QueryContext design
This is living in a subdirectory for now so we can have better
turnaround time on tests and not have to build everything else
along with it.

This covers the logic that we can have *without* actually using
databases or the filesystem in any way, just to provide a framework
that lets us validate the logic handling overlapping queries.

The overall purpose of this is to prevent deadlocks, by ensuring
that database locks are only taken when we have already proven
that they are available. In short, the QueryContext preregisters
its "scope" -- the set of things it may want to lock. The operation
of creating the QueryContext can block, but it blocks with no
database locks held. Once it is unblocked, the scope it has reported
is now considered unavailable, and no other QueryContext using any
overlapping scope can complete creation until this QueryContext
completes. While it's running, the QueryContext can't request write
access to anything outside its scope. Thus, once created, a
QueryContext can always proceed, without being blocked, until it's
done.

Note that this does not fully address multi-node behaviors;
once you have a QueryContext blocking things, you need to not
make queries to other nodes that could be blocked in turn by those
nodes. In short, no write queries to other nodes while holding a
write-type QueryContext on the local node, because if two nodes
do that to each other at once, they can both be blocked.

We believe RBF is currently designed such that read-only accesses
don't block progress on writes, so non-write access doesn't
create problems.

We also have some code to allow us to create dot-format output
from the components of this system, which is mostly intended to
be a debugging tool.
2022-10-28 14:01:58 -05:00
Garrison Davis
522a29f866
Stop sending roaring-migrate binaries to S3 (#2263)
Co-authored-by: Garrison Davis <garrison.davis@featurebase.com>
2022-10-27 17:25:29 -06:00
Stephanie Yang
9b91023e29
update molecula references to featurebase (#2262) 2022-10-27 15:57:53 -05:00
pokeeffe-molecula
e1b704d4ea
added a test to cover the keyword replace as being synonymous with insert (#2261) 2022-10-27 14:29:10 -05:00
pokeeffe-molecula
b32c33c992
tightened up is/is not null filter expressions (FB-1741) (#2260)
Covers tightening up handling filter expressions that contain is/is not null ops. These filters may have to be translated into PQL calls to be passed to the executor and even though sql3 language supports nullability for any data type, currently only BSI fields are nullable at the storage engine level (there is a ticket to add support for non-BSI field here FB-1689: IS SQL Argument returns incorrect error) so when these fields are used in filter conditions we need to handle BSI and non-BSI fields differently.
2022-10-27 13:11:14 -05:00
pokeeffe-molecula
fb40cdc2cb
fb-1729 Enriched Table Metadata (#2255)
enriched metadata for tables

added support for the concept of a table and field owners in metadata; mechanism to derive owner from http request metadata; metadata for table description
2022-10-26 11:23:40 -05:00
Seebs
37ae0ce51a don't obtain stack traces on rbf.Tx creation
We thought stack traces were mildly expensive. We were very wrong.
Due to a complicated issue in the Go runtime, simultaneous requests
for stack traces end up contending on a lock even when they're not
actually contending on any resources. I've filed a ticket in the
Go issue tracker for this:

	https://github.com/golang/go/issues/56400

In the mean time: Under some workloads, we were seeing 85% of all
CPU time go into the stack backtraces, of which 81% went into the
contention on those locks. But even if you take away the contention,
that leaves us with 4/19 of all CPU time in our code going into
building those stack backtraces. That's a lot of overhead for a
feature we virtually never use.

We might consider adding a backtrace functionality here, possibly
using `runtime.Callers` which is much lower overhead, and allows us
to generate a backtrace on demand (no argument values available,
but then, we never read those because they're unformatted hex
values), but I don't think it's actually very informative to know
what the stack traces were of the Tx; they don't necessarily reflect
the current state of any ongoing use of the Tx, so we can't necessarily
correlate them to goroutine stack dumps, and so on.
2022-10-25 14:19:25 -05:00
Pranitha-malae
ccd2e7ea63
resolving bool null field ingestion error (#2254)
* resolving bool null field ingestion error

* testing issues

* adding null support for bools

* updating the null bool field ingestion

* trying to resolve issue when ingesting null value for bool type

* adding a clearing support for bool type

* resolving issues with bool null value ingestion

* updating the jwt go package version and removing changes made in docker compose file

* reverting jwt go version

* removing v4 of jwt

* adding a comment in test file to see if sonar cloud accepts this file
2022-10-20 16:51:21 -05:00
Pranitha-malae
09baf99ce4
changes to add bool support in idk (#2240)
* initial changes to add bool support in idk

* modifying some default parameters for testing, will revert them later

* adding support for bool in making fragments function

* boolean values implementation without supporting empty or null values at this point

* Implement bool support in batch using a map (and a slice for nulls) (#2247)

* Implement bool support in batch using a map (and a slice for nulls)

* Keep the PackBools default for now

But set it explicity in the ingest tests which rely on it.

* Modify batch to construct bool update like mutex

The code in API.ImportRoaringShard has a switch statement which causes
bool fields to be handled like mutex fields. This means, that the
viewUpdate.Clear value should only contain data in the first "row" of
the fragment, which it will treat as records to clear for *all* rows.
This makes more sense for mutex fields; for bool fields, there's only
one other row to clear. But since the code is currently handling them
the same, we need to construct viewUpdate.Clear such that it conforms to
that pattern.

This commit also adds a test which covers this logic.

* Remove commented code; revert config for testing

This commit also removes the DELETE_SENTINEL case for non-packed bools,
since that isn't supported anyway.

* Revert default setting

* remove inconsistent type scope

* correcting the logic of string converstion to bool

* resolving an error in a test

* adding tests to cover code related to bool support in batch.go file and interface.go files

* modifying interfaces test

* added one more test case

Co-authored-by: Travis Turner <travis@pilosa.com>
Co-authored-by: Travis Turner <travis@molecula.com>
2022-10-19 12:16:38 -05:00
Travis Turner
800750c746
Fix some issues with running IDK tests in docker. (#2248)
*Stop running TestKafkaSourceIntegration with t.Parallel()

This test can't be run in parallel as it's currently written. Doing so
allows for interleaving of messages to the same kafka topic between
tests.

I didn't attempt to modify the test so it could be run in parallel. That
could be done, but left for someone more ambitious.

* Remove idk/testenv/certs which got accidentally committed.

also update .gitignore to include those.
2022-10-14 14:02:36 -05:00
Seebs
011174b631 make perf_able run at all, make it debug a bit better
switch perf-able to using same node type we use for other spot instances,
because otherwise it never finds any available capacity.

we switch the perf-able script to use the standard get_value function
instead of direct jq calls.

we try to grab server logs if the restore fails in the hopes of finding
out why the restore very occasionally fails.
2022-10-14 09:49:19 -05:00
Seebs
eba1ad3b85 drop PLG builds and related functionality, streamline phases
We end up spending a lot of time waiting for machines to become
available to run the multiple nearly-identical build phases. Instead,
let's just run one build phase that builds all four targets,
because the actual `go build` takes a tiny portion of the time
of the whole job.

We also drop the separate "pretest" phase which, while it was
intended to speed things up by getting that work done sooner,
actually just meant that all the other test phases were blocked
waiting on the build in a way they didn't need to be.

We also resume trying to skip the IDK tests when they're not needed.

We run sonarcloud after the external lookup tests, instead of
after clustertests, because clustertests are long and virtually
never fail, so this saves us a couple of minutes >95% of the
time at the expense of possibly running a useless test in the
rare case where the clustertests fail.

Redo the split of the various IDK builds (some of which need to
be done native on amd64, some on ARM) so that they are more similar
in length instead of being 3 minutes and 10 minutes.

Drop the non-auth variant of clustertests because it doesn't
really increase test coverage.
2022-10-14 09:49:19 -05:00
Seebs
55b6effe22 set test timeouts shorter
We fixed a number of performance issues as a result of which none
of the `go test` or `go test race` things should take more than 2-3
minutes, which means we definitely don't need to set a 90m timeout,
especially when the gitlab timeout is shorter.
2022-10-14 09:49:19 -05:00
Seebs
346dbb04fe use t.Fatal(f) to abort tests, not panic 2022-10-14 09:49:19 -05:00
Garrison Davis
6035345fb1
Upgrade CI to Go 1.19.2 (#2246)
All jobs now use GOVERSION or GOFUTURE to determine the docker image
pulled.

GOFUTURE is latest so that it will always use the latest version as new
versions are released. We can later lock it to a specific minor version
when there is another one released.

Co-authored-by: Garrison Davis <garrison.davis@featurebase.com>
2022-10-12 12:32:52 -06:00
jonathan.cheng
43f63b93e3
Cloud 940, skip bad row, enable ingest subsequent rows (#2201)
* first try to skip decodeMessage() error

* force idk to skip a row if there are errors in recordizing

* add comment for removing returning errors from decodemessage()

* added ingest flag SkipBadRows and implementation for skipping Bad Rows (errors that come from recordizer)

* added some comments

* removed comment

* made changes as per discussion with jaffee and walter. i hope this works...

* adding unit tests to check functionality implemented for CLOUD-940

* addressing review comments

* changed a variable name in test file

* removed a variable from ingest test file

* testing sonarcloud failure

* drop spurious second sonar-scanner call

We call sonar-scanner on the IDK data, and then we change
into the IDK directory and try to run it again on the same files,
which don't exist.

* abandon idk change detection for now

the "changes" rule appears not to be good at detecting changes
in some cases. specifically, it appears that you have to be in
an "only:" clause, not a "rules" clause, to trigger the
merge-specific behavior which checks the entire merge branch
instead of the top commit, but that means that if your last
commit doesn't touch IDK, we don't run IDK tests, and I haven't
been able to fix this yet.

So for now, revert the IDK-specific change detection behavior,
which slows CI down but gets us test coverage.

* fix path references

we had three tests all creating idk_coverage.out, then we tried
to grab all files named coverage.out from the testdata directory.

* refactoring tests to avoid duplication

* reverting changes made for local testing

Co-authored-by: CHIN JUNG CHENG <chengcj@CHINs-MacBook-Pro.local>
Co-authored-by: Pranitha-malae <56414132+Pranitha-malae@users.noreply.github.com>
Co-authored-by: Pranitha-malae <pranitha453@gmail.com>
Co-authored-by: Seebs <seebs@molecula.com>
2022-10-06 16:20:35 -05:00
Seebs
19dc881d94 test for correct state during test startup
When we've started a fake cluster, we should expect to reach a
"STARTING" state, not a "DOWN" state. This test would coincidentally
pass as long as we checked the state before any of the nodes got
their notification from the node watcher that at least one node was
STARTING, because prior to that the cluster would be DOWN. But once
it got to STARTING, we would wait forever; we never reached the
instruction to tell the nodes to come to any other state, and they
would never reach a DOWN state.
2022-10-06 11:45:50 -05:00
Seebs
83e08efa0a abandon idk change detection for now
the "changes" rule appears not to be good at detecting changes
in some cases. specifically, it appears that you have to be in
an "only:" clause, not a "rules" clause, to trigger the
merge-specific behavior which checks the entire merge branch
instead of the top commit, but that means that if your last
commit doesn't touch IDK, we don't run IDK tests, and I haven't
been able to fix this yet.

So for now, revert the IDK-specific change detection behavior,
which slows CI down but gets us test coverage.
2022-10-06 11:45:50 -05:00
Seebs
8cea8a663c fix sonarcloud integration
We call sonar-scanner on the IDK data, and then we change
into the IDK directory and try to run it again on the same files,
which don't exist in that directory. We shouldn't be running it
twice; we should run it once on all the files.

More subtly, we created files named foo_coverage.out, then tried
to glob files named coverage*.out. (The apparent similarity of the
$(PROJECT)_coverage.out names is harmless, PROJECT is getting set
and they're using different names.)

Fixing this gets SonarCloud more reliable again.
2022-10-06 11:45:50 -05:00
Seebs
a6ef3dabe2 improve resilience of smoke test setup
We want to retry our terraform setup if it fails, so let's check whether
it worked and possibly retry.

This loop is awful because I'm trying to both check the exit status
and the reported IPs. Once I know whether the exit status predicts the
reported IPs that should go away.
2022-10-06 11:45:50 -05:00
Julio Martinez
5c38d87d09
Change featurebase user home path to /var/lib/featurebase. (#2242) 2022-10-06 08:38:14 -07:00
Jacob Brinlee
694fb9b048
adding foreignIndex conf opt (#2239) 2022-10-05 09:13:44 -05:00
Hoang Pham
634c54e257 FB-1696 - fixed debug message to show topic's name instead of topic's address 2022-10-04 15:50:46 -05:00
Seebs
30a5a7dff9 drop test timeouts to reasonable values 2022-10-03 10:28:22 -05:00
pokeeffe-molecula
a8146f826d
moved file from this repo to documentation repo (#2232) 2022-09-28 14:32:15 -05:00
Julio Martinez
267773c9d1
Remove 30sec restart wait. (#2231) 2022-09-27 12:44:06 -07:00
pokeeffe-molecula
1a6c15263d
And now....INNER JOIN! (#2230)
* ID sql3 internal type representation is int64; fixed a bug that assumed incorrectly that it wasn't

* refactored some names for clarity

* primary: get nested loop joins to work; secondary get  brute force aggregations for SUM working

* added tests; removed debug output

* review feedback

* Update sql3/planner/compileselect.go

review feedback

Co-authored-by: Travis Turner <travis@pilosa.com>

Co-authored-by: Travis Turner <travis@pilosa.com>
2022-09-27 09:27:37 -05:00
HHans09
5a66d283f0 FB 1646 : Code updated to make the debug message more helpful 2022-09-26 16:32:19 -04:00
HHans09
3bb825a908 FB-1646 : UPdated code post code review 2022-09-26 16:32:19 -04:00
HHans09
555c8f6532 FB-1646 Removed Debugf messages that does not make sense 2022-09-26 16:32:19 -04:00
HHans09
d19b7ac841 UPdated the code to remove declared but unused variables - committedOffsets, stv & iv 2022-09-26 16:32:19 -04:00
HHans09
80281edaee Removed Debugf messages that does not make sense 2022-09-26 16:32:19 -04:00
Seebs
9c216ef8a6 use testhook test cleanup
The testhook post-test hooks only work if you use a TestMain to
invoke them, otherwise the cleanups can be registered but never
actually get run. This deletes the etcd sockets, and temp
directories, that we created from our test runs. We also fix
the test creating a temp file directly to create it in a TempDir
(which gets cleaned up after the test), and fix the name of the
top-level tests displayed in TestMain.
2022-09-26 12:33:43 -05:00
Seebs
3582cee4b6 remove a commented-out test case for a function that no longer exists 2022-09-23 16:56:27 -05:00
Seebs
8b52680f7d drop unused row
This looks like leftover code from an earlier draft. We weren't
using this value.
2022-09-23 16:56:27 -05:00
Seebs
9e2542d81e address multiple staticcheck issues
staticcheck notices a bunch of unused values and similar
things, let's fix them while we're here.
2022-09-23 16:56:27 -05:00
Seebs
c3b032d5cb drop ioutil
The ioutil package is deprecated, with all of its functions having
moved into os or io. Do the replacements so we stop having this
impending.
2022-09-23 16:56:27 -05:00
Seebs
cf94181c89 significant refactor of test setup and teardown
We centralize the creation paths for test indexes, fields,
etcetera so they all have a common path, all using standard
test holders. There's still two versions, one for test.* functions
and one for internal. They do share a TestHolderConfig though.

Large hunks of the related APIs are simplified/streamlined.
* Fragments are always created with a Field and don't need
  a workaround in case they don't have it.
* Creation of test fragments, etc., use optional FieldOptions
  but don't specify names because they're all using new holders
  for each thing created anyway. This dramatically reduces
  the complexity of the calls.
* test fragments are created inside test views which are created
  inside test fields, etcetera, so everything is using the same
  logic; test views aren't bypassing the other layers, they're
  creating themselves normally within a field.
* Quite a few things now use the standard runtime/production
  logic instead of being custom workarounds; for instance, instead
  of `mustOpenMutexFragment` creating a fragment and then creating
  a mutex vector for it, we just create a mutex-typed field and
  have the normal runtime code do this.
* Similarly, we now use the same field creation logic that production
  does, instead of having our own test-only thing that validates
  field names directly, so our test that we're validating field names
  is actually testing the runtime code. Yay.
* fragSpec goes away. it was a replacement for fragProxy which existed
  to solve memory allocation problems but replaced them with interface
  overhead problems. Now we just have pointers to things and maintain
  valid data structures.
* Many panics are now Fatal or Fatalf calls.
* Some specific bugs fixed, like a cluster which was requested and
  then had its first node directly overwritten, which isn't valid with
  shared clusters.
* Drop the temp-dir test flag and TempDir variable, we can just use
  $TMPDIR.
* Drop a benchmark of "write file to disk" that was purely a benchmark
  of file write speed, not a benchmark of rendering the data that needs
  to be written.
* Drop the unused "flags" parameter to fragment creation, which was
  only used back when we changed the BSI format.
* Use holder.Txf() rather than index.Txf(). The TxFactory has to be
  holder-level anyway, referring to it via the index is misleading.
* Test holders automatically close themselves and delete themselves,
  we remove various other things that thought they were responsible
  for deleting themselves.
2022-09-23 16:56:27 -05:00
Seebs
d710f83e2d reduce verbosity of retryablehttpclient
The default client appears to be pretty spammy and flood us with
debug messages about POST and GET requests, and honestly we don't really
need these or benefit from them, I don't think, so let's not.
2022-09-23 16:56:27 -05:00
Seebs
e3595e3fe7 set directory permissions restrictively to quiet etcd 2022-09-23 16:56:27 -05:00
Seebs
7cd00582ee restore commented-out test 2022-09-23 16:56:27 -05:00
Seebs
4e00a86492 drop excessively verbose messages used while debugging something long ago 2022-09-23 16:56:27 -05:00
Seebs
00b917be36 continue removing Tx parameters to view-type functions
A few view functions were taking a Tx, which had to be shard-specific,
but that's sort of awkward -- the view is inherently not shard-specific,
so it should be handling sharding internally.

There were also a couple of remaining obsolete checks for whether a
Tx was nil, at least two of which were in contexts where it absolutely
can't be. Remove all of them, and also the function itself.
2022-09-23 16:56:27 -05:00
rachithrr
8b74087c5c
FB-1674: Kafka consumer stops reading messages from topic (#2222)
Added condition to first sort by topic, followed by partition and offset.
2022-09-21 12:53:50 -05:00
pokeeffe-molecula
91e3b8457a
fb-1075 (#2221)
* handle multi field count correctly

COUNT() should ignore null values.
If the data type of the expression supports an existence bitmap for the underlying FeatureBase data type we will use it to eliminate nulls from the aggregate

* simplify aggregate for existence test

we can use a direct != null instead of an indirect not(=null), and
avoid relying on the probably-broken behavior in the executor that
tries to silently fix up Row(x=3) tests on BSI fields which wanted
Row(x==3).

Co-authored-by: Seebs <seebs@molecula.com>
2022-09-20 14:53:10 -05:00
Seebs
98a7129464 use timeout when waiting for cluster state changes
We had this fail in CI once, and failing took 30 minutes because
we didn't have a timeout on this. This shouldn't ever fail, but
the fact that it did indicates that the fabled etcd failures
we've seen a couple of times were still capable of happening.
This will make that failure happen sooner and more clearly.

Also, log the cluster states (and possibly node states) while
waiting. But add a delay -- otherwise we can do this quite a few
times per millisecond. We use Logf so that, if you didn't use -v,
you see these reported only if the test fails, but if the test fails,
we'll say what happened.

It would probably be better to have a passive thing that can wait
for updates, because we're waiting on heartbeats. Missing: A way to
detect what's actually happening in the failure cases, which we
see only quite rarely.
2022-09-14 11:47:50 -05:00
Seebs
60d52a6766 staticcheck is right, as usual 2022-09-14 11:47:50 -05:00
Hoang Pham
9c3ec0bb97 FB-1663 - fix make build-lattice failing 2022-09-13 14:10:35 -05:00
Hoang Pham
a7fbbd24d8 FB-1339 - UI - updated lodash version to fix gitlab vulnerability 2022-09-13 09:19:19 -05:00
Seebs
0c91270eb1 bump to go 1.19.1 because there's no longer a docker image for 1.19 2022-09-09 17:10:57 -05:00
Seebs
782faa3354 squash auth tests into regular smoke tests, improve smoke tests
This is a bit complicated and entangled, sorry.

First, we squash the auth-based smoke tests into the regular smoke
tests; we just run all the tests with auth on and that way we don't
need to spin up an entire separate cluster of machines just to run
a single query against them.

We improve the error detection, and standardize the jq-to-get-config
code. The purpose of this is to try to make sure that, if we actually
hit a failure and get "null" for a host name, we report *that*
as an error, rather than running ahead and producing 20+ separate
reports that ssh failed because it couldn't find a host named null.
2022-09-09 17:10:57 -05:00
Seebs
d627ff1724 don't run commands against holder before messing with its stats
You have to start the cluster before you can refer to its holders,
because GetNode doesn't work on an unstarted cluster, but if you
actually issue any commands, those require messing with the worker
pool which wants to have access to the holder's stats.
2022-09-09 17:10:57 -05:00
Matthew Jaffee
5be85a0d47 add persistent history and combination of multi-line commands to CLI
"featurebase cli" will now save command history to
$HOME/.featurebase/cli_history by default. Additionally if a command
is entered across multiple lines, the newlines will be removed when
the command is saved in the history. Previously each line was saved
separately which was a bit annoying.
2022-09-07 13:10:29 -05:00
pokeeffe-molecula
0a73abbbfe
Add a smoke test for the sql3 endpoint (#2214)
* turned on sql endpoint in smoke test; added a test to execute a simple sql statement

* add config to both configs

* fixed not enough arraying
2022-09-07 09:34:45 -05:00
Garrison Davis
1469f4a72c
Fix UUID library version for CVE-2021-3538 (#2213)
We were using v1.2.0 of the github.com/satori/go.uuid library to
generate UUIDs for transactions if the transaction had no previous id.

That version of the library had CVE-2021-3538: "Due to insecure
randomness in the g.rand.Read function the generated UUIDs are
predictable for an attacker."

More reading can be done here:
https://pkg.go.dev/vuln/GO-2022-0244
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3538

This vulnerability was found using the new govulncheck tool which is not
currently used in our CI pipeline but might be a good candidate to
include in the future. (Like all tools like this there are caveats to
its usage and utility which can be read about below.)

Information on that tool can be found here:
https://go.dev/blog/vuln
https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck
2022-09-06 13:52:13 -06:00
pokeeffe-molecula
7c936471cc
sql3 changes (#2211)
* first cut of working (slowly) bulk insert; table valued functions and a tuple data type to support time quantums

* oversight

* filter pushdown implementation; bulk insert

* addressed some linter issues
2022-09-06 11:16:11 -05:00
Seebs
790d1bf3dc drop [postgres] config stanza
This might be breaking CI now that the postgres wire protocol support
has been dropped.
2022-09-02 11:40:37 -05:00
Seebs
2052bb01d8 refactor testing to share clusters more often
When doing tests, we create a ton of one-off clusters. This
turns out to be expensive and slow. Fixing it is surprisingly hard.

Fundamentally: If we're sharing clusters, we need to use different
indexes for each test, to avoid clashes. This changes index names.
As a side-effect, this reorders many partition-based things, like
the order keys are returned in. Thus, to fix this, we change a lot
of tests to no longer depend on the *order* in which strings are
returned.

Having done that, we can also discard the ModHasher behavior, since
that only existed to allow us to reliably predict partitioning.

The basic design is as follows: Instead of a cluster being a
[]*Command, a "shareable" cluster is now a []*Command plus some
flags, and a "cluster" is a pointer to a possibly-shared cluster,
plus a link to the specific test using this specific cluster,
and correspondingly, its test name suitably coerced to be a valid
index name prefix.

The "test.Cluster" object now has methods to allow retrieving an
index name, and also implemnts fmt.Formatter to let you use,
e.g., `%i` with it in Sprintf to get "the index name, plus an i".
(This works for everything but %p and %T.)

This allows us to consistently rework all the many things that
use index names in a persistent way.

We also have `MustUnshared` and `MustRunUnsharedCluster` methods
which allow us to specify that a given test needs its own cluster
for some reason. For instance, the tests that want to run backups
need their own isolated cluster, and the tests that want to close
or reopen nodes need their own cluster because a reopened cluster
won't have working GRPC for some reason.

On "closing" a shared cluster (actually the test-specific wrapper
that reflects a given sharing), we delete any indexes starting with
that test's index name prefix. Otherwise, the huge pile of open
indexes prevents `go test -race` from working on MacOS, where we
run out of address space too quickly.

This is fairly enormous but most of the individual changes are
fairly trivial things like replacing the string "i" with "c.Idx()".

We also tweaked a test that failed for me a couple of times to
not depend on sort order.
2022-09-02 11:40:37 -05:00
Seebs
5579034eb2 shorten SetValue_QuickCheck
We reuse a fragment. It might seem surprising that this works, but
the fragment code actually doesn't have a persistent bit depth at
all, it just accepts whatever bit depth you tell it to use. Cutting
out the recreation of the fragments saves some time.

We also cap bit depth at 8, instead of 62, because there's a ton
of runtime cost to testing more bit depths, but it doesn't actually
change the logic.
2022-09-02 11:40:37 -05:00
Seebs
b2e56a2bc3 reduce simultaneous memory usage a bit
Delete indexes after we're done with them from subtests so that
we don't fill up on a huge number of unrelated indexes.
2022-09-02 11:40:37 -05:00
Seebs
937be623f7 set RBF sizes smaller for test
We end up hitting race detector limits on MacOS. This should mitigate
that.
2022-09-02 11:40:37 -05:00
Seebs
84a980af6a fix silly math typo
For arbitrary mod values m, greater than zero,
	(x%m + 1) != 0
is always true

What we almost certainly meant was
	x%(m+1) == 0

which would give you all the bits in row 0, half the bits in row 1,
etcetera.

Also, we drop to doing a quarter-shard because why not.
2022-09-02 11:40:37 -05:00
Seebs
397badbccb reduce size of KeyReplication test
This test used to be large, because it was testing some features that
were refactored out in October of 2019. Since we no longer have the
"buffer growth" to check, let's check a much smaller file.
2022-09-02 11:40:37 -05:00
Seebs
d81320c2ab improve post-hook behavior
We want to be able to register hooks which do cleanup, which may be
registered after the auditor cleanup check, which means that we
want LIFO order for post-hook cleanups.

We also want the test hook cleanup to be deferred, rather than
merely run after the tests are executed. Also, we have to extract
the result from running the test, then execute deferred things,
*then* call os.Exit, because os.Exit bypasses defers.
2022-09-02 11:40:37 -05:00
Seebs
474d3e0794 kill everything that tries to pass nil tx to field/view things
The "field/view will just synthesize a tx" behavior is awful and
also hides a number of fundamental flaws. We distinguish between
"we really do mean to work on a single shard here" and "we intend
to work on the whole field or view", and the latter now take
Qcx instead of Tx.

This eliminates a lot of very weird cases where we checked for
nil Tx and synthesized them, and also gets us away from
field and view taking Tx parameters when no possible Tx
can be constructed which is valid, because Tx are inherently
shard-specific at this time.
2022-09-02 11:40:37 -05:00
pokeeffe-molecula
e4a4a06af0
added /sql endpoint; implemented SHOW TABLES (#1935)
* squashed 45 commits into one :)

* tlt/sql experiment (#2035)

* Move PlanOperator to sql3/planner/types package

includes:
type PlanOperatorColumn struct
type PlanOperator interface

* Remove planner dependencies from pilosa package

The goal after this is to prevent the planner package (which doesn't exist yet)
from being imported by the pilosa package; we just want it injected into the server
in server/server.go. This is because the planner package uses pilosa types, so we need
to avoid circular dependencies.

Added ExecutionPlannerFn
Make public: pilosa.ExecOptions
Added a pilosa.Executor interface
Added a planner.types.CompilePlanner interface
Isolated the planner calls to:
- Executor.Execute()
- *API.[method]()

* Move executionplanner files into the sql3/planner package.

This required a bit of gymnastics, and there are some things around
FieldOptions which need to be addressed soon.

* Remove the hacky FieldOptions stuff I added earlier

This implementation just uses the pilosa.FieldOption functional options
provided by the API (as opposed to trying to build a FieldOptions
object.

It also changes field types to constants. These are private for now, but
if we need to make them public, we should put them in the planner/types
package.

* Implement the "scale" value from Decimal(scale)

Also, precision and scale were currently reversed in the parser. This
fixes that.

* Modify the parser to handle CACHETYPE <type> SIZE <size>

It's a little odd to me that the cache type values are Tokens, but I
guess it's ok. One thing to keep in mind is that FeatureBase expects
lowercase values, so this commit changes the parser to set the value to
the lowercase version of the type.

* Fix the /sql2 tests

This entailed a combination of commenting out or t.Skip()-ing tests
which covered code in the parser that has been commented out or removed
as not currently supported in sql3.

It also adds some coverage for the sql.Contraint stringers.

* Prevent JSON sql results from containing closing commas

This commit just re-works the existing output code to avoid inserting
closing commas (which results in invalid JSON).

* Enhance the CREATE TABLE test coverage.

In particular, ensure that the fields which get created in FeatureBase
are what we expect based on the fields defined in the CREATE TABLE
statement.

This also ensures that the TIMEQUANTUM and CACHETYPE contraints are not
provided for the same field (since those constraints are not supported
together).

* Adjust the EBNF file to indicate SIZE contraint is optional

A CACHETYPE can be provided without a SIZE. This change indicates that
SIZE is optional.

* Remove `executionplanner_` from file names (#2040)

* implementation of ALTER TABLE (sans column RENAME)

* refactored expression analysis; added more robust type checking; all unary and bin ops function on ints

* added type support for expressions; full bin/unary op support; added cast; more literal support

* cast int to all other types

* all literals (except idset, stringset & timestamp) make it thru; cast to all types with int as source now works

* implemented LIKE/NOT LIKE

* Implemented IS [NOT] NULL

* Move sql2 files into sql3/parser package (#2045)

* Move sql2 files into sql3/parser package

This also removes the sql2 package.

* Fix tests which were typing _id fields as INT intead of ID

* implemented BETWEEN, NOT BETWEEN

* Add featurebase/error package (#2046)

* Add featurebase/error package

I copied the `dax/errors` package which I am starting to use in the DAX
prototype into `featurebase/errors` in order to start using it with the
sql3 package. It's basically a wrapper around `github.com/pkg/errors`,
but it uses a customer coded error.

The sql package can define its own errors based on the
`featurebase/errors` types. Then do things like `Wrap()` and `Is()`.

* Address the linter complaints: shadowed variables, unreachable code

* implemented IN & NOT IN with expression lists

* first cut of CASE

* Fixed some errors from rebase

* updated bnf; removed unused code; tightened up error handling

* first crack at basic CLI for SQL3

Use: `featurebase cli`

Still lots to do here, but for example:

> select count(*) from tremor
+--------------+
|        COUNT |
+--------------+
| 1.158321e+06 |
+--------------+

* Iterate on the CLI (#2057)

Handle the errors.
Add an "exit" command.
Add some general formatting and white space.

Add termination character: ";" (semicolon)

This commit allows a user to provide multiple or partial SQL statements.

Example of multiple statements:
```
show tables; select * from foo;
```

Example of partial (multi-line) statements:
```
select *
from foo;
```

Don't uppercase the header values

* error refactoring; first cut of TOP; remove unused code; use log.Printf instead of fmt.Printf

* fixed a bug with QualifiedRef from refactoring; added bones of INSERT; removal of unused code; tightened up errors more; fixed failing tests

* single value list for INSERT

* Update bnf per discussion with Travis; INSERT now doing the requisite stuff

* Pat's eyes went square - nothing wrong with TOP, Pat needed to learn arrays again.

* improved some errors; fixed tests to suit

* send warnings back in the api; update CLI to display warnings

* start warning on stuff not implemented so we don't get bugged about it

* Tlt/sql experiment (#2063)

* Expresssion -> Expression

* Add SQL planner test

- adds a test to which it is easier to add tables and SQL statments
- un-exports all of the expression types
- removes the planner pointer from the expression types (it can be added
  back later if need be)

* Fix where clause on a string field

Prior to this commit, the binary expression for a where clause on a
string field was building the call by providing a range operator which
is typically used for BSI fields. This changes it to use the call.Args
for string values.

* Update planner tests to handle multiple sql for the same results

* Reorganize SQL tests

Introduce a test/helpers package and move shared MustQueryRows into that
package.

* Add a compatibility map for field types. (#2064)

This is primarily to address the fact that ID fields were previously
incompatible with INT literals.

We should probably consider introducing a custom type for FieldType
which can be used to define compatibilities.

* significantly refactored type checking

* Handle nil (NULL) values in the sql CLI. (#2067)

go-pretty panics if the interface{} field value is nil. This replaces
nil values with a "NULL" string.

* Squash some commits

fixed a still failing test

added line, col to all error messages

refactored source handling to enable table aliases

fixed some copypasta per review

warnings for order by & topn; implemented select as a source

starting to handle in (select...); added stub for optimizer

JSON-encode the sql error and warning strings (#2069)

Error strings with unencoded characters (like double quotes) were
resulting in invalid json.

got insert working; added symbol table; added concrete optimizer; added nascent NestedLoopsOperator; rewrite "where foo in (select..." as inner join

* all about the sets (#2085)

* implemented setcontains()

* implemented set literal; insert set column values; setcontains/all/any both in expr eval and pql filters

* Convert test to use latest framework. (#2086)

* fixed some comments

* removed refactored tests

Co-authored-by: Travis Turner <travis@pilosa.com>

* Add support for Decimal fields to the sql test. (#2090)

* dates (#2094)

* return dates as strings in output; tightened up decimal type checking

* return dates as strings in output; tightened up decimal type checking

* fixed failing tests after decimal changes

* can now insert decimal values

* implemented insert for timestamp data type; implemented current_date, current_timestamp constants

* fixed some failing tests

* handle date literals from strings in insert statements

* changes from feedback

* Fix pointer method error

* sql3 API interface (#2110)

* Introduce API-related interfaces: SchemaAPI, ComputeAPI

The sql3 code was relying on the pointer: *pilosa.API in order to call
API methods directly on the local node. If we want to import and use the
sql3 package in another service (the DAX queryer, for example), we need
to be able to use an implementation of an interface for those API method
calls.

This commit introduces two interfaces, both automatically implemented by
pilosa.API:
- SchemaAPI
- ComputeAPI

* Convert sql3 code to use IndexInfo instead of Index

The sql3 code was relying on a *pilosa.Index and its methods to get
general information like index and field name, type, etc. This commit
converts everything to use a *pilosa.IndexInfo instead.

This allows us to modify the SchemaAPI interface to also return
IndexInfo instead of Index, which will be a lot easier to implement in a
non-pilosa package (like DAX); creating a *pilosa.Index requires
providing things like data directory paths and holders, which are not
necessary for these use cases.

* Unary and Binary Ops R US plus CAST (#2111)

* implemented string literal for timestamp epoch

* fixed failing test

* fixed the failing test again

* refactored tests; implemented unary op tests for all datatypes; implemented binop tests for int/int, int/id, int/decimal & ID/int

* implemented all binary ops for INT & all other types, ID & all other types

* implemented binary ops for DECIMAL types & all other types

* added STRING & BOOL to various tests; implemented all remaining binOp tests

* fix up some stuff after rebasing

* refactored test defs into multiple files; implemented CAST for every datatype

* added tests for like/not like

* addressed review feedback

* addressed type review feedback

* tightened up IS [NOT] NULL behavior plus tests (#2118)

* tightened up IS [NOT] NULL behavior plus tests

* BETWEEN/NOT BETWEEN with all data types

* addressed review feedback

* Handle negative integers in column min/max constraints (#2120)

This commit parses the min/max contraint as an expression, as opposed to
an int literal, so that negative values are treated as Unary
expressions.

There currently isn't support for min/max constraints on `decimal`
fiels, so for now this change only expects +/- integer values.

* Implement the CREATE TABLE keypartitions logic (#2123)

* Execution time, IN/NOT IN & multiple aggregates (#2124)

* added display of execution time

* IN/NOT IN tests for all data types

* fixed date parsing

* removed duplicative tests

* refactoring aggregates

* suport multiple aggregates

* Address review feedback

* final round of feedback

* Add method SchemaAPI.CreateIndexAndFields() (#2127)

In order to support a CREATE TABLE statement as a single command, this
commit alters the SchemaAPI interface to contain a single method which
handles both the index and its fields. It also updates the sql3 code to
use this interface instead of CreateIndex() and CreateField()
indepedently.

* Symbol Handling (Again) (#2129)

* Refactored symbol handling in the planner; re-instated the select as source tests

* removed commented out code

* addressing review feedback

* Move hard-coded _id field out of planner and into interface implementation (#2130)

This commit moves the hard-coded addition of the `_id` field from the
planner to the SchemaAPI.IndexInfo() implementation method.

NOTE: If anything was expecting SchemaAPI.Schema() to also return the
`_id` field as part of its field list in each table, then it would not
be there because the `_id` field is only added in the IndexInfo() method
for now. Currently that's not a problem because nothing is expecting the
`_id` field for `Schema()`.

* Multiple aggregates, all aggregates stand alone and in GROUP BY (#2132)

* handle multiple aggregates in group by queries

* added handling for avg() aggregate both stand alone and in group by

* tightened up sum & avg outside of group by

* added min, max & percentile

* added warnings

* Make MaterializedRowSet implement the PlanOperator interface. (#2133)

This commit refactors the PQLMultiGroupByOperator to have a PlanOperator
as its output. Then, when it initializes, it sets up a
MaterializedRowSet and populates that with the values from the multiple
group by operations.

* added explicit min/max pql operators

* saved a file I forgot to save

* per review

* Un-indent some if/else nesting (#2136)

Co-authored-by: Travis Turner <travis@pilosa.com>

* Add optional `name` argument to test structs.

This commit adds the `name` argument to `tableTest` and `sqlTest` so
that a test can be optionally named. This allows a developer to more
easily run/identify a particular test by name.

* Inbuilt functions (redux) (#2141)

* set functions type parameter type checking

* implemented datepart

* include SQL3 type in SHOW COLUMNS output

* fixed select as source; failing SHOW COLUMNS test

* select in select list

* dump output columns; handle optimization for select list subqueries

* make it an error to return multiple rows for a select list subquery

* added description

* contants and test coverage for datepart function

* SQL3 Refactor-palooza (#2182)

* removed unneeded IsAggregate()

* first cut of working nested loops operator aka INNER JOIN

* remove selectListItemPlanExpression

* added some warnings

* all the tests are passing again!

* addressed some linter complaints

* added basic order by

* bug fixes; added 'or replace'/'replace' to insert

* for insert references should return appropriately

* added back ability to use subquery singleton expressions

* removed dead code; fixed test

* json-able plan, Schema() plus refactoring

* fixed dumb code

* add some tests for time quantum behavior

* Code cleanup during review. Also fixed INSERT to keyed table bug.

This commit contains a lot of minor adjustments made during code review.

It also contains a bug fix that was preventing INSERT into a keyed table
(i.e. _id type STRING) from working.

Co-authored-by: Travis Turner <travis@molecula.com>

* Fix expected min/max on timestamp column test (decimal field)

I don't know why this changed, but presumably something to do with
decimal related work that happened on master.

* Fix compile problem after rebase

* review feedback

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
Co-authored-by: Travis Turner <travis@pilosa.com>
Co-authored-by: Travis Turner <travis@molecula.com>
Co-authored-by: Fletcher Haynes <fletcher@capitalprawn.com>
2022-08-31 13:01:05 -07:00
Hoang Pham
650b7eaa45 FB-1627 - Added backup/restore tar. Purpose: for cloud team to backup and restore directly through stdout, stdin 2022-08-29 11:03:10 -05:00
Garrison Davis
6562b60340
Fix idk Version and idk BuildTime (#2205)
When we merged idk into featurebase, we didn't change the import path in
the Makefile to point to the correct go path
2022-08-25 17:43:13 -06:00
Garrison Davis
123b20d2f9
Upgrade Go to 1.19 (#2204)
Upgrade Go to 1.19

* Use go install to install statik for CI/CD

* Switch from stretch to buster for idk

The stretch release doesn't exist anymore for go 1.19 docker images.

buster is a newer version of Debian anyway (v10 vs v9)

Co-authored-by: Fletcher Haynes <fletcher.haynes@molecula.com>
2022-08-25 14:54:14 -06:00
Seebs
f03df56844 avoid insanely strange crash
So, nShards used to be 10. If you run a complete test, with go
test -race, and you have the sample input for the unrelated
TestImportMutexSampleData configured to use 64K bit density and 2K
rows, everything is fine. If you run a partial test, everything is
fine. If you run a complete test with -race, but you skip
TestImportMutexSampleData, or reduce either the bit density or the
row count, you get a very strange panic where the go panic handler
panics trying to report what happened so we don't get a valid stack
dump. On Macs. This is as much as I could debug it after about 6
hours. Since there's no special reason to think we need all 10
shards, and 9 still tests the behavior, we're leaving this one a
mystery.
2022-08-25 15:00:48 -05:00
Seebs
f3c164c483 don't rerun comparison pointlessly
The comment says "convert to each type and compare", but it
doesn't convert, it just compares the given container result to
three different forms of the same result. That's neat for testing
BitwiseEqual but doesn't actually give us more information, and
it takes nearly 3x as long.
2022-08-25 15:00:48 -05:00
Seebs
edbb2d3e1e Run slightly fewer set commands
We don't need all that many random set commands to get some coverage
for them.
2022-08-25 15:00:48 -05:00
Seebs
1f754dd998 Reduce amount of bit setting in mutex sample data
The mutex sample data test should still hit bugs with smaller
N and is very expensive for larger/denser data sets.
2022-08-25 15:00:48 -05:00
Seebs
33bd22a7cf parallelize some tests
These tests seem likely to be safe to run together, so let's.
2022-08-25 15:00:48 -05:00
Seebs
ebef51daa0 smallify Quick checks
Quick checks aren't super helpful, but they can test random stuff
a bit, so let's keep them, but make them smaller. Also, let's cram
the random selections into the first quarter of a shard so we see
more container updates to fewer containers because that's probably
more interesting.
2022-08-25 15:00:48 -05:00
Seebs
525412a5d8 rework Tx_Remove test to be much, much, faster
don't add/remove two million bits one at a time. instead, insert
small array containers, make them larger, replace them with bitmaps,
and so on. In short, we still create containers and change their
sizes in interesting ways, but we do it thousands of bits at a time.
This reduces runtime with -race from around 10-20 minutes to a second
or so.

We drop the "PartialContiguous" test because it was actually just
identical to PartialNoncontiguous, so far as I can tell, and not
really interesting.
2022-08-25 15:00:48 -05:00
Seebs
3c9a338d09 log errors we retry from, reuse retryablehttp client more consistently
We make clients pass in a context which has an associated
data structure which can be used to annotate errors we've encountered
inside retryablehttp. You might ask why we do this instead of
just giving retryablehttp a logger that isn't nopLogger; the answer
is that retryablehttp's logging is too spammy to use.

So we create a context, and then pass that in for requests, so that
when we check to see whether we should be retrying, we can log
the errors we encounter, so if we encounter errors we can log
something specific instead of "gave up after 5 retries".

We also make a second retryable client that would forward
authentication, and reuse that, rather than making a new client
for every call that needs to forward authentication. This allows
us to avoid the problem where that inner client wasn't picking
up the timeout settings we'd applied to the parent.

We log errors with Errorf if we actually failed entirely to do the
request, we log them with Infof if there's errors but the request
ultimately succeeds. We also try to log part of the response body
when there is one, but there wasn't an error.

If there's no response, we produce a spurious 500 and a message
saying that we produced it.
2022-08-25 10:11:50 -05:00
hphamMolecula
a2d02ffc57
FB-1337 - UI - fixes for regex backtracking vulnerabilities (#2187) 2022-08-24 15:37:55 -05:00
Seebs
317526cc09 add "only" clauses to IDK tests
The IDK tests should be run only when there's changes in the IDK
or client directories.

Also the shard transactional test should be run ever.

The "optional: true" flag is a fascinating quirk allowing you to
express that, *if* a job exists, we should wait for it, but if the
job doesn't exist, that's also acceptable.
2022-08-22 11:48:07 -05:00
Seebs
f066fcb33c Use socket instead of TCP for etcd config
When we make dummy test servers, we should make them using sockets
for etcd rather than TCP ports so we don't run into problems like
the test always failing if anything else is on that port already,
which it can totally legitimately be. For instance, if you ran
an existing featurebase server, and then tried "go test" in the
server directory, this would fail.
2022-08-22 11:48:07 -05:00
Seebs
36a4fb2cb7 skip IDK in "make test"
We want "make test" to run in a reasonable amount of time and
actually work, the IDK tests are full of tests that only run in
a specialized docker environment with things like hosts named
pilosa and kafka and such.
2022-08-22 11:48:07 -05:00
rachithrr
3d04b38398
Yaml invalid error (#2199)
Yaml invalid error. The rules of a job has to be in agreement with its prerequisites.
2022-08-19 16:49:58 -05:00
rachithrr
3e42fc7d9f
WIP: Sort extract columns by a field (#2193)
* FB-1251: Add ability to sort Extract queries by some field

There is a sort call which takes a row call and the field, and
based on the field type, the corresponding rows are read. both key and
value are stored in RowKV{}. The value is stored since its required to
merge data from shards. values are sorted in each shard and these sorted
listes are merged in the reduce.
sort-desc flag is sent to comparator to decide the sorting order. ok
flag is added to the compare function to track any error in the
sort.Slice anonymous function
Sorting over set field was removed, since there would be multiple values
for each ids and there would be no right sorting order there.
2022-08-19 13:29:17 -05:00
Garrison Davis
52e4dbb695
Add caching to go jobs (#2181)
The caching is done at the branch level.
2022-08-18 14:31:35 -06:00
Garrison Davis
9eb6b3ac3f
Fix idk package_docker_all CI job (#2196)
Before, we were building docker images for IDK for each of the four
linux/darwin amd64/arm64 platfrom/arch combinations, which didn't make
sense. If we want to later build docker images for linux/arm64, we can
add that later.

I also cleaned up the Dockerfile for IDK to minimize creation of excess
layers (by &&-ing RUN commands), and made apt quieter to cut back some
of the noise.
2022-08-18 13:52:04 -06:00
Garrison Davis
11fe9f0cad
Fix gosec-sast job (#2194)
We need to install base gosec tool and then the gitlab version to convert the gosec
json to the gl-sast-report.json that GitLab expects.

This lets us see the 'Security' tab under pipelines (and under the default branch
after this change is merged).

I chose to pin both of the versions of the tools to avoid any dependencies changing.
This could be an issue, but both repos are largely frozen.
2022-08-17 12:43:46 -06:00
CLoZengineer
a183357d65
chore(community): adds code of conduct (#2195)
Co-authored-by: Christopher Lowenthal <christopher.lowenthal@molecula.com>
2022-08-17 12:30:22 -04:00
Garrison Davis
584c1797cf
Use CI_COMMIT_REF_SLUG to tag Docker images (#2191)
We're using this because it's a builtin env variable that comes
with GitLab, and it fixes one of the annoying things about Docker
tags (e.g., you can't use all of the allowed characters in
Git branches).

One issue that I've seen a few times, is branches with either
capital letters (which was recently broken), or using the '/'
character.

This PR makes it so we always use the CI_COMMIT_REF_SLUG
when making or referencing images so that it is always consistent.

Note: this might make it slightly harder to intuit what the correct
Docker image to make (if you wanted to use the one built by CI rather
than locally). This trade off doesn't seem too hard to overcome.
2022-08-16 13:00:37 -06:00
Travis Turner
cddd9871af
Distinguish between three copies of fakeidp service (#2192)
There are currently three copies of a package called `fakeidp` in the
featurebase repo:

- ./idk/fakeidp/go.mod
- ./internal/clustertests/fakeidp/go.mod
- ./qa/fakeidp/go.mod

All three have a `go.mod` file. While this is supported under golang's
new Workspace support, what's not supported is that the modules share
the same name (in this case "fakeidp"). This commit is a sort of
temporary fix which renames the module for two of the instances. This
prevents, for example, VSCode with workspace support enabled, from
barfing.

By the way, one can enable VSCode workspace support with the following
setting:

```
// gopls
"gopls": {
    "build.experimentalWorkspaceModule": true
}
```

Also...

This commit fixes the `make testv` target. It's probably not used
anywhere (which I'm assuming because it was broken), but it's a handle
target, so now it will list and run tests against all packages found in
the repo, including the root package.
2022-08-16 09:13:11 -05:00
wmanongdo
baab212bb1
[CLOUD-934] Optionally broadcast IDK Kinesis errors/panics to externa… (#2185)
* [CLOUD-934] Optionally broadcast IDK Kinesis errors/panics to external storage

- Add a minor public method `idk.Main.SetLog` to allow setting the logger instance
  after initialization.
- Add a Logger implementation that captures recoverable errors and panics
  and pushes to an external store. Meant to decorate an existing Logger
  instance and always delegate to its implementation. Decoration happens
  when all AWS resources are initialized. Before then, the wrapped Logger
  implementation is used.
- If `--error-queue-name/CONSUMER_ERROR_QUEUE_NAME` specified, use an
  ErrorStreamLogger to push errors and panics to an SQS queue with that name.
  Omission of the option preserves current behavior.
- Parse sink ID from the `--stream-name/CONSUMER_STREAM_NAME` expecting the form
  'PREFIX'-VALID_UUID. If the sink UUID is invalid, emit a warning that errors/panics
  will not be written to an SQS queue but will still be logged using the decorated
  Logger instance.
- The inability to push to an SQS queue leads to warnings being emitted to notify
  ECS that no queue will be written to and is NOT a hard error.
- Add SQS interface mock for unit testing.
- Add IDK make targets for generating mock interfaces.

* [CLOUD-934] Execute go mod tidy and go fmt to pass CI/CD checks

* [CLOUD-934] Remove extraneous Makefile in idk/kinesis and fix install-mock-generator target

* [CLOUD-934] Add godocs to exported types and functions

* [CLOUD-934] Changed warning to not sound so ominous and update associated unit test

* [CLOUD-934] Unblock CI/CD at the IDK test stage
2022-08-12 17:59:56 -05:00
souhailanoor
39def696c5
FB-1618: Fix code smells due to unifying IDK and Featurebase (#2184)
* create constants for duplicates to resolve code smells

* refactored duplicated code for extract(rows))

* additional refactoring

* refactor test

* rename to match reg exp

* fixed naming

* fixed naming, removed duplicated string

* fixed index names

* fixed bug introduced in earlier commit

* create delete index method and refactor if statement

* refactored file to reduce complexity

* fix go fmt error

* fixed bug introduced in last commit

* address reviewer's comments

* remove trailing colon and spaces
2022-08-12 17:00:29 -05:00
hphamMolecula
985a70b14e
FB-1601 - Put a link to the cloud SaaS page in the admin UI (#2189) 2022-08-11 14:55:50 -07:00
Samir Patel
3c2ef484bd
[FB-1621] account for token expiration as float and int (#2188)
* account token expiration as float and int

* update tests
2022-08-10 17:26:10 -05:00
tgruben
7cfa516f74
[FB-1617] Commit Messages out of order (#2180)
* commiting partition highmark offset only; 
* protected spool access with lock
2022-08-08 14:41:22 -05:00
Samir Patel
3681feeeb2
[FB-1024 FB-1590] Increase timerange (un-revert) (#2174)
previously we allowed users to specify a granularity for timestamp
e.g. seconds, milli, micro, nano
however we converted everything to nano before we stored it.
This reduced the allowed range for all time units to what
was allowed by timestamp. For example, with second granularity
you can represent billions of years within the capacity of
int64 but with nano its somewhere b/w 100-200 years.

So now, for timeunits of seconds, milli, and micro the range
is year 0001 - 9999. These limits come from what Go
supports.

So this uses unit specific function to translate
timestamps to values and vice versa to increase
the time range.

In the process of increasing the range for timestamp and subsequent
testing, I found and addressed a few bugs:
- min/max queries were not using timestamp specific comparators so
  added that.
- Values from Import/ingest come to FB as relative values to epoch
    whereas other BSI fields come as actual values and then
    becomes relative to their respective bases within FB. so some
    specific handling of that was added.
- However! Set queries use timestamp strings which are, of course,
    the actual value they designate. So they have to become
    relative.
- When bitdepth is 0, Min/maxUnsigned functions did not run
resulting in a count of 0 when there
was an actual value that was 0.

Also, this removes (now) dead code and updates/adds tests.
2022-08-04 15:20:45 -07:00
tgruben
7a53e1e830
update to 1.9.1;make rm safe (#2175) 2022-08-02 15:09:20 -05:00
reesporte
b9865ee99a add row-col-mode to featurebase import
most types are imported in the format `<row>,<col>`, but ints and decimals
aren't. with this new flag, ints and decimals are imported using the
`<row>,<col>` format, instead of `<col>,<row>`.
2022-08-02 12:12:53 -05:00
tgruben
177db2e2b5
removed invalid state (#2173) 2022-08-01 12:47:17 -05:00
tgruben
0300cb071f
[FB-1598] Phase 0 of etcd extraction (#2169)
* Phase 0 of etcd extraction

* added test shell

* bare basic test

* address comments
2022-07-29 15:27:04 -05:00
Samir Patel
6f1514933b verify available space before backup
compares free space in output directory to
the usage of either the data directory or
index depending on what is being backed up.

- adds an http_handler endpoint to get usage
of a particular index
- adds InternalClient methods to get DiskUsage and
IndexUsage
2022-07-29 11:30:36 -05:00
souhailanoor
2bdf1f5081
FB-1597: unifying idk and featurebase (#2160)
* unifying idk and featurebase: first pass

* resolved conflict with master for gitignore & dockerignore

* deleted binaries that were accidentally pushed to git

* combined gitlab jobs for idk & featurebase

* run go fmt for idk

* updated ssh env variable, and made docker password variable in gitlab env variables

* fixed typo assigning variable name

* trying to fix docker login error

* trying a different solution for docker password

* pass registry

* fixed docker login

* updated paths for idk

* exclude idk tests from featurebase test run

* fix vendor error

* update certificates

* grpc needs to be in version 1.38
genproto, which is imported by big query updates the grpc version to 1.47.0
grpc 1.47.0 causes etcd to deadlock when calling etcd.Close()
the fix is to have a replace in go.mod to specify a specific grpc version

* run go mod tidy

* go mod

* run go mod tidy

* exclude bigquery since it is causing issues and undo grpc replace in go.mod

* fix grpc version

* fix formatting error

* update formatting

* attempt to fix formatting

* update path for code coverage

* update to use current branch binaries, not master

* fix for building idk - path updates

* udpate path for binaries

* update job dependecies

* update docker idk tests to use the current branch registry

* update stages for jobs

* updated job dependencies

* not allow idk s3 dump to fail since it is a dependency for integration tests

* update dependecy for idk tests

* update paths for idk build and code coverage

* download featurebase binary from s3

* pass branch name to all setup scripts

* change to current branch instead of master

* updated sonarcloud

* sonarcloud fix and branch name fix

* trying to speed up pipeline run time

* update stage

* branch name fix + sonar cloud

* sonarcloud
2022-07-28 17:23:16 -05:00
Julio Martinez
94a5721d05
Fixed broken fields when packaging rpm and deb files. (#2153)
* Fixed broken fields when packaging rpm and deb files.

* Update systemd unit files, package them into RPM's.

* Fix config file path for packages.

* Changed unit and binary paths to conform to standard locations for each vendor.

* Added featurebase owned directories.

* Create featrebase user/group and chown the right dirs

* Automate turning on featurebase

* Updated the .gitignore to include .vscode files.

* Changed RPM name to better conform to naming standards.

* Pass GOARCH when building RPM's.

* Avoid using recursive to remove files in this dir.
2022-07-27 12:54:46 -05:00
rachithrr
d627ee46cb
FB-1604: view knownshards return nil (#2168)
In the logs, I can see that this error occurs when a query is done
during the delete view.This fix is only to bypass it and log that
data.
The real issue is that the delete standard view which should happen
only once, is occuring every hour or two. The ingester might be
creating the standard views which needs to be fixed.
2022-07-27 11:47:52 -05:00
reesporte
89159134a4 recalculate shards for each call in query if it needs them
this way we don't have write/read calls in the same query that return false
results because they're using stale shards.
2022-07-27 10:25:52 -05:00
reesporte
8a59c1f930 remove unneccessary file opens 2022-07-22 12:20:16 -05:00
reesporte
2742ac351c catch errors on closing written-to files 2022-07-22 12:20:16 -05:00
tgruben
3cea9d28f6
set mod to 1.17 (#2161) 2022-07-22 09:51:03 -05:00
reesporte
7fbe96628d change perms: 0666 -> 0600; 0777 -> 0750 2022-07-21 13:34:46 -05:00
Seebs
b3a4e52a13 simplify, streamline, and possibly debug embedded etcd
The root problem this is attempting to address is sporadic
weird cases in which etcd mistakenly thinks it's down even when
it's up. I am not confident that this is addressed, but there's
a reasonable chance that it is, and I can't trigger it at the
moment, but it was always sporadic, so that doesn't prove much.

There's a lot going on here, and it comes into roughly three
categories.

First: Dropping unused/unneeded code. There's a lot of leftover
bits from the initial development and refactoring of this.

Second: Unifying and shuffling some of the design. We had
multiple interfaces which are functionally impossible to
usefully implement separately, so they're combined together,
and in some cases, moved.

Third: Streamlining logic and simplifying design choices.

This is combined into one commit because the changes are
thoroughly entertwined with each other and you can't usefully
break most of them out.

Also, a bunch of test coverage for most of these changes.

Big changes:

We merge the topology and disco packages.  The topology and disco
packages being separate creates a complicated tangle of problems
and dependencies.  The fundamental problem, approximately, is that
topology.Node has to track disco.NodeState.

There's three core interfaces interacting here:
	topology.Noder (maintains list of nodes)
	disco.Stator (maintains the state of a node)
	disco.Metadator (stores, possibly retrieves, node metadata)
But the node state mantained by the Noder *is* the set of node
metadata, plus state updates produced by Stators. The only actual
non-trivial and usable implementation of these interfaces is a single
thing which implements all three, and in which the implementations
share a single backend data source which they are all modifying.

But you can't move Noder into disco, because Noder has to refer
to topology.Node, but topology.Node refers to disco.

Solution: First, merge these two packages. Second, merge these
three interfaces, to provide a single interface which is more
clear about the fact that (metadator.)SetMetadata() and
(stator.)Started() are both changing the output we'll get from
(noder.)Nodes().

We rework the node state tracking.

We have this nodeStates map which is almost unused. Really, we
don't need it at all. Every node's state is either its last heartbeat
state or "Unknown", so we simplify this a bit. Also, we ensure that
the populateNodeStates function itself is yielding the sorted nodes
list, so we don't have to be as worried about possible later lookups
of sortedNodes happening outside a lock. We also add diagnostics
for deleting nodes from the metadata list (this should never happen),
and try to track heartbeat state more closely.

This is *probably* what fixes the underlying reported problem,
if anything did.

Still an open issue: Make heartbeat state changes aware of when
they're talking about *this* node and possibly not try to
mark it down? Except this may have a flaw: That would result in
each node disagreeing with other nodes in etcd about the state
of that node in the failure cases, and undermine the point of
using etcd to keep these states consistent.

We reduce the number of contexts and cancelfuncs in the etcd wrapper.

We create a shared context for the non-etcd.embed children of our
etcd wrapper, the heartbeat/keepalive and the node watcher, so we
can cancel that one context and cancel all of those at once, so
we don't need to separately track a function to call to cancel
the watch, AND be closing another channel. Also, our shutdown
now propagates automatically to the various etcd API calls we've
made for things like the node watcher and keepalive calls.

We still need to watch that channel in watchNodesOnce, though,
because apparently the watch doesn't yield an error even if the
context calling it is canceled. Whee.

This should reduce the risk of ending up in an inconsistent state,
and also the Close() function is probably idempotent now.

Smaller changes:

* Remove config-generators that existed to generate etcd
  configs but were used only for tests that no longer exist
  or make sense.
* Move the logic to generate etcd configs into the etcd
  package, instead of the "testing" subpackage. This allows
  us to write a self-contained config generator for
  clusters where the nodes know about each other, but do
  this just with etcd, not with full featurebase servers.
* Move the thing generating `fake:%d` socket names into
  the etcd package, which is the only place we use it.
  Also simplify it slightly.
* Don't panic on invalid URLs, report errors from them.
* At least try to use etcd's config.Validate functionality.
  It's underdocumented, so we're not sure what it will report,
  but at least if it does we'll get reports from it and
  know what they are?
* Try to handle CompactRevision errors from watches more
  correctly -- after a CompactRevision, any future attempt
  to watch from a lower revision will necessarily fail, so
  we adjust our target revision up. We don't have good
  testing for this.
* Drop the Metadata() method (that used to be in Metadator)
  because nothing ever used it and it didn't make much sense
  to try.
* Convert SetMetadata from taking an arbitrary json blob
  to taking the only data that would ever be valid since
  we always use it to extract node information anyway.
* Drop several unused functions, unexport things only used
  internally.
* Replace Started() with SetState("STARTED"), allowing us
  to write tests that mess with states. We weren't really thinking
  carefully about state transitions sometimes and now it's much
  easier to do that thinking.
* Stop leaving stray localhost:2380 and localhost:2379 in
  our embed config. We still sometimes see peer requests from
  those and I honestly don't know why, but at least it should
  be rarer.
2022-07-21 11:42:35 -05:00
souhailanoor
5451312515
Changes to row queries with from/to options (#2152)
Changes to row queries with from/to options return an error if field is not a timestamp field
logic couldn't be made earlier in call stack because other queries process from/to time differently.
2022-07-20 15:10:41 -05:00
hphamMolecula
41c59b77fd
FB-1548 - Added a fix for panic error that could happen when a view is opened by the ingest process but at the same time, was also deleted by TTL (#2147) 2022-07-18 17:35:34 -05:00
tgruben
ccbc944eea
standard code already in viewsByTimeRange (#2149) 2022-07-18 13:48:25 -05:00
Samir Patel
33a916c0f4 Revert "increase time range for timestamp by using specified granularity"
This PR reverts the timestamp work.

The timestamp work requires changes to FB and IDK; and there are
circular dependencies between tests in either repo preventing merging
of either. The work here is pretty stable, but required bypassing
the smoketest. Meanwhile, I found some additional things in IDK that
need addressing which means I merged this work in pre-maturely. Once
I get that worked out, I'll re-commit these commits.

This reverts following commits related to timestamp work:

bypass of smoke test b/c of circular dep with IDK: 0676790
update codec to reflect changes to timstamp range: bd5dc76
fix few bugs regarding timestamp: 33fce8a
increase time range for timestamp by using specified granularity: 5939923.
2022-07-18 11:09:04 -05:00
tgruben
d348cc65e9
[FB-1593] add from/to support to extract row call (#2148)
* add from/to support to extract row call

* gofmt
2022-07-15 18:17:59 -05:00
Samir Patel
0676790044 bypass of smoke test b/c of circular dep with IDK
can't merge b/c smoke test uses idk, which i can't merge
until this gets merged.
2022-07-15 15:15:12 -05:00
Samir Patel
bd5dc760b7 update codec to reflect changes to timstamp range
also address a few minor feedback comments from review
2022-07-15 15:15:12 -05:00
Samir Patel
33fce8a05b fix few bugs regarding timestamp
In the process of increasing the range for timestamp and subsequent
testing, I found and addressed a few bugs:
- min/max queries were not using timestamp specific comparators so
  added that.
- Values from Import/ingest come to FB as relative values to epoch
    whereas other BSI fields come as actual values and then
    becomes relative to their respective bases within FB. so some
    specific handling of that was added.
- However! Set queries use timestamp strings which are, of course,
    the actual value they designate. So they have to become
    relative.
- When bitdepth is 0, Min/maxUnsigned functions did not run
resulting in a count of 0 when there
was an actual value that was 0.

Also, this removes (now) dead code and updates/adds tests.
2022-07-15 15:15:12 -05:00
Samir Patel
593992312a increase time range for timestamp by using specified granularity
previously we allowed users to specify a granularity for timestamp
e.g. seconds, milli, micro, nano
however we converted everything to nano before we stored it.
This reduced the allowed range for all time units to what
was allowed by timestamp. For example, with second granularity
you can represent billions of years within the capacity of
int64 but with nano its somewhere b/w 100-200 years.

So now, for timeunits of seconds, milli, and micro the range
is year 0001 - 9999. These limits come from what Go
supports.

So this uses unit specific function to translate
timestamps to values and vice versa to increase
the time range.
2022-07-15 15:15:12 -05:00
tgruben
e9fce90e26
[FB-1587] crash would occur if missing nil-entry in batch (#2145)
* crash would occur if missing nilentry in batch

* Update client/batch.go

Co-authored-by: reesporte <45641995+reesporte@users.noreply.github.com>

Co-authored-by: reesporte <45641995+reesporte@users.noreply.github.com>
2022-07-12 17:20:55 -05:00
Samir Patel
6c0c8ffe09
upgrade ci-lint to 1.46.2 (#2143) 2022-07-07 11:18:41 -05:00
Hoang Pham
c0d630bee2 FB-1505 - check if view 'standard' exists 2022-06-30 16:58:57 -05:00
Hoang Pham
51ca8a131b FB-1505: catch ErrInvalidView for when multiple data nodes are trying to delete the same view 2022-06-30 16:58:57 -05:00
Hoang Pham
d807071a17 FB-1505 - Fixed for PR: renamed monitorTTL to monitorViewsRemoval 2022-06-30 16:58:57 -05:00
Hoang Pham
367448b034 FB-1505 - Fixes for PR: remove underscores from test names, rename TTLRemoval to ViewsRemoval 2022-06-30 16:58:57 -05:00
Hoang Pham
106c043f57 FB-1505 - added ability to update NoStandardView and delete standard view 2022-06-30 16:58:57 -05:00
souhailanoor
91e59e4376
Create a pool of goroutines bounded to hardware limits. This should resolve "connection refused" error from spawning too many goroutines at once. (#2138) 2022-06-29 16:22:37 -05:00
Kasey C. Rodgers
aaad12ed5b
sonarcloud ignore fix (#2137)
Co-authored-by: Kasey Rodgers <kasey.rodgers@molecula.com>
2022-06-29 12:36:44 -07:00
Matthew Jaffee
13b93d7795
add logging on error on DeleteFragmentFromStore in TTLRemoval loop (#2134) 2022-06-29 10:42:42 -05:00
reesporte
6afd9202bd add guardrails to TLS configs
We catch some possible states that don't make sense or are insecure:
1. If we're passed a nil tlsConfig to parse, return an error so we don't panic.
2. If we have a root CA, but we're skipping server cert verification, return an error.
3. If we have a TLS cert, but we're skipping server cert verification, return an error.
2022-06-28 11:58:19 -05:00
reesporte
edc7a9822f delete things from holder after removal from etcd
This way we can't get into an inconsistent state.

Consider this example:
You have a 3-node cluster, nodes A, B and C.
You create an index "blah" while all three nodes are up.
Nodes B and C go down.
You attempt to delete the index. It is removed from node A's holder, but is not removed from nodes B and C.
When nodes B and C are restarted, the schema still shows this "blah" index.
If you attempt to delete the index from node A, you receive an index not found error, but the schema indicates the index exists.

With this change however, when you first attempt to delete the index, it is not removed from the holder until there is enough nodes up to achieve consensus.

The same situation applies to fields and views.
2022-06-23 14:03:52 -05:00
Matthew Jaffee
bfa59ffdc4 fix container key computation for UnionRows call 2022-06-23 08:12:31 -05:00
Seebs
97c84da566 fix race condition in executor shutdown 2022-06-21 17:03:09 -05:00
Seebs
fd9d4de31d Remove most of the resize-related logic
We had two different, incompatible-with-each-other, and both
individually broken, partial implementations of resizing logic.
There's the original pre-etcd resize, and then the etcd resize,
and neither works, but there's conflicts between the ways they
don't work.

No attempt to fix this is likely to yield decent results, so
instead, we yank them both out entirely, so if we decide to
implement resizing (which we will) we won't be confused by
stray code pertaining to resizing that's not really hooked
up to anything.

We're leaving the resize messages in protobuf to avoid renumbering
protobuf messages. We rename some of our message types to UNUSED0,
etcetera, so that any code still using the old names won't
compile, to make sure we get rid of it, but we can't just drop
the numbers without breaking rolling restart.

The Resize_AddNode tests are removed not just because we don't
have resizing, but because they were completely broken anyway
and never worked at all. But there's no reason to fix them because
they exist to fix the functionality we didn't have and are now
removing the vestigial remains of.

We also drop the one usage of the AddNode function of Noder, because
it was used only by one test code fragment that was creatincg clusters,
and that can be done more correctly. There were no other call sites
at all.

We mark the monitorAntiEntropy function to be ignored by
code coverage because it's not actually being covered. There's
a separate ticket for removing that entirely.
2022-06-21 17:03:09 -05:00
Samir Patel
c04fd9734e
Add proper version info to sentry logs 2022-06-21 11:03:22 -05:00
reesporte
f3f1ea41b7 indicate sign with a bool 2022-06-17 14:58:30 -05:00
reesporte
51fb34e657 make Decimal proto definition backwards compatible 2022-06-17 14:58:30 -05:00
reesporte
0d91e2991d Revert "FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)"
This reverts commit acbcec54c8.
2022-06-17 14:58:30 -05:00
Samir Patel
f08d3e2834
fix parens around where clause bug (#2121)
Bug: if a sql query had a where clause within parens, the entire
clause would be ignored; and instead of it translating to a pql
intersection, it would become an All().

This occured b/c the parser library mapped such an expresstion to
a sqlparser.ParenExpr, and we did not have this as a condition in
a type switch.

So instead of treating a ParenExpr as nothing, we now recurse into
it.
2022-06-16 22:21:24 -05:00
Seebs
c0b26d5b69 improve sonarcloud coverage testing behavior
The sonarcloud job was accidentally altered to use *only* the PLG
coverage data, which is incomplete for reasons not yet fully
understood. Unfortunately, it wasn't *waiting* for the PLG coverage
data to be complete -- the job could start before the PLG coverage
ran, which mean that you could get anywhere from a few percent
to nearly total code coverage.

Also, we want to be sure to cover *both* the PLG and non-PLG coverage
data, so we add the non-PLG coverage data.

We also factor out the simulacraData package from our PKG_LIST because
it appears to be confusing sonarcloud because that package isn't
"included in project" or something.

Also remove a stray `ls` that was probably part of the original
testing/debugging of this.
2022-06-16 11:02:26 -05:00
rachithrr
acbcec54c8
FB-1491: Revert pql.Decimal commit for the 4.8.5 release (#2117)
* Revert "make pql.Decimal.Value a private big.Int field"

This reverts commit eab6174388.

* Revert "pql.Decimal for DecimalVal in ValCount&GroupCount"

This reverts commit a0c9eec410.

* Revert "Add AddDecimal support to pql"

This reverts commit 50787fd37a.
2022-06-15 09:15:37 -07:00
seebs
42b4c05df2
Implement UnionRows as a BitmapFilter (#2116)
This is fairly experimental, but basically, we make a fragment-level
op which, given a []uint64, can produce a union of all those rows in
the fragment, with a single scan through the fragment and not needing
a ton of additional space to reify all the rows at once.

Now with the Repair calls happening in the Results assembly rather than
on the intermediate data.
2022-06-15 08:40:12 -07:00
Samir Patel
0d43be934e
[FB-1479] Adds GRPC interceptor for sentry and chaining mechanism
also adds metadata for sentry performance monitoring for more organized output
2022-06-15 09:26:58 -05:00
Bruce Baranowski
b7516eacc5
CICD: fix Cleanup_Build_Job inconsistent failures (#2098)
* add aws profile to cleanup job

* Split cleanup into bash script

* change spot instances to one-tme
2022-06-14 11:49:25 -04:00
reesporte
9e17579a76 don't panic on nil field during inner join
when running a select statement with an inner join where the secondary field is non-existent, we get a panic. this commit fixes that.

see [fb-766](https://molecula.atlassian.net/browse/FB-766) for more information.
2022-06-14 10:01:16 -05:00
Matthew Jaffee
630d510f85 add a couple more tests cases, refactor to table driven
this was some quick work I did in response to a possible issue that
was reported. It didn't turn out to be a problem on our end and these
tests confirmed that, but I think this is worth checking in.
2022-06-13 13:48:24 -05:00
Kasey C. Rodgers
724863bb1b
Fb 1483 plg release (#2108)
* automate builds of single node featurebase for PLG

* make plg target uses go build instead of go install

* corrected artifact names in plg build stages

* add s3 dump for plg

* edits to s3 dump for plg
2022-06-10 15:07:36 -07:00
reesporte
a97c877f86 avoid out-of-bounds panic in rbf
We've seen this happen with relatively large datasets with a relatively low
max-file-size. The solution we came up with was to increase the max-file-size
config option, which works, but we still don't want there to be a panic if we
hit this again.

see https://molecula.atlassian.net/browse/FB-1381 for more information.
2022-06-10 15:29:06 -05:00
Samir Patel
5b11f3b3b1
[FB-1484] Sentry: fix middleware and CI test for PLG
* create getter for monitor state

* refactor monitor

* fix http middleware

* change warn to error if attmpt to cluster on plg

* sentry: special considerations if execution is part of test

- skip test if they build a cluster as this will error by design
- skip sending messages to sentry if testing
2022-06-10 14:52:32 -05:00
reesporte
821c6bd2ec we don't need _keys fields when we're migrating
https://molecula.atlassian.net/browse/FB-1085
2022-06-10 10:00:32 -05:00
Kasey C. Rodgers
2ef39fdc9c
Fb1463 no cluster build (#2100)
* got single node working; refining error messaging and version info to follow

* better implementation that separates the build condition into etcd/enterprise_cluster.go and etcd/plg_cluster.go. go build will default to a clustering version and 'go build -tags plg' will build the non-clustering version

* added Makefile target for 'make plg'

* additional comments, CI/CD update

Co-authored-by: Kasey Rodgers <kaseyrodgers@Kaseys-MBP.attlocal.net>
2022-06-09 12:32:46 -07:00
Seebs
ff7900070c drop the bool from a map that's only using it to check presence
We only actually check presence/absence in this map, we never
set the value stored to false, and we assume in some places that
any value present is equivalent to true, so we might as well
use a map of struct{} and save the several whole bytes of memory.
2022-06-09 10:26:19 -05:00
Samir Patel
42f5d6eea3
[FB-1444] Add sentry.io for error and perf monitoring (#2099)
add sentry for error monitoring and performance tracking. Must call the init function to actually turn on the feature. This is expected to be used in the PLG binary and not the enterprise binary.
2022-06-06 18:29:32 -05:00
reesporte
eab6174388 make pql.Decimal.Value a private big.Int field
This ensures that we can't overflow when adding `pql.Decimal`s together. The
only place we can possibly overflow is when converting pql.Decimal to an Int64,
but that is a risk we have to take. Also, the only place we do this is in our
ToRowser. We could maybe change that to strings, so the presentation of data
doesn't indicate an overflow, but that is a later decision to make. It will
also involve fixing the generate-proto-grpc make command, because that's broken
rn.
2022-06-06 16:44:01 -05:00
reesporte
a0c9eec410 pql.Decimal for DecimalVal in ValCount&GroupCount
This way we can avoid annoying floating point rounding errors.

Check out FB-1359 for an example:
```
--- FAIL: TestExecutor_GroupByStrings (0.55s)
    --- FAIL: TestExecutor_GroupByStrings/3 (0.00s)
        executor_test.go:5433: unexpected result at 0:
             got:{Group:[generals.1.r1] Count:5 Agg:2775
DecimalAgg:27.749999999999996}
            want:{Group:[generals.1.r1] Count:5 Agg:2775 DecimalAgg:27.75}
```
2022-06-06 16:44:01 -05:00
reesporte
50787fd37a Add AddDecimal support to pql
This allows us to add two Decimals together as long
as the result doesn't overflow int64 either in value or in scale.
2022-06-06 16:44:01 -05:00
Samir Patel
3750fea632
add timestamp nils to nullIndices (#2095)
* add timestamp nils to nullIndices

* add test
2022-06-02 15:54:24 -05:00
souhailanoor
64a532b416
FB-1471: featurebase: added relevant details to error for value out of range (#2092)
* added relevant details to error
2022-06-02 14:53:10 -05:00
tgruben
a2f910ce35
[FB-1334] add batch support to clear a mutex on nil (#2091)
* mutex clear on nil support with test

* Update client/batch.go

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>

Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2022-06-01 17:37:03 -05:00
Bruce Baranowski
aa8057e9e4
CICD - Spot instances (#2087)
* spot instance test

* update outputs.tf to provide spot instances

* uptate outputs.tf data_node_ips

* propogate spot instance request tags to the instances
2022-05-31 17:25:09 -04:00
Bruce Baranowski
c0d56e13f2
Remove extra Cloudforlation tags (#2089) 2022-05-31 16:51:22 -04:00
Bruce Baranowski
8490be9fb0
CF tremor delete hotfix (#2088) 2022-05-31 15:35:40 -04:00
Matthew Jaffee
cc2230b4b8 don't encode 'base' in the field options json
it's not something that we can send to the server (it calculates base
off of min and max), and we don't need it in the json string in order
to use it client side when building import requests.
2022-05-29 09:03:27 -05:00
Matthew Jaffee
96f589ce24 add base to FieldOptions.String 2022-05-29 09:03:27 -05:00
Matthew Jaffee
98cb763499 don't use base for timestamp fields 2022-05-29 09:03:27 -05:00
Matthew Jaffee
d4820d872f decode int base from schema in client code
not having this breaks ingest when ingesting int-like fields with
nonzero bases (using the shard transactional endpoint)
2022-05-29 09:03:27 -05:00
Samir Patel
fb81e7a360
[FB-1462 FB-1393] Timestamp fix (#2082)
* serialize base and epoch into req

* fix and validate timestamp import

* refactor overflow check and test
2022-05-27 20:19:06 -05:00
Matthew Jaffee
9fb68b416c add doc comments 2022-05-27 11:25:17 -05:00
Matthew Jaffee
a815bba520 comment cleanup 2022-05-27 11:25:17 -05:00
Matthew Jaffee
90eb860b03 fix hardcoded containers per rowshard
There are 16 containers in a row in a shard with the default shard
width of 2^20, but since you can change the shard width at compile
time, everything should be computed off that.
2022-05-27 11:25:17 -05:00
Matthew Jaffee
a4b1af2add add TestImportRoaringSingleValued 2022-05-27 11:25:17 -05:00
Matthew Jaffee
5c6e668c07 fix issue where mutex clear bitmap wasn't properly set
specifically for shard transactional endpoint
2022-05-27 11:25:17 -05:00
Matthew Jaffee
d7718483bf fix bug where multiple ints in same batch could ingest union of ints
if the same ID is added multiple times with different values, only the
last value should get set. Without this change, if the multiple
records weren't immediately next to each other, all the bits from all
the values would get set.
2022-05-27 11:25:17 -05:00
Matthew Jaffee
991d3d7780 remove experimental RBF Viz stuff 2022-05-27 11:25:17 -05:00
Matthew Jaffee
e2d6610ae7 fix: rebuild rank cache for set imports (ImportRoaringShard)
the ranked cache must be fully rebuilt as the BitmapRewriter doesn't
have an easy way to track which rows had how many bits changed which
we would need to update the cache.

We also needed to add a Clear method to topn cache to completely
remove old values before the rebuild as otherwise they'd sit there and
pollute the cache after it was rebuilt.

This also includes fixing a strange idiosyncrasy where the _exists
field was a set field, but didn't have its type explicitly set. This
was causing it to have a ranked cache even though that option was
turned off. Hoping this doesn't have any weird follow-on effects... or
if it does the tests catch them.
2022-05-27 11:25:17 -05:00
Matthew Jaffee
772496b440 "all bitmap" multi-field, single-shard ingest
This adds a shard-based import endpoint which takes bitmap data for
all field types and imports data for the whole shard transactionally.

It uses the BitmapRewriter interface to try to intelligently allow for
setting and clearing bits simultaneously without multiple writes which
is especially helpful when ingesting into int-like fields, but also
allows clear-and-then-set behavior for set fields.
2022-05-27 11:25:17 -05:00
reesporte
964f14a3a1
If the field doesn't exist return ErrFieldNotFound (#2081)
This way we don't return seemingly valid data for calls on non-existent fields. See
also [FB-237](https://molecula.atlassian.net/browse/FB-237).
2022-05-26 16:45:10 -05:00
reesporte
8ba81643d2
[FB-1379] Create a featurebase subcommand to obtain an auth token (#2079)
* Add CleanOAuthConfig endpoint

We will use this to get the OAuthConfig information, without the client secret, from
FeatureBase without having to have access to the config file. This will be useful
for the auth-token subcommand.

* Add string manipulation utility functions

Go doesn't have native support for these kind of things, so I added this to make it
easier to do string reversal, and replacing the first string encountered from the
end of the string to the front.

* Add auth-token subcommand

This is for work on [FB-1379](https://molecula.atlassian.net/browse/FB-1379).

We need this new auth-token subcommand to allow users to get access and refresh
tokens without having to login to featurebase via the UI. This commit adds that
functionality.

* error on oauth endpoint if auth isn't on

* https as default scheme in cmd, not internalclient
2022-05-26 11:35:51 -05:00
reesporte
2d937728fa
remove vestigial print statement (#2080) 2022-05-26 09:33:43 -05:00
Matthew Jaffee
8e5ab106dc
FB-1459 ugly first cut at supportings Rows(in=[...]) (#2066)
* ugly first cut at supportings Rows(in=[...])

need tests, better handling of various combinations of arguments and
error cases

* explicitly error when other arguments passed with 'in' to Rows

* first cut at supporting Rows(in=[...])

'in' is explicitly not supported with any other arguments (except the
field of course), and will error. It works both as a standalone Rows
call and in GroupBy.

* bitmapfilter require ordered rowids

* remove log message

Co-authored-by: Todd Gruben <todd@molecula.com>
2022-05-25 11:57:59 -05:00
reesporte
d9b13eebc8
Recognize semi-colon separated cookies too (#2078)
This fixes a bug where the frontend UI sends GRPC cookies via a single semi-colon
separated string, which our new token parsing algorithm did not recognize as valid.
Now we account for that special case, at the small expense of greater overall
computational complexity.
2022-05-24 21:45:33 -05:00
hphamMolecula
ba44bc86f6
FB-1403 - fixed TTL to not allowed negative values (#2076)
* FB-1403 - fixed TTL to not allowed negative values

* FB-1403 - TTL - fixed comment

* FB-1403 - TTL - added comments for unit test, removed extra if statement, removed extra unit test
2022-05-23 18:35:57 -05:00
Bruce Baranowski
e3aff58632
Smoketest cleanup (#2077)
* added after_script

* changed after_script to a stage

* add shell tag

* Add pipeline prefix

* cleanup-list-test

* use unique jobid instead of random string

* remove dangling resources

* Spot instance test

* Revert "Spot instance test"

This reverts commit f722734b4dc04609918c29445dd4e739a3a1bd77.

* spot test

* Revert "spot test"

This reverts commit f35cc088db09b408e4f3b37a4b419a6126e52b43.

* manual trigger & cleanup test

* Finish cleanup script

* string wrapping

* typo fix

* final cleanup

* change nonexist test

* silent grep

* utilize query feature

* cleanup only test

* cleanup only test

* No skipping stages

* modify to pipieline-

* add --region
2022-05-23 16:37:42 -04:00
reesporte
60e6900c2e
Add refresh token header/cookie (#2071)
* Add refresh token header/cookie

As part of work on automatic refreshing of access tokens in the grafana plugin
(FB-1377), we will now accept a refresh token in the "X-Molecula-Refresh-Token"
header or the "refresh-molecula-chip" cookie.

This refresh token will be used if the access token is expired. To achieve this,
there was a lot of plumbing that had to be done. Here is a list of some of it:

* Added lots of constants for the new values.
* Removed token cache, since we will be keeping state on the clients.
* We now only refresh tokens when they are expired, which is more inline with the
  OAuth spec.
* Refactored SetGRPCMetadata to be simpler to read.
* Refactored AddAuthToken.
* Update failing tests.
* We now don't split GRPC cookies on ";". Not sure why we did that before tbh.

I also added TODOs to add the refresh token to other subcommands. This is out of
scope for my current ticket, but it would be nice to have in the future.

* remove unnecessary context from Authenticate

* Add comments on why we check both cases for headers

It's because some GRPC clients lowercase metadata names. I've run into issues with
this enough that I think it's worth the extra checks. We prefer lowercase though,
because that's "standard".

* Fix test that broke during rebase
2022-05-20 16:12:27 -05:00
souhailanoor
3986e202bf
FB-1378: Use IP whitelisting for ingest authentication and authorization (#2070)
* Use IP whitelisting for ingest
For ingest, use configured IPs to authenticate the requests.
Auth-token will no longer be used for requests from ingest consumers.
If IP in request is in configured IPs, authenticate and authorize as an admin.
If IP in request is not in configured IPs, proceed with the standard authentication/authorization using ADD.

* need to remove port from client IP

* addressed review comments
2022-05-20 14:57:05 -05:00
Matthew Jaffee
62971f55dd return error in Batch.doImport if there is one
swallowing this error was a mistake... caller would not know that
ingest failed and might incorrectly report success
upstream (e.g. committing offsets to Kafka)
2022-05-19 16:26:46 -05:00
Fletcher Haynes
dc20f8c689
Make gauntlet manual (#2073)
* Changed several gauntlet tests to be manual due to cost emergency

* Made perf_able manual

Co-authored-by: Fletcher Haynes <fletcher.haynes@molecula.com>
2022-05-19 12:52:56 -07:00
Fletcher Haynes
8eaa5c0a43
Changed several gauntlet tests to be manual due to cost emergency (#2072)
Co-authored-by: Fletcher Haynes <fletcher.haynes@molecula.com>
2022-05-19 12:24:39 -07:00
reesporte
f4e221e4f0
make race tests not run if it doesn't build (#2068) 2022-05-18 16:23:36 -05:00
Samir Patel
43a61d87b2
return HTTP status code: 400 (Bad Request) when ingest values are (#2047)
out of range. Previously internal server error was returned.

This is to allow for ingest to continue while logging bad values
instead of stopping ingest as we do when there is a server error.
2022-05-17 14:26:10 -05:00
Seebs
d63d2492b9 clear the reference to a tx from the freelistCursor
We've been seeing weird retention of Tx that shouldn't still be open, and
one possible explanation is that, until a Tx actually uses the freelist
cursor (either to allocate a page or to release it back to the freelist),
the freelistCursor statically stored in the Db object continues to have a
pointer to the previous Tx which used it, which allows a Tx, and thus its
dirty page map, to be retained forever.

I previously thought this should also nil out the page maps in the Tx, but
the more I think about it, the less I think that's a good idea. The actual
lifespan of a committed Tx should be quite short. If it *does* stick around,
it's beneficial to us as debuggers to see those large maps of dirty pages
sticking around. So after thinking about it a lot I decided not to do
that.

Similarly, when closing out a container filter (whether a filter or
a rewriter), zero out the Cursor, Tx, and filter and rewriter functions.
(We don't have to worry about the cursor's Tx, because the cursor gets
closed, which zeros its Tx and returns the cursor to the cursor pool,
too.) This likely matters a lot less, as the filters in the pool
get garbage collected "soon", but it still reduces the amount of
stuff being retained.
2022-05-17 10:32:47 -05:00
reesporte
5e1df3f30a
[fb-1377] SetGRPCMetadata should always set the cookie, whether there was a cookie there to begin with or not (#2065)
* make CookieName an exported constant

* fix SetGRPCMetadata

this will actually set the grpc metadata even if there are no cookies in the
metadata already.

* gofmt yourself
2022-05-16 17:07:02 -05:00
hphamMolecula
39006396db
FB-1456 - TTL - fixed views not returning correct results (#2062)
* FB- 1456 - TTL - fixed views not returning correct results when least precise quantum are deleted

* FB-1456 - TTL - PR - fixed comment

* FB-1456 - TTL - changed getQuantum to getLowestGranularityQuantum since we only care about the least precise quantum that is available

* FB-1456 - TTL - removed unit test used for debug

* FB-1456 - TTL - fixed comments

* [FB-1435] BSI Base Fix (#2056)

* add bsi base back to int value

* test bsi base/min/max for IntFields

motivated by bsi base not being added back to values
in extract calls when min was a positive integer.

* FB-1456 - TTL - fixed comments

Co-authored-by: Samir Patel <48686912+54mir@users.noreply.github.com>
2022-05-16 15:26:13 -05:00
Samir Patel
68e72c2ce0
[FB-1435] BSI Base Fix (#2056)
* add bsi base back to int value

* test bsi base/min/max for IntFields

motivated by bsi base not being added back to values
in extract calls when min was a positive integer.
2022-05-13 09:33:53 -04:00
tgruben
09b4eed348
[FB-1388] Add optional support for continuous profiling in datadog (#2037)
Enable ability to use DataDog continuous profiling
2022-05-12 12:33:46 -05:00
hphamMolecula
94e772e6ec
FB-1403 - TTL - Added check for upper bound date (#2053)
* FB-1403 - TTL - Changed TTL to check for the end date of view time

* FB-1403 - TTL - clean up unit tests
2022-05-11 13:57:29 -05:00
tgruben
dd139cd48d
[FB-1398] Mainline etcd (#2049)
* use mainline etcd-io dependencies, not forks

this commit does lots of things around clustering with goal of increasing stability.

- upgrades from molecula/etcd to go.etcd.io/etcd@v3.5.4
- upgrades from seebs/bbolt to go.etcd.io/bbolt@v1.3.6
- update tests to use unix sockets for etcd cluster communication
    - this is what etcd uses for a lot of internal testing, so if their devs think
      it's a valid test, we can probably accept that
- cleanup etcd node-watcher shutdown process

Co-authored-by: tgruben <tgruben@gmail.com>

* moved random query to another repo

it had weird dependency issues with upgrading to mainline etcd bc of the vegeta dep
so we removed it bc no one really uses it anyway

we got this error message:
```
github.com/molecula/featurebase/v3/cmd/random-query imports
	github.com/tsenart/vegeta/v12/lib tested by
	github.com/tsenart/vegeta/v12/lib.test imports
	github.com/streadway/quantile tested by
	github.com/streadway/quantile.test imports
	.: "." is relative, but relative import paths are not supported in module mode
```

* add cleanup to EtcdUnixSocket test util

Co-authored-by: reesporte <reesedporter@gmail.com>
2022-05-11 09:49:48 -05:00
souhailanoor
ffed9531fc
FB-1253: Fixes for scheduled test (#2048)
* fix for changes in utilCluster

* fixes for samsung and backup-restore gauntlets
2022-05-06 12:00:04 -05:00
souhailanoor
b82375bca2
Tremor delete test scripts (#1974)
- terraform scripts to set up cluster
- cloud-formation scripts to set up cluster
- set up ingest node with kafka server and datagen
- set up second ingest node with molecula-consumer-kafka-static
- set up datadog in all nodes (ingest + featurebase)
- set up script to execute different queries
- only run delete test on schedule
2022-05-05 10:25:35 -05:00
Matthew Jaffee
a093099a8c dont default to standard view for some time range queries
previously, we would use the standard view if the query seemed to
cover all the views we had, or if we didn't seem to have any time
views. This is unintuitive if some views have been deleted (which
comes up a lot more often with TTL!). It's also unintuitive if you
know you haven't set any data w/ a timestamp and your query that
specifies a time range returns any data.
2022-05-04 11:04:38 -05:00
Matthew Jaffee
0d50bd2890 implement ability to update TTL on time fields 2022-05-04 11:04:38 -05:00
Matthew Jaffee
e0e01f9f65 expose --header-timeout option on featurebase backup 2022-04-29 16:37:40 -05:00
Matthew Jaffee
c554adb70a convert executor.shutdown to channel to avoid data race
Here was the race:
https://gitlab.com/molecula/featurebase/-/jobs/2391959728
2022-04-28 14:09:32 -05:00
Matthew Jaffee
cb4f23fc98 translate data: only redirect to UNKNOWN node if there is no STARTED
caveat: this will always redirect to the first UNKNOWN
node... possibly we would want to select randomly or have the ability
to retry different nodes.
2022-04-28 14:09:32 -05:00
Matthew Jaffee
f7651e3a26 update tests to reflect recent changes around allowing things when
nodes are UNKNOWN
2022-04-28 14:09:32 -05:00
Matthew Jaffee
364888086b allow reading translation from nodes in UNKNOWN state 2022-04-28 14:09:32 -05:00
Matthew Jaffee
02663d0282 when calculating what nodes can process a shard allow UNKNOWN state
we have an issue where nodes get into UNKNOWN state rather frequently
during periods of high load when they aren't actually down. We want to
allow queries in this situation rather than giving a "shard
unavailable" message.
2022-04-28 14:09:32 -05:00
Matthew Jaffee
dee46d4423 add PartitionToNodeAssignment as a new option
We default to the jmp-hash method which we had previously, and allow a
user to set the "modulus" option which uses a simple mod operation to
ensure an even spread of partitions across nodes.

I think that ideally we would have new indexes uses modulus and
existing indexes use jmp-hash which implies supporting this
configuration on a per-index basis.

If we don't do per index, we should probably run the whole test suite
both ways.
2022-04-27 17:21:47 -05:00
Matthew Jaffee
24af93e7d8 change assignment of partitions to nodes
we change this to use a simple modulus to ensure maximally even
assignment of partitions to nodes rather than the hash thing we were
doing previously which may have helped minimize data movement when
adding nodes, though I'm not even sure of that.

The logic was duplicated in a few places, so we've also condensed
that. For now, we're skipping tests which have baked in assumptions
about which node a partition will end up on as we expect them to fail
until they are updated.
2022-04-27 17:21:47 -05:00
Travis Turner
7ccc845aac
Change Ttl to TTL (#2038)
* Change Ttl to TTL

Following go convention, acronyms should have a consistent case.
See
[Initialisms](https://github.com/golang/go/wiki/CodeReviewComments#initialisms)

This commit changes some public-facing methods, so any code importing
this package and using these methods will need to be updated.

* rewrite Ttl -> TTL

Co-authored-by: reesporte <reesedporter@gmail.com>
2022-04-27 11:20:39 -05:00
rachithrr
eba7927b56
FB-1387: Grafana Empty Variable Select (#2032)
Fixed the issue where deselecting variables didn't work on quries like
groupby and extract.
The empty variables list returns All() when the variables are empty.
2022-04-26 12:39:28 -05:00
reesporte
0e37e04f47
check for context deadline exceeded in retry client (#2033)
you can get a context deadline exceeded from clientv3 if there's heavy load and the
etcd server sends a grpc code DeadlineExceeded. this causes the etcd client to not
retry connecting and then you end up with nodes that can't recover.

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: seebs <seebs@molecula.com>

Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: seebs <seebs@molecula.com>
2022-04-25 14:23:27 -05:00
Ben Johnson
8702fac11d
Improve RBF documentation (#2034) 2022-04-25 09:13:54 -05:00
Bruce Baranowski
19613a3048
Mitigate 1 instance of potential integer overflow 2022-04-19 11:06:25 -04:00
reesporte
a8c1b93610
Add Max(timestamp) tests to smoke-test (#2025)
* Add Max(timestamp) tests to smoke-test

run a Max() call on a timestamp field twice, and make sure the results are the same

* chmod +x
2022-04-18 15:33:20 -05:00
reesporte
03df1ba6ad
remove trailing spaces en masse (#2024) 2022-04-18 09:31:35 -05:00
reesporte
e2bf96731f
Merge pull request #2015 from molecula/union-distinct-ts-better
save space when union-ing DistinctTimestamps
2022-04-14 11:11:36 -05:00
reesporte
96df2700fd save space when union-ing DistinctTimestamps
By using an empty struct, we reduce memory usage by
up to 16 bytes (the size of a timestamp string)
2022-04-14 10:31:56 -05:00
reesporte
f5c3c44411
Merge pull request #2019 from molecula/sup-218
[SUP-218, FB-1356] Pass auth info through context as needed, setup auth smoke testing infrastructure
2022-04-14 10:07:54 -05:00
reesporte
f224e64bc3 setup auth cluster infra
also add test for sup218

Co-authored-by: rachithrr <rachith.ramaswamy@molecula.com>
Co-authored-by: bruce-b-molecula <bruce.baranowski@molecula.com>
2022-04-14 09:37:52 -05:00
reesporte
ea33a2b976 fix broken test 2022-04-14 09:37:33 -05:00
reesporte
1060520fa7 add better error messaging for if the test is empty 2022-04-14 09:37:33 -05:00
reesporte
bff9128c9b properly thread the ctx through so we can pass Auth around 2022-04-14 09:37:32 -05:00
seebs
e530193e80
Merge pull request #2017 from molecula/fb1358
[FB-1358] gracefully handle invalid indexes in joins
2022-04-13 12:48:36 -05:00
Seebs
727c2ed724 gracefully handle invalid indexes in joins
If a join is requested against an index that doesn't exist, we
should report that as an error rather than panicing.
2022-04-13 11:44:58 -05:00
tgruben
bfde4860c1
Merge pull request #2018 from molecula/fix-bad-defaults
[FB-1360] apply sane numbers when min/max 0 is provided
2022-04-12 16:15:11 -05:00
Todd Gruben
7588912c19 apply sane numbers when min/max 0 is provided 2022-04-12 15:47:14 -05:00
seebs
54a8754c33
Merge pull request #2001 from molecula/fb1290
[FB-1290] ApplyRewriter and friends
2022-04-12 14:35:22 -05:00
Seebs
cb99f88527 ClearRecords API change 2022-04-12 13:15:15 -05:00
Seebs
5d1db3a4f2 handle dirty correctly even if a page split happens 2022-04-12 13:04:55 -05:00
Seebs
6e90bfc9bc return early rather than just evaluating a rejection
The intent of these lines was "if there's no filter, return
immediately rather than doing operations".

But actually we didn't write that, so we were calling intersectionCallback
on empty filters, which didn't matter since it failed out quickly, but
it's still a waste of effort.

Except we shouldn't get to these anyway because ConsiderKey already
correctly rejected these cases. I think. But still.
2022-04-12 12:24:22 -05:00
Seebs
16fef7ffbd re-add the nextOffsets logic to BitmapBitmapTrimmer
In fact, we *do* want to skip ahead sometimes to the next thing, and
only call our callback for things that match our filter. I was thinking
that we needed to call the callback for all data regardless, because
what if you're writing to a mutex and adding new data.

But even if you're adding new data, it's still in the filter, because
it has to be, because we don't start out knowing there's no existing
data. So the mutex actually works fine.

So the rule for BitmapBitmapTrimmer is that your filter doesn't have
any meaning other than (1) it tells us which containers you need
to see, (2) we provide it to your callback function. Maybe you want
to subtract those. Maybe you want to add them. That's up to you to
decide.
2022-04-12 12:24:22 -05:00
Seebs
88a6a047d2 try to reduce seeking in ApplyRewriter a little
Slightly more careful thoughts about whether or not the cursor
is "dirty".
2022-04-12 12:24:22 -05:00
Seebs
919eb3f0e8 rework bulkImportMutex to use ApplyRewriter
Now that we have ApplyRewriter, it's a viable way to implement ImportMutex.
It can be slower on low-density writes, because it's checking more things
than it otherwise might -- the other filter form can skip ahead and only
check the containers it's modfying, in principle, while this one doesn't
know it can do that. (The decision as to how far to skip ahead has to
be made in the BitmapBitmapTrimmer, while it's the callback provided to
it that knows when it next has data to write.)

On the other hand, it's probably faster in some cases, and would be
more-faster if we could improve the cursor management a bit, and it's
skipping at least some seeking because it doesn't need to use
ImportPositions after reading the whole thing.
2022-04-12 12:24:22 -05:00
Seebs
852a8be45a use ApplyRewriter for ClearRecords
This uses the shiny new ApplyRewriter logic for ClearRecords,
mostly to verify that ApplyRewriter works at all.

This also implies separating the cache update code out from
importPositions so it can be used also by this.

We also use fragment.ClearRecords instead of the different clearFragment
code in executor.  The clearFragment implementation did not update TopN
caches and the like. Standardize it on the clearRecords implementation
which does.
2022-04-12 12:24:22 -05:00
Seebs
74ae1fd598 export and improve DifferenceInPlace
We don't need to manually copy each individual item and keep
checking for the second index being out of bounds for every
item, we know it can't change at this point, so we can just bump
it over. We want this operation because BitmapRewriter can
use it to simplify trimming in some cases.
2022-04-12 12:24:22 -05:00
Seebs
5148974602 trust cell.BitN a few more places
Found a couple of places where we were still not trusting this, but really
we're testing it a lot more carefully now.
2022-04-12 12:24:22 -05:00
Seebs
9acc7a6019 Drop unneeded locks
The filter and rewrite logic are unlocking and relocking but I don't
think they should. I think those locks were added early on during
testing of the filter stuff, but I don't think they should be needed,
and I've been unable to find a case where they were. I think probably
I had something where a ConsiderData function was trying to run a Tx.
2022-04-12 12:24:22 -05:00
Seebs
e67beb8766 create BitmapRewriter/ApplyRewriter, parallel to BitmapFilter
This in a parallel to ApplyFilter/BitmapFilter which allows writebacks
while it's running. It's a write operation, so it needs a write lock
on the Tx, and needs to create bitmaps if they don't already exist.
The semantics are a bit messy and need better documentation still.
2022-04-12 12:24:22 -05:00
Seebs
d972028858 implement RemakeContainerFrom and helper function for it
We frequently want to grab the set of values from a []uint64
that correspond to a given key, and make a container from them, but
sometimes we only want to do one of these. This implementation
lets us do that the same way every time, and do in-place
container creation without extra allocs.
2022-04-12 12:24:22 -05:00
Seebs
86088fd688 drop incorrect test
The test for bitmap-to-array succeeding doesn't work with roaringParanoia,
which *does* intentionally panic at that point. Possibly we should also
drop the corresponding logic that tries to prevent it from panicing,
since it won't work with the paranoia flag on anyway.
2022-04-12 12:24:22 -05:00
Ben Johnson
11a5178471
Merge pull request #2010 from molecula/fb-1229
[FB-1229] Shrink RBF freelist & truncate data file on checkpoint
2022-04-12 08:33:28 -06:00
Ben Johnson
7f05dc5848
Merge branch 'master' into fb-1229 2022-04-11 14:00:37 -06:00
Samir Patel
be17087a68
Merge pull request #2011 from molecula/paginate
[FB-1303] Iterate through group membership http response
2022-04-11 15:26:37 -04:00
Samir Patel
9e69ee3534
Merge branch 'master' into paginate 2022-04-11 14:53:31 -04:00
reesporte
9b5b7e80a6
Merge pull request #2012 from molecula/fb-1346
Implement ToRowser interface for DistinctTimestamp
2022-04-11 11:50:17 -05:00
Samir Patel
ef6decf63a update handler tests 2022-04-11 10:42:14 -05:00
Samir Patel
3cf34d7503 update TestChkAuthN 2022-04-11 10:42:14 -05:00
Samir Patel
bddccf6ead add http status check to authenticate 2022-04-11 10:42:14 -05:00
Samir Patel
eea6a40fe0 Iterate through group membership http response
Follows the nextLink in http response to iterate through
paginated group membership response in order to obtain all
groups that the user is a member of.

Also, checks cache to make sure we don't add empty groups
to the cache.
2022-04-11 10:42:14 -05:00
reesporte
66def7678c Implement ToRowser interface for DistinctTimestamp
Because the ToRowser interface was not implemented for DistinctTimestamp, there was
a error when using the GRPC endpoint to call Distinct(All(), field=ts). Implementing
the ToRowser interface for DistinctTimestamp solves that problem.

Related to SUP-210: WebUI, Python - Distinct() does not work for Timestamp field
2022-04-11 10:38:37 -05:00
tgruben
4a155eba88
Merge pull request #2014 from molecula/expose-etcd-ttl
[FB-1347] expose etcd ttl timeout period
2022-04-11 10:33:20 -05:00
tgruben
45d4d0bcfd
Merge branch 'master' into expose-etcd-ttl 2022-04-11 09:51:59 -05:00
seebs
8284306d5f
Merge pull request #2009 from molecula/fb1342
[FB-1342] handle time quantums better in GroupBy
2022-04-11 09:47:19 -05:00
Ben Johnson
fe7c97afa0 Fix size/PageSize calculation to be int64. 2022-04-11 08:26:00 -06:00
Ben Johnson
3b8ce696bd Shrink RBF freelist & truncate data file on checkpoint 2022-04-11 08:21:44 -06:00
Todd Gruben
74ab06f5d3 expose etcd ttl timeout period 2022-04-11 08:58:39 -05:00
Seebs
9f2b888c4f standardize and correct time range handling
If you're wondering how something that simple gets a commit
message this long, sit down, because you are in for a ride.

The Row, Rows, TopK, and GroupBy(Rows...) commands had three
different sets of semantics for from/to ranges. We unify these.
Sounds easy, right?

The original purpose of this was to address a bug in GroupBy
where, if you had multiple queries only one of which used time,
we could end up silently returning no results because we tried to
do a time query against a non-time field. This was easy to
fix; just move a boolean flag from outside a loop to inside
the loop so it resets to false on each pass.

In the process of trying to test that, I discovered that
specifying `from=...` without `to=...` in a Rows in a GroupBy
didn't work. Searching around, I discovered that we had three
different answers:

	GroupBy, TopK: unspecified 'to=' is 0
	Row: unspecified to is tomorrow
	Rows: unspecified to is the max time quantum in the field

(A time value of 0 is apparently interpreted as January 1st,
0001.) Note that "GroupBy" is really referring to a Rows()
command in a GroupBy, it's just that this uses completely different
code (because it has to be computing rows potentially matching or
restricted to a filter, or provide the rows it generated so
they can be used to filter something else).

So we fixed that, and made a field method for finding the min/max
values (as done in a Rows command that *isn't* in a GroupBy),
and tried to use that with viewsByTimeRange. Then I tried to write
documentation for this, but the documentation was unclear, and
I tried to clear it up. Which caused me to discover that these
four different places ALSO differed in when or whether they'd
replace a broad query with "just the standard view".

So. Round two of the fix: We create a `field.viewsByTimeRange`,
which tries to fall back to a standard view when one exists
and the specified range covers everything, and treats zero
values as non-restrictive, but also picks a narrow range that
is actually related to the range of dates in the field. This
matters because viewsByTimeRange generates the entire set of
views it would need *even if those views don't exist*.

We drop one test that was testing Rows specifically to verify
that, if you omitted To, we acted as though you'd specified a date
two days in the future. That behavior is not now intended, so
we drop the test that tries to verify it.

Thing that might make this better: Figuring out a way to generate the
list of views more cheaply. Right now, we're redoing all the view
computation, including producing a sorted list of view names, for
every shard. This is excessive, but hard to fix.

In particular, there is no trivial way to generate a sorting such
that you can take slices of it and have them be the right slices,
because we want to skip smaller time quanta when an entire larger
parent quantum is included. e.g., if we're including all of
April 2022, we don't want to include any of the days for April of
2022, but if we're doing up through April 15th, we want to include
the first 15 days of April, but NOT include the whole-month quantum.
And so on. Fixing this cleanly is hard and would require a
significant design effort.
2022-04-08 14:19:36 -05:00
Kasey C. Rodgers
aaa7051c21
Merge pull request #2013 from molecula/fb1309
fix the spots where gitlab thinks we're using hard-coded passwords
2022-04-08 12:35:52 -04:00
Kasey C. Rodgers
d47f3975c9
Merge branch 'master' into fb1309 2022-04-08 09:02:42 -07:00
kcrodgers24
3816a7fad4 fix the spots where gitlab thinks we're using hard-coded passwords 2022-04-07 12:22:45 -04:00
Ben Johnson
1cc606f1e3
Merge pull request #1998 from molecula/fb-1291
[FB-1291] Allow fsync() to be disabled on RBF WAL only
2022-04-07 10:22:15 -06:00
Ben Johnson
130f3bb10a
Merge branch 'master' into fb-1291 2022-04-07 09:16:29 -06:00
reesporte
8fc70e6494
Merge pull request #2008 from molecula/FB-1332
Timestamp FieldOptions should include Min and Max when marshalled to …
2022-04-06 16:54:52 -05:00
reesporte
77568762c2 Timestamp FieldOptions should include Min and Max when marshalled to JSON
When you backup a cluster, we call /schema which marshals timestamp field options to
json, and restores the fields with those options. If the min and max are missing,
they are set to 0 on restore, which causes an issue on subsequent ingest.

Fixes [SUP-213](https://molecula.atlassian.net/browse/SUP-213) and
[FB-1332](https://molecula.atlassian.net/browse/FB-1332)
2022-04-06 16:29:24 -05:00
Ben Johnson
c06293052d
Merge branch 'master' into fb-1291 2022-04-06 12:24:54 -06:00
reesporte
f93b4b7878
Merge pull request #2007 from molecula/fb-1234-integration-test
Fb 1234 integration test
2022-04-05 15:21:53 -05:00
reesporte
29c339ced6 make the test a gauntlet test, uncomment all the others
Co-authored-by: tgruben <tgruben@gmail.com>
2022-04-05 15:00:32 -05:00
reesporte
c61d565b3c integration test for backup restore sev 2!
Co-authored-by: tgruben <tgruben@gmail.com>
2022-04-05 14:59:50 -05:00
reesporte
44dac583eb
Merge pull request #2005 from molecula/fb-1324
[FB-1324]: TranslateData should only redirect to an up node
2022-04-04 16:01:57 -05:00
reesporte
dbc3159e2c TranslateData should only redirect to an up node
During backups on a multi-node cluster, TranslateData was unconditionally redirecting to the primary, regardless of the primary’s status. This is less than ideal. If the primary is down, the backup will fail.

As a consequence of this fix, we will also no longer needlessly redirect to ourselves on a single node cluster. This is a great optimization win!!!!

Fixes # FB-1324 SUP-209

Co-authored-by: tgruben <tgruben@gmail.com>
2022-04-04 15:38:47 -05:00
seebs
e379ae5a36
Merge pull request #2003 from molecula/fb1306
[FB-1306] ingest API delete could deadlock
2022-04-04 11:38:08 -05:00
Seebs
28c2ccf074 allow ingest API delete to work at all, add test for it
The ingest API tried to do a Qcx operation that needs a write Tx after
requesting a write Tx. This doesn't work. The ingest API is the only caller
of clearExistenceColumns, so it's easy to just make it work for a given
shard using a provided Tx. This isn't especially clean, but a lot of this
is due for an overhaul anyway because the Qcx/Tx stuff is sort of broken.

Also, add any test case at all for this, since we didn't have one, and
also fix the fact that the test case failed because the test harness
didn't allow empty result sets.
2022-04-01 09:48:51 -05:00
reesporte
8230d53714
Merge pull request #2002 from molecula/fb-1305
refactor AddAuthToken to fallback to userinfo
2022-04-01 09:12:03 -05:00
reesporte
f529e723e7 refactor AddAuthToken to fallback to userinfo
This commit addresses a bug in https://molecula.atlassian.net/browse/SUP-200 where
the Authorization header was not being set correctly when the token was passed via
"userinfo" in the context and not "token".

Now, we prefix the token with "Bearer " when the token comes from userinfo.

This commit also adds a unit test for this function, and simplifies logic. It also
fixes a test that didn't quite test the behavior we wanted.
2022-03-30 16:52:24 -05:00
reesporte
23d8282663
Merge pull request #2000 from molecula/badge-time
add coverage, code quality badges
2022-03-30 10:34:55 -05:00
reesporte
efc21595c1 add coverage, code quality badges 2022-03-30 10:07:23 -05:00
tgruben
eb7c67e5fc
Merge pull request #1997 from molecula/bad-delete-bandaid
[FB-1290] revert async remove channel
2022-03-29 16:07:12 -05:00
Todd Gruben
2ac360734e remove RemoveChannel 2022-03-29 13:42:20 -05:00
Ben Johnson
c4e6a6ce8a Allow fsync() to be disabled on RBF WAL only 2022-03-25 15:16:41 -06:00
Todd Gruben
9e3a2bba15 revert remove channel 2022-03-25 15:50:54 -05:00
reesporte
a23c820e12
Merge pull request #1995 from molecula/sup-194
FB-1287 - fix viewTimePart to account for bad strings
2022-03-25 11:53:14 -05:00
reesporte
5946a12ab9 fix viewTimePart to account for bad strings
this stems from https://molecula.atlassian.net/browse/SUP-194 where the string
"standard" was being passed to viewTimePart, which output "standard" as the result.
this is not a valid time string and was causing confusing errors. now it simply
doesn't do that

this commit also adds regression testing framework and a regression test for fb-1287
2022-03-25 11:27:39 -05:00
Matthew Jaffee
f23d30deb4
Merge pull request #1996 from molecula/fb-1281
[FB-1281] Add regression test for delete with invalid bitmap panic
2022-03-24 16:44:56 -05:00
Ben Johnson
7aff965a28 Add regression test for FB-1281 2022-03-24 15:20:57 -06:00
Matthew Jaffee
1f147f3c8c
Merge pull request #1994 from molecula/fb-1270-repro
add reproducer for FB-1270 into smoke tests
2022-03-24 13:57:58 -05:00
Matthew Jaffee
bb637131b9 delete query was syntactically broken and unecessary
the issue reproduced even though this query was broken, so it can be removed.
2022-03-24 13:33:11 -05:00
Matthew Jaffee
b08389e0ed add reproducer for FB-1270 into smoke tests 2022-03-24 12:58:25 -05:00
Ben Johnson
cc86d9ba19
Merge pull request #1993 from molecula/sup-193
Clear page from RBF dirty cache on free.
2022-03-24 11:42:53 -06:00
Ben Johnson
331bf5567b
Merge branch 'master' into sup-193 2022-03-24 10:58:11 -06:00
Samir Patel
4843030a8b
Merge pull request #1992 from molecula/fb-1274
[FB-1274] Allow empty values to be provided for vars in Row call
2022-03-24 12:20:48 -04:00
Samir Patel
8da946fe9b allow empty values to be provided for vars in Row call
queries can become arbitrarily long when variables are used.
This is especially the case when a variable is defined as
'select distinct field from table'
and a user wants to use all the values in a Row call
(which is effectively disabling any condition on the field).

This change allows users to select no values for a variable
associated with a Row call to disable the condition. If that
variable is the only condition (query expands to nothing)
then it interprets it as an All call.
2022-03-24 10:45:30 -05:00
Ben Johnson
52ab38d50d Clear page from RBF dirty cache on free. 2022-03-24 09:12:15 -06:00
reesporte
29754b53b6
Merge pull request #1991 from molecula/authclustertest-fix
use the env var for project
2022-03-24 09:35:20 -05:00
reesporte
e4e24baa43 use the env var for project 2022-03-23 08:55:23 -05:00
rachithrr
1230e4127c
Merge pull request #1990 from molecula/FB-1281
FB-1281: FeatureBase crashes when Row call with "==" in Delete
2022-03-21 16:49:09 -05:00
rachithrr
cc4dcce181
Merge branch 'master' into FB-1281 2022-03-21 15:48:16 -05:00
rachithrr
d7c561aa7d FB-1281: FeatureBase crashes when Row call with "==" in Delete
- the EQ goes through HasConditionArg(), but the error wasn't caught
in the case of Delete.
2022-03-21 15:40:39 -05:00
seebs
bac3360fa3
Merge pull request #1989 from molecula/fb1266
[FB-1266] prevent concurrent map writes in openField
2022-03-21 15:10:32 -05:00
Seebs
70760b187f prevent concurrent map writes in openField
Prior to this, we locked the index-wide i.mu around writes to i.fields.
But now the entire open process is holding that lock, so we couldn't
lock it here (that'd deadlock) and didn't think we needed to (because
it was held). But in fact that means that multiple fields being opened
at once can concurrently write to the map. Conveniently, we *already*
pass a shared mutex into openField() to prevent exactly this sort of
problem; we just need to actually use it when doing the write.
2022-03-21 14:34:39 -05:00
Kasey C. Rodgers
a9b56b055e
Merge pull request #1988 from molecula/fb-1277-go1.17.8
build with Go 1.17.8 to avoid vulnerability in 1.17.7
2022-03-21 12:32:17 -07:00
Matthew Jaffee
3c98f1dfb1 build with Go 1.17.8 to avoid vulnerability in 1.17.7 2022-03-21 13:53:00 -05:00
seebs
7f19c5cec7
Merge pull request #1985 from molecula/fb1266
[FB-1266] track closing status for index/field/view, shut down cache flush early
2022-03-21 12:23:44 -05:00
Seebs
32fec70816 track closing status for index/field/view, shut down cache flush early
This is a lot more complex than it sounds like it will be.

We shut down the cache flush when a holder is closed, but if you're
deleting an index, we don't check for that, and can have a cache flush
still creating cache files in an index which could conceivably result
in os.RemoteAll() failing. This shouldn't happen often, but it's happened
at least once.

To address this, first, we make sure that every tier of this operation
bails as quickly as it can after the thing it's working on closes. Second,
we retry RemoveAll.

Unfortunately, some things get reopened, so we have to handle that,
have mutexes covering the access to the channel, and so on. Also, some
things were getting double-closed, which was previously harmless but
could now fail. So, first, catch all the existing double-closes and
remove them, second, make the double-close fail with an error. Note
that virtually none of the tests check for errors on close.

This passes tests and should be unable to hit the original problem.
Unfortunately, it's unreasonably hard to check that, because it
requires an incredible coincidence of timing on the delete aligning
with a cache flush.
2022-03-18 14:41:44 -05:00
seebs
f7820e45f9
Merge pull request #1986 from molecula/fb1272
[FB-1272] listen on localhost:0 instead of :0
2022-03-18 14:40:59 -05:00
Seebs
a6aa1097f1 listen on localhost:0 instead of :0
MacOS's firewall complains about a previously unknown app trying to
listen for network connections whenever we run go test. That's because
we *are* listening for network connections on arbitrary interfaces, not
just on localhost as we probably intended. Fix that.
2022-03-18 13:38:30 -05:00
Matthew Jaffee
436334005e
Merge pull request #1984 from molecula/fb-1268-future-go1.18
FB-1268 use Go 1.18 for future tests
2022-03-17 16:52:06 -05:00
Matthew Jaffee
75a2d066c2 use Go 1.18 for future tests 2022-03-17 16:08:39 -05:00
tgruben
11c55faeba
Merge pull request #1982 from molecula/restore-migrate
Restore migrate
2022-03-16 15:19:26 -05:00
Todd Gruben
b3e930dc39 hard code field options 2022-03-16 14:49:58 -05:00
Matthew Jaffee
0d4ea1d991
Merge pull request #1981 from molecula/fb-1260-err-field-exists-2
need to wrap in conflictError to actually produce 409
2022-03-16 00:40:05 -05:00
Matthew Jaffee
7da4a71421 need to wrap in conflictError to actually produce 409 2022-03-16 00:36:09 -05:00
Matthew Jaffee
7ff1d94648
Merge pull request #1980 from molecula/fb-1260-err-field-exists
return correct ErrFieldExists so we give an HTTP 409
2022-03-15 23:33:26 -05:00
Matthew Jaffee
8f7f5324d4 return correct ErrFieldExists so we give an HTTP 409 2022-03-15 23:20:39 -05:00
reesporte
25dce501fe
Merge pull request #1979 from molecula/test-delete
test delete
2022-03-15 16:11:23 -05:00
reesporte
fc41870dfe remove linux amd64 dependency
Co-authored-by: souhailanoor <90720110+souhailanoor@users.noreply.github.com>
2022-03-15 14:43:06 -05:00
reesporte
f690694e77 remove commented gitlab jobs, run only on merge to master 2022-03-15 14:43:06 -05:00
reesporte
c9c36f5fc6 WIP: start integration test setup
TODO:
- remove commented out gitlab jobs
- make it run only on merge to master
2022-03-15 14:43:06 -05:00
tgruben
1906709ce5
Merge pull request #1978 from molecula/decimal-field-fix
[FB-1257] decimal woes
2022-03-15 11:35:42 -05:00
Todd Gruben
dfe052aa1a increase test coverage 2022-03-15 11:01:03 -05:00
Todd Gruben
8c3c774492 ensure provided min/max are valid on int fields 2022-03-15 10:29:48 -05:00
Todd Gruben
739fd9b04b ensure provided min/max are valid 2022-03-15 09:33:27 -05:00
Todd Gruben
f7fb9f386e decimal wowes 2022-03-15 01:52:18 -05:00
reesporte
12f931d635
Merge pull request #1976 from molecula/internal-disk-usage
add /internal/disk-usage endpoint for testing
2022-03-14 15:42:51 -05:00
reesporte
5224612df3 add /internal/disk-usage endpoint for testing
will be used to ensure delete work doesn't result in an ever-inflating usage of
memory
2022-03-14 15:23:15 -05:00
tgruben
3135c40f17
Merge pull request #1970 from molecula/FB-1185
[FB-1185] Batch delete transactions
2022-03-14 15:06:45 -05:00
tgruben
3a59421e3b
Merge branch 'master' into FB-1185 2022-03-14 14:30:37 -05:00
Todd Gruben
f9ee18b8b0 review suggestions 2022-03-14 14:18:21 -05:00
Ben Johnson
00924a2834
Merge pull request #1975 from molecula/remove-worker-pool-mu
[FB-1250] Remove unnecessary worker pool mutex
2022-03-14 12:47:11 -06:00
tgruben
a54fded24a
Merge branch 'master' into FB-1185 2022-03-14 13:00:24 -05:00
Ben Johnson
01e8a59f76 Remove unnecessary worker pool mutex 2022-03-14 09:56:08 -06:00
hphamMolecula
9e3734e9cc
Merge pull request #1973 from molecula/fb-1188-ttl-info
FB-1188 - TTL - Better TTL logging info
2022-03-11 12:17:12 -06:00
Hoang Pham
6a2a0cf008 FB-1188 - TTL - run TtlRemoval on server start, better ttl log info message 2022-03-11 11:37:36 -06:00
rachithrr
05870bcc5b
Merge pull request #1921 from molecula/clustertest-retry-coverage-v2
FB-1159: Try to test etcd retry code
2022-03-11 07:29:18 -06:00
Todd Gruben
e64dde0b4c remove round trip 2022-03-11 06:20:07 -06:00
Todd Gruben
82d3f54a28 new delete flow to allow for qcx reset 2022-03-11 06:20:07 -06:00
Todd Gruben
e209759283 make maxdelete an optional param 2022-03-11 06:20:07 -06:00
Todd Gruben
1a8989a69b . 2022-03-11 06:20:07 -06:00
Todd Gruben
eff54f49a6 qcx finish/reset 2022-03-11 06:20:07 -06:00
Todd Gruben
dc7493ff75 optimize container after remove 2022-03-11 06:20:07 -06:00
Todd Gruben
d322cc7aef batch size 65536 2022-03-11 06:20:07 -06:00
rachithrr
d29f2d219a
Merge branch 'master' into clustertest-retry-coverage-v2 2022-03-10 17:14:39 -06:00
souhailanoor
ac450a0c95
Merge pull request #1969 from molecula/fb-1186-updates
FB-1186: make deletes concurrent
2022-03-10 17:11:23 -06:00
rachithrr
5059f37c01 Merge branch 'master' of github.com:molecula/featurebase into clustertest-retry-coverage-v2 2022-03-10 16:54:30 -06:00
rachithrr
e2ce9afce9 sonarcloud fix 2022-03-10 16:25:59 -06:00
souhailanoor
7c8fde3bd6
Merge branch 'master' into fb-1186-updates 2022-03-10 16:18:50 -06:00
Souhaila Noor
a7b849c5fa release read tx 2022-03-10 16:18:39 -06:00
Matthew Jaffee
85ea078e86
Merge pull request #1972 from molecula/remove-circle
Remove CircleCI config
2022-03-10 14:52:20 -06:00
souhailanoor
c67b8f6653
Merge branch 'master' into fb-1186-updates 2022-03-10 13:15:55 -06:00
Matthew Jaffee
92562e547e remove old circle CI config 2022-03-10 11:41:35 -06:00
rachithrr
bed6312129 clean up 2022-03-10 11:40:38 -06:00
Samir Patel
4baec78303
Merge pull request #1944 from molecula/bug-primary-ingest
[FB-1082] retry request on primary host
2022-03-10 12:23:47 -05:00
souhailanoor
c0db6670c9
Merge branch 'master' into fb-1186-updates 2022-03-10 10:29:35 -06:00
Samir Patel
48997347b9 add server side redirect to primary for ingest requests
this applies to handlePostIngestData, handlePostIngestSchema

also moves a helper method (ApplyOneIngestSchema) from
http handler to API
2022-03-10 10:22:13 -06:00
Samir Patel
17e8dbd318 client side retry ingestAPI requests on primary host
If non-primary host fails to process a request, retry on primary node.

conditions when we should not do this:
- no error
- we've aleady tried the primary
- we're making a status request to get the primary node...this
  could lead to lock contention if we allow it to happen as we are
  making an http request within an on going http request to discover
  the primary node.

This also deletes the RemoveHost method and the associated test b/c
it is not used anywhere anymore and updates the returned error type.
2022-03-10 10:22:13 -06:00
tgruben
000eccae46
Merge pull request #1971 from molecula/SUP-178
[FB-1247] undo bitmapN fix
2022-03-10 10:21:11 -06:00
rachithrr
ce776e97fc adding more chaos 2022-03-10 09:43:52 -06:00
Souhaila Noor
f653457b5a address reviewer's comments 2022-03-10 09:36:18 -06:00
Todd Gruben
57b8dcd43a go fmt 2022-03-10 09:03:07 -06:00
tgruben
52e9027c79
Update roaring.go 2022-03-10 08:26:07 -06:00
Todd Gruben
09a9932951 extra protection of bitmapToArray 2022-03-10 07:48:51 -06:00
Todd Gruben
4a6c0ab086 bitmapN not reliable et 2022-03-09 21:02:39 -06:00
Souhaila Noor
37f43d7d6f added concurrency for delete during start-up 2022-03-09 09:40:08 -06:00
Ben Johnson
b7c93072d4
Merge pull request #1966 from molecula/fb-1239
[FB-1239] Free previous RBF bitmap pointer page when replacing container
2022-03-09 08:13:02 -07:00
Ben Johnson
7cad6d2973 Free previous RBF bitmap pointer page when replacing container 2022-03-08 15:05:23 -07:00
tgruben
5545bc5e8e
Merge pull request #1967 from molecula/SUP-170-upgrade-go
[FB-1244] bump go to go 1.17.7
2022-03-08 09:52:42 -06:00
Todd Gruben
8c247ff419 bump go to go 1.17.7 2022-03-08 08:38:07 -06:00
hphamMolecula
f7639e4a0b
Merge pull request #1954 from molecula/fb-1188-ttl
FB-1188 - Added TTL field option
2022-03-08 03:59:43 -06:00
tgruben
c3ac40991f
Merge branch 'master' into fb-1188-ttl 2022-03-07 16:57:38 -06:00
Hoang Pham
8b19e7a9e1 FB-1188 - removed parseDuration error logs in proto.go 2022-03-07 11:45:29 -06:00
seebs
fae3376581
Merge pull request #1965 from molecula/fb1240
[FB-1240] handle BitN when updating an existing bitmap pointer cell
2022-03-07 11:22:33 -06:00
Hoang Pham
49cf5c8817 FB-1188 - improved description of TTL 2022-03-07 11:16:33 -06:00
Seebs
d8b9a921b8 handle BitN when updating an existing bitmap pointer cell
We have code to correctly fill in cell.BitN when a leaf cell already
exists but isn't of the correct sort, but not to handle the case where
it already exists and *is* a BitmapPtr, but doesn't necessarily have
the right BitN value.
2022-03-07 09:16:16 -06:00
tgruben
806a8875a2
Merge branch 'master' into fb-1188-ttl 2022-03-07 07:42:56 -06:00
Travis Turner
30424499fa
Merge pull request #1813 from molecula/tlt/tx-comments
Clean up some of the go-doc entries in tx.go
2022-03-04 15:30:01 -06:00
Travis Turner
c4bc78bb36
Merge branch 'master' into tlt/tx-comments 2022-03-04 15:05:39 -06:00
tgruben
0e819b7d7a
Merge branch 'master' into fb-1188-ttl 2022-03-04 11:30:46 -06:00
seebs
aed3fc7fee
Merge pull request #1963 from molecula/fb1235
[FB-1235] Don't deadlock on multiple simultaneous CreateField
2022-03-04 11:20:21 -06:00
Seebs
9135b41ca8 test multiple field creations at once on a cluster
This test tries to verify that we can create multiple fields on a cluster
without deadlocking or getting errors *other than* ErrFieldExists or
wrappers of it. The "or wrappers of it" implies a change to ConflictError's
semantics, but honestly I think it should have had those semantics all along.
2022-03-04 10:21:18 -06:00
Seebs
bc6947a9ac try not to deadlock on simultaneous CreateField to two nodes in a cluster
Two CreateField messages reaching different nodes in a cluster at the same
time could cause a deadlock because each CreateField runs with a write lock
held, then issues requests to other nodes which, at a minimum, need
a read lock and which may require a write lock. Reorder things a bit to
make the broadcast to other nodes happen outside the lock. We may also
need to do something to have nodes handle the case where something's been
created in etcd but they haven't gotten the message about it yet.
2022-03-04 10:21:18 -06:00
Samir Patel
be5cffff32
Merge pull request #1964 from molecula/sql-where-testcases
[FB-1226 FB-1227] Add tests for sql WHERE clause with timestamps
2022-03-04 11:02:38 -05:00
Samir Patel
2ebb4d1865 add tests for sql WHERE clause with timestamps
Creates a timestamp field in the TestSQLQuery dataset.

Modifies a helper function to allow datasets with
timestamp to be properly converted to table responses.

Adds test cases for:
- conditional where clauses
- where clause with group by
- timestamp within where clause
- select distinct with where clause
2022-03-03 22:20:49 -06:00
Hoang Pham
4f32938ec8 FB-1188 - format server.go 2022-03-03 17:14:41 -06:00
Hoang Pham
5314f24bb1 FB-1188 - added back disco import that was accidently removed from merge conflict 2022-03-03 16:23:55 -06:00
Hoang Pham
31aa5ceaa4 Merge branch 'fb-1188-ttl' of ssh://github.com/molecula/featurebase into fb-1188-ttl 2022-03-03 16:20:11 -06:00
Hoang Pham
5f640aab0c FB-1188 - Fixed ttl parseDuration 2022-03-03 16:19:29 -06:00
hphamMolecula
a7a9722722
Merge branch 'master' into fb-1188-ttl 2022-03-03 16:12:42 -06:00
Hoang Pham
6d18d9e0c4 FB-1188 - added more unit tests 2022-03-03 16:09:37 -06:00
Ben Johnson
32fb80960a
Merge pull request #1962 from molecula/fb-1237
[FB-1237] Revert auto-quoting in Web UI
2022-03-03 13:01:45 -07:00
Ben Johnson
d9ad819fe9 Revert auto-quoting in Web UI 2022-03-03 12:35:54 -07:00
Matthew Jaffee
b7469acb04
Merge pull request #1952 from molecula/1222-release-format
FB-1222 release format
2022-03-02 15:25:45 -06:00
Matthew Jaffee
3fc271ff07 change release format
This was in response to some feedback we got about the new release
format. Executables were no longer had executable permission due to
going through S3 (hence the tarballs), and we wanted a more consistent
directory structure in the final release which included the versions
of various components.
2022-03-02 14:39:41 -06:00
reesporte
2f6aed74e6
Merge pull request #1956 from molecula/fb-1127
remove /schema/details cardinality calculation, and schemaDetailsOn config option
2022-03-02 14:37:53 -06:00
reesporte
17203e3441 remove cardinality calculation from schema/details
this is related to work for [fb-1127](https://molecula.atlassian.net/browse/FB-1127)

cardinality reporting has caused no shortage of issues such that we recommend
disabling them almost everywhere.

this commit removes the cardinality calculation for right now, as well as the option
to enable/disable schema details.
2022-03-02 14:09:09 -06:00
Hoang Pham
d883d4de53 FB-1188 - TTL - added more unit tests 2022-03-02 12:46:21 -06:00
Matthew Jaffee
239477c526
Merge pull request #1960 from molecula/race-tests-needs
add "needs: []" to go tests race to make overall pipeline faster
2022-03-02 10:40:27 -06:00
Matthew Jaffee
0dc5aed8d7 add "go mod tidy" CI check
pulled this from IDK... we just had an issue where we had an unused
dep in go.mod.
2022-03-02 08:47:12 -06:00
Matthew Jaffee
63c3a8b761 add "needs: []" to go tests race to make it start immediately
also move race tests to a special "nonblocking" stage that is after
everything else, so they don't block anything else from starting
2022-03-02 08:47:12 -06:00
Hoang Pham
5385102784 FB-1188 - Added unit tests for http_handler 2022-03-01 18:06:08 -06:00
Ben Johnson
d7ee20ca69
Merge pull request #1961 from molecula/fb-1227
[FB-1227] Enable WHERE clause for SELECT DISTINCT SQL queries
2022-03-01 16:07:37 -07:00
Hoang Pham
883e940d7f FB-1188 - Fixed units tests for TTL 2022-03-01 16:48:03 -06:00
Ben Johnson
1222bf22cd Use Distinct() call for SQL DISTINCT 2022-03-01 15:04:32 -07:00
Ben Johnson
321c14880b
Merge pull request #1958 from molecula/fb-1226
[FB-1226] Enable multi-field WHERE clause for GROUP BY SQL queries
2022-03-01 15:04:20 -07:00
Ben Johnson
7ebc28a734
Merge branch 'master' into fb-1226 2022-03-01 12:09:57 -07:00
seebs
789fef7a8e
Merge pull request #1955 from molecula/fb1225
[FB-1225] don't look up a field by name to find out its name
2022-03-01 12:43:21 -06:00
Seebs
21a478a728 don't look up a field by name to find out its name
If a field doesn't exist, looking up that field produces a nil,
and querying the name of a nil field fails. Don't do that. Instead,
just use the name you're looking it up by.

We could in theory return an error here, but we already handle
nonexistent fields elsewhere and checking this when we already have
checks for it seems unnecessary, I think?

Also, we add a test for this. The test is over in server/grpc_test.go
because we have infrastructure there for testing the SQL server
functionality, and you can't actually write reasonable self-contained
tests for the SQL stuff because it has no way to create a working
server.
2022-03-01 11:49:42 -06:00
reesporte
87300e27f1
Merge pull request #1957 from molecula/tidy
go mod tidy
2022-03-01 11:45:37 -06:00
Ben Johnson
e69ad74532 Enable multi-field WHERE clause for GROUP BY SQL queries 2022-03-01 10:28:11 -07:00
reesporte
422f532b89 go mod tidy 2022-03-01 10:54:53 -06:00
reesporte
28af155411
Merge pull request #1951 from molecula/mem-endpoint
add get internal mem usage endpoint
2022-02-28 16:55:25 -06:00
reesporte
18bddca86f add get internal mem usage endpoint
for use in benchmarking deletes
2022-02-28 16:31:12 -06:00
reesporte
92aa99ffa9
Merge pull request #1949 from molecula/fb-1187
use free id bucket to re-use ids
2022-02-28 16:30:48 -06:00
reesporte
287332d820 use free id bucket to re-use ids
this way memory usage doesn't grow without bound when we have lots of deletes and
writes.

fixes [fb-1187](https://molecula.atlassian.net/browse/FB-1187)
2022-02-28 15:56:58 -06:00
seebs
78e55fe410
Merge pull request #1943 from molecula/fb1216
[FB-1216] Improve sum aggregate performance
2022-02-28 15:22:14 -06:00
Seebs
f5954d3cc6 use a pool for containerFilter objects
We create a lot of these during a large GroupBy query or anything else
that creates a ton of filters. Use a pool so we can reuse them, since
most of their data doesn't need to be zeroed out, and typical use
patterns have a lot of sequential creation of these short-lived things
within a goroutine.
2022-02-28 14:41:30 -06:00
Seebs
eb26a86518 implement a BSI-aware filter to avoid OffsetRange calls in fragment.sum
We don't really need to fully extract every row, we just need counts.
This naive approach uses logic similar to BitmapBitmapFilter, but tweaks
it so that we can intercept the existence and sign bit rows, work with
an optional filter, and yield a sum. We accumulate the statistics
internally, rather than using a callback, because I tried to make it
work with a callback and it was a complete mess.

Note the fancy check for container reuse in the BSI Count filter.
This is because intersection(full container, X) is just the original
X, *not* a copy, but in this case we need a copy because RBF
ApplyFilter will in fact reuse a single container's storage for
each consecutive container.
2022-02-28 14:41:30 -06:00
Seebs
67f2312150 trust cell.BitN now
We used to manually do this because we had a number of cases where
BitN wasn't being updated, but so far as we know we've fixed them
and we have run a fair amount of stuff with sanity checks on and
not hit anything, so eliminating the constant recounting on bitwise
containers seems like a win.
2022-02-28 14:41:30 -06:00
Ben Johnson
0e84a30469
Merge pull request #1934 from molecula/fb-1113
[FB-1113] Add test coverage for RBF deletion
2022-02-28 13:34:14 -07:00
Ben Johnson
6948b18052 Add test coverage for RBF deletion 2022-02-28 12:56:24 -07:00
Ben Johnson
0b5a0d449e
Merge pull request #1953 from molecula/sup-156
[SUP-156] Add SQL SELECT mapping test
2022-02-28 12:55:35 -07:00
Ben Johnson
0f70253cc0 Add SQL SELECT mapping test 2022-02-28 12:17:07 -07:00
reesporte
da3ce449ba
Merge pull request #1942 from molecula/fb-1127
rip out ui/usage
2022-02-28 13:16:29 -06:00
reesporte
241550c751 fix sonarcloud code smells 2022-02-28 12:05:44 -06:00
reesporte
248dc4fe85 rip out ui/usage
addresses concerns in [fb-1127](https://molecula.atlassian.net/browse/FB-1127)

TLDR;
/ui/usage was a hotbed for issues and SEs have been turning it off anyway for ages
2022-02-28 12:05:44 -06:00
seebs
2cbcc24639
Merge pull request #1928 from molecula/fb1211
[FB-1211] don't crash on close during reads
2022-02-28 11:52:31 -06:00
Seebs
7dd7557e21 don't dump stuff to stdout for tests
We have some tests that cover stuff like the DumpDot functionality,
but we don't need them to actually write to stdout during ordinary
testing. Dump to buffers which we politely ignore. Yes, we could have
used a dummy writer, but this way it's super easy to display the
contents if we find ourselves suddenly caring.
2022-02-28 11:15:52 -06:00
Seebs
3ced081271 prevent crashes when closing db
When closing, we need to wait for existing Tx to exit before truncating
files and unmapping things. This shouldn't matter, because we don't actually
close the DB until all transactions are done, normally... except for the
background usage-gathering task. But really, it's probably just better to
be conservative.

The actual logic is fancier than it looks. We can't hold db.mu.Lock during
this, or the existing Tx can't exit. So we first grab the lock, set the closed
flag, set up a waiter for all current Tx to exit, and then release the lock.
Now we wait on the current Tx exiting. Once that's done, we grab the locks.
Anything coming in that tries to start a Tx will fail out fairly quickly
because the opened flag is now false, so even if other things get those
locks before we do, they won't keep them or create new Tx.

This makes one test deadlock because it opens a Tx and never closes it,
so we change that test to close its Tx.
2022-02-28 11:15:32 -06:00
Seebs
5901bcd5d6 drop unused helper functions
I have no idea what these functions were for, but we aren't using them
so let's not have them.
2022-02-28 11:14:22 -06:00
tgruben
39903bc17e
Merge pull request #1939 from molecula/FB-1185
[FB-1185] remove string keys on delete to allow for reuse
2022-02-28 10:46:21 -06:00
tgruben
53e3ac3e38
Merge branch 'master' into FB-1185 2022-02-28 10:20:30 -06:00
pokeeffe-molecula
9cfa557bc7
Merge pull request #1946 from molecula/able-perf
only run able perf on master
2022-02-28 10:01:08 -06:00
pokeeffe-molecula
01f27fb743
Merge branch 'master' into able-perf 2022-02-28 09:44:09 -06:00
pokeeffe-molecula
6fa4e1242c only run able perf on master 2022-02-28 09:43:19 -06:00
tgruben
7fbcfdcd17
Merge branch 'master' into FB-1185 2022-02-28 09:42:15 -06:00
seebs
8e57c6f539
Merge pull request #1936 from molecula/bug-like-log
[FB-1176] Check "like" argument applied to keyed fields
2022-02-28 09:34:31 -06:00
Todd Gruben
376af2c25f adust logic to include normalFlow vs recovery after merge 2022-02-28 08:12:03 -06:00
Samir Patel
97ba0c0e4d add test cases for Rows call w/ "like" 2022-02-25 16:54:19 -06:00
Samir Patel
05e98ee678 Check "like" argument applied to keyed fields
Check if queries that have a 'like' argument are applied to keyed
fields. If not, log that the user is trying to use 'like' on an
unsupported field type (as opposed to reporting that there
are no results.)
2022-02-25 16:54:19 -06:00
Todd Gruben
0ed85d6d69 comment cleanup and removed long test 2022-02-25 16:40:04 -06:00
Todd Gruben
d85ac1dca7 missed a test 2022-02-25 16:23:54 -06:00
Todd Gruben
ecaaddcf71 . 2022-02-25 16:23:54 -06:00
Todd Gruben
e64767a886 merge with master 2022-02-25 16:23:54 -06:00
Todd Gruben
cf1de78efd remove string keys on delete to allow for reuse 2022-02-25 16:23:54 -06:00
reesporte
872eb99b9d
Merge pull request #1933 from molecula/data-race-begone
fix some data races
2022-02-25 16:15:47 -06:00
reesporte
45633e23a5 only set bits after the holder is completely setup
This should help prevent a data race. SetBit can, in some cases, cause an
asynchronous task to run which tries to update the stats counter.

But if that task runs while we are modifying the stats counter itself, we have a
data race.
2022-02-25 15:02:24 -06:00
reesporte
6b23925bd7 improve Server WaitGroup concurrent usage
Add a lock to the Server WaitGroup so that if the Server WaitGroup is already
waiting, we won't concurrently add to it and cause a data race.

Also, when adding to the Server WaitGroup, check that the server is not closing
already, since that means we really shouldn't be doing more work.
2022-02-25 15:02:21 -06:00
souhailanoor
4e2eeaf1e9
Merge pull request #1938 from molecula/fb1186
FB-1186: Recover if delete was not completed
2022-02-25 13:07:50 -06:00
Hoang Pham
e16171cb4b FB-1188 - Added TTL field option 2022-02-25 11:39:31 -06:00
Souhaila Noor
574c404a66 addressed review comments 2022-02-25 11:06:06 -06:00
souhailanoor
8890f3ed06
Merge branch 'master' into fb1186 2022-02-25 10:41:27 -06:00
tgruben
f0dc484044
Merge pull request #1941 from molecula/fb-1214
[FB-1214] Fix RBF recovery when using methodical meta page detection
2022-02-25 09:55:21 -06:00
Souhaila Noor
8a95ac344b We check for incomplete deletion when server is started.
When deletion is started, _exists field is updated with row+1.
After deletion is completed, we delete _exists=row+1.
If _exists>=1, then deletion was not completed.

Updated go version in docker to match other requirements.
Removed duplicate error check for grpc.
2022-02-25 09:28:13 -06:00
tgruben
7d07b47350
Merge branch 'master' into fb-1214 2022-02-25 09:10:42 -06:00
pokeeffe-molecula
9909adbd05
Merge pull request #1940 from molecula/able-perf
added an aggregate into the test
2022-02-25 08:52:52 -06:00
pokeeffe-molecula
a1fca4ce3c take out political_party 2022-02-24 19:46:03 -06:00
pokeeffe-molecula
2fb6799565 extend the job timeout 2022-02-24 18:01:07 -06:00
Ben Johnson
28c41e9b4d Fix RBF recovery when using methodical meta page detection 2022-02-24 16:05:12 -07:00
pokeeffe-molecula
83485aa63a added an aggregate into the test 2022-02-24 16:33:02 -06:00
pokeeffe-molecula
c9368d5e7a
Merge pull request #1932 from molecula/able-perf
Able perf
2022-02-24 12:56:19 -06:00
pokeeffe-molecula
4fef282416 removed tfstate.backup files 2022-02-24 10:24:27 -06:00
pokeeffe-molecula
d6210e2421 Merge branch 'master' into able-perf 2022-02-23 14:16:44 -06:00
pokeeffe-molecula
a07264a8d1 split untar and restore 2022-02-23 13:12:03 -06:00
pokeeffe-molecula
db81dcd5c1 missed some lines apparently 2022-02-23 11:06:23 -06:00
pokeeffe-molecula
e2b1986504 make it so the autoscaler does not kill us...precious 2022-02-23 10:54:12 -06:00
seebs
94cfecf0d3
Merge pull request #1930 from molecula/fb1207
[FB-1207] catch the panic we throw for an invalid timestamp
2022-02-23 10:11:02 -06:00
pokeeffe-molecula
8e96afca9e filter out DEBUG from restore 2022-02-22 22:15:14 -06:00
pokeeffe-molecula
3c72330659 don't fill up the output with progress 2022-02-22 16:43:37 -06:00
Seebs
6d93e41e7f catch the panic we throw for an invalid timestamp
We recover from some specific panics deeper in the PEG parser, but when
we added the invalid timestamp, we didn't add it to the list we catch
and handle gracefully. Add test case for this, and test case for
successful parsing. Also add the word "valid" to the error message so
people don't get as confused by it.
2022-02-22 16:20:09 -06:00
pokeeffe-molecula
fba0f67bfa added policy to read write S3 2022-02-22 15:23:39 -06:00
pokeeffe-molecula
b0ea69d2f4 added restore 2022-02-22 13:50:47 -06:00
pokeeffe-molecula
9bc7839dcb moved some stuff around; got test to execute 2022-02-21 08:31:46 -06:00
pokeeffe-molecula
ae0c70d60b interpolate all the js strings 2022-02-17 18:20:05 -06:00
pokeeffe-molecula
9b5a65c35f skip some stuff in the gauntlet we don't need to run 2022-02-17 16:46:03 -06:00
pokeeffe-molecula
dad9bdcae3 Merge branch 'master' into able-perf 2022-02-17 16:26:05 -06:00
pokeeffe-molecula
4b407c10fc works on my machine 2022-02-17 14:29:07 -06:00
pokeeffe-molecula
d8a46f9dfb use dnf instead of apt-get 2022-02-16 21:29:50 -06:00
seebs
c7c04e08a8
Merge pull request #1927 from molecula/fb1210
don't segfault for me, empty distinct results on timestamp field
2022-02-16 17:32:26 -06:00
pokeeffe-molecula
08f5454f6b run it from the shell script 2022-02-16 17:01:41 -06:00
Seebs
2aa10670fb don't segfault for me, empty distinct results on timestamp field
There's an obvious bug, plus another bug that I hit trying to reproduce
the first bug, plus another... it's a long story.

Basically: If you get nothing back from executeDistinctShardBSI on a
Timestamp field, the request for a large enough pool of strings to hold
timestamp conversions of the nothing segfaults because r.Columns() on
a nil row segfaults.

To try to test this better, I added a filter to the executor test that
we use for this case, which got me a different result complaining about
a DistinctTimestamp result not being a SignedRow.

So, there's a couple of issues. One is that, in the case where a filter
is present, if the filter comes up with nothing, we can bail early
and return a result of the SignedRow type, which then breaks the reduce
part of our map/reduce when we try to reduce DistinctTimestamp values
into a SignedRow. To fix this, we make sure that we return the expected
type even in the case where we're bailing early.

A simpler way to see the actual original bug is, rather than having
a filter, just have a shard that has a value in *some other field*
but not in the timestamp field. So we add that to the test, too.

But also, really, since this is a problem that's happened more than
once, I propose that we also just make nil rows allow you to request
their columns and get back nil, so things like this don't bite us as
much. This wouldn't be a sufficient fix for the filter case, and I
still have the short-circuit for the nil row case explicitly in this
particular case because relying on the nil behavior bugs me, but I
think it's safer to allow .Columns on nil rows.
2022-02-16 16:52:00 -06:00
pokeeffe-molecula
1f0799e887 trying again. again. 2022-02-16 14:24:43 -06:00
pokeeffe-molecula
228489eafa omg 2022-02-16 14:10:35 -06:00
pokeeffe-molecula
c9dbb9f3cc again 2022-02-16 14:08:45 -06:00
pokeeffe-molecula
305a046f99 Try again 2022-02-16 13:59:00 -06:00
pokeeffe-molecula
156552f8d4 try deps another way 2022-02-16 13:50:26 -06:00
pokeeffe-molecula
d126b8198f Merge branch 'master' into able-perf 2022-02-16 13:32:08 -06:00
pokeeffe-molecula
55e465ba5c add some retries 2022-02-16 13:23:52 -06:00
pokeeffe-molecula
7610dea65e add the test script 2022-02-16 13:00:35 -06:00
Matthew Jaffee
69a4a0d779
Merge pull request #1924 from molecula/fb-1182-build-on-tags
Fb 1182 build on tags
2022-02-16 11:57:19 -06:00
Matthew Jaffee
e7241ac024 fix tag check to check against null
empty string doesn't work because gitlab doesn't set the variable at
all. How do I know that "null" is correct? Because Fletcher told
me... apparently it's a ruby-ism
2022-02-16 10:51:12 -06:00
Matthew Jaffee
307aefc05e fix up S3 release dump
- remove commit SHA nesting
- add NOTICE, .service files, and .conf
2022-02-16 10:51:12 -06:00
Matthew Jaffee
12a215a006 add separate S3 dump step for tags 2022-02-16 10:51:12 -06:00
pokeeffe-molecula
dca6a27f00 try to get artifacts in child pipeline 2022-02-16 10:46:00 -06:00
seebs
713085918b
Merge pull request #1926 from molecula/FB-1208-crash
[FB-1208] local shadow causing unexpected behavior
2022-02-16 10:33:10 -06:00
Todd Gruben
3668343a01 local shadow causing unexpected behavior 2022-02-16 09:27:52 -06:00
pokeeffe-molecula
16c58db078 now try and set up the cluster 2022-02-16 08:32:39 -06:00
pokeeffe-molecula
0f7990e772 now try and run k6 2022-02-15 20:59:13 -06:00
pokeeffe-molecula
9c3e4a4a8c sudont 2022-02-15 18:39:28 -06:00
pokeeffe-molecula
4a31fe4b2e reordering some stuff 2022-02-15 18:16:00 -06:00
pokeeffe-molecula
e5f85a6f94 try again, again, again 2022-02-15 18:05:55 -06:00
pokeeffe-molecula
65f6239d96 fixing 2022-02-15 16:05:02 -06:00
pokeeffe-molecula
997b8f9b5b remove rules in child 2022-02-15 14:28:12 -06:00
pokeeffe-molecula
53a3573c25 y u no work 2022-02-15 13:14:14 -06:00
pokeeffe-molecula
093de45c06 Merge branch 'master' into able-perf 2022-02-15 12:37:17 -06:00
pokeeffe-molecula
bde8c51f9a try again, again 2022-02-15 12:29:34 -06:00
Ben Johnson
b570a38780
Merge pull request #1925 from molecula/rank-cache-bulk-invalidation
[FB-1206] Periodically invalidate rank cache during bulk add
2022-02-15 10:34:22 -07:00
pokeeffe-molecula
a19cd72e18 install k6 instead of docker 2022-02-15 11:31:12 -06:00
pokeeffe-molecula
a3f2181ed5 takes rules out altogether 2022-02-15 10:39:07 -06:00
pokeeffe-molecula
a8e9e4b9ce try again 2022-02-15 09:59:42 -06:00
pokeeffe-molecula
792121b43e get child pipeline to work 2022-02-15 09:56:38 -06:00
Ben Johnson
6b84d685d5 Periodically invalidate rank cache during bulk add
This commit changes `RankCache.BulkAdd()` so that entries are
limited to an upper bound of 2x `maxEntries`. When this bound
is exceeded then the cache is automatically recalculated.
2022-02-15 08:25:45 -07:00
Matthew Jaffee
6e41c663e0
Merge pull request #1923 from molecula/cicd-will-it-never-end
Cicd will it never end
2022-02-15 08:43:53 -06:00
pokeeffe-molecula
fdb500898d fixed path 2022-02-15 07:59:33 -06:00
pokeeffe-molecula
355b522dac
Merge branch 'master' into cicd-will-it-never-end 2022-02-14 17:22:12 -06:00
pokeeffe-molecula
f97878edcf fixed arch problem 2022-02-14 16:31:55 -06:00
hphamMolecula
d1c2861469
Merge pull request #1922 from molecula/sup-145
SUP-145: Removed shard list in "shard unavailable" error log
2022-02-14 16:04:27 -06:00
hphamMolecula
38fc2f9dbb
Merge branch 'master' into sup-145 2022-02-14 15:25:18 -06:00
tgruben
d75e6888fc
Merge pull request #1918 from molecula/sup-146
[SUP-146] roaring-migrate bug;performance improvements
2022-02-14 15:08:26 -06:00
Todd Gruben
6c512359a1 missed a fmt statement 2022-02-14 14:53:47 -06:00
Todd Gruben
cbc9bf71a1 logging 2022-02-14 14:41:22 -06:00
hphamMolecula
8f1349543f
Merge branch 'master' into sup-145 2022-02-14 14:40:12 -06:00
Todd Gruben
d4b7d0cb57 Merge branch 'sup-146' of github.com:molecula/featurebase into sup-146 2022-02-14 14:09:13 -06:00
Todd Gruben
8a48c1b67a standard logger 2022-02-14 14:09:05 -06:00
tgruben
baa3a7793f
Merge branch 'master' into sup-146 2022-02-14 13:47:00 -06:00
rachithrr
1a87e7c9dd FB-1159: Try to test etcd retry code
-This code should cover the retry logic.
-The ingest is set to 100,000 records, because it's difficult to cause
leader change with lower number of records to ingest.
-Additional node: By applying stress on other two nodes while ingesting
simultaniously causes "context erorr" logic which can fail many tests.
2022-02-14 13:43:34 -06:00
Kasey C. Rodgers
956c37ec85
Merge pull request #1919 from molecula/fb1163-etcd-source-of-truth
make etcd schema primary source of truth for indexes and fields
2022-02-14 11:01:55 -08:00
tgruben
33451254e6
Merge branch 'master' into sup-146 2022-02-14 12:28:20 -06:00
Kasey C. Rodgers
ede8cf61a0
Merge branch 'master' into fb1163-etcd-source-of-truth 2022-02-14 10:28:10 -08:00
tgruben
c4eebc6885
Update cmd/roaring-migrate/main.go
Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2022-02-14 12:17:55 -06:00
tgruben
89598a7788
Update cmd/roaring-migrate/main.go
Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2022-02-14 12:17:42 -06:00
tgruben
e1e968ef97
Update cmd/roaring-migrate/main.go
Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2022-02-14 12:17:24 -06:00
Todd Gruben
7e25ca467a Merge branch 'sup-146' of github.com:molecula/featurebase into sup-146 2022-02-14 12:12:30 -06:00
Todd Gruben
9bc28091c9 better testing 2022-02-14 12:11:28 -06:00
kcrodgers24
d57050d966 requested idx == nil fix; add doc comment 2022-02-14 10:09:33 -08:00
seebs
a98546c086
Merge pull request #1906 from molecula/task
improve task pool and give it some testing
2022-02-14 11:34:34 -06:00
kcrodgers24
7013910158 give each test its own InMemSchemator 2022-02-14 09:15:23 -08:00
pokeeffe-molecula
f35741adcf removing experiments 2022-02-14 10:46:58 -06:00
Hoang Pham
63b5eed010 SUP-145: Removed shard list in "shard unavailable" error log 2022-02-14 10:10:04 -06:00
Seebs
96ab9314d1 use task pool for executor workers
This adopts the task pool functionality to let us spawn new worker
threads when worker threads are blocked. The underlying reason for
this is the same as the reason for the previous worker-pool-growing
strategy; while our design persistently has at least one thing which
can proceed, it can be the case that there are N things blocked,
where N is the size of our worker pool. Blocked workers shouldn't
count against our desired number of workers.

Originally, the intent was to thread this into RBF, and provide
backpressure from RBF on the pool when blocking on writes. Unfortunately,
that's not good enough, because while a write is blocked, the Qcx
calling it is *also* holding the Qcx's mutex, which means that any other
NewTx on that Qcx will *also* block. So we need to block for the
entire time of the NewTx.

Removing the existing worker spawning code resulted in a subtle
and maybe-harmless change; prior to this, each invocation of `mapperLocal`
would hold a lock, which meant that all the tasks for a given local mapper
would be put in the queue *sequentially*, ensuring that they'd all be
picked up by workers before things from later workers.

With the new pushback, that's not, strictly, necessary. Also, if you
disable it, you can end up with 300,000 goroutines at once, most of them
blocked.

A smallish run does, in fact, eventually complete anyway -- it will
indeed keep making workers until everything gets one. However, while
it's *correct*, it's also noticably *slower*. The same test workload
goes from around 33 seconds to a bit over 40 seconds when that lock
isn't present. (But that's with an extremely small WAL write cap
introduced to make the previous deadlock possible.)

With large numbers of shards, the practical impact is that you can
have quite a lot of things in process, with hundreds of goroutines
each, all blocked waiting for one writer. If we force them to all be
processed at the same time, all the reads that are connected to
each other are much more likely to get all processed at once, before
something new comes along.

In short, that lock isn't strictly necessary but it seems to help
noticably with performance and reduce simultaneous goroutines
significantly.
2022-02-14 09:56:20 -06:00
Seebs
ff091b0346 implement a task pool
This implements a task pool which can handle backpressure; the
idea is, you have a target number of workers, but when a worker
blocks, you can tell it that it's blocking, and it can spawn
another worker in the mean time. This reduces the bounding provided
by the worker pool, and can significantly overshoot the intended size
of the pool in some cases, but it provides quick scaling up when
part of a workload gets blocked.

There's also a simulator attached to it. The simulator's job is
to act similarly to the executor's worker pool working on RBF
databases, including the weird semantics of writes and reads;
specifically, that reads aren't blocked by writes, but a write
can't terminate until every read that started before it has exited.
(This is an oversimplification; actually, writes can complete,
but they still hold the write lock until any WAL merge completes,
and the WAL merge can't complete until old reads are done.)

The simulator is significantly more complicated than the pool.
2022-02-14 09:56:19 -06:00
tgruben
e963bccc93
Merge branch 'master' into sup-146 2022-02-14 08:16:37 -06:00
pokeeffe-molecula
6362173288 testing a theory 2022-02-12 11:30:04 -06:00
pokeeffe-molecula
06e70d41e9 added a job to clean up files 2022-02-12 11:22:03 -06:00
pokeeffe-molecula
03da38d677 Merge branch 'master' into cicd-will-it-never-end 2022-02-12 11:14:26 -06:00
pokeeffe-molecula
4d8ff30eaa Merge branch 'master' into cicd-will-it-never-end 2022-02-11 17:33:13 -06:00
Matthew Jaffee
40eff84e25
Merge pull request #1920 from molecula/coverage-permission-denied
try to clean up some files that are causing CI heartburn
2022-02-11 17:32:55 -06:00
Matthew Jaffee
490ad7f08a try to clean up some files that are causing CI heartburn 2022-02-11 16:59:11 -06:00
pokeeffe-molecula
92d491682d added perf test 2022-02-11 15:38:33 -06:00
Matthew Jaffee
7a0025f417
Merge pull request #1911 from molecula/max-memory-extract-only
[SUP-143] Restrict max-memory setting to Extract() only
2022-02-11 14:47:24 -06:00
Ben Johnson
6d06f5550b Restrict max-memory to Extract() calls only 2022-02-11 14:19:56 -06:00
Matthew Jaffee
4fb22e495c
Merge pull request #1916 from molecula/test-port-conflicts
more binding to 0==less port conflicts in CI
2022-02-11 14:04:52 -06:00
kcrodgers24
4e7c72cc00 make etcd schema primary source of truth for indexes and fields 2022-02-11 11:47:49 -08:00
Matthew Jaffee
b5dae698ff remove unused env var from test
cluster.hosts is no longer a config option since move to etcd
2022-02-11 12:02:10 -06:00
Matthew Jaffee
53a33134d9 add verbose output to race tests 2022-02-11 12:02:10 -06:00
Matthew Jaffee
102a6e723b more binding to 0==less port conflicts in CI 2022-02-11 12:02:10 -06:00
souhailanoor
7a2929d788
Merge pull request #1913 from molecula/clustertests-coverage
FB-1183: Enable code coverage for clustertests
2022-02-11 11:50:36 -06:00
pokeeffe-molecula
23980af634 Merge branch 'master' into cicd-will-it-never-end 2022-02-11 11:40:11 -06:00
Souhaila Noor
7983a7506f - Need to get code coverage on the server and client side
- For server side, used an instrumented binary with a test that wraps around the main entrypoint for featurebase
- Every time, the binary is called, a new coverage file is generated.
- For the client side, used the standard -coverprofile flag for go test to generate code coverage
- For backup test that's expected to fail, needed to call Run call in backup.go directly. The code coverage is not written to disk for an instrumented binary if there is an error.
2022-02-11 11:26:00 -06:00
tgruben
064ed9af1a
Merge branch 'master' into sup-146 2022-02-11 11:22:12 -06:00
Todd Gruben
8d5cdbdd77 roaring-migrate bug;performance improvements 2022-02-11 11:19:44 -06:00
Garrison Davis
33c7e16c24
Merge pull request #1917 from molecula/gd-examine-aws-perms
Investigating AWS credential issues
2022-02-11 09:32:57 -07:00
garrison.davis@molecula.com
054f7c6cce Make wget less noisy 2022-02-11 08:57:23 -07:00
garrison.davis@molecula.com
27024de323 Use profile explicitly 2022-02-11 08:55:57 -07:00
pokeeffe-molecula
90d897ad7d address merge conflict 2022-02-10 14:00:06 -06:00
pokeeffe-molecula
966a86e4de Merge branch 'master' into cicd-will-it-never-end 2022-02-10 13:59:40 -06:00
pokeeffe-molecula
bb1f403974 fixes to able defn 2022-02-10 13:56:59 -06:00
Garrison Davis
a21dd96b2d
Merge pull request #1912 from molecula/gd-instance-scale-in-protection
Stop termination in the gauntlet stage
2022-02-09 17:01:06 -07:00
Garrison Davis
26dc93d761
Merge branch 'master' into gd-instance-scale-in-protection 2022-02-09 16:41:59 -07:00
garrison.davis@molecula.com
62e6544089 Stop termination in the gauntlet stage
We have pipelines that get to the gauntlet stage then get failed because
the ASG scales-in before the gauntlet stage finishes. (4/6 of the last
gauntlet failures were from this failure.)

There are a few ways to fix this, but my proposal is to turn on scale-in
protection to stop scaling in the instance running the gauntlet job
(scale in other instances instead), then turn off the scale-in
protection after the gauntlet test is run.
2022-02-09 16:22:10 -07:00
Samir Patel
1dc0d2c88b
Merge pull request #1910 from molecula/pql-variables
[FB-1063] Dynamically expand queries based on $variable values
2022-02-09 16:58:33 -05:00
Samir Patel
96de9834bc
Merge branch 'master' into pql-variables 2022-02-09 14:40:18 -05:00
Samir Patel
39c9a062aa address feedback 2022-02-09 13:16:19 -06:00
Samir Patel
be68241d8e add test 2022-02-09 12:33:12 -06:00
Samir Patel
bfcbf9d784 change interfaceOrVariable type 2022-02-09 11:29:11 -06:00
pokeeffe-molecula
3a0777c063 added 'able' perf testing environment 2022-02-08 16:30:35 -06:00
Samir Patel
edc16a61ea remove comment 2022-02-08 16:08:04 -06:00
Samir Patel
4fee777c23 Merge branch 'pql-variables' of github.com:molecula/featurebase into pql-variables 2022-02-08 16:02:56 -06:00
Samir Patel
9e8b968c19 Refactor ExpandVars to reduce complexity 2022-02-08 15:58:12 -06:00
Samir Patel
cd0bdd4c30 refactor 2022-02-08 15:43:14 -06:00
Samir Patel
fbe23915cf support ConstRow expansion and cleanup 2022-02-08 13:39:22 -06:00
Matthew Jaffee
456e8d6417
Merge pull request #1907 from molecula/fb-1108-3-cleanup
Fb 1108 3 cleanup
2022-02-08 09:50:01 -06:00
Matthew Jaffee
04b13d9eb6 have test use the cluster.Start helper to avoid port conflicts
cluster.Start creates ephemeral ports for all the etcd stuff, whereas
node.Start uses the default config. I don't know why this test was
using the node.Start, but it passes without it.
2022-02-08 09:30:07 -06:00
Samir Patel
9a52dd1a2c handle rows for the most part 2022-02-07 20:00:05 -06:00
Ben Johnson
4fb795d6cb Parse variables for _field 2022-02-07 15:40:24 -07:00
Samir Patel
f5d0b227fa messing with parser, Rows call
messing around trying to get Rows call to recognize
$ syntax. got Rows to not barf, but it is interpreting $ syntax
as string values for the _field parameter as opposed to a Variable
2022-02-07 16:21:35 -06:00
Samir Patel
a755006d95 match on variable name, not field name 2022-02-07 15:43:32 -06:00
Matthew Jaffee
6cc5d198ee remove unused stuff and fix a bunch of random staticcheck issues
sorry... once I saw, I couldn't unsee
2022-02-07 15:10:10 -06:00
Matthew Jaffee
c2ed9ecdba remove InternalQueryClient 2022-02-07 15:10:10 -06:00
reese
6408debacf
Merge pull request #1905 from molecula/fb1172
fb1172: enable refresh tokens
2022-02-07 14:03:33 -06:00
reesporte
88d2914b15 fb1172: enable refresh tokens
- rip out gobby stuff
- add tokenCache, groupsCache
- refresh the token if needed
- set cookies after authenticate
- remove signature validation, the IDP does that for us
- added way more unit tests
- update older tests to use new API
- add fake idp to authcluster tests
2022-02-07 13:42:11 -06:00
Samir Patel
b3faaa9dc0 handle expanding of Row call
working for equality, but not for inequalityh ATM
2022-02-07 12:55:10 -06:00
reese
e8c123ca23
Merge pull request #1908 from molecula/log-index
log index with query for grpc
2022-02-04 16:53:39 -06:00
reesporte
8097e7dffd update test 2022-02-04 16:26:56 -06:00
reesporte
ede85735df use nfpm 2.11.3 so CI doesn't break 2022-02-04 16:12:20 -06:00
reesporte
1f8efd663c log index with query for grpc 2022-02-04 16:04:19 -06:00
Matthew Jaffee
36b721fd8d
Merge pull request #1902 from molecula/sup-139
[SUP-139] Fix GroupBy with multiple offset int groups
2022-02-04 11:34:36 -06:00
Ben Johnson
f824117df9 Fix GroupBy with multiple offset int groups 2022-02-04 09:36:59 -07:00
Matthew Jaffee
ed736b3cb3
Merge pull request #1904 from molecula/fb-1108-2-move-http-to-core
remove http subpackage and bring implementations into core
2022-02-04 08:56:10 -06:00
Matthew Jaffee
254bacc40c remove http subpackage and bring implementations into core
remove interfaces as necessary
2022-02-03 21:04:04 -06:00
Matthew Jaffee
0f0e418763
Merge pull request #1903 from molecula/kill-image-in-clustertests
get rid of 'image' in clustertests which was causing issues
2022-02-03 20:51:17 -06:00
Matthew Jaffee
2cc65ccae4 get rid of 'image' in clustertests which was causing issues 2022-02-03 17:00:49 -06:00
Matthew Jaffee
fac5bdbfbf
Merge pull request #1901 from molecula/fb-1114-2-rip-inspect
remove inspect command
2022-02-03 12:55:49 -06:00
Matthew Jaffee
d1f3b58861 remove inspect command 2022-02-03 11:25:31 -06:00
Matthew Jaffee
063bdaf41e
Merge pull request #1897 from molecula/fb-1114-rip-roaring
rip out roaring backend support
2022-02-03 11:16:23 -06:00
Matthew Jaffee
fea624f1ba fix typo w/ authclustertests 2022-02-02 21:05:33 -06:00
Matthew Jaffee
bff6b17a8e remove check command (was for roaring backend files) 2022-02-02 20:56:18 -06:00
Matthew Jaffee
1f371fa953 turn off verbose on linter, add smoke build
if your code doesn't build, the linter errors can be very misleading
2022-02-02 20:56:18 -06:00
Matthew Jaffee
70ea784d41 don't mind me, just submitting stuff that doesn't even compile and
then getting confused by linter errors
2022-02-02 20:56:18 -06:00
Matthew Jaffee
69c00a92ad remove a bunch of roaring backend stuff
snapshotQueue, op tracking, roaring-only tests
2022-02-02 20:56:18 -06:00
Matthew Jaffee
fa4855c887 remove unnecessary filter 2022-02-02 20:56:18 -06:00
Matthew Jaffee
e471b462b6 remove all occurences of Bitmap.Source 2022-02-02 20:56:18 -06:00
Matthew Jaffee
f8b180a4a5
Merge pull request #1900 from molecula/fix-clustertests
get container ID via "docker-compose" call in clustertests
2022-02-02 16:27:23 -06:00
Matthew Jaffee
979023392d authclustertests wasn't working because...
weirdness with the docker-compose file being in a different directory,
I think.
2022-02-02 15:08:04 -06:00
Matthew Jaffee
61783e5827 add option to set ResponseHeaderTimeout per client
this is necessary as in some cases we want a low timeout (when we
expect a quick response, e.g. with backup), but in others we may want
a very long timeout (long running query).

Now we have more granular control over timeouts so we can get things
to fail more predictably in tests.
2022-02-02 14:04:40 -06:00
Matthew Jaffee
06235c3d70 get container ID via "docker-compose" call in clustertests
this should be a lot more reliable than trying to construct it based
on the project name as the exact construction can differ between
docker-compose versions.

There was also an issue with the backups succeeding when they should
fail in the test. There's an arcane maze of HTTP timeouts to navigate
here, but basically there are situations where the client will just
wait forever rather than erroring if the server is paused at the
right(wrong) time. I'm not convinced we've solved every possible case
of this, so we still may see the backup succeed even when it's
supposed to fail. The ultimate hammer is to add Client.Timeout, but
that's a very blunt instrument and I'm afraid it could cause a timeout
when really we just have a lot of data to download or something.

There may be a better way to say "only time out if you literally
haven't heard a peep from the server in this long", but I haven't been
able to figure it out yet.

I also fixed how the authclustertests are run as they weren't using
the PROJECT parameter correctly. Now they can run concurrently with
clustertests, and with other copies of authclustertests without having
conflicts.
2022-02-02 12:03:46 -06:00
pokeeffe-molecula
e88c30c6cb
Merge pull request #1899 from molecula/cicd-will-it-never-end
remove dependence on gitlab artifact api; add s3 dump
2022-02-01 16:04:54 -06:00
pokeeffe-molecula
ca2def7389 dump to s3 2022-02-01 14:51:06 -06:00
pokeeffe-molecula
1e4b3321ff remove reliance on gitlab token 2022-02-01 14:40:38 -06:00
pokeeffe-molecula
6db05d6150 don't use gitlab api to get binaries 2022-02-01 14:22:24 -06:00
Ben Johnson
3989b363ce Add variable support to PQL 2022-02-01 08:30:48 -07:00
tgruben
8816583cd3
Merge pull request #1898 from molecula/sup-138
[SUP-138] add timestamp formatting to type FieldRow used in GroupBy
2022-01-31 14:52:54 -06:00
Todd Gruben
d7c082b515 add timestamp formating to type FieldRow used in GroupBy 2022-01-31 12:32:05 -06:00
souhailanoor
3ece8139fc
Merge pull request #1896 from molecula/auth-bug
FB1151-Enable auth for endpoint
2022-01-28 15:28:54 -06:00
Souhaila Noor
bae9d16c4f updated the tests 2022-01-28 14:28:59 -06:00
Souhaila Noor
20871a8780 remove asserting for log path 2022-01-28 13:07:22 -06:00
Souhaila Noor
1a4acfe97d fix bug with query bug 2022-01-28 13:01:08 -06:00
souhailanoor
baf5e47d8f
Merge branch 'master' into auth-bug 2022-01-28 12:12:19 -06:00
Souhaila Noor
f58ebbe505 enable auth for endpoint 2022-01-28 12:10:22 -06:00
pokeeffe-molecula
083670d20e
Merge pull request #1895 from molecula/cicd-will-it-never-end
added retries to go tests
2022-01-27 17:14:59 -06:00
pokeeffe-molecula
586e4d7f5a Merge branch 'master' into cicd-will-it-never-end 2022-01-27 15:50:21 -06:00
pokeeffe-molecula
d7401babd4 add retries....so these fracking flaky ass tests don't screw up the pipeline constantly 2022-01-27 15:49:54 -06:00
pokeeffe-molecula
1774062f24
Merge pull request #1894 from molecula/cicd-will-it-never-end
allow clustertests to fail
2022-01-27 15:24:44 -06:00
pokeeffe-molecula
7ff9e82b1b
Merge branch 'master' into cicd-will-it-never-end 2022-01-27 14:52:51 -06:00
pokeeffe-molecula
fedcdab1c2 allow clustertests to fail 2022-01-27 14:49:46 -06:00
pokeeffe-molecula
a8fd5f99f2
Merge pull request #1890 from molecula/fb1151-auth-tooling
FB-1151 auth tooling
2022-01-27 13:04:13 -06:00
pokeeffe-molecula
95605a4e59
Merge pull request #1891 from molecula/cicd-will-it-never-end
build roaring-migrate
2022-01-27 12:16:58 -06:00
souhailanoor
1d26739c90
Merge branch 'master' into fb1151-auth-tooling 2022-01-27 12:07:22 -06:00
pokeeffe-molecula
47f87f24c3
Merge branch 'master' into cicd-will-it-never-end 2022-01-27 11:42:40 -06:00
pokeeffe-molecula
05864f38df
Merge pull request #1893 from molecula/docker-is-messed-up
fix broken dockerfile
2022-01-27 11:42:14 -06:00
pokeeffe-molecula
d16ada75af use -o instead of a subsequent mv command 2022-01-27 11:36:16 -06:00
reesporte
1db6009d70 fix broken dockerfile
i think its gonna work this time!!!
2022-01-27 10:55:20 -06:00
pokeeffe-molecula
dff061ca22 now do it for the other one 2022-01-27 10:18:21 -06:00
pokeeffe-molecula
5d7c2437e9 trying again 2022-01-27 10:00:22 -06:00
pokeeffe-molecula
0f5ce612e0 building roaring-migrate for linux_amd64 2022-01-27 09:39:34 -06:00
pokeeffe-molecula
b67b8aff6c Merge branch 'master' into cicd-will-it-never-end 2022-01-27 09:38:14 -06:00
Souhaila Noor
0e1cf5bbbd Enable authentication/authorization for featurebase tools
- Add auth-token for featurebase import, backup and restore
- Add auth-token to http request
- Create a cluster tests with auth enabled
- Add test for import with auth enabled
2022-01-26 17:30:26 -06:00
Matthew Jaffee
d7c3fa2a93
Merge pull request #1889 from molecula/1174-projectify-clustertests
add project support to clustertests to allow for concurrent runs
2022-01-25 08:15:26 -06:00
Matthew Jaffee
71da3fdcb2 add docker-compose project to clustertests in CI to allow concurreny 2022-01-25 07:54:48 -06:00
Matthew Jaffee
7fbcba5c4b add GCP back in 2022-01-25 07:54:48 -06:00
Matthew Jaffee
3477534930 add project support to clustertests to allow for concurrent runs
also remove gcp tag... shouldn't be needed any more as I think the AWS
runners are properly configured.
2022-01-25 07:54:48 -06:00
pokeeffe-molecula
e0e86ec1d3 put docker containers in the right place 2022-01-24 18:34:14 -06:00
pokeeffe-molecula
8e775b88b9
Merge pull request #1875 from molecula/cicd-will-it-never-end
Added docker build & rpm, deb packaging for linux arm64
2022-01-24 17:15:13 -06:00
reese
de11a1d903
Merge pull request #1888 from molecula/fb1146
fb1146 - fixes panic on POST /transaction on non-primary node
2022-01-24 17:11:49 -06:00
reesporte
365789b791 remove unnecessary port bindings 2022-01-24 16:29:12 -06:00
pokeeffe-molecula
d389aae9c3
Merge branch 'master' into cicd-will-it-never-end 2022-01-24 16:12:54 -06:00
reesporte
ec543ac094 Merge branch 'master' into fb1146 2022-01-24 15:25:00 -06:00
reesporte
276088c386 fix panic on POST /transaction on non-primary node
- if we're a non-primary node, redirect to the primary
- if non-primary nodes can create transactions now, then the client should not receive an ErrNotPrimaryNode
- streamline metrics logic
2022-01-24 15:24:21 -06:00
pokeeffe-molecula
1721dd0dcf remove comments 2022-01-24 15:11:02 -06:00
Matthew Jaffee
10eac6fe9a
Merge pull request #1886 from molecula/fb-1116-rip-generation
rip out generation stuff
2022-01-24 11:52:12 -06:00
Matthew Jaffee
a2e109a07c disable roaring backend in test 2022-01-24 09:49:01 -06:00
Matthew Jaffee
2d44c23ac0 remove problematic roaring-only test 2022-01-24 09:49:01 -06:00
Matthew Jaffee
82c75851df rip out generation stuff
it was somewhat difficult to avoid ripping this out without also
touching some of the stuff that supports roaring backend. That's going
soon too, so no worries :)
2022-01-24 09:49:01 -06:00
Travis Turner
1d7a42c7e7
Merge pull request #1826 from molecula/tlt/rbf-comments
Clean up some of the godoc entries in rbf
2022-01-24 09:37:30 -06:00
Travis
07cd6ec228
Clean up some of the godoc entries in rbf 2022-01-22 07:52:36 -06:00
pokeeffe-molecula
bc89ca3553 now with real private_subnets! 2022-01-21 20:31:16 -06:00
pokeeffe-molecula
5241bd4ce4
Merge branch 'master' into cicd-will-it-never-end 2022-01-21 18:07:19 -06:00
reese
6d2f95e3fb
Merge pull request #1884 from molecula/fb1164
add test coverage
2022-01-21 14:29:46 -06:00
reesporte
836df379ac add test coverage
for the following auth related packages:
* authn
* http
* server

fix minor bugs, do some cleaning up, etc in `authn/authenticate.go` and `http/handler.go`
2022-01-21 13:57:47 -06:00
Ben Johnson
c7208cf5e3
Merge pull request #1882 from molecula/go-mod-v3
Upgrade go.mod to featurebase/v3
2022-01-21 12:53:09 -07:00
Ben Johnson
9ebf0e2119 Upgrade go.mod to featurebase/v3 2022-01-21 10:57:05 -07:00
seebs
4e578b8a65
Merge pull request #1879 from molecula/slowCI
bump test timeouts ridiculously
2022-01-21 11:52:54 -06:00
Seebs
03a18e9beb for leasedkv tests, don't use default etcd config
The default etcd config means that if two of this test run around the
same time, we end up with one of them failing because it can't bind.
Elsewhere, we resolve this by binding to ephemeral ports and fixing
up the config to use them, so we duplicate that here.

This includes duplicating the existing listenerWithURL from test/,
because that package has to import us, so we can't import it, and
I don't really want to make a separate package for one trivial
function.
2022-01-21 11:12:10 -06:00
Seebs
096c44884a fix typo in doc comment 2022-01-21 11:12:10 -06:00
Seebs
375aaf8fbc don't hardcode local port for backup and restore pprof service
If we hardcode a port, we can't run on a crowded machine, like in
CI. If we use :0, we can print the value actually picked.
2022-01-21 11:12:10 -06:00
Seebs
d50065a16f bump timeouts on single-writer RBF Tx test
There's no correct timeout value here, really, but the intent
of this is that we first want to be sure that a second tx doesn't
successfully start before the first exits, and then that the second
*does* successfully start *after* the first exits.

Unfortunately, there's no guarantees on timely processing, and in
reality, CI can break us by waiting more than 10ms before we get
enough CPU time to do something. More generally, there's no way to
make a test like this work correctly -- no matter how long you wait
for the second Tx to start before closing the first one, it's always
possible that it *would* have started just a millisecond later even
without you closing the first one. And similarly, no matter how long
you give it to start when it's *supposed* to, it could always take
longer.

We could in principle just set this to wait for the second Tx to start
and rely on the test timeout killing us if it doesn't, but then we
don't get a useful message.

Let's optimistically hope that 10 seconds is long enough for a trivial
rollback to happen, since that doesn't need to imply writes. And I
think 50ms is a better bet for the first test, although that does
make this test close to 5x slower on non-CI hardware.
2022-01-21 11:12:10 -06:00
Seebs
b40c86c278 retry etcd leader on "etcdserver: leader changed"
This should always be etcdserver.ErrLeaderChanged, but actually
apparently it's not always:

	non-retryable error: etcdserver: leader changed

The "non-retryable" comes from our code. The "leader changed"
message appears to come from etcdserver, but there appear to be
circumstances where it has a suffix, or it could get wrapped,
so we check for the string being contained in an error. This is
not pretty.
2022-01-21 11:12:10 -06:00
Seebs
b5fb9aad84 bump test timeouts ridiculously
gitlab CI runs as much as 5x slower sometimes during business hours,
resulting in tests failing due to 10-11 minute timeouts that would
succeed in under 2-3 minutes outside of business hours. to allow us
to do anything at all, let's just set that to half an hour, and 90
minutes for `go test -race`.

Concern: It's possible there's a timeout that's a gitlab CI configuration
thing involved too, because we see some go test timeout panics, but we
also see some weird messages about SIGQUIT at 11 minutes, which isn't
the go test timeout, so we may need to address that too.

Note that we're changing the Makefile, and also the config for the
gitlab CI passes, which don't use the Makefile. The Makefile changes
are just to be careful and avoid retriggering this later. We may
want to revert these if we get the other issues fixed.
2022-01-21 11:12:10 -06:00
Garrison Davis
71b03d8b85
Merge pull request #1883 from molecula/remove-go-caching
Remove go caching
2022-01-21 10:02:48 -07:00
garrison.davis@molecula.com
a93c3f2f71 Remove go caching
This will likely return when it's done in S3.
2022-01-21 09:55:23 -07:00
hphamMolecula
a179b15300
Merge pull request #1873 from molecula/ui-fixes
UI bug fixes
2022-01-21 09:55:04 -06:00
hphamMolecula
239832668b
Merge branch 'master' into ui-fixes 2022-01-20 17:09:37 -06:00
reese
d47ffdf5d7
Merge pull request #1880 from molecula/grpc-logging
grpc logging
2022-01-20 16:59:24 -06:00
hphamMolecula
0891f27a6a
Merge branch 'master' into ui-fixes 2022-01-20 16:38:34 -06:00
reese
647d62c8e7
Merge branch 'master' into grpc-logging 2022-01-20 15:51:21 -06:00
reese
efb5be8a67
Merge pull request #1878 from molecula/redirect-url
add a redirect-base-url config option
2022-01-20 15:51:00 -06:00
reesporte
81fcd9c228 fix merge conflicts 2022-01-20 14:14:25 -06:00
reesporte
9371212697 Merge branch 'master' into grpc-logging 2022-01-20 14:06:05 -06:00
reesporte
399a11223f use aws to run these jobs 2022-01-20 13:58:18 -06:00
reese
2e0aaa27a9
Merge branch 'master' into redirect-url 2022-01-20 13:08:16 -06:00
hphamMolecula
1d618a36ce
Merge branch 'master' into ui-fixes 2022-01-20 12:21:15 -06:00
Samir Patel
164c69bdf2
Merge pull request #1874 from molecula/keygen
update keygen subcommand
2022-01-20 13:19:09 -05:00
reesporte
87bbca938c add a redirect-base-url config option
this allows the user to configure a url for their IDP to redirect to, rather
than relying on the bind address of the featurebase server itself
2022-01-20 12:09:18 -06:00
hphamMolecula
ac54607a2c
Merge branch 'master' into ui-fixes 2022-01-20 09:42:01 -06:00
Samir Patel
dcdc90b961
Merge branch 'master' into keygen 2022-01-20 01:12:45 -05:00
reesporte
592fcbb05b one logger to rule them all
unify logging method, actually log query for streaming and unary requests
2022-01-19 21:20:08 -06:00
reese
06ed22ef93
Merge pull request #1877 from molecula/fb1167
fix bug with nil elements in protobuf indexes
2022-01-19 21:13:03 -06:00
reese
35343db29a
Merge branch 'master' into fb1167 2022-01-19 19:08:11 -06:00
seebs
ffbf55ee40
Merge pull request #1860 from molecula/rbfPages
RBF page/cursor management improvements
2022-01-19 18:27:52 -06:00
Seebs
fb11895985 oops handle nil 2022-01-19 17:09:57 -06:00
Seebs
749dcd6970 retry on etcd timeout errors 2022-01-19 16:57:47 -06:00
Samir Patel
16eff203ec
Merge branch 'master' into keygen 2022-01-19 16:38:31 -05:00
Seebs
2dce518a24 retry other etcd ErrTimeout variants
etcd can return more detailed ErrTimeout variants in rare cases, and we
want to retry on those too.
2022-01-19 15:19:45 -06:00
Seebs
37507db4ac use array containers instead of individual bitwise adds
This affects TestTx_Remove, TestTx_DeallocateToFreeList, and
TestTx_RecreateBitmap, all of which were adding hundreds of thousands
of individual bits, or more, and all of which work just as well and
produce the same behavior using largeish containers.

This reduces race-detector-test runtime from about 20 minutes to
a couple.
2022-01-19 15:19:45 -06:00
Seebs
719a30e128 shorten MultiTx test
The MultiTx test runs for a fairly long time but doesn't add much
value running that much longer, and there's no reason it should take
more than half the time we spend on this entire directory.
2022-01-19 15:19:45 -06:00
Seebs
112abcb549 use stable cursor for freelist operations
The Cursor datatype is quite large, and allocating them constantly for
ops is extremely expensive. To avoid this, we create a single stable cursor
that lives in the DB, and can be used for freelist modifications. Since the
freelist is only ever modified once at a time, this should be safe. We also
don't fully zero it between operations, we just reset the relevant parts.
2022-01-19 15:19:45 -06:00
Seebs
adcd5adb02 improve the sync.Pool used for pages, avoid excess page allocations for WAL
Several changes. One is, we don't provide a `New` for pagePool, which
allows allocPage to check whether a page was returned, and thus, zero
pages which were found in the pool, or make new pages, but never zero
pages it just created with make. We then also make many more things
which were making pages use the pool.

Reuse the same page allocation for multiple header pages dumped into
the WAL; the bitmap header pages aren't stashed in our page map,
they're only written to the disk, so we don't need to make a new page
each time, we can just make one new page for the whole batch.

Internally in the pool, we pool pointers to [PageSize]byte, rather
than slices. sync.Pool needs pointer-like things. To store a pointer
to a slice, you have to heap-allocate the slice, also. So, instead
of heap-allocating copies of these slices, we just use pointers to
the raw data.
2022-01-19 15:19:45 -06:00
hphamMolecula
b7e85db4b3
Merge branch 'master' into ui-fixes 2022-01-19 15:16:05 -06:00
reesporte
a162322fc9 fix bug with nil elements in protobuf indexes
we were allocating space we weren't using smh my head
2022-01-19 14:53:35 -06:00
reese
49972939ec
Merge pull request #1876 from molecula/fb1166
fix bug where drop table wasn't being authorized
2022-01-19 14:26:04 -06:00
reesporte
61ef1aee4e fix older tests 2022-01-19 12:55:07 -06:00
reesporte
e7552a76a7 fix bug where drop table wasn't being authorized
also fixes bug in GetAuthorizedIndexList where perms weren't being properly compared
2022-01-19 12:08:05 -06:00
pokeeffe-molecula
27f1fcbf45
Merge branch 'master' into cicd-will-it-never-end 2022-01-19 11:59:34 -06:00
pokeeffe-molecula
c2c140aad4 print out the url of the binary we are trying to get 2022-01-19 11:26:40 -06:00
Samir Patel
e1d7389893
Update ctl/keygen.go
Co-authored-by: reese <45641995+reesporte@users.noreply.github.com>
2022-01-19 11:23:02 -05:00
pokeeffe-molecula
bc589ee4eb when it fails, it should fail 2022-01-19 10:13:11 -06:00
Samir Patel
950e62aae9 update keygen subcommand
this updates the subcommand to output a single secret key
instead of two reflecting changes made to AuthN/authZ
2022-01-19 10:11:19 -06:00
pokeeffe-molecula
b144c0e61c added ARG decl. 2022-01-19 10:10:30 -06:00
hphamMolecula
580a6109fb
Merge branch 'master' into ui-fixes 2022-01-19 10:04:35 -06:00
pokeeffe-molecula
ec76cb5b34 added .deb & .rpm package for arm64 2022-01-18 18:14:51 -06:00
pokeeffe-molecula
4ab3c32211 build docker for arm64 2022-01-18 18:08:59 -06:00
Hoang Pham
c969a8370e UI - added fix for Query Builder page showing up as blank when there are no tables associated with current user 2022-01-18 17:57:40 -06:00
reese
8834d211af
Merge pull request #1872 from molecula/build-lattice-improvements
actually be able to generate-statik
2022-01-18 15:43:30 -06:00
reesporte
fdf7b4107a actually be able to generate-statik
these were the changes i had to make to be able to build lattice on my machine
2022-01-18 12:14:54 -06:00
Samir Patel
695321e6c0 print attr 2022-01-17 20:47:27 -06:00
Matthew Jaffee
50f798cb18
Merge pull request #1870 from molecula/gitlab-ci-parity
add race and shardwidth22 tests to gitlab
2022-01-17 20:43:57 -06:00
Samir Patel
70b1ef906f switch on req type 2022-01-17 20:41:57 -06:00
Matthew Jaffee
8b5fdf40fc
Merge branch 'master' into gitlab-ci-parity 2022-01-17 16:35:50 -06:00
Matthew Jaffee
22a60a19f8
Merge pull request #1869 from molecula/qol-tweak
clean up files generated by tests
2022-01-17 16:35:24 -06:00
Matthew Jaffee
a16fee5f88 set shardWidth properly in client
the shardwidth22 tests were broken client side, but we didn't realize
this because we weren't running the client side tests since moving the
client code into the main FB repo until recently (woops), and more
recently, we'd stopped running the shardwidth22 tests in the move to
Gitlab, so when we re-enabled them we finally noticed that they were
broken in the client.

All this change does is takes the shardWidth value from the core
featurebase package instead of using a hardcoded value in the client package.
2022-01-17 10:57:01 -06:00
Matthew Jaffee
da03e3fad2 add race and shardwidth22 to Gitlab CI, cleanup
our coverage reporting was a bit wonky and had files coming from both
test and test-future... made everything come from future
2022-01-17 10:12:40 -06:00
Matthew Jaffee
e297a6775d have simulacradata tests clean up generated files 2022-01-17 09:39:28 -06:00
reese
80f9ddaa02
Merge pull request #1868 from molecula/security-logging
FB1109: authn/z audit logging
2022-01-15 12:43:32 -06:00
reesporte
04a51a7819 remove shadowed ok
thanks golangci-lint
2022-01-15 12:25:09 -06:00
reesporte
50f9b0d1b6 Merge branch 'master' into security-logging 2022-01-15 12:21:38 -06:00
reesporte
7644922406 adds logging to all network requests
addresses ticket FB-1109:
when auth is turned on, we log:
- source ip (if available)
- user-agent
- user id
- user name
- query string
- request endpoint

also adds some minor tweaks and comments  to chkAuthZ flow
2022-01-15 12:21:27 -06:00
Matthew Jaffee
231a395138
Merge pull request #1867 from molecula/external-lookup-gitlab
get external-lookup tests running in Gitlab CI
2022-01-15 08:13:10 -06:00
Matthew Jaffee
d5bd031451 better error reporting if delete fails 2022-01-14 21:09:16 -06:00
Matthew Jaffee
a08560d01e get external-lookup tests running in Gitlab CI
I was going to write a docker-compose thing for this to run postgres
alongside the Go tests, but then saw that Gilab has this handy-dandy
notion of a service, so used that.
2022-01-14 21:09:16 -06:00
reese
f9c7ff3629
Merge pull request #1866 from molecula/fb1130
[fb-1130]: filter http response and lockdown endpoints
2022-01-14 17:45:51 -06:00
reesporte
3fdf4e2d8b Merge branch 'master' into fb1130 2022-01-14 16:06:45 -06:00
reesporte
baf02748be filter http response and lockdown endpoints
- fixes required permissions on some http endpoints
- filters http endpoints:
    - /ui/usage
    - /schema
    - /schema/details
- filter GRPC show tables, fields
- allow admins to do anything
2022-01-14 16:05:54 -06:00
Matthew Jaffee
34c64fbaba
Merge pull request #1865 from molecula/wrapping-etcd-retry
add wrapping to differentiate etcd errors
2022-01-14 15:58:56 -06:00
Matthew Jaffee
555d185929 add wrapping to differentiate etcd errors
we had a CI job fail in an interesting way, but can't tell if the
etcd retrying stuff is working, so adding in this wrapping so we can
better differentiate the errors if we see it again.

Job is here: https://gitlab.com/molecula/featurebase/-/jobs/1977060827

Failure is:

```
=== RUN   TestClusterStuff
    cluster_test.go:36: creating index: against http://pilosa2:10101/index/testidx 404 Not Found: 'creating index: sending CreateIndex message: executing request: against http://pilosa3:10101/internal/cluster/message 500 Internal Server Error: 'processing message: getting index: testidx: etcdserver: request timed out
        ''
--- FAIL: TestClusterStuff (8.85s)
```
2022-01-14 14:01:37 -06:00
reesporte
06c34c9f3e Merge branch 'master' into ui-fixes 2022-01-14 13:56:47 -06:00
reese
605da1e074
Merge pull request #1861 from molecula/bearer-conversion-squashed
[fb-998] [fb-1131] [fb-1129] addresses multiple authn/z tickets
2022-01-14 13:52:24 -06:00
reesporte
68c6bffa2c clear localstorage on sign out 2022-01-14 13:02:01 -06:00
reesporte
89567b791b Merge branch 'master' into bearer-conversion-squashed 2022-01-14 12:34:22 -06:00
Matthew Jaffee
b2afe7ad3b
Merge pull request #1863 from molecula/moar-cicd-clustertests
add clustertests to gitlab CI
2022-01-14 12:32:40 -06:00
reesporte
9f37cf7b48 Merge branch 'master' into bearer-conversion-squashed 2022-01-14 12:32:06 -06:00
reesporte
cf2410fea6 addresses multiple authn/z tickets
* fb-998 - authn/z enabled in handlers (kitchen-sink ticket)
    - authorization is enabled through the use of a bearer token (using header "Authorization")
    - authorization may occur through the use of an "Authorization" header or "molecula-chip" cookie
    - ui is updated for changes to handler
* fb-1131 - protect grpc endpoints
    - GRPC endpoints now check authorization if auth is enabled
* fb-1129 - inter-node communication
    - the following endpoints use the secretKey for authentication:
        - /internal/cluster/message: POST
        - /internal/translate/data: GET, POST

* added test to api_test.go (TestAuth_MultiNode) testing various auth/permissions stuff on a multi-node cluster

not included:
    - fb-1130 - filter response of endpoints
    - fb-1109 - improved audit logging

@jaffee [are you not entertained](https://www.youtube.com/watch?v=mutgotxrcqg)

Co-authored-by: souhailanoor <90720110+souhailanoor@users.noreply.github.com>
Co-authored-by: tgruben <tgruben@gmail.com>
Co-authored-by: 54mir <48686912+54mir@users.noreply.github.com>
Co-authored-by: kcrodgers24 <49999391+kcrodgers24@users.noreply.github.com>
2022-01-14 12:31:32 -06:00
Matthew Jaffee
2f30bcda45 add clustertests to gitlab CI
had to install some dependencies and things on the runner which are
detailed in a comment.
2022-01-14 11:05:41 -06:00
pokeeffe-molecula
f6c458b093
Merge pull request #1862 from molecula/cicd-smoketest
Now with working integration testting
2022-01-13 15:27:17 -06:00
pokeeffe-molecula
0b9d108626
Merge branch 'master' into cicd-smoketest 2022-01-13 14:52:24 -06:00
pokeeffe-molecula
dcc295b25d fixed broken shell script 2022-01-13 14:24:44 -06:00
Matthew Jaffee
5048c8712f
Merge pull request #1859 from molecula/fieldView
[SUP-132] track field directly in view to prevent deadlocks
2022-01-13 13:50:33 -06:00
pokeeffe-molecula
ff16924a0a fixed path typo 2022-01-13 13:31:41 -06:00
Matthew Jaffee
dad244e0d3 skip sometimes-failing test of experimental code
this is killing us in CI for no good reason
2022-01-13 13:16:57 -06:00
Seebs
6fba8aba8b track field directly in view to prevent deadlocks
The central reason this exists:

**sync.RWMutex can block read locks even when no write lock is yet held.**

If a write lock is *requested*, this can block future read locks. In
particular, this means that recursive read locks are unsafe. But there's
additional problems.

The specific case that bit us involves not two, but *three* things
running at once.

Thing #1: executor doing AvailableShards. This RLocks the index, and
then each field, and then each view. To complete, it must be able to
obtain a read lock on each view in turn.

Thing #2: DeleteField. This Locks the index. Even if it is stuck
waiting for the lock (which it will be until AvailableShards completes),
it can prevent *additional* RLocks of the index.

Thing #3: CreateFragment. This Locks a view, then RLocks the index in
order to look up a field.

CreateFragment can't proceed until DeleteField completes. DeleteField
can't proceed until AvailableShards completes. And AvailableShards
can't proceed until CreateFragment completes.

Solution: Cache the *Field in the view, so we don't need a read lock
on the field or index to complete a CreateFragment.
2022-01-13 13:16:57 -06:00
pokeeffe-molecula
f4d28b840a stop gauntlet from running every build 2022-01-13 13:00:02 -06:00
pokeeffe-molecula
da3cabe642 Merge branch 'master' into cicd-smoketest 2022-01-13 12:57:42 -06:00
pokeeffe-molecula
04a2df3036 added basic integration tests 2022-01-13 12:57:26 -06:00
Matthew Jaffee
4a1e53421e
Merge pull request #1858 from molecula/retryEtcd
[SUP-130] handle ErrTimeout in etcd embed "retryClient"
2022-01-13 12:54:10 -06:00
Seebs
84adefe6a5 handle ErrTimeout in etcd embed "retryClient"
This tries to be more correct/careful about retries (checking against
the actual exported errors from etcdserver, not just the string
representations), and also supports retrying on timeouts, not just
on client changes. It can also retry more than once, mostly in case
we hit one of each of those.

For timeout errors, we mostly use the fact that it's a timeout to
give us a reasonable backoff, but then delay a fraction of a second
longer just to give it a moment to recover if the ErrTimeout is
masking something else that took longer.
2022-01-13 11:47:57 -06:00
Bruce Baranowski
c60bed21c3
Merge pull request #1840 from molecula/IO-47
added tags to sg terraform
2022-01-12 19:18:04 -05:00
bruce-b-molecula
ef5736c73e added tags to sg terraform 2022-01-12 18:59:28 -05:00
Ben Johnson
24c38cd6b9
Merge pull request #1848 from molecula/fb-828
[FB-828] Fix RBF WAL size check
2022-01-12 09:59:01 -07:00
Ben Johnson
a49a14652f Fix RBF WAL size check
This commit changes the max WAL size calculation to double the
number of bitmap pages in the WAL as they require an extra header
page. Previously, this was causing the WAL to be overrun and
references to those pages were outside the mmap range and caused a
panic.
2022-01-12 08:26:14 -07:00
pokeeffe-molecula
5f5caff30d
Merge pull request #1855 from molecula/cicd-smoketest
Really get gauntlet to run in master
2022-01-11 18:42:02 -06:00
pokeeffe-molecula
24a963ef52
Merge branch 'master' into cicd-smoketest 2022-01-11 18:27:22 -06:00
pokeeffe-molecula
d896953af4 stop gauntlet from running on push 2022-01-11 18:08:14 -06:00
pokeeffe-molecula
8919d9d5d3 change the way we call ssh 2022-01-11 15:51:18 -06:00
Matthew Jaffee
afc1cd62b7
Merge pull request #1853 from molecula/fb-1115-rip-rowcache
FB-1115 rip out rowcache
2022-01-11 14:10:05 -06:00
Matthew Jaffee
34393dee09 rip out rowcache
not strictly backward compatible... hopefully no one is actually using
the rowcache config option
2022-01-11 13:49:09 -06:00
pokeeffe-molecula
c647c0c079
Merge pull request #1851 from molecula/cicd-smoketest
Cicd smoketest
2022-01-11 12:56:07 -06:00
pokeeffe-molecula
7e8d217208 so much fail... 2022-01-11 12:21:38 -06:00
pokeeffe-molecula
5056a8ea4d Update .gitlab-ci.yml 2022-01-11 11:39:45 -06:00
pokeeffe-molecula
562d665014
Merge branch 'master' into cicd-smoketest 2022-01-11 11:37:23 -06:00
Matthew Jaffee
951368acea
Merge pull request #1852 from molecula/fb-1118-commented-prints
remove a bunch of commented print statements and unecessary prints
2022-01-11 11:08:48 -06:00
pokeeffe-molecula
130c2265ca
Merge branch 'master' into cicd-smoketest 2022-01-11 11:00:58 -06:00
Matthew Jaffee
df88b5a78c remove a bunch of commented print statements and unecessary prints 2022-01-11 10:42:44 -06:00
Matthew Jaffee
888e68f884
Merge pull request #1847 from molecula/1147-slow-int-import
FB-1147 FB-1149 add sorting for ints/mutex in batch importer
2022-01-11 10:41:45 -06:00
pokeeffe-molecula
994ba6f597 ignore in sonarcloud 2022-01-11 10:30:28 -06:00
Matthew Jaffee
48b4169cb5 refactor client batch tests to reduce duplication
also use a single cluster with each test creating a different index
rather than each test creating a whole new cluster.

runtime went from 38s to 30s in my informal tests
2022-01-11 10:17:43 -06:00
Matthew Jaffee
db87a3c4f7 fix vet shadow issue 2022-01-11 10:15:58 -06:00
Matthew Jaffee
7fbd371038 get some of the client tests to actually *run*
discovered that client tests weren't running due to integration build
tag. Fixed the file I needed to get through SonarCloud and documented
rest of what needs to be done in FB-1152 https://molecula.atlassian.net/browse/FB-1152
2022-01-11 10:15:58 -06:00
Matthew Jaffee
131f891f75 fix up error messages in client batch test 2022-01-11 10:15:58 -06:00
Matthew Jaffee
6335b9c801 disable retryablehttp logger because *wow* that's a lot of output 2022-01-11 10:15:58 -06:00
Matthew Jaffee
16161025f2 trying to get sonar coverage reporting working
looks like test-report.out and coverage.out aren't about the same
tests. I'm unclear on how sonar uses tests.reportPaths vs
coverage.reportPaths, but figured I'd try at least generating them
from the same run to see if that helped.
2022-01-11 10:15:58 -06:00
Matthew Jaffee
55a385ed2d add sorting for ints/mutex in batch importer
fixes pathological case where imports with randomly ordered IDs which
spanned multiple shards and included ints or mutex fields could be
incredibly slow due to making 1000s of requests.
2022-01-11 10:15:58 -06:00
reese
ce8b5fa323
Merge pull request #1849 from molecula/fb-1148
distinct on timestamps can reduce now
2022-01-11 09:52:52 -06:00
pokeeffe-molecula
4bcdb817a5 Merge branch 'master' into cicd-smoketest 2022-01-11 08:49:03 -06:00
pokeeffe-molecula
394a6e9854 switching gauntlet to scheduled 2022-01-11 08:47:02 -06:00
pokeeffe-molecula
4b192ee8bf added progress reporting 2022-01-10 18:02:45 -06:00
pokeeffe-molecula
5ec9d7cf96 Now with more gauntlet 2022-01-10 16:11:03 -06:00
reesporte
1f370744c5 add multi-shard test for distinct(timestamp) 2022-01-10 15:41:30 -06:00
reesporte
cf483aca77 distinct on timestamps can reduce now 2022-01-10 13:07:57 -06:00
pokeeffe-molecula
e4e667215f try to run full gauntlet 2022-01-10 12:19:06 -06:00
pokeeffe-molecula
d35273c3b5 Update .gitlab-ci.yml 2022-01-10 11:59:32 -06:00
pokeeffe-molecula
d3b64941a5 fix yaml (again) 2022-01-10 10:42:48 -06:00
pokeeffe-molecula
63bf6dee2e fix yaml 2022-01-10 10:38:11 -06:00
pokeeffe-molecula
d4e9852b09 try to get gauntlet to run e2e on GitLab 2022-01-10 10:28:51 -06:00
pokeeffe-molecula
320ae1a8b2 make test failures clearer 2022-01-10 08:24:11 -06:00
pokeeffe-molecula
286953c5fc getting gauntlet working 2022-01-09 11:53:14 -06:00
pokeeffe-molecula
b82e05b012
Merge pull request #1843 from molecula/cicd-smoketest
make sure gauntlet does not run unless scheduled
2022-01-08 17:09:49 -06:00
pokeeffe-molecula
6dee0d1ec2 changes 2022-01-08 16:42:23 -06:00
pokeeffe-molecula
a5c36d5c21 remove un-needed files 2022-01-08 16:00:46 -06:00
pokeeffe-molecula
4743624210 refactored scripts for imperative setup and execution 2022-01-08 15:35:57 -06:00
pokeeffe-molecula
bb434639ad cleaning up terraform to put in pre-prepared VPC 2022-01-07 17:25:48 -06:00
pokeeffe-molecula
b864d6b6f1 un-broke some stuff 2022-01-07 13:40:35 -06:00
pokeeffe-molecula
eb60fb301f Merge branch 'master' into cicd-smoketest 2022-01-07 11:58:10 -06:00
pokeeffe-molecula
c0161b6bbc
Merge pull request #1846 from molecula/cicd-mitigations
disable gauntlet
2022-01-07 11:18:10 -06:00
pokeeffe-molecula
219322b675 fix ordering of rules 2022-01-07 10:43:52 -06:00
pokeeffe-molecula
5779b1c036 disable gauntlet 2022-01-07 10:12:20 -06:00
reese
2494aaf959
Merge pull request #1845 from molecula/staticcheck-file-perm-fix
fix file perms to be _actually_ 600
2022-01-07 10:06:47 -06:00
reesporte
bebc54b4e2 fix file perms to be _actually_ 600
based on staticcheck results:
server/server.go:627:58: file mode '600' evaluates to 01130; did you mean '0600'? (SA9002)
server/server.go:632:65: file mode '600' evaluates to 01130; did you mean '0600'? (SA9002)
2022-01-07 09:30:11 -06:00
Fletcher Haynes
3b2ee2a15c .gitlab/.gitlab-ci.yml 2022-01-07 07:17:00 -08:00
Fletcher Haynes
369c91daf9 Fixed a few more things 2022-01-07 07:04:01 -08:00
Fletcher Haynes
d328ead713 Resolved conflicts 2022-01-07 06:59:08 -08:00
Fletcher Haynes
70833218b1 Added in auto-peering of smoketest VPC 2022-01-07 06:58:02 -08:00
pokeeffe-molecula
574be963ec follow up changes to get vpn working - still no dice 2022-01-06 20:13:52 -06:00
Fletcher Haynes
56cf9f43f5 Added in connecting the gauntlet VPC to a VPC that can be reached via the VPN 2022-01-06 17:07:14 -08:00
pokeeffe-molecula
e550925fba changes 2022-01-06 19:00:00 -06:00
Kasey C. Rodgers
801d1e3e73
Merge pull request #1844 from molecula/fix-tls-check
correct TLS enabled check
2022-01-06 10:55:17 -08:00
Fletcher Haynes
1e2aa7c807 Changed smoke test to allow failure 2022-01-06 10:36:20 -08:00
kcrodgers24
5dfca76fbb correct TLS enabled check 2022-01-06 09:29:03 -08:00
Samir Patel
2469d7e61c
Merge pull request #1830 from molecula/protect-endpoints
[FB-1023] Protect endpoints
2022-01-06 11:52:40 -05:00
Samir Patel
41bde6ccba don't write content to no content 2022-01-06 10:35:11 -06:00
Samir Patel
6e9efd0e09 Merge branch 'protect-endpoints' of github.com:molecula/featurebase into protect-endpoints 2022-01-05 17:30:18 -06:00
Samir Patel
3fe381ff22 address feeback 2022-01-05 17:29:59 -06:00
reese
7881b0987f
Merge branch 'master' into protect-endpoints 2022-01-05 17:24:41 -06:00
pokeeffe-molecula
183d30073d
Merge branch 'master' into cicd-smoketest 2022-01-05 16:20:27 -06:00
pokeeffe-molecula
c5e91420cc make sure gauntlet does not run unless scheduled 2022-01-05 16:19:47 -06:00
pokeeffe-molecula
4268804a46
Merge pull request #1842 from molecula/cicd-smoketest
Cicd smoketest
2022-01-05 15:55:42 -06:00
pokeeffe-molecula
1fccfabc8f changes based on feedback 2022-01-05 15:35:38 -06:00
pokeeffe-molecula
6959c424e3 getting smoke test report to show 2022-01-05 14:39:45 -06:00
pokeeffe-molecula
a2ee26b57c running all of gauntlet in schedule 2022-01-05 12:25:41 -06:00
reesporte
fd896de270 rename CookieValue to AuthContext
because we're not using cookies anymore
2022-01-05 12:10:33 -06:00
pokeeffe-molecula
03fc5d470d I give up...we're sleeping 2022-01-04 22:11:38 -06:00
pokeeffe-molecula
6c8e309e70 added connection timeout 2022-01-04 21:30:06 -06:00
pokeeffe-molecula
f5b669508b getting node deployed; first test 2022-01-04 20:55:23 -06:00
pokeeffe-molecula
2f68b2a6f6 set data nodes to 1; refine cluster test 2022-01-04 19:57:37 -06:00
pokeeffe-molecula
97fc84ef17 fixed filenames for output 2022-01-04 19:31:18 -06:00
pokeeffe-molecula
f51834be82 declare the cluster_prefix variable 2022-01-04 18:37:18 -06:00
pokeeffe-molecula
2e0812ed98 variable fix 2022-01-04 18:09:16 -06:00
pokeeffe-molecula
ca5633c594 add uniqueness to cluster prefix 2022-01-04 16:36:11 -06:00
reesporte
e335886741 adding Groups Struct back in
"It was pure hubris that brought us to this point."
2022-01-04 16:23:25 -06:00
reesporte
8d6490329b Merge branch 'master' into protect-endpoints 2022-01-04 16:18:18 -06:00
Samir Patel
23a1b4c536 revisions and docs 2022-01-04 16:02:25 -06:00
pokeeffe-molecula
cfacc72c53 smoking or non-smoking? 2022-01-04 15:00:39 -06:00
pokeeffe-molecula
094f70a91a
Merge pull request #1839 from molecula/pipeline-scheduling
Pipeline scheduling
2022-01-04 14:15:29 -06:00
pokeeffe-molecula
13b6f6f133 re-enabling actual test 2022-01-04 13:02:45 -06:00
pokeeffe-molecula
a2be201009 fixed yaml fubar 2022-01-04 12:37:05 -06:00
pokeeffe-molecula
c06d21a189 rules it is.. 2022-01-04 12:33:45 -06:00
pokeeffe-molecula
624975e123 getting scheduling to work 2022-01-04 11:29:00 -06:00
Samir Patel
8690160dd4
Merge pull request #1812 from molecula/54mir/authentication
[FB-1014] Authentication
2022-01-04 09:43:56 -05:00
Samir Patel
ab4e4ac216
Merge branch 'master' into 54mir/authentication 2022-01-04 09:28:58 -05:00
pokeeffe-molecula
c5a75fcd66
Merge pull request #1838 from molecula/get-pipeline-to-run
just run it all the time for now
2022-01-03 23:20:22 -06:00
pokeeffe-molecula
cc9c2761be
Merge branch 'master' into get-pipeline-to-run 2022-01-03 23:19:34 -06:00
pokeeffe-molecula
b4da2be804 just run it all the time for now 2022-01-03 23:19:07 -06:00
Samir Patel
414dff1d22 revisions 2022-01-03 22:56:21 -06:00
pokeeffe-molecula
3e31035e29
Merge pull request #1837 from molecula/get-pipeline-to-run
disabling single node deploy
2022-01-03 22:46:09 -06:00
pokeeffe-molecula
65a2deb842
Merge branch 'master' into get-pipeline-to-run 2022-01-03 22:45:13 -06:00
pokeeffe-molecula
44d635f407 disabling single node deploy 2022-01-03 22:43:25 -06:00
Samir Patel
d537398568
Merge branch 'master' into 54mir/authentication 2022-01-03 23:33:45 -05:00
pokeeffe-molecula
5f8b78ba9a
Merge pull request #1836 from molecula/get-pipeline-to-run
fix gitlab pipeline; disable circleci; remove artifactory
2022-01-03 22:22:06 -06:00
pokeeffe-molecula
56584905c2 fix gitlab pipeline; disable circleci; remove artifactory 2022-01-03 22:11:30 -06:00
pokeeffe-molecula
61c0ef9a1e
Merge pull request #1835 from molecula/fix-failed-deploy-linux-node
Fix failed deploy linux node
2022-01-03 21:50:21 -06:00
Fletcher Haynes
b9e8d3a103 Commented out a failing test as a meta-test 2022-01-03 19:17:11 -08:00
Fletcher Haynes
70a3af97a8 Fixed some variables in the CI file 2022-01-03 19:05:39 -08:00
Samir Patel
a7fada30dd revisions 1 2022-01-03 20:43:51 -06:00
Fletcher Haynes
c0708e5403 Changed the env vars a CI job was accessing 2022-01-03 16:48:42 -08:00
tgruben
16600a219c
Merge branch 'master' into 54mir/authentication 2022-01-03 17:55:58 -06:00
Fletcher Haynes
58a70863eb
Merge pull request #1823 from molecula/fb901
Fb901
2022-01-03 15:51:24 -08:00
Samir Patel
1b10f26258 fix permission stuff for write queries 2022-01-03 17:41:09 -06:00
Samir Patel
7834db2347 change write call detection 2022-01-03 16:24:14 -06:00
Fletcher Haynes
a40d974377
Merge branch 'master' into fb901 2022-01-03 14:20:08 -08:00
pokeeffe-molecula
51ad67e06a
Update qa/tf/gauntlet/samsung/README.md
Co-authored-by: reese <45641995+reesporte@users.noreply.github.com>
2022-01-03 16:09:26 -06:00
pokeeffe-molecula
804b7b3146
Update qa/tf/README.md
Co-authored-by: reese <45641995+reesporte@users.noreply.github.com>
2022-01-03 16:06:54 -06:00
Ben Johnson
379c5e0bd1
Merge pull request #1832 from molecula/rbf-no-panic
Avoid panics in RBF debug tooling
2022-01-03 13:43:10 -07:00
Fletcher Haynes
e89c04acaf
Merge branch 'master' into fb901 2022-01-03 12:25:26 -08:00
Fletcher Haynes
4016a1d03d Fixed commenting in the gitlab CI file. 2022-01-03 12:21:32 -08:00
garrison.davis@molecula.com
fa9ae13363 Adds gauntlet testing framework for Samsung
This adds the Terraform needed to create a gauntlet testing framework for a cluster that is a mirror of Samsung's. It is meant to be run once a day in CI via the GitLab scheduler.
2022-01-03 12:15:07 -08:00
Ben Johnson
af9795aa1a Avoid panics in RBF debug tooling 2022-01-03 13:13:02 -07:00
tgruben
d5dcdcd40a
Merge branch 'master' into 54mir/authentication 2022-01-03 12:45:15 -06:00
reese
080ea6ad2e
Merge pull request #1806 from molecula/percentile-timestamp-decimal
FB-1095 implement percentiles on timestamp/decimal
2022-01-03 12:26:05 -06:00
tgruben
fb5765676b
Merge branch 'master' into 54mir/authentication 2022-01-03 12:15:10 -06:00
Samir Patel
d18b739402 add test cases 2022-01-03 11:49:38 -06:00
reesporte
b13538e426 update doc comment 2022-01-03 11:16:14 -06:00
reesporte
72adb177ae Merge branch 'master' into percentile-timestamp-decimal 2022-01-03 11:12:23 -06:00
reesporte
6e3ce01ecb explicitly test that getScaledInt works with timestamps 2022-01-03 11:11:54 -06:00
reesporte
fa2391b948 explicitly test untested path of valcountize 2022-01-03 11:11:27 -06:00
reesporte
99f6a1c113 change min to val
bc it could be used for things besides mins
2022-01-03 10:45:23 -06:00
Fletcher Haynes
93b97b9831 Test push to see if pipeline is running on push to master 2021-12-30 17:00:59 -08:00
reesporte
9b77432952 fix bad formatting 2021-12-29 14:22:29 -06:00
Samir Patel
c0fe253ce2 Merge branch 'protect-endpoints' of github.com:molecula/featurebase into protect-endpoints 2021-12-29 14:41:49 -05:00
Samir Patel
cf86be16c1 add authN only middleware for /internal 2021-12-29 14:41:31 -05:00
reesporte
8e697c0d8c Merge branch 'protect-endpoints' of github.com:molecula/featurebase into protect-endpoints 2021-12-29 13:38:55 -06:00
reesporte
17679eb924 create a Permissions type
makes it nice to say p.Satisfies(otherPerm)
2021-12-29 13:38:11 -06:00
Samir Patel
7750900310 more logging 2021-12-29 13:18:42 -05:00
reesporte
be66103c45 requirements when auth is enabled
postgres binding is turned off
TLS must be turned on
2021-12-29 11:20:19 -06:00
reesporte
2847c22a4c linter things 2021-12-29 11:06:58 -06:00
reesporte
42f3557c55 fix merge conflicts 2021-12-29 09:05:53 -06:00
Samir Patel
d95d4dac9d pass group membership thru context 2021-12-28 17:36:52 -05:00
Travis Turner
56b9e2aba7
Merge pull request #1831 from molecula/tlt/ignore-down
Stop blocking API called when cluster is DOWN or DEGRADED
2021-12-28 14:14:29 -06:00
Travis
ffd91137e1
Stop blocking API called when cluster is DOWN or DEGRADED
This commit effectively removes the API-level validation that was
blocking certain API methods when the cluster was in a particular state
(namely DOWN and DEGRADED). The thinking is that we shouldn't be
blocking these requests at the API level, but rather should let them
pass through and allow the fact that a node is ACTUALLY down dictate the
behavior.

With this change, two tests were modified. They were previously
expecting the error message from the API validation on DOWN, but now
they check for a "shard unavailable" error, which is what gets returned
for a particular query when the cluster is in an unhealthy state.
2021-12-28 13:52:04 -06:00
Matthew Jaffee
6fd985c8eb
Merge pull request #1828 from molecula/errant-print
fix retry period and change client DialTimeout for commands (e.g. restore/backup)
2021-12-28 13:51:28 -06:00
Matthew Jaffee
1a8c10d5f3 fix backup fail test so it actually fails
A few things were going wrong here.

First, we take a "RetryPeriod" option on backup and restore which is
meant to be roughly the total amount of time we spend retrying any
given request before failing. However we were incorrectly passing that
as the RetryMaxWait which is the maximum amount of time to sleep
between any two attempts. We now do some fuzzy math to figure out
approximately how many attempts we should make given a minimum sleep
of 100ms and the fact that we double the sleep time every attempt.

Second, during the backup test, if a host was totally stopped when we
started the request, it would fail immediately and then retry, but if
the host was stopped during the request (after DNS had resolved), then
the request would wait for the DialTimeout which we default to 30s, so
turning off the cluster for 5 seconds and turning it back on resulted
in the backup completing rather than failing. Because of this, we
change the commandClient to have a default dial timeout of 1 second.

I was tempted to change the global default to 1s which I think would
be fine, but didn't want to break anything too badly.
2021-12-28 13:31:42 -06:00
Matthew Jaffee
fe54cbf8ae remove other print and tweak backup test timings 2021-12-28 13:31:42 -06:00
Matthew Jaffee
bb39b05d05 remove leftover fmt.Println 2021-12-28 13:31:42 -06:00
Hoang Pham
936fb9e6bd UI - rename a unit test 2021-12-28 13:04:56 -06:00
Ben Johnson
f8e13f9629
Merge pull request #1829 from molecula/metrics
Add job & worker metrics
2021-12-28 11:31:13 -07:00
Ben Johnson
310584b0d8 Add job & worker metrics 2021-12-28 10:01:18 -07:00
Hoang Pham
0ad2bffd33 UI - added test files 2021-12-28 10:56:31 -06:00
Samir Patel
e5fa99a531 apply mw to handlers 2021-12-28 10:08:44 -05:00
Samir Patel
6d590581d4 apply mw to handlers 2021-12-28 10:06:40 -05:00
Samir Patel
7544e7d1cb extend mw 2021-12-28 09:24:46 -05:00
Samir Patel
b9961870c1 implement as mw 2021-12-27 18:22:53 -05:00
Samir Patel
7a6595d628 authorize few endpoints e.g. query 2021-12-27 16:43:47 -05:00
Samir Patel
0ef67fd699 move query logger option to auth 2021-12-27 16:42:13 -05:00
Travis Turner
145f65ab0e
Merge pull request #1827 from molecula/tlt/etcd-data-dir
[FB-1125] Expose `etcd.dir` configuration option
2021-12-27 11:42:59 -06:00
Travis
6638fa17ee
Expose etcd.dir configuration option
The goal is to allow a user to separate FeatureBase and etcd I/O.
2021-12-27 11:13:38 -06:00
Ben Johnson
4a5179f87f
Merge pull request #1824 from molecula/rbf-expvar 2021-12-27 10:02:37 -07:00
Ben Johnson
9367a62609 Add /debug/rbf endpoint for debugging 2021-12-27 09:34:43 -07:00
Samir Patel
49e9faa03b stub out checker 2021-12-22 16:49:43 -06:00
Samir Patel
684c408b93 Merge branch '54mir/protect-endpoints' into queryLoggerSetup 2021-12-22 15:12:31 -06:00
Samir Patel
9bf56188f7 Merge branch '54mir/authentication' of github.com:molecula/featurebase into 54mir/authentication 2021-12-22 14:08:21 -06:00
Samir Patel
8b40c6bf7b rm comments 2021-12-22 13:47:16 -06:00
Samir Patel
448289d609 add subcommand for key generation 2021-12-22 13:04:00 -06:00
Matthew Jaffee
f1b525fc74
Merge pull request #1807 from molecula/backup-http-retry
add exponential retry logic to internal http client, use in backup and restore
2021-12-22 13:00:24 -06:00
Matthew Jaffee
295fab4892 retry on >= 400, not just greater. good catch 2021-12-22 12:21:11 -06:00
Samir Patel
23a884b3a2 Merge branch '54mir/authentication' of github.com:molecula/featurebase into 54mir/authentication 2021-12-22 12:05:41 -06:00
Samir Patel
b8b4425d4f clean up 2021-12-22 12:05:24 -06:00
Hoang Pham
39ebbbd88e UI - formatted tsx files with prettier (single quote) 2021-12-22 11:40:01 -06:00
Samir Patel
9612096682 Merge branch '54mir/authentication' of github.com:molecula/featurebase into 54mir/authentication 2021-12-22 11:31:56 -06:00
Samir Patel
52d941d127 more tests 2021-12-22 11:31:37 -06:00
Matthew Jaffee
ea59f14d50 must use retryablehttp.NewClient to get defaults
otherwise it won't actually retry :(
2021-12-22 11:21:11 -06:00
Matthew Jaffee
640ba45129 use retryableHTTP in client, fix memory usage of restore
instead of awkwardly reading an entire file into a buffer, we use
retryablehttp's reader func to open the file fresh if we need to
retry, so a small fixed-size buffer can be used internally for copying
the contents onto the network.
2021-12-22 10:56:16 -06:00
Seebs
63d8686e22 scratch space -- need to finish updating deployPerf though 2021-12-21 16:20:25 -07:00
Seebs
b4304765e8 partial draft of perf/regression test script 2021-12-21 16:20:25 -07:00
Hoang Pham
c67ae54b1d UI - fixed Sign In button 2021-12-21 16:44:27 -06:00
Matthew Jaffee
cde3f6b5ea add profiling to backup/restore 2021-12-21 16:24:21 -06:00
Matthew Jaffee
2bce396445 add retry restore test and custom retry policy 2021-12-21 16:24:21 -06:00
Matthew Jaffee
d3b9193c8d try to fix data race with http lib
WARNING: DATA RACE
Write at 0x00c008121e80 by goroutine 235:
  bytes.(*Reader).WriteTo()
      /usr/local/go/src/bytes/reader.go:139 +0x45
  github.com/molecula/featurebase/v2/http.nopCloser.WriteTo()
      <autogenerated>:1 +0x5d
  io.copyBuffer()
      /usr/local/go/src/io/io.go:391 +0x482
  io.Copy()
      /usr/local/go/src/io/io.go:368 +0x78
  net/http.(*transferWriter).doBodyCopy()
      /usr/local/go/src/net/http/transfer.go:400 +0x2f
  net/http.(*transferWriter).writeBody()
      /usr/local/go/src/net/http/transfer.go:364 +0xc9a
  net/http.(*Request).write()
      /usr/local/go/src/net/http/request.go:682 +0x887
  net/http.(*persistConn).writeLoop()
      /usr/local/go/src/net/http/transport.go:2343 +0x349

Previous write at 0x00c008121e80 by goroutine 192:
  bytes.(*Reader).Seek()
      /usr/local/go/src/bytes/reader.go:118 +0x824
  github.com/molecula/featurebase/v2/http.(*InternalClient).doWithRetry()
      /go/src/github.com/molecula/featurebase/http/client.go:1773 +0x86d
  github.com/molecula/featurebase/v2/http.(*InternalClient).executeRequest()
      /go/src/github.com/molecula/featurebase/http/client.go:1806 +0x15b
  github.com/molecula/featurebase/v2/http.(*InternalClient).CreateIndex()
      /go/src/github.com/molecula/featurebase/http/client.go:433 +0xbf8
  github.com/molecula/featurebase/v2/server_test.TestMain_Set_Quick.func1()
      /go/src/github.com/molecula/featurebase/server/server_test.go:64 +0x624
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1123 +0x202

Goroutine 235 (running) created at:
  net/http.(*Transport).dialConn()
      /usr/local/go/src/net/http/transport.go:1709 +0xc30
  net/http.(*Transport).dialConnFor()
      /usr/local/go/src/net/http/transport.go:1421 +0x151

Goroutine 192 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1168 +0x5bb
  github.com/molecula/featurebase/v2/server_test.TestMain_Set_Quick()
      /go/src/github.com/molecula/featurebase/server/server_test.go:45 +0x116
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1123 +0x202
2021-12-21 16:24:21 -06:00
Matthew Jaffee
f676fbfc51 add retryability to restore command 2021-12-21 16:24:20 -06:00
Matthew Jaffee
3105a24542 rewind Body on retry
this is really not ideal, and there are libraries for this kind of
thing, but I'd have to figure out how to make the libraries work with
everywhere we're already creating stdlib http clients.
2021-12-21 16:24:20 -06:00
Matthew Jaffee
cdf4bc4c88 add clustertests testing backup's retry 2021-12-21 16:24:20 -06:00
Matthew Jaffee
8486efaa79 add exponential retry logic to internal http client, use in backup 2021-12-21 16:24:20 -06:00
Hoang Pham
2bf1f0e4d4 Merge branch '54mir/authentication' of ssh://github.com/molecula/featurebase into 54mir/authentication 2021-12-21 16:06:11 -06:00
Hoang Pham
7de6c37b11 UI - cleaned up code, added comments 2021-12-21 16:06:02 -06:00
rachithrr
5650a24c9b query logger is set up. 2021-12-21 16:52:22 -05:00
Garrison Davis
d9dc613dd5
Merge pull request #1820 from molecula/pipeline-changes
Run integration on merge to default branch
2021-12-21 14:50:29 -07:00
Samir Patel
fd7d905be2 fix formatting issues 2021-12-21 15:49:51 -06:00
garrison.davis@molecula.com
15612b8b92 Run integration on merge to default branch
Additionally, the go version is using the GOVERSION build
variable instead.
2021-12-21 13:58:10 -07:00
Samir Patel
f011587d4e add tests 2021-12-21 10:08:49 -06:00
Samir Patel
1c907281bf authz changes 2021-12-20 18:03:18 -06:00
Samir Patel
10a7aa55ea same-site strict 2021-12-20 18:00:13 -06:00
Samir Patel
d9710cb7d7 remove auth struct from authorization 2021-12-20 16:45:17 -06:00
Samir Patel
3b374a62bf Merge branch 'master' into 54mir/authentication 2021-12-20 16:42:11 -06:00
Hoang Pham
a24a1e8922 UI - added fixes for PR comments 2021-12-20 15:55:52 -06:00
Samir Patel
602145b390 add to tests 2021-12-20 15:41:18 -06:00
Matthew Jaffee
18d2ef3d53
Merge pull request #1818 from molecula/fb1107
[FB-1107] slightly better lock protection around bitDepth in view
2021-12-20 15:31:13 -06:00
Seebs
ddb5020aa6 slightly better lock protection around bitDepth in view
There's a number of deeper issues here (the fragment is conjuring
up a Tx, for instance) but this helps.

Also use field.view() to get the view rather than accessing viewMap
directly without a lock. Also change field.cacheBitDepth to ratchet
upwards -- if we have multiple shards and some shards have lower
depths than others, we should use the highest as the cached value,
not the most recent.
2021-12-20 15:09:27 -06:00
Ben Johnson
3c082b7d2c
Merge pull request #1819 from molecula/rbf-check-empty-branch
[FB-1105] Add rbf check for empty branch pages
2021-12-20 14:01:10 -07:00
Ben Johnson
60f0008dec
Merge branch 'master' into rbf-check-empty-branch 2021-12-20 13:40:34 -07:00
Samir Patel
6faa889bfb move logout url to conf 2021-12-20 14:30:19 -06:00
Ben Johnson
6481b4eabe Add rbf check for empty branch pages 2021-12-20 13:24:34 -07:00
Matthew Jaffee
3de18a9f77
Merge pull request #1816 from molecula/fb-1105
[FB-1105] Fix RBF multi-level branch delete
2021-12-20 14:13:24 -06:00
Ben Johnson
5f8a281918 Fix RBF multi-level branch delete
This commit fixes a bug in RBF where deleting all the elements in
a bitmap that has a depth greater than 2 will cause the root bitmap
to be a branch page with a cell count of zero. This breaks an
assertion in `readBranchCell()` which causes a panic post-commit.

A new assertion has been added to prevent a branch page from being
written with a zero count in the future.
2021-12-20 12:52:14 -07:00
Samir Patel
405692e376 Update authn/authenticate_test.go
Co-authored-by: souhailanoor <90720110+souhailanoor@users.noreply.github.com>
2021-12-20 13:16:34 -06:00
souhailanoor
7d0e0600d6
Merge pull request #1805 from molecula/fb1000
FB-1000: Ability to map user groups to cluster admin / index-level permissions
2021-12-20 13:07:13 -06:00
souhailanoor
55c67a9d1f
Merge branch 'master' into fb1000 2021-12-20 12:35:17 -06:00
seebs
88569789dd
Merge pull request #1817 from molecula/pages
rbf pages subcommand: don't panic on invalid page type
2021-12-20 12:30:57 -06:00
Hoang Pham
fa96d39cd0 Merge branch '54mir/authentication' of ssh://github.com/molecula/featurebase into 54mir/authentication 2021-12-20 12:30:27 -06:00
Hoang Pham
c91e7dc8de UI - renamed authOn to isAuthOn 2021-12-20 12:28:38 -06:00
Samir Patel
89f360c1ce Merge branch '54mir/authentication' of github.com:molecula/featurebase into 54mir/authentication 2021-12-20 12:28:26 -06:00
Samir Patel
e7f4eb1e36 response codes 2021-12-20 12:28:17 -06:00
Hoang Pham
7dc9df425d UI - removed unnecessary code 2021-12-20 12:23:55 -06:00
Hoang Pham
9086587e06 Changed how the UI processes /auth to turn on/off authentication 2021-12-20 12:19:56 -06:00
Seebs
977a699a98 don't panic on invalid page type
debugging tools shouldn't panic when they encounter bugs. insert
"you had one job" meme.
2021-12-20 10:58:41 -06:00
Hoang Pham
d7ba3c8334 UI - changed createTheme back to createMuiTheme 2021-12-20 09:57:07 -06:00
Samir Patel
daeebf98eb more test cleanup 2021-12-20 09:43:30 -06:00
Samir Patel
67d438aab5 clean up 2021-12-20 01:29:11 -06:00
Samir Patel
605d47702e add handler tests 2021-12-20 00:15:48 -06:00
Samir Patel
4b4095f13e Merge branch '54mir/authentication' of github.com:molecula/featurebase into 54mir/authentication 2021-12-19 23:35:07 -06:00
Samir Patel
0d52a952e0 resolve some comments 2021-12-19 23:33:44 -06:00
souhailanoor
e82088e086
Merge branch 'master' into fb1000 2021-12-19 11:38:08 -06:00
Souhaila Noor
c14bd08213 updated admin to be at the cluster level 2021-12-19 11:37:41 -06:00
Ben Johnson
06204bcf7b
Merge pull request #1809 from molecula/fb992
[FB-992] Implement RBF Async Checkpoint
2021-12-18 13:08:42 -07:00
Matthew Jaffee
7826c06eee use atomics for currentWorker to avoid race 2021-12-18 09:04:04 -06:00
Seebs
8974014d57 too tired to be writing code 2021-12-17 22:48:40 -06:00
Seebs
1439c316d3 read-only lock for check of shutdown 2021-12-17 22:25:01 -06:00
Seebs
9a2a8f964c fix silly typo in worker pool downscaling 2021-12-17 22:22:27 -06:00
Seebs
8f217ab099 scale down worker pool when it's large
if we have more than twice our starting worker pool, and have had no
tasks when checking the queue for multiple rounds, send a job telling
the system to retire a worker. eventually we'll get down to about 2x
the starting pool size if we stay idle.
2021-12-17 22:05:41 -06:00
Seebs
9945575bf1 create a new worker every so often if progress isn't happening
this is very approximate and may be a mess and may be unbounded, but
in practice i think it should be okay. if it's not we'll have an
adventure.
2021-12-17 21:57:38 -06:00
Hoang Pham
89a628e91a Added Featurebase UI code for authentication 2021-12-17 18:20:20 -06:00
Seebs
41f6156bda don't use write Tx even when we're using the expensive logic for write Tx 2021-12-17 17:57:33 -06:00
Souhaila Noor
a606bd030a addressed reviewer's feedback 2021-12-17 16:46:07 -06:00
Souhaila Noor
f05f1d0de2 added more authz functionality 2021-12-17 15:51:37 -06:00
Matthew Jaffee
0799862266 move some locks, nbd 2021-12-17 15:09:25 -06:00
Matthew Jaffee
1fd872b126 less write locks in fragment.importRoaring/row 2021-12-17 15:09:25 -06:00
Ben Johnson
57ca5591a2 Unlock rbf.DB during WAL copy & fsync() 2021-12-17 15:09:25 -06:00
Seebs
47e098c3b1 simplify txWaiter
We don't need a condition variable for a thing with a single waiter
which waits only once, and a data structure which only one side ever
modifies. That's a closable channel.
2021-12-17 15:09:25 -06:00
Seebs
994cc03e88 fix locking and list management for afterCurrentTx
Two issues: First, there was a race condition because we were never
using the mutex for anything but the condvar broadcast, second, there
was no reason for the afterCurrentTx to need to maintain the list since
we already know where in the list we are when we are waking it up.

afterCurrentTx still wants to run with the db lock held, because
the degenerate case (no outstanding Tx) means that it will be running
with it held already. That's for another commit.
2021-12-17 15:09:25 -06:00
Seebs
5764d98f6d test fixes and order of operations on changing db.PageMap
We need to update db.PageMap after we write the db, but before
we truncate the WAL, so new transactions don't pick up the old
PageMap and then get a truncated WAL.

Also, checkpoint should not abort if there's txs -- that's okay now.
2021-12-17 15:09:25 -06:00
Seebs
29f5f6d7c2 copy things rows after getting them and before their finishers during writes
When a qcx is a write, every Tx under it closes immediately, thus
invalidating all returned data. Thus, if you do a Not() inside a Store(),
you're doing a difference on an existence row and some other row
call... and both of those rows were run, individually, as separate
transactions that got invalidated the moment they were fetched. Oops.
2021-12-17 15:09:25 -06:00
Ben Johnson
4279e2cb2d rebase fixes 2021-12-17 15:09:25 -06:00
Seebs
c3c02eabb0 almost but not quite support async checkpoint
This gets us to being able to run reads during a checkpoint, but
now we have to wait for new reads to end before we can release
the write lock, etc.

This is actually slightly slower, but if we could get ONE more step,
we could allow new writes during that phase, to a different WAL,
if we had a different WAL to write to.
2021-12-17 15:09:25 -06:00
Seebs
6d68e71933 make the checkpoint async 2021-12-17 15:09:25 -06:00
Seebs
806669fa0f make db able to fail out if it can't checkpoint, fix silly wrong-units error
PageMap uses "WALID", which is a WAL page ID relative to the "base" ID of the
WAL, rather than the wal page count you'd get just reading the file. So everything
it reports has a fixed offset at any given time. I think this may be left
over from a point where there were partial checkpoints. Anyway, the net
outcome is that each new transaction was getting different page IDs, but
the actual WAL pages did not always reflect that. Each checkpoint increases
the offset. This might imply that we can start having problems after
4 billion pages written even if most of them were redundant?

Anyway, with that fixed, this seems to work. I think.
2021-12-17 15:09:25 -06:00
Seebs
b8f59d922c checkpoint rework/refactoring: logger, async-ish checkpoint
Trying to make the checkpoint be asynchronous-at-all, and
also allowing it to log.
2021-12-17 15:09:25 -06:00
Seebs
a631e25dc5 refactor: removeTx responsible for getting/releasing its own lock
We change nothing substantive here, except that there's a window
between when a write transaction updates the root pages and when
it removes itself from the db tx list and possibly causes a checkpoint
where it's not holding the db lock.

The issue here is that we want to be able to *keep* the lock but
still return, so no one else can start transactions, but the specific
Rollback or Commit that removed the last outstanding transaction
doesn't block forever. This will, later, allow us to exercise
finer-grained control over when we allow transactions. This is
a separate commit so we can run the test suite against it, and
verify that this part in particular didn't break anything.
2021-12-17 15:09:25 -06:00
Seebs
5c889c72bd make test hit the lock harder
Discovered test was running slightly strange and spending an unreasonable
amount of time on rand.Intn(), possibly because we weren't caching the
value used as the loop condition. Tweaked that, also made the pool a
bit different. Now it takes ~50 seconds for benchtime 100x, and produces
a profile with a TON of time spent waiting on sleeps (expected) and
the condition variable for waiting on checkpoints (the thing we want
to measure, really).
2021-12-17 15:09:25 -06:00
Seebs
3ed4487ae2 scratch space for FB-992: create benchmark for checkpointing
Note also the commented-out debug printf in checkpoint, there as a
reference. This is interesting because it turns out that MOST of checkpoint
writes is not actually writing new pages in most cases.

The actual "pages in WAL : pages in map" ratio is typically around 30:1
apparently. This would likely be different in cases where we were
updating existing data, though.

This is scratch space to prep for an actual work. The final
results will likely be different.
2021-12-17 15:09:25 -06:00
Travis
ca58a0d0f1
Clean up some of the go-doc entries in tx.go
I was just reviewing the Tx interface, and while reading the go-docs
found some errors, undocumented methods, and other fun things.
2021-12-17 13:47:43 -06:00
souhailanoor
44b855d50b
Merge branch 'master' into fb1000 2021-12-17 11:46:25 -06:00
Souhaila Noor
2ca29e6018 addressed reviewer's comments and added more tests 2021-12-17 11:45:35 -06:00
Samir Patel
7ce07d4e4a settings 2021-12-17 11:42:02 -06:00
Samir Patel
3b58e887ed add group lenth check 2021-12-17 11:34:48 -06:00
Samir Patel
c2d51a2257 remove settings 2021-12-17 10:00:21 -06:00
Samir Patel
1555746ff1 test 2021-12-16 23:53:30 -06:00
Samir Patel
db2263465b tests 2021-12-16 23:39:58 -06:00
Samir Patel
e5866f5f9c comment out string checking in test 2021-12-16 22:08:16 -06:00
Samir Patel
a793ebc3c4 update config internal test 2021-12-16 21:56:54 -06:00
Samir Patel
4565cb714b update config internal test 2021-12-16 21:02:58 -06:00
Samir Patel
eb693beb0b add authN login test 2021-12-16 20:35:34 -06:00
Samir Patel
b082a318f3 move authN to its own package 2021-12-16 20:34:09 -06:00
Samir Patel
b37f13e5c5 rename 2021-12-16 20:33:23 -06:00
reese
65ab92f364
Merge pull request #1811 from molecula/fb-1027
[fb-1027] ensure field bit depth is set when restoring shard
2021-12-16 08:54:34 -06:00
reesporte
c59ce837b3 ensure field bit depth is set when restoring shard
we have to manually set the cache value here bc it wont get set until the node is restarted otherwise
2021-12-15 16:09:45 -06:00
Samir Patel
52625c70ab check auth enabled before handling auth requests 2021-12-15 15:42:56 -06:00
Samir Patel
0cb27bfdd3 Merge branch '54mir/authentication' of github.com:molecula/featurebase into 54mir/authentication 2021-12-15 14:54:41 -06:00
Samir Patel
10dbbb49c8 rename 2021-12-15 14:54:01 -06:00
Samir Patel
f0e287e40b handle logout and userinfo 2021-12-15 14:53:30 -06:00
Samir Patel
a1de086cd8 change scopes from string to slicee 2021-12-15 14:53:04 -06:00
Samir Patel
1bd935bb59 separate out authentication from auth 2021-12-15 14:52:16 -06:00
Samir Patel
213572bb78 add logout and userinfo endpoints 2021-12-15 14:51:45 -06:00
Souhaila Noor
484cbbcd09 fixed func name 2021-12-15 14:19:21 -06:00
souhailanoor
0c65485b0e
Merge branch 'master' into fb1000 2021-12-15 13:37:15 -06:00
Souhaila Noor
48913caafd renamed package to authz, inmplemented reviewer's feedback 2021-12-15 13:36:27 -06:00
Samir Patel
7d81c6e1c1 add defaults to conf 2021-12-15 12:39:14 -06:00
Matthew Jaffee
600494c724
Merge pull request #1810 from molecula/sup-126
[SUP-126] Defer unlock & rollback during rbf.DB.Begin()
2021-12-15 08:39:24 -06:00
Ben Johnson
7141662c03 Defer unlock & rollback during rbf.DB.Begin() 2021-12-15 07:16:30 -07:00
Samir Patel
a261aa9972 refactor auth.go 2021-12-13 23:13:19 -06:00
Samir Patel
4eee8a4245 change the way auth is instantiated, and send to handler 2021-12-13 23:12:04 -06:00
Samir Patel
541132a176 hash and block key cmd options 2021-12-13 23:10:29 -06:00
Samir Patel
bd81427dd5 load auth object into handler 2021-12-13 23:10:04 -06:00
Samir Patel
ee9416d53a move auth struct to config 2021-12-13 23:09:14 -06:00
Samir Patel
5e6aec6f60 add hash and block keys to conf file 2021-12-13 23:08:41 -06:00
souhailanoor
a8b198af99
Merge branch 'master' into fb1000 2021-12-13 14:15:09 -06:00
Hoang Pham
583a0293ce added Login page for testing with BE endpoint 2021-12-13 14:04:41 -06:00
tgruben
a52eda0510
Merge pull request #1808 from molecula/sup120
[SUP-120] use higher level iterator in order to account for ops log
2021-12-13 13:51:29 -06:00
Todd Gruben
c25ab78b03 use higherlevel iterator in order to account for ops log 2021-12-13 13:10:16 -06:00
Souhaila Noor
3c8a7384ba added reviewer's suggestions 2021-12-13 13:05:35 -06:00
Souhaila Noor
32228bb134 updated go.mod 2021-12-13 10:48:40 -06:00
Souhaila Noor
9e2cf81127 added unit tests 2021-12-13 10:35:56 -06:00
Samir Patel
3b257fe3cb remove settings 2021-12-11 14:10:34 -06:00
Samir Patel
b5c87e0f18 add auth endpoints 2021-12-11 00:11:30 -06:00
Samir Patel
29832a3140 add authorization 2021-12-10 16:45:20 -06:00
Matthew Jaffee
7935624549 implement percentiles on timestamp/decimal, still needs tests 2021-12-10 15:21:29 -06:00
souhailanoor
e5052a864b
Merge branch 'master' into fb1000 2021-12-10 14:09:39 -06:00
Souhaila Noor
01e4baab04 determine permission for user access to index 2021-12-10 14:07:24 -06:00
Matthew Jaffee
9283d52141
Merge pull request #1798 from molecula/fix-backup-key-translation
FB-1080 Fix backup key translation
2021-12-10 13:59:43 -06:00
Matthew Jaffee
e8972e437e smaller clusters to take less memory... test-race getting oom killed 2021-12-10 11:52:39 -06:00
Matthew Jaffee
081184f436 another data race? fuck 2021-12-10 11:52:39 -06:00
Matthew Jaffee
f2a6ee738c remove old shell-based backup/restore tests 2021-12-10 11:52:39 -06:00
Matthew Jaffee
53373240ef make chksum process All() results correctly for unkeyed indexes 2021-12-10 11:52:39 -06:00
Matthew Jaffee
ea267202bd more complete backup/restore coverage in go tests
I think we can remove the shell version now
2021-12-10 11:52:39 -06:00
Matthew Jaffee
1980c8b8e5 featurebase backup: don't hide TranslateStoreNotFoundError
I think this shouldn't happen unless there's actually a problem
2021-12-10 11:52:39 -06:00
Matthew Jaffee
b0d29bb425 fix unrelated data race that randomly cropped up in CI 2021-12-10 11:52:39 -06:00
Matthew Jaffee
3d3080df8b full backup/restore test in a Go test 2021-12-10 11:52:39 -06:00
Matthew Jaffee
aff3d3ddd9 do a backup in a go test for coverage purposes
also found a weird issue with schema marshalling

if you create a field thru the api w/o specifying a field type, you
get slightly different behavior than going thru the HTTP handler which
is... not ideal. I changed the marshaler to accept an empty field type.
2021-12-10 11:52:39 -06:00
Matthew Jaffee
3761fc6d3c have Circle build release on branch instead of waiting for merge 2021-12-10 11:52:39 -06:00
Matthew Jaffee
7a8f0135b3 redirect GetTranslateData if node doesn't own partition 2021-12-10 11:52:39 -06:00
Matthew Jaffee
b8da3bc7e6 checksum All() instead of Count(All()) to cover index keys 2021-12-10 11:52:39 -06:00
reese
e45a26cc19
Merge pull request #1804 from molecula/copyright-notice-added-back-in
[no-000] add copyright notice back in
2021-12-10 11:21:03 -06:00
reesporte
48aef0c8a4 add copyright notice back in
```bash
for file in `cat diffys`; do
   printf '%s\n%s\n' "// Copyright 2021 Molecula Corp. All rights reserved." "$(cat $file)" >$file;
done
```
2021-12-10 11:01:04 -06:00
reese
eca56c52d4
Merge pull request #1803 from molecula/no-license
[no-000] removed license from each go file
2021-12-10 10:06:43 -06:00
reesporte
4c53f86e82 removed license from each go file
i used this script, a little clunky but it got the job done

```bash
for file in `find . -type f -print | grep '\.go'`; do
    sed '1,/^\/\/ limitations under the License.$/d' $file > $file.tmp;
    result=`cat $file.tmp`
    if [[ result != "" ]]; then
        gofmt $file.tmp &> /dev/null;
        if [[ $? == 0 ]]; then
            mv $file.tmp $file && gofmt -w $file;
        else
            rm $file.tmp;
        fi
    else
        rm $file.tmp;
    fi
done
```
2021-12-10 09:17:17 -06:00
reese
0f51a85002
Merge pull request #1802 from molecula/sup120-pt1
[FB-1092] translaste -> translate
2021-12-09 09:09:45 -06:00
reesporte
76c1d237ac translaste -> translate
also remove meaingless comments
2021-12-08 16:35:26 -06:00
Matthew Jaffee
6dbbb52438
Merge pull request #1801 from molecula/simplify-coverage
try to simplify test coverage w/ -coverpkg
2021-12-08 13:46:51 -06:00
Matthew Jaffee
4f55f423b0
Merge branch 'master' into simplify-coverage 2021-12-08 12:57:31 -06:00
reese
134cc8c2e3
Merge pull request #1800 from molecula/sup112
[SUP-112] Roaring-migrate panic bug fix
2021-12-08 10:55:35 -06:00
Matthew Jaffee
c91e81537d try something a bit different 2021-12-08 09:54:20 -06:00
reesporte
69f364e167 remove breaking test 2021-12-08 09:30:16 -06:00
reesporte
a2b86caad8 Merge branch 'master' into sup112 2021-12-08 09:24:02 -06:00
reesporte
47f78c88e0 check that translate store is not nil where it needs to be checked 2021-12-08 09:23:46 -06:00
reesporte
fed20ffd3e test that translate key error messages are correct 2021-12-08 09:23:46 -06:00
Matthew Jaffee
a40bc3edf7 try to simplify test coverage w/ -coverpkg 2021-12-07 18:38:48 -06:00
reesporte
f223d2d84b Merge branch 'sup112-with-tests' into sup112 2021-12-07 15:21:14 -06:00
Matthew Jaffee
4488ab1062
Merge pull request #1784 from molecula/recordbatch-ingestapi
add new RecordBatch implementation which uses ingest API
2021-12-06 20:40:09 -06:00
Matthew Jaffee
77897f3ef0 try to get some more test coverage on error cases
(without creating too much duplication!)
2021-12-06 20:19:42 -06:00
Matthew Jaffee
1a4180ca4a add new RecordBatch implementation which uses ingest API 2021-12-06 17:06:55 -06:00
reese
7788af166f
Merge pull request #1797 from molecula/staticcheck-issues-pt-2
[fb-964] fixes some more staticcheck errors
2021-12-06 17:04:35 -06:00
reesporte
a0aaa0f371 don't start error messages with a capital letter 2021-12-06 16:40:13 -06:00
reesporte
0a82474a65 Merge branch 'master' into staticcheck-issues-pt-2 2021-12-06 16:33:25 -06:00
reese
8cd9dcd70d
Merge pull request #1799 from molecula/distinct-timestamp-count
[FB-1081] fix count on distinctTimestamp
2021-12-06 16:28:38 -06:00
reesporte
716a3a89c1 added test case 2021-12-06 16:16:43 -06:00
reesporte
060c73fb2f add some tests for the encoding/decoding of DistinctTimestamp 2021-12-06 15:35:39 -06:00
reesporte
af3c5809e2 add support for multi-node queries 2021-12-06 14:57:05 -06:00
reesporte
4f03228968 fix count on distinctTimestamp
adds the ability to get the count of a distinct call to a timestamp field
2021-12-06 11:57:17 -06:00
reesporte
4c9029e0b6 Merge branch 'master' into sup112 2021-12-06 10:43:52 -06:00
reese
6ae433efbd
Merge branch 'master' into staticcheck-issues-pt-2 2021-12-06 09:11:59 -06:00
Matthew Jaffee
a8b1b93fa7
Merge pull request #1795 from molecula/topk-on-mutex
FB-1079 enable TopK on mutex fields
2021-12-03 17:15:40 -06:00
reesporte
b046ad5e8f fixes some more staticcheck errors 2021-12-03 16:50:02 -06:00
Matthew Jaffee
bd3e73ba66 refactor test to reduce duplication
I guess this is actually better... thanks SonarCloud!
2021-12-03 16:41:49 -06:00
Matthew Jaffee
58b4f40cdc enable TopK on mutex fields
I think it was just an oversight that it wasn't, because this seems to work
2021-12-03 16:41:49 -06:00
reese
d47cf8d3de
Merge pull request #1758 from molecula/staticcheck-issues
[FB-964] resolve some more staticcheck issues
2021-12-03 16:39:20 -06:00
reese
3d3d0b7a51
Merge branch 'master' into staticcheck-issues 2021-12-03 16:02:30 -06:00
reese
f4a2960a11
Merge pull request #1796 from molecula/pilosa-rename
[FB-1021] rename to pilosa
2021-12-03 15:28:54 -06:00
reesporte
c2964f7c7b rename to pilosa
thanks to alan's comment [here](https://molecula.atlassian.net/browse/FB-1021?focusedCommentId=11721)
2021-12-03 14:56:18 -06:00
reese
30b45adb30
Merge branch 'master' into staticcheck-issues 2021-12-03 14:28:44 -06:00
souhailanoor
ad5b3da9f9
Merge pull request #1793 from molecula/fb1031-souhaila
FB-1031: Update featurebase.conf to enable configuring an arbitrary OAuth2.0 provider as the Identity Provider for FB AuthN/AuthZ
2021-12-03 13:42:13 -06:00
reese
47d70f1aa9
Merge branch 'master' into staticcheck-issues 2021-12-03 13:34:27 -06:00
souhailanoor
2a2e272093
Merge branch 'master' into fb1031-souhaila 2021-12-03 13:00:36 -06:00
seebs
b3270c61eb
Merge pull request #1791 from molecula/sup119
FB-1073:  handle errors more gracefully, but don't stream CreateKeys
2021-12-03 13:00:23 -06:00
Souhaila Noor
7bcbb5eaca fixed indentation 2021-12-03 12:10:31 -06:00
Souhaila Noor
90c3c67ce4 fixed test for auth disabled 2021-12-03 12:00:07 -06:00
souhailanoor
e8f5458100
only validate config when auth is enabled
Co-authored-by: reese <45641995+reesporte@users.noreply.github.com>
2021-12-03 11:58:08 -06:00
souhailanoor
cebba84bee
add scope to install/featurebase.conf
Co-authored-by: Samir Patel <48686912+54mir@users.noreply.github.com>
2021-12-03 11:38:43 -06:00
Souhaila Noor
6425fc50fc added identity provider scope url as parameter 2021-12-03 11:24:18 -06:00
Souhaila Noor
8bf7f58961 Merge branch 'master' into fb1031-souhaila 2021-12-03 10:59:57 -06:00
Souhaila Noor
06fd65cb31 resolved reviewer's suggestions and made it pretty & user friendly 2021-12-03 10:56:21 -06:00
tgruben
da1cc34f96
Merge branch 'master' into sup119 2021-12-03 10:55:38 -06:00
reesporte
666baffb7d Merge branch 'master' into staticcheck-issues 2021-12-03 09:36:13 -06:00
reesporte
63c5c11108 fix some staticcheck issues 2021-12-03 09:31:45 -06:00
tgruben
f17d6b836e
Merge pull request #1792 from molecula/store-fix
[FB-1041] Handle bitmap page recycling properly
2021-12-02 17:11:42 -06:00
Souhaila Noor
978f236c59 resolved additional comments 2021-12-02 16:36:04 -06:00
Souhaila Noor
78e11e0fda resolved reviewer's comments 2021-12-02 16:15:15 -06:00
tgruben
3e5877299b
Merge branch 'master' into store-fix 2021-12-02 16:00:53 -06:00
Todd Gruben
1df90af26e free bitmap pages on deallocate 2021-12-02 15:57:52 -06:00
reesporte
5ab83243c6 add tests checking for the proper errors on nil results 2021-12-02 15:47:49 -06:00
Souhaila Noor
50d80f2f1c fixed arg cli descriptions 2021-12-02 14:52:38 -06:00
Souhaila Noor
aebd4c4c62 fixed formatting 2021-12-02 14:22:08 -06:00
Souhaila Noor
7de3eaa935 resolved review's comment 2021-12-02 14:19:59 -06:00
Souhaila Noor
91c8bf5e05 fixed duplicated empty string 2021-12-02 14:04:21 -06:00
Souhaila Noor
214a6dfac4 Merge branch 'fb1031-souhaila' of github.com:molecula/featurebase into fb1031-souhaila 2021-12-02 14:01:06 -06:00
Souhaila Noor
64b31da4a1 resolved duplicated line 2021-12-02 14:00:51 -06:00
souhailanoor
0189b2eef7
Merge branch 'master' into fb1031-souhaila 2021-12-02 13:11:19 -06:00
Souhaila Noor
b5ba3fb2ea added auth arg validation and set up auth package 2021-12-02 13:09:13 -06:00
Seebs
7270016d1a don't explode on translate data restore for _keys
There isn't really a field called _keys but some old backups
will think they have translate data for this. Ignore it politely.

Also in general produce a diagnostic rather than a panic for
translate data restores to nonexistent indexes or fields.
2021-12-01 12:04:24 -06:00
Seebs
8b20406f45 experiment: handle errors more gracefully, but don't stream CreateKeys
We were trying to write an error to a ResponseWriter After attempting to
write to it, and this produces messages about superfluous WriteHeaders,
which is correct. This patch changes things so that we report messages
more clearly and verbosely if we hit them before writing, and if we try
to write and fail, we log the message because that's all we can do.

This does change semantics slightly, in that now we're marshalling
separately from trying to write the marshalled data. I think this is
probably a reasonable call because it lets us get diagnostics about a
hypothetical encoding problem, but in practice I don't think there
should be any encoding problems. So my guess is the actual error will
occur in that last line, and be logged to the server console instead
of failing to write over HTTP.

Also note that this changes some of the messages to include the
underlying error they're complaining about.

We also merge the create/find and index/field cases because only a
couple of lines of code changed between four largeish functions,
and we test some of the failure cases.

We don't have test coverage on the "field isn't provided" type things
because the mux won't actually route things there without them, so
far as I know.
2021-12-01 11:06:54 -06:00
tgruben
73f3c01284
Merge pull request #1790 from molecula/tgruben-patch-1 2021-11-30 21:34:27 -06:00
tgruben
740f3e2838
Merge branch 'master' into tgruben-patch-1 2021-11-30 18:48:41 -06:00
Souhaila Noor
dc1c39fd21 updated featurebase.conf 2021-11-29 16:46:55 -06:00
seebs
21f2868175
Merge pull request #1785 from molecula/sanitycheck
Perform sanity check only if we have the storage it runs on
2021-11-29 09:58:55 -06:00
Souhaila Noor
28e1be7540 added AuthN/AuthZ parameters to featurebase server configuration 2021-11-29 09:40:05 -06:00
tgruben
8b7d429417
Update README.md 2021-11-29 09:18:44 -06:00
souhailanoor
0bcac33313
Merge branch 'master' into sanitycheck 2021-11-24 08:31:13 -06:00
souhailanoor
42f3b79640
Merge pull request #1786 from molecula/fixBugInCicdPipeline
remove duplicate code in multiple stages of gitlab yml for CICD
2021-11-24 08:30:54 -06:00
Souhaila Noor
65c4fc9cdb updated error messages 2021-11-23 20:28:14 -06:00
Souhaila Noor
02b0f4ffd6 test standard condition 2021-11-23 18:50:47 -06:00
Souhaila Noor
0e2d71c303 added error handling 2021-11-23 18:48:06 -06:00
Souhaila Noor
6172f98eab test failed condition 2021-11-23 18:32:09 -06:00
Souhaila Noor
001678386f define ip var 2021-11-23 17:27:57 -06:00
Souhaila Noor
42b6c2b351 updated syntax 2021-11-23 17:25:10 -06:00
Souhaila Noor
afb96f4a9b pass error back to gitlab runner 2021-11-23 17:17:13 -06:00
Souhaila Noor
b243f4b8a3 fix yaml error 2021-11-23 17:10:13 -06:00
Souhaila Noor
d13eef4c4b echo errors 2021-11-23 17:09:35 -06:00
Souhaila Noor
612e11887f added dependency 2021-11-23 16:41:35 -06:00
Souhaila Noor
88c89749af updated job's stage 2021-11-23 16:37:11 -06:00
Souhaila Noor
f03720f0a3 error handling 2021-11-23 16:33:32 -06:00
Souhaila Noor
2de7d2c885 fixed yaml syntax error 2021-11-23 16:26:09 -06:00
Souhaila Noor
0030e759da removed aws config from shell script 2021-11-23 16:24:56 -06:00
Souhaila Noor
d781dfb29b remove error handling to debug 2021-11-23 16:18:14 -06:00
Souhaila Noor
8a77da0db9 removed ssh keys from shell script 2021-11-23 16:14:21 -06:00
Souhaila Noor
184b935550 added print statement 2021-11-23 16:07:22 -06:00
Souhaila Noor
53d7d6b91c fix for ssh-add error 2021-11-23 16:04:29 -06:00
Souhaila Noor
cceb173d5d added before script commands 2021-11-23 15:55:36 -06:00
Souhaila Noor
a6bc10dec9 removed single quotes 2021-11-23 15:50:43 -06:00
Souhaila Noor
dbd1e611d0 changed jobs order 2021-11-23 15:42:12 -06:00
Souhaila Noor
53766f47ca fixed jobs dependencies and added args 2021-11-23 15:38:09 -06:00
Souhaila Noor
aac3b0768c fixed syntax error 2021-11-23 15:32:22 -06:00
Souhaila Noor
97841608e0 switched stages to make testing faster 2021-11-23 15:26:42 -06:00
Souhaila Noor
cce48a2638 created a shell script for deplooying node and handling error conditions 2021-11-23 15:24:47 -06:00
Souhaila Noor
692f2f8cb4 updated dependency of jobs and made instanceId a global variable 2021-11-23 13:29:56 -06:00
Souhaila Noor
7e8cbdeb53 updated a comment to trigger the pipeline for another test 2021-11-23 12:09:51 -06:00
Souhaila Noor
fbf4463572 remove duplicate code in multiple stages 2021-11-23 11:08:14 -06:00
Seebs
14911bfdff Perform sanity check only if we have the storage it runs on
SanityCheckMapping is specific to roaring bitmaps stored in-memory, if
we have an RBF backend, we shouldn't even try it, it'll just panic.

This implies that, in whatever circumstance we were hitting this, we
were getting an error back from the backend. We still need to address
that error, but to do that we need to know what it was, which we don't
if we panic.
2021-11-23 10:22:06 -06:00
Kasey C. Rodgers
769a750cdf
Merge pull request #1775 from molecula/generate-test-data-FB-971
generate csv files that simulate Samsung's data
2021-11-22 15:22:01 -08:00
kcrodgers24
11f1cd3689 Merge branch 'generate-test-data-FB-971' of github.com:molecula/featurebase into generate-test-data-FB-971 2021-11-22 14:55:14 -08:00
kcrodgers24
50e7cda07f modify functions to accept a requested num of records 2021-11-22 14:53:17 -08:00
Kasey C. Rodgers
cc65263ac5
Merge branch 'master' into generate-test-data-FB-971 2021-11-22 14:22:31 -08:00
kcrodgers24
4c9edabd6d Merge branch 'master' into generate-test-data-FB-971 2021-11-22 14:19:16 -08:00
reese
3789a8dd05
Merge pull request #1780 from molecula/sup-100
[SUP-100] fix bug where timestamp val is wrong in Min/Max
2021-11-22 16:10:55 -06:00
kcrodgers24
49289f2237 replace fmt.Print with t.Fatal, and improve date generator 2021-11-22 13:53:41 -08:00
reesporte
f0434a29d0 Merge branch 'sup-100' of github.com:molecula/featurebase into sup-100 2021-11-22 15:06:07 -06:00
reesporte
88fd6b1a9a remove helper status 2021-11-22 15:06:00 -06:00
reese
868a84f9fb
Merge branch 'master' into sup-100 2021-11-22 14:48:02 -06:00
souhailanoor
221fd4d4e7
Merge pull request #1783 from molecula/delete_EC2_node_on_failure
Fix bug for deleting Ec2 nodes when job fails
2021-11-22 14:34:24 -06:00
Souhaila Noor
c51a2de672 fixed dependency error 2021-11-22 14:10:34 -06:00
Souhaila Noor
f7fc380bcd split aws commands to allow for better error handling 2021-11-22 13:14:58 -06:00
kcrodgers24
06be6c0981 use log.Fatal in lieu of fmt.Print 2021-11-22 11:06:38 -08:00
reesporte
8918d91a09 Merge branch 'master' into sup-100 2021-11-22 13:05:40 -06:00
kcrodgers24
2385fda259 add tests, remove commented code 2021-11-22 10:45:12 -08:00
kcrodgers24
97c4ee670b add tests 2021-11-22 10:43:13 -08:00
Souhaila Noor
a32a217dbd test error condition 2021-11-22 12:10:42 -06:00
Souhaila Noor
55d35365c6 allow failure for ec2 node job 2021-11-22 10:53:42 -06:00
reesporte
fa635874d4 encode/decode timestamp val appropriately 2021-11-22 10:08:18 -06:00
souhailanoor
15877b897e
Merge pull request #1782 from molecula/decreaseTimeForCICD
Decrease sleep time for gitlab CICD pipeline
2021-11-19 15:05:48 -06:00
Souhaila Noor
2cde034e82 testing reviewer's suggestion 2021-11-19 14:40:37 -06:00
reesporte
e4745c1d77 add test for timestamp Min/Max on multinode clusters 2021-11-19 14:32:08 -06:00
souhailanoor
5d7469c519
Merge branch 'master' into decreaseTimeForCICD 2021-11-19 13:47:57 -06:00
kcrodgers24
4f5f27f513 make error handling best 2021-11-19 11:47:32 -08:00
Matthew Jaffee
0614665a29
Merge pull request #1781 from molecula/remove-cloudbuild
remove unused .cloudbuild directory (was for GCP CI stuff)
2021-11-19 13:41:20 -06:00
souhailanoor
99e50c25aa
Merge branch 'master' into decreaseTimeForCICD 2021-11-19 13:19:10 -06:00
Souhaila Noor
c83170f1f0 decrease sleep time 2021-11-19 13:16:48 -06:00
Matthew Jaffee
a02a8a94b3 remove unused .cloudbuild directory (was for GCP CI stuff) 2021-11-19 12:50:40 -06:00
tgruben
aecc6547c0
Merge pull request #1779 from molecula/FB-972-query
[FB-972] Random query and load tester
2021-11-19 12:48:20 -06:00
tgruben
df9ba3d2db
Merge branch 'master' into FB-972-query 2021-11-19 12:33:02 -06:00
Todd Gruben
5c5e16af33 added a generate only flag 2021-11-19 12:26:23 -06:00
Todd Gruben
f4a40e79b9 final cleanup 2021-11-19 12:08:24 -06:00
Matthew Jaffee
f6e9b6ab40
Merge pull request #1762 from molecula/clean-up-top-level
remove outdated files at top level
2021-11-19 11:53:01 -06:00
kcrodgers24
dc9c2a842a make error handling better 2021-11-19 09:38:12 -08:00
Todd Gruben
989f9c3f48 applied suggestions 2021-11-19 11:29:17 -06:00
Matthew Jaffee
25e5c6f5fb remove references to CONTRIBUTING and CHANGELOG 2021-11-19 11:22:15 -06:00
Todd Gruben
b12f00db59 changed default seed to current time 2021-11-19 10:57:36 -06:00
Matthew Jaffee
f7b4f621a1 remove references to LICENSE and checks for it in source files 2021-11-19 10:38:06 -06:00
Todd Gruben
1089435218 add check for index presence 2021-11-19 09:48:45 -06:00
Todd Gruben
c72406819e added seed param 2021-11-19 09:40:39 -06:00
reesporte
ff39b76143 remove extra line smh my head 2021-11-19 09:32:41 -06:00
reesporte
caebbffe6c Merge branch 'sup-100' of github.com:molecula/featurebase into sup-100 2021-11-19 09:24:15 -06:00
reesporte
0adfa75188 add unit test
we can avoid regressions with a simple unit test that checks that timestamp
ValCounts have the appropriate values in comparisons
2021-11-19 09:23:01 -06:00
Matthew Jaffee
b3b11638a3 remove outdated files at top level
we're no longer Apache 2.0 licensed, or open source, so LICENSE and
CONTRIBUTING.MD are gone. We track the changelog elsewhere, so that
can go, and I don't think anyone has looked at the NOTES file in 3
years. I modified the NOTICE not to refer to the Apache license any
more.
2021-11-19 09:03:14 -06:00
Todd Gruben
de7af694fd Merge branch 'FB-972-query' of github.com:molecula/pilosa into FB-972-query 2021-11-19 05:17:22 -06:00
Todd Gruben
f6b3a81ac3 made duration minutes for query rate 2021-11-19 05:16:30 -06:00
kcrodgers24
85629c85b7 Merge branch 'generate-test-data-FB-971' of github.com:molecula/featurebase into generate-test-data-FB-971 2021-11-18 16:16:56 -08:00
kcrodgers24
b5e5df8b58 add error checking 2021-11-18 16:10:49 -08:00
reese
ec1231ff57
Merge branch 'master' into sup-100 2021-11-18 17:30:37 -06:00
reesporte
8f85a9e88d fix bug where timestamp val is wrong in Min/Max 2021-11-18 17:27:13 -06:00
tgruben
cbd7a4f30c
Merge branch 'master' into FB-972-query 2021-11-18 17:17:32 -06:00
Souhaila Noor
ce13bb78ed fixed typo 2021-11-18 17:09:52 -06:00
nagamocha3000
ae95fa2a2a
Merge pull request #1778 from molecula/install
add config files for release
2021-11-19 02:02:25 +03:00
kcrodgers24
27b73d2b7d corrects typo on line 229 2021-11-18 14:27:19 -08:00
nm
3b92f9493d add config files for release 2021-11-19 01:26:18 +03:00
Todd Gruben
87ededd61e Modified random query to use vegeta library 2021-11-18 16:23:12 -06:00
kcrodgers24
90ace6b970 deletes duplicate file and adds license header 2021-11-18 13:47:23 -08:00
kcrodgers24
14050c567c corrects naming convention and age range 2021-11-18 13:15:44 -08:00
souhailanoor
bbbcc7d677
Merge branch 'master' into generate-test-data-FB-971 2021-11-18 14:44:20 -06:00
souhailanoor
6623cbba8d
Merge pull request #1777 from molecula/fixEC2NodeBug
fix for ec2 ip filtering
2021-11-18 13:37:31 -06:00
souhailanoor
d8967dfb96
Merge branch 'master' into fixEC2NodeBug 2021-11-18 13:06:44 -06:00
seebs
8ae19b3c36
Merge pull request #1766 from molecula/fb1019
FB-1019: internal consistency errors in RBF
2021-11-18 12:57:41 -06:00
Souhaila Noor
4e3f31471c remove double quotes from variable name 2021-11-18 12:42:09 -06:00
Souhaila Noor
5d489198bd fixed apt install bug 2021-11-18 12:11:48 -06:00
Souhaila Noor
d40eefb364 added host:port as a command line input 2021-11-18 12:06:07 -06:00
Souhaila Noor
eb717f568d fix for ec2 ip filtering 2021-11-18 11:49:38 -06:00
tgruben
b6875476ff
Merge branch 'master' into generate-test-data-FB-971 2021-11-18 10:30:06 -06:00
Todd Gruben
442d109814 created qa folder 2021-11-18 10:28:49 -06:00
Seebs
9c0c0ec8c1 There are two related bugs here.
First, it is possible for us to end up allocating *or freeing* pages during
a modification of the free list, in a way such that the change to the free list
means that when we finish the modification which caused the allocate or free,
we've overwritten the inner change.

Second, when deallocating trees, we don't actually deallocate the branch nodes
themselves.

The former causes potentially severe data corruption. The latter causes us
to gradually leak pages in a way that we don't notice because we only run those
tests during the RBF tests.

The fix for this is surprisingly intricate, because of the counterintuitive
fact that *allocating* a page means *removing* things from the free list
(and thus potentially deallocating free list pages), while *freeing* a page
means *adding* things to the free list (and thus potentially needing to
allocate pages for the free list).

While modifying the free list, any allocations we need always just come from
the end of the file; we don't try to reuse free pages. If a page becomes
*deallocated* by a free list modification, we don't annotate it in the free
list at the instant that it happens; we stash that information until the
current modification of the free list happens, then iterate through any
such pages.

I am pretty sure there's virtually never more than one, and I don't actually
know that I can create a case wherein we'd end up with the nested case
firing, wherein removing a page from the free list causes us to remove another
page, but I think if the free list got large and cluttered and needed
rebalancing or something it could maybe happen.
2021-11-18 10:05:55 -06:00
Seebs
a38c219cf3 Add test for RBF failures
This test case triggers a failure in RBF, it's a separate patch to
make it easier to see the failure.
2021-11-18 10:05:54 -06:00
reese
db99b83bb2
Merge pull request #1772 from molecula/sup-102
[SUP-102] fix presentation of timestamps in Groupby, Distinct calls from psql client
2021-11-17 13:15:16 -06:00
Kasey C. Rodgers
9302775fd8
generate csv files that simulate Samsung's data 2021-11-17 08:21:57 -08:00
reesporte
ea96c10114 fix typo 2021-11-17 09:10:50 -06:00
reesporte
6419a87797 use util function for formatting timestamp 2021-11-17 09:07:08 -06:00
reesporte
f8e93871c0 refactor safeCopy to pure function and add unit test 2021-11-17 08:51:28 -06:00
reesporte
7390ae072d Merge branch 'master' into sup-102 2021-11-17 08:11:03 -06:00
seebs
2e0b5cb55b
Merge pull request #1774 from molecula/fbholder
unbreak featurebase holder subcommand
2021-11-16 15:18:06 -06:00
reesporte
1cc6a87d20 refactor and add test 2021-11-16 14:53:30 -06:00
Seebs
dcab1a6708 unbreak featurebase holder subcommand
The "just open the holder" subcommand doesn't work the way it used
to, because now that we rely on etcd to open a holder, trying to open
a holder without things set up just coredumps.

Step 1: Fix that.
Step 2: Also add a test that covers it so we don't get bitrotted again.
Step 3: Remove an unrelated stale comment that doesn't deserve its
own commit log, having to do with an option that no longer exists
which is no longer being set right under the comment saying we set it.
2021-11-16 14:23:35 -06:00
tgruben
7ee343c8fa
Merge pull request #1773 from molecula/fix-ci
Added back code coverage
2021-11-16 12:32:03 -06:00
Todd Gruben
4c966dee22 removed filter 2021-11-16 12:08:46 -06:00
reesporte
9e041803fb add license 2021-11-16 09:20:44 -06:00
reesporte
da783d97ef add test for pgWriteDistinctTimestamp 2021-11-16 09:14:15 -06:00
reesporte
24051111b6 Merge branch 'sup-102' of github.com:molecula/featurebase into sup-102 2021-11-15 17:15:51 -06:00
reesporte
9bbd946ac5 update test to ignore FieldOptions field 2021-11-15 17:15:44 -06:00
reesporte
b3b536505d fix presentation of timestamps from a groupby pql call 2021-11-15 17:15:44 -06:00
reesporte
6d6cf7e51f fix presentation of timestamps from a distinct pql call 2021-11-15 17:15:44 -06:00
reesporte
5767b778b9 Merge branch 'sup-102' of github.com:molecula/featurebase into sup-102 2021-11-15 17:13:26 -06:00
reesporte
f5afb7a3ed update test to ignore FieldOptions field 2021-11-15 17:13:19 -06:00
Todd Gruben
6413ed3228 added protection against trailing slash 2021-11-15 17:13:19 -06:00
Souhaila Noor
8770ce245e ingest and delete for samsung workflow 2021-11-15 17:13:19 -06:00
reese
3e9f78d030
Merge pull request #1769 from molecula/fix-build-lattice
[SUP-106] use go1.16.10 for build and test, add test with go1.17.3
2021-11-15 17:12:32 -06:00
reesporte
269526348e update test to ignore FieldOptions field 2021-11-15 17:03:40 -06:00
reese
d7e0a0a4c3
Merge branch 'master' into sup-102 2021-11-15 16:19:26 -06:00
reese
e817dcf0a8
Merge branch 'master' into fix-build-lattice 2021-11-15 16:04:20 -06:00
reesporte
9e570c9e84 fix presentation of timestamps from a groupby pql call 2021-11-15 15:59:51 -06:00
souhailanoor
875692a033
Merge pull request #1771 from molecula/fb973-ingest
FB-973 Create ingest workload for Samsung Simulacra
2021-11-15 15:34:21 -06:00
reesporte
96dfe845d3 fix presentation of timestamps from a distinct pql call 2021-11-15 15:04:27 -06:00
souhailanoor
54e85b8e6e
Merge branch 'master' into fb973-ingest 2021-11-15 14:55:33 -06:00
Souhaila Noor
f0a6ebae8f ingest and delete for samsung workflow 2021-11-15 14:51:57 -06:00
tgruben
5980d3d278
Merge pull request #1770 from molecula/migrate-bug
[FB-1026] added protection against trailing slash
2021-11-15 13:15:19 -06:00
Todd Gruben
7de69df424 added protection against trailing slash 2021-11-15 10:54:13 -06:00
reesporte
ed5525c836 remove long lines i guess 2021-11-15 10:19:51 -06:00
reesporte
0a4e9fe8cf move lattice build dir to right location 2021-11-15 10:16:43 -06:00
reese
dcab3a4bce
Merge branch 'master' into fix-build-lattice 2021-11-14 15:16:11 -06:00
reesporte
d1345ca265 build all with golang:1.16.10 2021-11-14 15:00:28 -06:00
reesporte
541df0fe37 is it because of the go cache? 2021-11-14 14:40:05 -06:00
reesporte
fd1a2d2e78 smh 2021-11-14 14:26:27 -06:00
reesporte
4995888f00 the problem was i was installing it for a different architecture smh 2021-11-14 14:11:56 -06:00
reesporte
de0e8cc0f9 maybe go bin is in a different spot? 2021-11-14 13:52:44 -06:00
reesporte
9ff56e032e pls 2021-11-14 13:37:57 -06:00
reesporte
0d8ecfbcb5 be more explicit? 2021-11-14 13:22:12 -06:00
reesporte
91271795ac f 2021-11-14 13:07:42 -06:00
reesporte
220515bbd4 "update path" 2021-11-14 12:53:33 -06:00
reesporte
948928c06e set gopath explicitly 2021-11-14 12:37:18 -06:00
reesporte
49ce895c4d change path 2021-11-14 12:19:27 -06:00
reesporte
67835f746d please work 2021-11-14 12:17:09 -06:00
reesporte
14e9fb1ff1 statik h 2021-11-14 12:02:45 -06:00
reesporte
a214ac5ded verbose statik install 2021-11-14 11:46:52 -06:00
reesporte
b28c9feef0 more print debug 2021-11-11 18:28:20 -06:00
reesporte
1337a9dfaa more debugging by print statement 2021-11-11 18:12:27 -06:00
reesporte
640d12cb6c debug by print statmeentS 2021-11-11 17:54:26 -06:00
reesporte
61d558de3c update tests, actually install statik smh my head 2021-11-11 17:40:28 -06:00
reesporte
0ab58b9132 untar properly 2021-11-11 17:23:34 -06:00
reesporte
37866204d7 use statik right 2021-11-11 17:09:14 -06:00
reesporte
bd209b3005 please god work 2021-11-11 16:46:10 -06:00
reesporte
58c01793cb this ought to do it 2021-11-11 16:25:51 -06:00
tgruben
5a68470339
Merge pull request #1768 from molecula/upgrad-go
upgrade go builder to 1.16.10
2021-11-11 16:19:15 -06:00
reesporte
d449c8449f don't treat warnings as errors 2021-11-11 16:17:38 -06:00
reesporte
531957c51f hope 2021-11-11 16:05:43 -06:00
tgruben
2f504ff43d
Merge branch 'master' into upgrad-go 2021-11-11 15:47:59 -06:00
Todd Gruben
253ca1182e upgrade go 2021-11-11 15:46:45 -06:00
reese
1dc61daa4c
Merge pull request #1764 from molecula/typo-fix
[NA-000] fix typo
2021-11-11 11:31:32 -06:00
reesporte
02baec2c6e oops 2021-11-11 11:02:51 -06:00
reesporte
9ef057cc85 fix typo 2021-11-11 10:27:31 -06:00
souhailanoor
c62f9715c5
Merge pull request #1750 from molecula/FB-900_singleNodeDeployment
FB-900: aws single node deployment for linux amd64 binary
2021-11-08 16:59:01 -06:00
Souhaila Noor
a8707b55bd updated instance type 2021-11-08 16:14:25 -06:00
Souhaila Noor
05be45194a combined iam role with run-instance 2021-11-08 15:54:12 -06:00
Souhaila Noor
1bda8e439d fixed indentation 2021-11-08 15:26:01 -06:00
Souhaila Noor
2607e2dfb1 Merge branch 'FB-900_singleNodeDeployment' of github.com:molecula/featurebase into FB-900_singleNodeDeployment 2021-11-08 15:22:23 -06:00
souhailanoor
88ba24828c
Merge branch 'master' into FB-900_singleNodeDeployment 2021-11-08 15:16:01 -06:00
Souhaila Noor
d48da50cf6 consolidated some commands 2021-11-08 15:15:26 -06:00
Souhaila Noor
91e93cb975 fixed stage 2021-11-08 14:47:14 -06:00
Souhaila Noor
d5f5340016 fixed syntax error 2021-11-08 14:44:33 -06:00
Souhaila Noor
4c291180b9 added artifact paths 2021-11-08 14:38:35 -06:00
Souhaila Noor
aab7a2e4be fixed stages 2021-11-08 14:33:34 -06:00
Souhaila Noor
1b503a3ddf made the sleep time longer 2021-11-08 14:32:00 -06:00
Souhaila Noor
d92bd37d71 added another sleep 2021-11-08 14:20:04 -06:00
Souhaila Noor
af4b420d66 added region 2021-11-08 13:58:34 -06:00
Souhaila Noor
48295a5491 added abs paths and add sleep time 2021-11-08 13:50:47 -06:00
Souhaila Noor
3d11f9cebf added profile 2021-11-08 13:35:20 -06:00
Souhaila Noor
c2dfc35bdc added iam role 2021-11-08 13:21:07 -06:00
Souhaila Noor
aa4c7aa901 removed targets flag 2021-11-08 12:00:17 -06:00
Souhaila Noor
fe6bea04c2 fix var assignment 2021-11-08 11:55:17 -06:00
Souhaila Noor
32eb7ab097 access array value 2021-11-08 11:45:41 -06:00
Souhaila Noor
49fd477d95 updated var assignment 2021-11-08 11:39:17 -06:00
Souhaila Noor
6d4ae4c345 changed var assignment 2021-11-08 11:34:10 -06:00
Souhaila Noor
2b315c6634 removed instance id file 2021-11-08 11:23:05 -06:00
Souhaila Noor
26d77c51b5 removed variable overwrite 2021-11-08 11:06:55 -06:00
Souhaila Noor
8edfc0c9ff made instanceId a global variable 2021-11-08 11:00:49 -06:00
Souhaila Noor
4a42571dd9 fix for go 2021-11-08 10:45:10 -06:00
Souhaila Noor
22c0815288 fixed syntax error 2021-11-08 10:31:57 -06:00
Souhaila Noor
d3cc4d7f2a added argument to scp 2021-11-08 10:26:59 -06:00
Souhaila Noor
14265090db fixed arguments 2021-11-08 10:20:10 -06:00
Souhaila Noor
38a17e2b94 fixed typo 2021-11-08 09:40:14 -06:00
Souhaila Noor
1cdc8e4959 added aws image 2021-11-08 09:33:34 -06:00
Souhaila Noor
27e39b933f reverted change to aws configure 2021-11-08 09:21:14 -06:00
Souhaila Noor
ebde0142da add stage to configure featurebase 2021-11-08 09:14:47 -06:00
Souhaila Noor
e629e0165d install correct version of go 2021-11-08 08:42:49 -06:00
Souhaila Noor
aae5374248 fixed stages 2021-11-08 08:18:37 -06:00
Souhaila Noor
1befe2ad32 added aws config for terminate job 2021-11-08 08:10:20 -06:00
Souhaila Noor
4c2832ab31 fixed yaml syntax error 2021-11-08 07:59:15 -06:00
Souhaila Noor
79d1a005ce job to terminate ec2 instance 2021-11-08 07:55:42 -06:00
Souhaila Noor
5b5c003b1e private key fix 2021-11-08 07:43:31 -06:00
Souhaila Noor
df99dd7578 fixed typo 2021-11-07 09:31:34 -06:00
Souhaila Noor
76ba07e806 update ssh key filename 2021-11-07 09:29:46 -06:00
Souhaila Noor
46d6ced5b4 updated ssh permissions 2021-11-07 09:24:40 -06:00
Souhaila Noor
f0b2e6beea updated permissions for ssh key 2021-11-07 09:17:02 -06:00
Souhaila Noor
dfc98e3000 updated sleep time 2021-11-07 09:11:52 -06:00
Souhaila Noor
57d4eb45de gitlab path test2 2021-11-07 08:53:01 -06:00
Souhaila Noor
0e564a00e8 path for cloud-init 2021-11-07 08:47:10 -06:00
Souhaila Noor
606b718428 fixed path for cloud-init 2021-11-07 08:42:40 -06:00
Souhaila Noor
78713c6a8c test cloudinit 2021-11-07 08:39:43 -06:00
reesporte
66c7d59707 remove dot imports from catcher.go 2021-11-05 15:39:50 -05:00
Souhaila Noor
103312be8f added cloutinit 2021-11-05 15:04:09 -05:00
Matthew Jaffee
8d47efb666
Merge pull request #1753 from molecula/add-fgprof
add fgprof endpoint by default
2021-11-05 14:42:18 -05:00
Souhaila Noor
6531f90747 fixed syntax error 2021-11-05 14:26:20 -05:00
Souhaila Noor
bf93278ca3 scp binary 2021-11-05 14:24:02 -05:00
Souhaila Noor
179a0e7624 fixed typo for copy path 2021-11-05 14:03:14 -05:00
Matthew Jaffee
fd50c15243 add fgprof endpoint by default
to aid in debugging performance issues
2021-11-05 14:02:58 -05:00
Souhaila Noor
590e5edc57 reverted to last working version 2021-11-05 13:57:37 -05:00
Souhaila Noor
7a5ba0e5d6 Revert "sanity check for scp"
This reverts commit 86407ebcab.
2021-11-05 13:52:26 -05:00
Souhaila Noor
cf365db944 changed ssh config 2021-11-05 13:47:47 -05:00
Souhaila Noor
98e5f6deaf ssh key 2021-11-05 13:45:11 -05:00
Souhaila Noor
4b2322160b sanity 2021-11-05 13:41:13 -05:00
seebs
f02c5c0354
Merge pull request #1748 from molecula/core932
FB-932: rework Import to reduce copying and network traffic
2021-11-05 13:38:12 -05:00
Souhaila Noor
fae8d2d116 ssh add command 2021-11-05 13:32:15 -05:00
Souhaila Noor
642d4fcb86 fixed variable name 2021-11-05 13:27:03 -05:00
Seebs
c7e4bc0fd0 refactoring experiment
I'm not actually sold on this, but I'm not entirely unsold on it. It seems like
it does reduce the amount of duplication a lot, but also it's sort of a mess.

In the process, noticed that it makes more sense to grab the whole cluster
rather than just the nodes for an arbitrary shard for the shard==^0 case,
because then if we have an API (but no Qcx), we can be reasonably confident
that we'll be able to pick the local node for loopback even if we aren't
using the API directly.

Have thought about whether we should create our own Qcx in cases like that
but I really don't like the idea of automatically creating a Qcx.
2021-11-05 13:06:38 -05:00
Seebs
d4b06d077e Import/ImportValue API rework and improvements
Underlying goal: Don't use the http client to send messages back to the
local host. Also, when sending data to other nodes, don't collate it
from an ImportRequest into a completely different format, then immediately
collate that back into an ImportRequest. This does require changing
the logic over in ctl/import to make it create an ImportRequest.

Also, add additional testing to make sure we're actually trying anything
at all with several combinations (such as submitting import requests
which don't match the configuration of index or field), and improve
test coverage for that.

This introduces the ability to tell an http/client InternalClient about
a specific API that it should use for local queries where applicable.
That's not implemented outside of the import stuff, but should probably
be applied eventually to other things that are trying to talk to many
nodes one of which may be the local node. That behavior is contingent
on passing in a Qcx, because it is implicitly tied to an existing
execution context, and it can't assume that it can create a new one,
because that could deadlock.
2021-11-05 13:06:38 -05:00
Seebs
60ac6a929f make address lookup failures okay on MacOS 2021-11-05 13:06:38 -05:00
Seebs
cff8da346f Improvements and benchmarks for ingest field operation sorting
Reusing the field operation sorting for other things caused me
to hit a bug, also made me curious about a performance issue and
whether it was possible to improve it. Answer: Not easy to improve,
anyway.
2021-11-05 13:06:38 -05:00
Souhaila Noor
4f964aeef4 updated ssh config 2021-11-05 12:53:39 -05:00
Souhaila Noor
86407ebcab sanity check for scp 2021-11-05 12:39:11 -05:00
Souhaila Noor
7c02e9c447 added scp 2021-11-05 12:37:15 -05:00
Ben Johnson
f2bc887d6f
Merge pull request #1751 from molecula/fb-904
[FB-904] Add deb/rpm packaging of FeatureBase binary
2021-11-05 10:59:48 -06:00
Souhaila Noor
d080164a49 echo aws config 2021-11-05 11:35:54 -05:00
Souhaila Noor
ab3679bef7 sanity check 2021-11-05 11:33:17 -05:00
Souhaila Noor
6e6d7a77db debug echo statements 2021-11-05 11:26:09 -05:00
tgruben
fd08815f51
Merge branch 'master' into fb-904 2021-11-05 11:23:01 -05:00
Souhaila Noor
a9ab597d28 added profile to start-instance 2021-11-05 11:20:21 -05:00
Souhaila Noor
021af2c5e5 changed ssh key name to match aws 2021-11-05 10:56:10 -05:00
Souhaila Noor
0cfd5f116d echo ssh file 2021-11-05 10:50:59 -05:00
Souhaila Noor
550a610b5b sanity checks 2021-11-05 10:46:54 -05:00
Souhaila Noor
f7497bfe8f pass ssh key to a file 2021-11-05 10:35:15 -05:00
Souhaila Noor
6643e3963e reverted back to variable for ssh 2021-11-05 10:28:36 -05:00
Souhaila Noor
04b64c0f30 add path for ssh keys 2021-11-05 09:54:37 -05:00
Samir Patel
6fa8f0a88e
Merge pull request #1749 from molecula/bug/index-bounds
[FB-965] featurebase import: check for data in requests
2021-11-05 09:49:50 -05:00
Souhaila Noor
bd440f4c23 updated permissions for ssh key 2021-11-05 09:43:19 -05:00
Souhaila Noor
d147c03e22 add ssh config in section with using ssh keys 2021-11-05 09:32:53 -05:00
Souhaila Noor
7271821ebe fixed path for ssh keys 2021-11-05 09:28:25 -05:00
Souhaila Noor
14a9662494 fixed yaml syntax error 2021-11-05 09:24:20 -05:00
Souhaila Noor
f9ff3973d0 fixed argument name 2021-11-05 09:17:19 -05:00
Samir Patel
139f4c9cbb
Merge branch 'master' into bug/index-bounds 2021-11-05 09:16:39 -05:00
Samir Patel
cb6a364890 more qcx defers 2021-11-05 09:12:28 -05:00
Souhaila Noor
383663673b configure ssh 2021-11-05 09:11:27 -05:00
Souhaila Noor
321d273dce fixed typo in instance name 2021-11-05 09:03:51 -05:00
Ben Johnson
94c6c4ee53
Merge branch 'master' into fb-904 2021-11-04 16:58:30 -06:00
Samir Patel
20131a697c add additional tests and defer qcx 2021-11-04 17:07:24 -05:00
Samir Patel
cdaec2e0d2 remove duplicate checks 2021-11-04 16:04:00 -05:00
Samir Patel
67233d5720 move checks to api.go 2021-11-04 15:52:37 -05:00
Souhaila Noor
82b97022ff removed sleep time 2021-11-04 14:57:41 -05:00
souhailanoor
268ea74856
Merge branch 'master' into FB-900_singleNodeDeployment 2021-11-04 14:47:46 -05:00
Souhaila Noor
f80f2fc702 added rsa key 2021-11-04 14:34:19 -05:00
Souhaila Noor
08161a366a undo last commit 2021-11-04 13:42:03 -05:00
Souhaila Noor
20224b1df5 updated aws config 2021-11-04 13:28:48 -05:00
reese
2e9b43dfca
Merge pull request #1752 from molecula/sup-86
[SUP-86] slow webui on large query
2021-11-04 12:54:11 -05:00
Samir Patel
c0e201d638 dedup api_test 2021-11-04 12:19:56 -05:00
reesporte
f70fdfb59e remove inline styling 2021-11-04 12:14:01 -05:00
Souhaila Noor
8274a32127 debug profile 2021-11-04 12:09:20 -05:00
reesporte
4891cd1c9a Merge branch 'sup-86' of github.com:molecula/featurebase into sup-86 2021-11-04 11:55:59 -05:00
reesporte
7b3dee5653 single quotify 2021-11-04 11:55:32 -05:00
Souhaila Noor
7a6e7c2fd5 set profile 2021-11-04 11:53:43 -05:00
Souhaila Noor
01260cfcce update profile 2021-11-04 11:38:58 -05:00
Ben Johnson
395f35fc3d FB-904: Add deb/rpm packaging of FeatureBase binary 2021-11-04 10:32:59 -06:00
Souhaila Noor
502f40593e updated profile 2021-11-04 11:26:05 -05:00
Souhaila Noor
67da6d9ffa debug profile 2021-11-04 11:12:30 -05:00
Souhaila Noor
6e673bafa3 configure profile 2021-11-04 10:58:08 -05:00
Souhaila Noor
c19aa7d6b3 changed profile name 2021-11-04 10:27:13 -05:00
Souhaila Noor
b95d013e14 configure aws profile 2021-11-04 10:12:26 -05:00
Souhaila Noor
50f409771f updated aws profile 2021-11-04 09:59:11 -05:00
Souhaila Noor
df2064a860 define aws credential variables 2021-11-04 09:31:31 -05:00
Souhaila Noor
6ee2341c88 undo last commit changes 2021-11-04 09:04:43 -05:00
Souhaila Noor
e1ca09a7b5 comment other parts of script to speed up testing 2021-11-04 09:02:17 -05:00
Souhaila Noor
c29dcddca6 replace terraform with awscli for integration test 2021-11-04 08:57:10 -05:00
reese
cdbd8b6da7
Merge branch 'master' into sup-86 2021-11-03 13:20:21 -05:00
reesporte
e11ce9a248 clearer wording 2021-11-03 13:18:41 -05:00
reesporte
1585313a0c better styling 2021-11-03 13:14:28 -05:00
reesporte
f9c78091ab move warning label to results count 2021-11-03 13:05:47 -05:00
tgruben
63fd5100d1
Merge pull request #1740 from molecula/golangci-lint
[FB-895] gofmt govet
2021-11-03 10:14:47 -05:00
Todd Gruben
2e086b866a . 2021-11-03 09:37:52 -05:00
Todd Gruben
792032d8b2 Merge branch 'golangci-lint' of github.com:molecula/pilosa into golangci-lint 2021-11-03 09:02:56 -05:00
Todd Gruben
41ed706d83 add license 2021-11-03 09:02:47 -05:00
tgruben
3318b79710
Merge branch 'master' into golangci-lint 2021-11-03 08:58:33 -05:00
Todd Gruben
7fa71d9548 check selecthandler 2021-11-03 08:57:24 -05:00
Todd Gruben
e915d75df6 remove @ from yaml
try to fix yml syntax

same

same

same

same2

same3

same4

same5

try with shell runner instead of dind

remove lattice from dockerfile

change path to bin

runs after linux arm64 build

change dockerfile path

same

same

add dir

better test coverage
2021-11-03 08:48:57 -05:00
reesporte
ad2f5c5ed4 limit the number of results that we keep
also tells the user how many results there were, but they only
get to see 1000 of them
2021-11-02 16:03:43 -05:00
Samir Patel
2bc2640fbf test two scenarios 2021-11-02 15:50:48 -05:00
Samir Patel
3ca91bba7f More specific error message on mismatch 2021-11-02 15:49:59 -05:00
Souhaila Noor
a8d3d1c4d4 fix terraform apply inputs 2021-11-02 15:00:58 -05:00
Souhaila Noor
f3884e21ba changed directory name for terraform files 2021-11-02 14:40:06 -05:00
Souhaila Noor
01e4ae4070 fix missing plan file for terraform apply 2021-11-02 14:13:53 -05:00
Souhaila Noor
d565303160 fix script not running in correct directory 2021-11-02 13:28:33 -05:00
Souhaila Noor
39f85fe2a4 added terraform config for aws single node deployment 2021-11-02 12:25:01 -05:00
Todd Gruben
a79bb893af test ToRows 2021-11-02 12:14:57 -05:00
Todd Gruben
f8d4d83e1a check op log 2021-11-02 10:54:56 -05:00
Samir Patel
4fd2a4fedd
Merge pull request #1737 from molecula/CI/build-containers
[CORE-898] Create FeatureBase Docker Images in CI
2021-11-02 09:41:24 -05:00
reesporte
5d7a399500 go mod tidy! 2021-11-01 19:24:18 -05:00
Samir Patel
5206e8fa0e more comprehensive value check 2021-11-01 18:19:38 -05:00
Samir Patel
1de6085782 remove empty value check from handler 2021-11-01 17:51:16 -05:00
Samir Patel
002b65c516 add checks for data presence on import req 2021-11-01 17:04:33 -05:00
reesporte
25d9895a21 actually get coverage on every single package and subpackage (slow) 2021-11-01 16:49:27 -05:00
reesporte
35d35d9d4d get rid of coverage html since we dont use it 2021-11-01 14:33:57 -05:00
Todd Gruben
2f92fd2a9a all the things 2021-11-01 12:49:27 -05:00
Todd Gruben
ff6a85b728 cvrpkg try again 2021-11-01 12:33:59 -05:00
Todd Gruben
745c34bbfd remove syntload 2021-11-01 12:27:44 -05:00
Todd Gruben
b9b9b0b9cf coverage fun part2 2021-11-01 12:17:17 -05:00
Todd Gruben
76f7690ede Merge branch 'golangci-lint' of github.com:molecula/pilosa into golangci-lint 2021-11-01 11:59:45 -05:00
Todd Gruben
2dab5ac8b2 coverage fun 2021-11-01 11:59:22 -05:00
tgruben
7e0ada9e1a
Merge branch 'master' into golangci-lint 2021-11-01 11:33:56 -05:00
Todd Gruben
9f67866e95 include subpackages in coverage 2021-11-01 11:21:57 -05:00
Samir Patel
a2ba7f39ea Merge branch 'CI/build-containers' of github.com:molecula/featurebase into CI/build-containers 2021-11-01 10:48:36 -05:00
Samir Patel
ab495a3e7b Merge branch 'master' of github.com:molecula/featurebase into CI/build-containers 2021-11-01 10:46:10 -05:00
Samir Patel
a084ad0753 Up goverversion to 1.16.9 2021-11-01 10:44:01 -05:00
reese
e769c085ae
Merge pull request #1746 from molecula/sup-85
[SUP-85] add quotes around strings in webui representation
2021-11-01 10:42:14 -05:00
reese
7d47663b44
Merge branch 'master' into sup-85 2021-11-01 10:31:04 -05:00
Samir Patel
584cac2517
Merge pull request #1743 from molecula/54mir/toggle-schema-details
[FB-920] Add cmd option to disable cardinality calculation in schema/details endpoint
2021-11-01 10:24:24 -05:00
reesporte
510dd4dfb7 un-prettify for less lines of code changed :) 2021-11-01 09:36:36 -05:00
Samir Patel
3fb9395ce0
Merge branch 'master' into CI/build-containers 2021-11-01 09:32:02 -05:00
Samir Patel
8ee0528858
Merge branch 'master' into 54mir/toggle-schema-details 2021-11-01 09:31:35 -05:00
reesporte
705efc1b8a refactor for easier reading, add more tests 2021-11-01 09:25:07 -05:00
Samir Patel
faa831928c Add some error handling 2021-10-31 23:48:43 -05:00
Samir Patel
163492801f Add test to test endpoint code directly 2021-10-31 23:18:53 -05:00
Todd Gruben
f6f8db941d add tes for sonar? 2021-10-30 11:52:46 -05:00
Todd Gruben
521ada8e70 bug with shadow correction 2021-10-30 10:44:23 -05:00
Samir Patel
d828d73eae Add APISetOptions test for coverage 2021-10-29 19:04:21 -05:00
Todd Gruben
bba60eb20d add key to cache 2021-10-29 17:01:45 -05:00
Samir Patel
21969b1637 Add unit test 2021-10-29 16:52:09 -05:00
reesporte
4a18973274 use prettier to format changed files 2021-10-29 16:16:59 -05:00
reesporte
77e8d6cdc9 Merge branch 'sup-85' of github.com:molecula/featurebase into sup-85 2021-10-29 16:06:35 -05:00
reesporte
ad0b6db841 refactor css as import 2021-10-29 16:04:58 -05:00
Todd Gruben
2d33c40a50 maybe without before? 2021-10-29 15:08:09 -05:00
Todd Gruben
7ca714e6d1 added the linter back to circle 2021-10-29 13:50:41 -05:00
Todd Gruben
2ddcbce8ad fix govet and gofmt errors in existing code 2021-10-29 13:14:27 -05:00
Todd Gruben
8af9cfbb7d removed --new check 2021-10-29 13:14:27 -05:00
Todd Gruben
396e1e6433 . 2021-10-29 13:14:27 -05:00
Todd Gruben
21283e123f remove timeout 2021-10-29 13:14:27 -05:00
Todd Gruben
ac3445b8a5 disable lint on circleci 2021-10-29 13:14:27 -05:00
Todd Gruben
6d6cf655c5 clean gofmt 2021-10-29 13:14:27 -05:00
Todd Gruben
36fa27e2a2 limit linters to only specified 2021-10-29 13:14:27 -05:00
Todd Gruben
113c6bc21a cleanup gofmt 2021-10-29 13:14:27 -05:00
Todd Gruben
2b03c97a38 only run latest try2 2021-10-29 13:14:27 -05:00
Todd Gruben
d1baac6239 only check for new issues 2021-10-29 13:14:27 -05:00
Todd Gruben
f4a47346b0 add golangci-lint to gitlab pipeline. Currently gofmt and govet 2021-10-29 13:14:27 -05:00
Todd Gruben
7e14008ed8 add golangci-lint to gitlab container 2021-10-29 13:14:27 -05:00
reese
86e7058c8c
Merge branch 'master' into sup-85 2021-10-29 12:32:56 -05:00
seebs
84f6a5570f
Merge pull request #1747 from molecula/gopsutilupg
uprev gopsutil
2021-10-29 12:14:11 -05:00
reesporte
f04cb01e5d meaningless commit 2021-10-29 11:56:09 -05:00
reesporte
e520277c71 please work holy moly 2021-10-29 11:33:40 -05:00
reesporte
ff43570881 hopefully this works 2021-10-29 10:32:32 -05:00
reesporte
029fad1fb7 hopefully this works to set up test coverage 2021-10-29 09:34:25 -05:00
reesporte
f6de92ecda set up jest test coverage in gitlab ci 2021-10-29 09:17:12 -05:00
reesporte
8bf4d196e6 set up jest test coverage in gitlab ci 2021-10-29 08:31:08 -05:00
reesporte
04642dad0f hopefully sets up jest test coverage in gitlab 2021-10-29 08:17:10 -05:00
reesporte
ae69ad0d4e add artifact path(s) 2021-10-28 16:21:58 -05:00
reesporte
cdbfcef0eb hopefully updates the ci pipeline to run jest
i updated the gitlab ci pipeline so that hopefully it will run jest coverage stuff for sonar
2021-10-28 16:19:03 -05:00
reesporte
5b869c2810 Merge branch 'sup-85' of github.com:molecula/featurebase into sup-85 2021-10-28 15:16:04 -05:00
reesporte
5ef7975475 refactor and add tests 2021-10-28 15:15:43 -05:00
Seebs
360f161303 uprev gopsutil
The old revision emits a warning on MacOS X that looks concerning, and
even though it's actually mostly-harmless, it is an annoyance.

Also run `go mod tidy` which affected go.sum.
2021-10-28 14:08:13 -05:00
reese
327b358bd2
Merge branch 'master' into sup-85 2021-10-28 13:48:20 -05:00
reesporte
aadfc63bf0 add quotes around strings 2021-10-28 13:45:07 -05:00
Matthew Jaffee
06714aa601
Merge pull request #1744 from molecula/SUP-76-stop-fsyncs
don't fsync on RBF Open if WAL is empty
2021-10-28 13:20:41 -05:00
reesporte
b66a0316e6 Merge branch 'upgrade-node' of github.com:molecula/featurebase into upgrade-node 2021-10-28 11:30:42 -05:00
Samir Patel
b787fccf3a Add cmd option to disable cardinality calc 2021-10-28 10:25:26 -05:00
Matthew Jaffee
c3e14cb9ae don't fsync on RBF Open if WAL is empty
This is targeted at reducing startup times, especially on OSX where
the fsync calls seem to be taking an egregiously long time. I got one
index to go from ~1min to open to ~1sec. This looks safe to me, but
will get opinions from RBF experts.
2021-10-28 09:43:32 -05:00
reese
115b1a9c6a
Merge pull request #1742 from molecula/sup-81
remove shards list from error message entirely
2021-10-28 09:42:57 -05:00
reesporte
968ce78c73 remove ShardSlice entirely 2021-10-27 17:05:56 -05:00
reesporte
bc44f9b8d1 remove shards list from error message entirely 2021-10-27 16:45:17 -05:00
Stephanie Yang
10f235dac1 attempt to upgrade node (to v14) and node-sass (to v4.14) 2021-10-27 13:00:40 -05:00
reese
469791a670
Merge pull request #1739 from molecula/sup-81
[SUP-81] wrap shards list in ShardSlice for prettier output in error messages
2021-10-26 16:04:48 -05:00
reesporte
eb8460c291 wrap shards in error message as ShardSlice for pretty output 2021-10-26 15:39:52 -05:00
reesporte
7c885c8130 export ShardSlice 2021-10-26 15:39:06 -05:00
seebs
6cb9ce0315
Merge pull request #1731 from molecula/core930
[FB-930] remove bolt backend, bluegreentx, and a ton of unused API surface
2021-10-26 13:37:16 -05:00
Seebs
ad30a926f4 Giant Commit: drop a bunch of stuff we don't use.
These commits are hard to disentagle, and doing them separately means
re-modifying the same chunks of code several times before removing it,
and similar things.

Basically:
(1) Drop the bolt backend storage.
(2) Drop the blue-green wrapper that compares two backends.
(3) Drop unused or barely-used Tx API components from all the
remaining backends.
(4) Minor related cleanup to simplify things related to these.

The boltdb backend existed only to verify RBF. The blue-green wrapper
was mostly used to verify RBF, but in practice we had to do a lot
of working around that, and it introduced a lot of special cases.

Types removed:

IteratorFinder: Used only to implement the roaring iterator
on top of boltdb, and to complicate the way it worked in roaring.
Reverted the complications. Also unexport NewSliceContainers
which is used only for that outside of roaring's internals.

PortMapper from cluster_internal_test.go: Used only for a test
we removed early this year. Never used for anything else.

RawRoaringData: Totally unused.

TxStore: Totally unused.

Functions removed from Tx API, and sometimes corresponding
members were removed from structs:

* Dump: debugging code, I don't think I found any actually reachable
  paths to it.
* Group: only used for debugging TxGroup stuff
* IncrementOpN: only used by fragment, fragment can increment its
  own opN.
* Options: unused?
* Pointer: debugging only
* Readonly: used only to decide how to handle Tx in a TxGrp,
  but we never add a non-readonly Tx to a TxGrp. Removed also all
  the corresponding write-aware stuff.
* RoaringBitmapReader: Used exactly once, can just be a bm.WriteTo.
* Sn (and OpenSnList): Unused
* UnionInPlace: unused and conceptually-invalid; it didn't write
  to storage and shouldn't have, and was just "create a bitmap
  then call union-in-place", which we can do directly.
* UseRowCache: just checked storage.UseRowCache.

Other things removed:

The SetRequiredForAtomicWriteTx and ClearRequiredForAtomicWriteTx
functions go away, since nothing now seems to be using them? Same
for holder_internal_test's `testHasBit` and `testMustNotHaveBit`,
which were unused.

The DBPerShard "DeleteDBPath" and "HasData" functions and related
parts were mostly unused; took out the parts that were never
actually being reached.

Changed the API of one function to simplify special cases and
remove things:
* ImportRoaringBits had a special "data" argument which gave it
  subtly different semantics for RBF and roaring (for roaring, it
  could produce a roaring bitmap *with ops log*), didn't seem to
  be adding much. Removed corresponding "readStorageFromArchive"
  which is not otherwise used.

Also took out various debugging/dumping functions that were unused
and may have bitrotted.

Dropped a test from txfactory_internal_test, and the "pjobs"
code, because those two were the only things that needed Barrier
and thus idem, which lets us drop two more dependencies. We already
have errgroup for grouping things which want to terminate as
soon as one of them errors, approximately. To do better we'd have
to have context-threading, really.

Unbroke the WriteFragment test for non-roaring tests and made it
not roaring-only.
2021-10-26 12:30:25 -05:00
Seebs
ecd0ecc6d1 add featurebase to .gitignore
we ignored pilosa binaries but we've renamed so now the binary is named
featurebase.
2021-10-26 09:15:44 -05:00
Seebs
dc8702ea3e use testhook auditor to track Qcx open/close
This also requires doing something to keep the TxGroup in each Qcx
from holding its Tx references after the Qcx closes, because otherwise
the list of Qcxs that we keep to verify that they all got closed ends
up keeping every shared/read-only Tx open forever, resulting in many
gigabytes of memory usage when running with the race detector.  To
avoid having to reason about whether anything would ever access a nil
TxGroup, or run through iteratively zeroing maps, we just make a new
empty group at that point.
2021-10-26 09:13:53 -05:00
reese
53b7d9e210
Merge pull request #1736 from molecula/time-estimate-rules
SUP-75: Change time estimation to use avg time per message
2021-10-25 15:42:09 -05:00
reesporte
d51c6b950f meaningless commit to kick off sonarcloud with new rules 2021-10-25 15:24:55 -05:00
reesporte
d934d117da add test case names 2021-10-22 14:52:57 -05:00
reesporte
5dd4b0e048 rename vars to more sensible names 2021-10-22 14:49:05 -05:00
reesporte
bd0d68b2fd rename function, return pctDone 2021-10-22 12:54:46 -05:00
reesporte
681ed9923d add license header 2021-10-22 11:29:09 -05:00
reesporte
0f108a612d refactor and add unit tests 2021-10-22 11:25:03 -05:00
reesporte
45e36600f3 don't include .*.swp 2021-10-22 10:49:07 -05:00
Samir Patel
c9d25909be cleanup 2021-10-21 16:27:43 -05:00
Samir Patel
3a83537b5e Merge branch 'CI/build-containers' of github.com:molecula/featurebase into CI/build-containers 2021-10-21 16:27:12 -05:00
Samir Patel
44148ed79d Build featurebase docker image in CI.
Add to registry.
2021-10-21 16:20:07 -05:00
reesporte
7102de9f60 off by one error fixed 2021-10-21 16:19:57 -05:00
Samir Patel
64fd686ec4 tag with slug and sha 2021-10-21 15:46:02 -05:00
Samir Patel
b1ee2c7a59 same 2021-10-21 15:25:52 -05:00
Samir Patel
3cf8f9db5e change tag 2021-10-21 15:18:13 -05:00
reesporte
27515a3f98 number of sent messages is just i silly 2021-10-21 14:24:27 -05:00
Samir Patel
e1945bcf1c change commit name to commit slug 2021-10-21 14:20:51 -05:00
Samir Patel
fba75f1a0c same 2021-10-21 14:16:08 -05:00
Samir Patel
2517e11afd try without mv 2021-10-21 14:09:29 -05:00
Samir Patel
c1746fae5b add login 2021-10-21 13:33:21 -05:00
reesporte
adf3e528f5 Change time estimation to use avg time per message
In [SUP-75](https://molecula.atlassian.net/browse/SUP-75?atlOrigin=eyJpIjoiYmU5MzdkMmUyZTAyNGQ2Y2IzMDMzYTgzMDU2Y2ZhNmMiLCJwIjoiaiJ9) Allen
pointed out that the time estimation is really good for the first couple lines of output, but gets exponentially worse as execution continues.

After looking into it, it looks like we’re currently using a heuristic based on the amount of messages processed in the previous
second(ish) which is what results in that sort of exponential drop off.

To remedy this, I adjusted the time estimation calculation to use the average time per message up to the point of calculating the new
estimate to ideally improve estimates over time, with the trade-off of a potentially less accurate estimate to begin with.
2021-10-21 13:09:24 -05:00
Samir Patel
9669745de6 change tag 2021-10-21 12:04:31 -05:00
Samir Patel
466c5a5627 same 2021-10-21 12:00:47 -05:00
Samir Patel
841e79f343 same 2021-10-21 11:51:26 -05:00
Samir Patel
7e1b629504 change docker push url 2021-10-21 11:33:34 -05:00
Samir Patel
30fb649126 make directory changes 2021-10-21 11:18:42 -05:00
Samir Patel
3aec5fd9de print more stuff 2021-10-21 09:38:42 -05:00
Samir Patel
5f152af53a print stuff 2021-10-21 09:17:29 -05:00
Samir Patel
7cde102944 move binary to gitlab 2021-10-21 08:48:02 -05:00
Samir Patel
4ec0f7428a change dir 2021-10-20 19:10:25 -05:00
Samir Patel
adcbc4c801 add -f flag 2021-10-20 18:06:30 -05:00
Samir Patel
2839ef53c9 add dir 2021-10-20 17:30:13 -05:00
Samir Patel
3fcdc6ff9e same 2021-10-20 17:11:03 -05:00
Samir Patel
7b39ab2bbd same 2021-10-20 17:09:34 -05:00
Samir Patel
00b6c2ff8a change dockerfile path 2021-10-20 16:59:03 -05:00
Samir Patel
dd56bdf645 runs after linux arm64 build 2021-10-20 16:50:35 -05:00
Samir Patel
34a04d276e change path to bin 2021-10-20 16:38:07 -05:00
Samir Patel
686f3a8684 remove lattice from dockerfile 2021-10-20 16:23:20 -05:00
Samir Patel
225b4a7a58 try with shell runner instead of dind 2021-10-20 15:17:23 -05:00
Samir Patel
554d3f1e35 same5 2021-10-20 14:34:24 -05:00
Samir Patel
5b0244e228 same4 2021-10-20 14:15:07 -05:00
Samir Patel
bde29ec792 same3 2021-10-20 14:01:05 -05:00
Samir Patel
35dc4aa07a same2 2021-10-20 13:47:29 -05:00
Samir Patel
93a5cab3fc same 2021-10-20 13:05:14 -05:00
Samir Patel
86c45fba1c same 2021-10-20 12:49:49 -05:00
Samir Patel
9e2992424d same 2021-10-20 12:41:38 -05:00
Samir Patel
e2f3a645c1 try to fix yml syntax 2021-10-20 12:28:26 -05:00
Samir Patel
aa0d5040e5 remove @ from yaml 2021-10-20 12:21:05 -05:00
Samir Patel
a83b7f64a0 tests if docker gets built in gitlab 2021-10-20 11:20:20 -05:00
Fletcher Haynes
3605449b53
Merge pull request #1734 from molecula/gitlab
Migrated Cloud Build to GitLab
2021-10-15 10:07:31 -07:00
Fletcher Haynes
72a2689e4c Migrated Cloud Build to GitLab
This adds in a config YAML file for gitlab
2021-10-14 18:37:06 -07:00
nagamocha3000
263a5b86c9
Merge pull request #1733 from nagamocha3000/core-919-field-deadlock
CORE-919 Fix deadlock on field recreation after node restart
2021-10-14 18:20:25 +03:00
nagamocha3000
c6b7089332 Add comment as to why we are using os.Exit instead of panic 2021-10-14 18:07:02 +03:00
nagamocha3000
bce008df26 Fix deadlock on delete then recreate field after node restart 2021-10-14 17:04:09 +03:00
nagamocha3000
07a340ba9d Add test for deadlock on field recreation 2021-10-13 23:11:56 +03:00
tgruben
9d2d30feb7
Merge pull request #1718 from tgruben/sql2-type
Better type support in result set for looker (postgres) sql2 interface
2021-10-12 12:36:15 -05:00
Todd Gruben
4d4f64a339 address ben's comments 2021-10-12 11:21:14 -05:00
Todd Gruben
5d57d361f4 quite down 2021-10-12 10:50:03 -05:00
Todd Gruben
e4e0d13837 go mod tidy correction? 2021-10-12 10:40:32 -05:00
Todd Gruben
c4c7d91bf0 make linker happy 2021-10-12 10:24:19 -05:00
Todd Gruben
34dad863e2 wip 2021-10-12 10:20:24 -05:00
Todd Gruben
caee5680c3 wip 2021-10-12 10:20:24 -05:00
Todd Gruben
1a068cf0e2 added type support for looker; added intercept for yellowfin typelen query 2021-10-12 10:20:24 -05:00
Kasey C. Rodgers
c4a348724e
Merge pull request #1726 from molecula/csv-error-17
adds more detail to CSV ingest error message
2021-10-12 07:04:22 -07:00
Kasey C. Rodgers
25230693c5
Merge branch 'master' into csv-error-17 2021-10-08 13:55:58 -07:00
Kasey C. Rodgers
ded60af8c3
Update pilosa.go
Co-authored-by: Matthew Jaffee <jaffee@pilosa.com>
2021-10-08 13:46:17 -07:00
Fletcher Haynes
276dab6d12
Merge pull request #1728 from molecula/cicd
Added in various CI files
2021-10-08 12:39:08 -07:00
Fletcher Haynes
6eefd2d1f0
Merge branch 'master' into cicd 2021-10-08 12:18:26 -07:00
Fletcher Haynes
155855d97f Added in various CI files
This adds in configs for Cloud Build, Artifactory, and GitLab CI/CD.
2021-10-08 12:16:03 -07:00
tgruben
746212f63f
Merge pull request #1727 from tgruben/wip-partial-restore
partial backup/restore
2021-10-08 12:58:33 -05:00
Todd Gruben
71f1e6f1dd linter 2021-10-08 12:20:53 -05:00
kcrodgers24
b2c73b6a41 changes error message text for additional clarity 2021-10-08 09:47:16 -07:00
Todd Gruben
786bebe58b partial backup/restore 2021-10-08 10:50:52 -05:00
kcrodgers24
1f257aab9c adds more detail to CSV ingest error message 2021-10-08 08:27:49 -07:00
Ben Johnson
0d548094eb
Merge pull request #1724 from molecula/sql-inner-join
CORE-809: Aggregate COUNT() with INNER JOIN
2021-10-07 14:56:28 -06:00
Ben Johnson
98e7ade591 CORE-809: Aggregate COUNT() with INNER JOIN 2021-10-07 14:20:07 -06:00
seebs
39aa12b12a
Merge pull request #1723 from molecula/seebs/genfix
don't close storage after failing to open cache
2021-10-01 15:52:42 -05:00
Seebs
8433f81b68 don't close storage after failing to open cache
If the inner function that handles the open of storage and cache
fails, we close the fragment. If we closeStorage() before that,
then we can try to close the storage again, which causes a panic
when we try to mark the generation as Done again.

I was going to set f.gen = nil after marking it done, but I'm
not feeling safe about that -- there's too many places where
we check things about f.gen, and it seems unsafe. The generation
code should be removed at some point, because it all exists
as a workaround for not having any way to detect when reads are
"done", because we didn't want to do something huge and intrusive,
like adding the Tx system and requiring transactions to get
closed.
2021-10-01 11:02:45 -05:00
seebs
8ed922d30e
Merge pull request #1720 from molecula/fsync
Fsync
2021-10-01 10:58:13 -05:00
Seebs
9db87f78d0 fix go.mod/go.sum 2021-10-01 10:45:08 -05:00
Seebs
214a1492a8 kill off a ton more fsyncs
Performance of tests on MacOS has been atrocious for a while, and
a lot of that is fsync, so we're trying to make that optional.

To test all of this, I modified RBF to panic if anything tried to
open an RBF database without disabling fsync, and ran the tests that
way, and tracked down the various places this could still happen.

There's a lot of places in our tree where we were creating
test holders which were not getting created with fsync disabled, which
results in a surprisingly large number of points at which we end
up calling fsync in tests, which makes tests much slower than they
need to be. There's also a bunch of places where the flags don't get
propagated correctly; for instance, storage.fsync didn't propagate
to the RBFConfig.

We add an "fsync enabled" flag to OpenTranslateStoreFunc, so we can
tell translation stores that we don't need syncing, so the server's
config can be passed on appropriately.

More of the test code that sets things up is correctly configuring
that flag by default.

We also change the barely-used bolt storage backend to support this as
well.

With this done, the only calls to fsync left in a run of `go test -short`
in the top-level directory are from the zap logger in etcd, and consumed
around 0.03 seconds. The overall impact is that `go test -short`
went from "takes enough more than 10 minutes that i don't know how long
it takes" to about 2.5 minutes.
2021-10-01 10:45:08 -05:00
Seebs
e774acb4a0 disable a few more fsyncs in boltdb
boltdb has a couple of places where it fsyncs even when fsync is
disabled, this turns out to cost an amazing amount of time over
several thousand databases in our test run. In theory, they are
rare circumstances compared to updates; in practice, when you
open 256 partition key translation databases per server opened
and most of them never get written to, not so much.
2021-10-01 10:45:08 -05:00
Seebs
9ac4a5a8f4 don't necessarily fsync RBF databases even on close when fsync is disabled
In test runs, we open, and close, *huge* numbers of databases. Even
the single fsync on close for these ends up being expensive on some
hosts. *cough* Apple. At least in theory, writes delivered to the
disk are just as written whether or not you've hit fsync, as long
as the machine doesn't power off before getting to them. In the
circumstances where we disable fsync, that's fine.

Since we already have an fsync function for "fsync if it's
not disabled", use that.
2021-10-01 10:45:08 -05:00
Seebs
d5b61ee8e8 reduce etcd fsyncs during testing
We disable fsync more consistently in testing, including using
etcd's already-existing UnsafeNoFsync option to disable fsyncs
in the backing store boltdb used by etcd, to reduce runtime of
our tests on MacOS significantly.

Corresponding to this, we update etcd by one patch to pick
up a locally-invented patch which turns out to be nearly-identical
to the upstream fix for "disabling fsync makes boltdb not
even bother to write some data sometimes", which caused crashes
galore.
2021-10-01 10:45:08 -05:00
Samir Patel
231e11ffe8
Merge pull request #1719 from 54mir/54mir/log-roaring-migrate
CORE-874 Add darwin build to roaring-migrate-tool
2021-10-01 10:35:22 -05:00
tgruben
c750717f50
Merge branch 'master' into 54mir/log-roaring-migrate 2021-10-01 10:02:46 -05:00
nagamocha3000
7a597610e2
Merge pull request #1710 from nagamocha3000/core-849-prevent-node-from-blocking-replication-process
CORE-849 Test paused node picks up once cluster state is back to normal
2021-09-30 21:07:48 +03:00
nagamocha3000
c24a5e77ba Test paused node picks up once cluster state is back to normal
This adds the following test:
1. cluster comes up (node 1,2,3), status normal
2. Pause node 3
3. Insert keys making sure to filter out the keys that will go to the paused node
4. Wait for status to become degraded
5. Unpause node 3
6. Wait for status to get back to normal
7. Check that keys were replicated to all 3 nodes
2021-09-30 20:48:01 +03:00
seebs
4648aa9477
Merge pull request #1713 from molecula/seebs/core829
rework executor's per-shard union to use UnionInPlace
2021-09-30 11:26:31 -05:00
Samir Patel
a845d93a25 Add license headers 2021-09-30 09:28:33 -05:00
Samir Patel
5d070b47bb clean up 2021-09-29 15:57:31 -05:00
Samir Patel
feb8997ca8 Add darwin build to roaring-migrate-tool 2021-09-29 15:42:50 -05:00
Seebs
3ef25e4a16 rework executor's per-shard union to use UnionInPlace
The actual code here is mostly jaffee's, but I've reworked it some.

This doesn't directly seem to be using UnionInPlace, but really it
is.

The actual logic inside (*Row).Union is a mess and probably silly
in a few ways, but hardly matters. The important part is that,
instead of calling it once per child as we get them, we gather
all of them at once and then call it on all of them. That gets
us a call to (*Row).Union that does a very elaborate dance to
compute a call to (*rowSegment).Union on the only segment present
in each of those rows, which then does a simpler thing to
call (*Bitmap).Union() with the first response as a receiver
and the rest as parameters, and THAT then ends up calling either
unionIntoTargetSingle() if there's only one other bitmap,
or using UnionInPlace on a Freeze() of the first bitmap, which
gets us (we hope) the benefits of the fancy UnionInPlace logic.

Every part of this is a reminder that we really need to replace
roaring and also the Row/rowSegment stuff some day.
2021-09-29 11:31:13 -05:00
souhailanoor
e5479390b8
Merge pull request #1717 from molecula/CORE-844_webUI_rename
CORE-844: remove Pilosa name and website from curl handler for webUI endpoints
2021-09-28 17:23:51 -05:00
souhailanoor
68d1126ac9
Merge branch 'master' into CORE-844_webUI_rename 2021-09-28 17:12:16 -05:00
Souhaila Noor
49e8c1c69f undid the changes pushed earlier for incrementing the release version 2021-09-28 16:59:54 -05:00
Souhaila Noor
3fe28ca7b9 renamed webUI from Pilosa to FeatureBase and updated version 2021-09-28 16:34:52 -05:00
Ben Johnson
938c425d80
Merge pull request #1716 from molecula/sql-scan
CORE-860: Allow StmtRows.Scan() for more types
2021-09-28 15:06:35 -06:00
tgruben
7cf5e5c804
Merge branch 'master' into sql-scan 2021-09-28 15:52:41 -05:00
Ben Johnson
b7126a5859 Allow StmtRows.Scan() for more types 2021-09-28 13:16:24 -06:00
tgruben
f0b93da070
Merge pull request #1715 from tgruben/cleanup-query
addsql version to handler
2021-09-27 16:37:04 -05:00
tgruben
8861e4528a
Merge branch 'master' into cleanup-query 2021-09-27 16:24:06 -05:00
seebs
8fd6ebc8da
Merge pull request #1711 from molecula/seebs/clusterIngest
CORE-826: cluster support for ingest API
2021-09-27 16:22:37 -05:00
Todd Gruben
79c066a9a0 mod tidy fun 2021-09-27 16:11:27 -05:00
Todd Gruben
2b36625081 missed test handler 2021-09-27 16:04:40 -05:00
Todd Gruben
51876b1821 addsql version to handler 2021-09-27 15:42:14 -05:00
Seebs
02d3d24bc5 code review cleanup 2021-09-27 12:05:57 -05:00
Seebs
12882ad147 handle replication
I assumed the existing import code handled replicas. It doesn't, actually.
It just assumes they're handled. So, in the new import code, when splitting
things up by-shard, send each shard's data to *every* node that has
that shard, not just the first one.
2021-09-27 12:05:57 -05:00
Seebs
b3f82ac894 return early on error instead of writing success status also 2021-09-27 12:05:57 -05:00
Seebs
b41f3554da move stableTranslator into test code
It was useful having this in the package to verify code coverage of
the translator, but that having been verified, I'd sort of rather have
it NOT live in the package at all, it's really a testing-only kind
of thing.
2021-09-27 12:05:57 -05:00
Seebs
4bab752fa7 improve comments 2021-09-27 12:05:57 -05:00
Seebs
b78ce29a3e unexport ShardedRequest.Merge
This function absolutely shouldn't be used outside of testing, so I've
made the tests using it internal tests and unexported the method.
2021-09-27 12:05:57 -05:00
Seebs
610c4ed6cb introduce protobuf types for ingest ops
We add a new protobuf type. Also, protoc changed slightly and remade
some tests, in a way which should have no effects but makes the code
*very* slightly cleaner.

This introduces the first testing code in encoding/proto (whoops)
so that scaffolding is a first draft; if you're looking at this code
and the design is a problem go ahead and fix it.

The purpose of this is to verify that we're actually covering all
the branches in the ingest.ShardedRequest and pb.ShardedIngestRequest
message conversions. (Except the top-level one for a nil request,
which isn't checked by this.)

The coverage report doesn't actually include coverage for the ingest
code, though, so we haven't actually properly tested Compare.
Baby steps!
2021-09-27 12:05:57 -05:00
Seebs
9f271467fb ingest cluster support
We add endpoints and protobuf encode/decode to allow for sending
sharded requests over the wire in protobuf, so we can take our
sharded data and send it to other nodes if needed.

This is a squash of >15 other commits, so a bit of history
is relevant:

The Request type had FieldTypes in it because the field type
information was needed for sharding because sorting requires
that information. We change this around to make the external
sharding operation require the field types, and curry that
through the codec -- the codec is needed to tell the request
how it shards. (This is because the correct sorting order
varies by field type.) Requests (and ShardedRequests) no
longer have that table in them.

And then we hit a nasty bug in production and RCA showed
that our testing wasn't good enough and we need to be more
careful, and I discovered that test coverage in this package
was around 70%.

So, the other big thing here is coverage testing; in order to
make coverage testing viable and programmatically testable,
we have added the ability to render requests *back* to
JSON. This is not a great idea, but it does allow us to do
a lot of sanity-checking and verify that the encodings we're
using are consistent and correct.

This, plus some specific tests of decoding specific flawed
inputs, has caught a number of issues. Which are now fixed!

A lot of internal API surface got slightly changed, in ways
that make it simpler to work with. For instance, the
(*FieldOperation).TranslateUnsigned function doesn't really
need to exist; we can just have a non-method translate
function for unsigned and for signed, and use them based on
field type.

The stable translation hack used for testing had a bug that
could allow it to end up producing incorrect results if you
asked it to translate an ID first rather than exclusively
asking it to translate strings first, this has been
corrected. (This is a bug fix in code that was added
partway through creating this, but is tricky enough to
mention its own comment.)

Test coverage is now just over 90%, and a lot of what's left
is error-check returns that may well be actually unreachable
unless, say, the documentation for encoding/json is full of
lies. Which it probably is.
2021-09-27 12:05:57 -05:00
tgruben
214ae4dfac
Merge pull request #1696 from tgruben/looker-count
[CORE-838] Looker Integration
2021-09-27 09:48:31 -05:00
Todd Gruben
c2caa63978 tidy 2021-09-27 08:20:03 -05:00
Todd Gruben
ed1cf7ffef cleanup and applied review suggestions 2021-09-27 07:05:08 -05:00
Todd Gruben
0920c4c029 silence and rebase 2021-09-25 14:06:55 -05:00
Todd Gruben
c4e64528e0 fix 2021-09-25 13:56:36 -05:00
Todd Gruben
2053319db0 silence reporting 2021-09-25 13:53:19 -05:00
Todd Gruben
3baf15226e make lookPQL a package var 2021-09-25 13:53:19 -05:00
Todd Gruben
fc339b9a62 skipp looker comments on PQL 2021-09-25 13:53:19 -05:00
Todd Gruben
5bc1364cdb wip 2021-09-25 13:53:19 -05:00
Todd Gruben
d6dd1e025b removed extra command complete message
cleanup
2021-09-25 13:53:19 -05:00
Todd Gruben
5176b7ff03 added sqlversion config option 2021-09-25 13:53:19 -05:00
Todd Gruben
2ca7b107d2 removed client1 from clustertests 2021-09-25 13:53:19 -05:00
Todd Gruben
9c8538ec5a docker fix not really related to anything 2021-09-25 13:53:19 -05:00
Todd Gruben
c56fd33924 wip 2021-09-25 13:51:02 -05:00
Todd Gruben
419d1ed05d linter cleanup 2021-09-25 13:51:02 -05:00
Todd Gruben
95dc4a1a50 basic looker connection tests pass
sql1 pass through works
2021-09-25 13:51:02 -05:00
Ben Johnson
ab8c42bfd9
Merge pull request #1714 from molecula/sql-col-mapping
CORE-860: Fix SQL column mappings
2021-09-25 11:23:40 -06:00
Ben Johnson
1527eea14b Fix SQL column mappings 2021-09-25 09:36:11 -06:00
Ben Johnson
9f50689509
Merge pull request #1712 from molecula/sql-type-check
Add SQL type checker
2021-09-24 17:07:52 -06:00
Ben Johnson
ff8f0cab96 Add SQL type checking 2021-09-24 14:02:20 -06:00
Samir Patel
ab5e7d4195
Merge pull request #1709 from 54mir/54mir/rename-pilosa-docker2
CORE-859 CORE-839 Rename docker builds to featurebase (with docker fix)
2021-09-23 10:46:50 -05:00
Samir Patel
3403f2f621 Merge branch '54mir/rename-pilosa-docker2' of github.com:54mir/pilosa into 54mir/rename-pilosa-docker2 2021-09-23 10:17:31 -05:00
Samir Patel
5324431ab0 Rename pilosa to featurebase 2021-09-23 10:16:14 -05:00
tgruben
db5143b7af
Merge branch 'master' into 54mir/rename-pilosa-docker2 2021-09-23 10:03:53 -05:00
Matthew Jaffee
930ec3a403
Merge pull request #1672 from jaffee/better-mmap-error
better explanation for 'cannot allocate memory' error
2021-09-23 09:10:09 -05:00
Matthew Jaffee
693606fa80 better explanation for 'cannot allocate memory' error 2021-09-23 08:32:12 -05:00
Samir Patel
839dd1cd43 Remove prints 2021-09-22 16:02:02 -05:00
Samir Patel
4699c840bc More rename to work with backup and cluster tests 2021-09-22 15:41:17 -05:00
Samir Patel
746ffd4bd1 Rename in docker-tag-push 2021-09-22 15:41:09 -05:00
Samir Patel
0ec855766c Rename in make docker-image 2021-09-22 15:41:05 -05:00
Samir Patel
3ca15cc3c4 Rename docker builds to featurebase 2021-09-22 15:41:00 -05:00
Samir Patel
44897d9310 docker fix 2021-09-22 15:35:52 -05:00
Ben Johnson
14fdfe478b
Merge pull request #1708 from molecula/sql-comment
CORE-860: Handle SQL comments during scan
2021-09-21 08:58:23 -06:00
Ben Johnson
ac022ce0ab CORE-860: Handle SQL comments during scan 2021-09-21 08:29:30 -06:00
Ben Johnson
521e4cadb1
Merge pull request #1707 from molecula/sql-group-by
CORE-830: Implement SQL GROUP BY
2021-09-20 08:28:27 -06:00
Ben Johnson
b4cbd45b84 Implement SQL GROUP BY 2021-09-19 08:45:35 -06:00
Matthew Jaffee
0452237b24
Merge pull request #1702 from seebs/bitmapRun
callback logic fixes for intersectionCallback and containerCallback
2021-09-16 16:06:08 -05:00
Matthew Jaffee
3e222d8771 tweak to locking which should avoid stall/deadlock w/ mutex check
The view.go change is straightforward and fairly obviously more
correct.

The field.go change avoids holding the field read lock for the
duration of the mutex check request. The thinking was that while the
read lock was held something else was attempting to get a write lock,
which blocked all other read locks and something was getting into a
loop. Seebs might have a more detailed explanation, but that's as far
as my understanding goes at the moment. I believe this change is safe
though as we don't read/modify any field level data structures after
grabbing the standard view.
2021-09-16 14:07:31 -05:00
Seebs
e7e3331fb4 test intersectionCallback more carefully
This takes our reasonably broad selection of predefined container
types and tries intersectionCallback on each pair of them, comparing
results against the results of plain old intersect(). We've had
several intersectionCallback fixes recently; every one of them
produces test failures here if reverted or broken, so I have at
least some confidence in this coverage.

Similarly, test everything on containerCallback, verifying that
we get the same set of values called back that we get from Slice().

Both of these were verified with -coverprofile to actually be
hitting all the lines of code that aren't insane edge case
checks like "what if a run is in the wrong order".
2021-09-16 14:05:35 -05:00
Seebs
12244dcbed record stats for intersectionCallback under the right name 2021-09-16 14:05:35 -05:00
Seebs
e0dfde9934 appease gofmt 2021-09-16 14:05:35 -05:00
Seebs
3ae12391c7 callback logic fixes for intersectionCallback and containerCallback
The inner loop of intersectionCallbackArrayArray's "fast"
case has
	for len(ca) > 0 && ca[0] < va {
	}
so we do not leave that loop unless len(ca) is 0, or
ca[0] >= va.

We then return from the whole function if len(ca) is 0,
so the only way we finish one iteration of the outer for
loop is if ca[0] >= va. Thus, this can be an `if` rather
than a `for`.

We also fix the logic for ArrayRun to make it require fewer
tests and be clearer about why the tests work and clearer about
always making progress.

And, finally, the bitmap/range callback logic, and the underlying
"callback per bit in word" logic, were both badly broken. In
particular, if a range started and ended in the same word, it would
hit the values in that word twice, once with them incorrectly
shifted, but then it would further garble any offsets past the first
in a word. Eww.
2021-09-16 14:05:35 -05:00
rachithrr
cd1e17d0ba
Merge pull request #1695 from rachithrr/decimal-groupby-added
CORE-777: Added DecimalAgg field in GroupCount to output decimal sum
2021-09-16 10:49:57 -05:00
rachithrr
9e84647e63
Merge branch 'master' into decimal-groupby-added 2021-09-16 09:49:31 -05:00
rachithrr
f549dae625 CORE-777: Added DecimalAgg field in GroupCount to output decimal sum
-created groupCountDecimal
-added test
2021-09-16 09:43:13 -05:00
Kasey C. Rodgers
61c6ffced8
Merge pull request #1690 from molecula/supportARM64-799
add support for ARM64 [CORE-799]
2021-09-14 08:07:09 -07:00
Kasey C. Rodgers
2ae1de8ad6 Update Makefile
corrected typo in docker-release section
2021-09-14 07:31:23 -07:00
kcrodgers24
efcb0768db wip 2021-09-14 07:31:23 -07:00
kcrodgers24
ba10b3dfde add support for ARM64 2021-09-14 07:31:23 -07:00
seebs
1b3e441645
Merge pull request #1697 from seebs/mutexFix
add clusters to MutexCheck test, fix silly bug revealed by doing so
2021-09-14 09:07:56 -05:00
tgruben
66871c70a8
Merge branch 'master' into mutexFix 2021-09-14 08:27:02 -05:00
nagamocha3000
248ec8ebff
Merge pull request #1677 from nagamocha3000/ha_key_translation
CORE-837 Perform partial replication for index keys
2021-09-14 10:53:44 +03:00
nagamocha3000
575854df8a Make index-key replication more resilient to network failures 2021-09-14 03:12:52 +03:00
Seebs
72444f3b87 add clusters to MutexCheck test, fix silly bug revealed by doing so
The merge lists behavior was flawed in that it would drop one item
from the list per merge, which means that, with high replication
and low number of distinct items, it could even produce an empty
list.

The actual "is there anything wrong" logic is fine, but the list of
clashing values set for a given record is not.

Unfortunately this also doubles the time the test takes, to
21 seconds on MacOS. OW.
2021-09-13 16:25:15 -05:00
seebs
0d568b0d52
Merge pull request #1687 from seebs/core850
make details optional and support limits on mutex checks
2021-09-09 16:17:53 -05:00
Seebs
e27085da66 check context occasionally while processing mutex check results
It's hard to do this remotely sanely for the fragments, but the
translation and collation process itself could be fairly slow on
large data sets, so we should check occasionally for canceled
context and return early if no one needs the result anyway.

Also, take out no-longer-correct comments from the test case.
2021-09-08 13:47:15 -05:00
Seebs
26d38c0ee0 make details optional and support limits on mutex checks
We support query parameters for details (default false) which
request additional data, and for a limit (default 0/MaxInt32)
on number of results returned to limit the amount of spam
produced if there's a lot of results. The simpler default
output should reduce load and runtime significantly, and the
ability to specify limits makes it easier to get reasonably
small responses.

There's some context support here, but the underlying filters
don't take contexts or check for them, which is probably
a flaw but might be a bit large to correct for this.
Despite being large, this set of changes is actually
fairly well contained within the mutex-checking code.
2021-09-08 11:59:47 -05:00
Ben Johnson
484fcd8cf2
Merge pull request #1684 from molecula/sql-select
CORE-807: Implement non-aggregate SELECT query
2021-09-08 08:26:25 -06:00
Ben Johnson
92646cbdf7 Implement non-aggregate SELECT query 2021-09-08 08:09:54 -06:00
seebs
1586861ed2
Merge pull request #1685 from seebs/fewerSlowTests
drop rbf_bolt tests from CI
2021-09-07 16:41:17 -05:00
Seebs
37b55c190f drop rbf_bolt tests from CI
The rbf_bolt tests are unusually expensive, partially because they're
run with the race detector on, but also because it's basically running
two copies of all the tests and comparing them... But they haven't
detected anything in ages, because the RBF stuff is now pretty stable,
and those tests take about twice as long as anything else in our testing,
and thus impede our workflow noticably for little-to-no return. We might
some day want to fully remove them, but for now, just taking them out of
CI should streamline our workflows a bit.
2021-09-07 14:06:23 -05:00
seebs
a3368c64ab
Merge pull request #1681 from seebs/core850
mutex sanity-check endpoints to allow for checking possible mutex corruption
2021-09-07 14:02:44 -05:00
seebs
7586cc0724
Merge branch 'master' into core850 2021-09-07 13:11:31 -05:00
seebs
674fbadd0f
Merge pull request #1680 from seebs/mutexFixes
Mutex fixes -- these address a couple of cases in which mutexes could end up with duplicate values, and also improve the testing so they're more likely to get caught.
2021-09-07 13:11:22 -05:00
tgruben
2a3a5285de
Merge branch 'master' into mutexFixes 2021-09-07 12:45:04 -05:00
Seebs
b391ab9153 mutex sanity-check
This implements a fairly straightforward sanity-check for mutexes,
implemented as a bitmapfilter at the fragment level, and with higher
levels combining results. There's two endpoints, an internal endpoint
which only checks the local node's shards, and an external one which
forwards requests (using the internal endpoint) to all the other nodes.

The internal endpoint does not do key translation, the external one
does.

The transmission format is a probably-inefficient JSON blob, and
returns data separated per-shard so we don't have as much merging
work to do.

This introduces a horrifying monstrosity function which tries to
sneakily corrupt mutex fields and which has to be exported (EWWWWW)
but which is only present in _test code (!??!! THIS WORKS WHY).

Also one typo fix in unrelated code caused by not wanting to keep
fighting with gofmt about this.
2021-09-07 12:41:49 -05:00
rachithrr
5ae2abcfaa
Merge pull request #1682 from rachithrr/ingesttool
CORE-747: Build tooling to provide datagen-like functionality that uses the API
2021-09-03 12:55:55 -04:00
tgruben
170dda1145
Merge branch 'master' into ingesttool 2021-09-03 09:11:25 -05:00
rachithrr
43b34c7d84 CORE-747: Build tooling to provide datagen-like functionality that uses the API
Featurebase
2021-09-02 10:18:50 -04:00
Seebs
0701f9b7dd fix broken intersectionCallback functions
Two of the intersectionCallback functions were broken.

In intersectionCallbackArrayArray, when checking to see whether we can
skip ahead 8, we need to check whether that last value is lower than
the one we're looking for, not whether the first value is.

For intersectionCallbackArrayBitmap, actually implement it at all;
it had never gotten modified significantly from the original
intersectionCount, so it still counted and returned intersections, but
never called the callback at all.
2021-08-31 13:45:59 -05:00
Seebs
6dc8cd7b49 improve mutex import testing
When doing the import tests, import all the data sets if there's
multiple data sets, and check that we're producing the correct number of
results including overwriting previous values, not just that we produce
the same number of values that we set, which shouldn't happen if there's
any overlap.

Also add a specific test that triggers the case I first ran into this for.
2021-08-30 14:16:15 -05:00
Ben Johnson
408e3f84b3
Merge pull request #1679 from molecula/sql-where
CORE-808: Handle SQL WHERE clause
2021-08-26 08:44:15 -06:00
Ben Johnson
6bf854862b Handle SQL WHERE clause 2021-08-26 08:25:16 -06:00
seebs
397f90896b
Prototype ingest API
This is the prototype of the new JSON ingest API. It's not for external use yet, it's still experimental.
2021-08-20 13:26:36 -05:00
Seebs
bb1d52a385 ingest and ingest/codec testing work
This is a design to let us write test cases for ingest with schema setup
and data in the json formats we want to use, and results as alternating
queries and expected results, so we can just create new test files and
run the tests against them. We also have to report back what we created
when creating things.

In the process of developing this, I noticed that the documentation describes
ingest schema as allowing more than one schema operation, but we didn't support
this, and also it wouldn't do much good because there was no way to do partial
things like "just add a field". Fixed.

Also we implement comparison for ops, so the test output is actually
a test rather than just some data to visually eyeball.

In the process, realize that the handling of timestamps was wrong; we said that we
take them as raw numbers relative to the epoch, not as raw Unix timestamps.

Also a couple of related cleanups caught by doing the testing.
2021-08-19 09:50:59 -05:00
nagamocha3000
3185fe4181 Add schema endpoint
This adds the schema and ingest endpoints. (Code actually by Brandon,
seebs just squashed the commits.)
2021-08-19 09:50:59 -05:00
Seebs
e167f1c7fa fancier shard-sorting
This is a rework of Nia's radix sort. Still using stdlib sort for the
tail ends of things, and should probably replace it at some point
because it's still woefully inefficient, but this gets decent
performance, and lets us do the fancy thing of doing quick partial
sorting by record-key-only to get to shards, then deciding whether
to sort by value-then-record (as for a set field) or just by record
(as for int fields), which lets us reduce the amount of re-sorting
the same data by different criteria we do.

We also use a messy code-duplication basically-bubblesort for the
inner loops because it's much cheaper for small N.

This also lets us use field-aware sorting for shards, sorting them
correctly for a corresponding field type, and add corresponding API
support and fragment support for an option to tell the fragment
code that we already ordered things in the order that's most
efficient there, to avoid a second sort that we don't otherwise
need.
2021-08-19 09:50:59 -05:00
Seebs
016765d8a2 Prototype ingest API
This partially-implemented prototype of the ingest API is based on our
programmatic ingest API reference. It has noticable limitations, most
crucially that it doesn't handle multi-node clusters right now. However,
it basically implements the expected semantics.

There's some noticeable performance issues to do with the high overhead
of sorting bits in order to import them efficiently, but this is fixable.

We also add the hooks to the internal client, and make the finisher logic
a bit smarter.

Much of this code was originally by Nia Weiss, but it's been merged
and restructured a bit to get things broken into logical commits.
2021-08-19 09:50:59 -05:00
Matthew Jaffee
61f3fa23b0
Merge pull request #1676 from seebs/prep
ingest API prep work
2021-08-19 09:08:28 -05:00
Seebs
423cddbdbb avoid allocations in viewsByTime
This is sort of horrible, but viewsByTime was about 25% of total CPU time in
the ingest path, NOT including increased GC overhead. This overoptimized
approach to letting us recycle a buffer, and use the same buffer for multiple
time views at once, reduces that to about 2.5%. Sorry for the mess.

We also streamline the process of building the per-view data sets a bit,
and streamline it a lot in the non-time-quantum case.
2021-08-18 13:45:36 -05:00
Seebs
f019cc7409 make import correctly reflect that it needs a single shard always
In fact, we have a number of things assuming that values passed to Import
always fit within a single known shard, so, drop all the extra complexity
around this, drop the computation of fancy view/shard keys, and so on.

There's a lot of room left to improve this probably but it's at least
better, I think.

Unfortunately, there's a handful of things, basically all of which are
test cases, which were relying on this, so, we also add functionality
for splitting import requests by shards. But this allows us to stop
duplicating each shard's inputs one at a time... which turns out to
mean that we now care that the import operation can write back to the
import request. This only affects test cases, so we adopt a crufty
hack involving cloning import requests in those rare cases, and also
when reusing the same column IDs to write to the existence field that
we'd be using later to write to another field.

Note that even if we weren't overwriting the column IDs with positions,
we'd be sorting the column/row ID lists by row-then-column, which means
we'd still be corrupting the column ID lists. This may want to change
at some point.

We also reuse a single Tx for all the views, because DB-per-shard
means that should work fine, and reduces the cost of doing these
updates, probably.
2021-08-18 13:45:36 -05:00
Seebs
6af987a5ba fix error formatting/spelling
Go convention is that error messages don't end with periods and
don't start with capital letters.
2021-08-18 13:45:36 -05:00
Seebs
ab9b70d7e8 mapperLocal: actually leave loop on read from done channel
staticcheck points out that the break is otherwise an ineffective
break because it just ends the current case clause of the switch
it's in, which is true.
2021-08-18 13:45:36 -05:00
Seebs
1745a93aee allow "us" for microseconds in timestamp units
The convention of using a "u" for "micro" is pretty well-established and some
people will have trouble typing the Greek letter, accept that as a synonym.
2021-08-18 13:45:36 -05:00
Seebs
e768fc89ea stop using pointers to time.Time
We're reading timestamps as []int64, instead of allocating a time.Time
for each timestamp, just use the same logic to determine whether to use the
int64 timestamp that we would have used to decide whether to allocate it.
We still have to check the whole run, though, because we're providing a large
list of 0s instead of "no timestamps", for Reasons.
2021-08-18 13:45:36 -05:00
Seebs
35faa39b20 don't use nil qcx
A nil Qcx is a crime against existence and makes baby pandas cry.

Having taken out the hack that tried to accommodate this when tests did it,
we now have to fix the tests. Oh no.
2021-08-18 13:45:36 -05:00
Seebs
dab8dff9c2 make "subdivide list by shardwidth" available for reuse
We keep wanting this, and it's shardwidth-dependent code, and we keep rewriting it.
It should be in the shardwidth package.
2021-08-18 13:45:20 -05:00
Seebs
7b27a48d7c allow Molecula copyrights 2021-08-17 15:23:31 -05:00
Ben Johnson
409d59e297
Merge pull request #1675 from molecula/sql-count
CORE-806: Implement basic SQL COUNT(*) query
2021-08-17 14:12:40 -06:00
Ben Johnson
702f55964f Add apt-get update flag 2021-08-17 07:21:40 -06:00
Ben Johnson
5122c2decc Refactor SQL planner to inside Server 2021-08-16 13:12:16 -06:00
Ben Johnson
9b8dc3d7e6 Implement basic SQL COUNT(*) query 2021-08-13 10:41:39 -06:00
Matthew Jaffee
dac6234d0d
Merge pull request #1671 from jaffee/differentiate-map-error
differentiate error messages between opening file and mapping it
2021-08-09 12:27:22 -05:00
Matthew Jaffee
207634aea3 differentiate error messages between opening file and mapping it 2021-08-09 11:42:25 -05:00
Matthew Jaffee
54a4c2a587
Merge pull request #1663 from molecula/fully-disable-usage-endpoint
CORE-800 Disable /ui/usage endpoint completely when usage-duty-cycle is set to 0
2021-08-05 09:37:10 -05:00
Alan Bernstein
9565620f4d Disable /ui/usage endpoint completely when usage-duty-cycle is set to 0 2021-08-04 16:22:55 -05:00
Alan Bernstein
51cc29364c
Merge pull request #1669 from molecula/feature/syang/aggregate-sort
CLOUD-61: Add aggregate sort option to query builder
2021-08-02 20:46:58 -05:00
Stephanie Yang
1609582ba1 Update aggregate label to cardinality 2021-08-02 19:01:37 -05:00
Stephanie Yang
97df326ac6 update test and add additional test for aggregate sort 2021-08-02 19:01:37 -05:00
Stephanie Yang
b0633898a3 add ability to set an aggregate sort on int fields 2021-08-02 19:01:37 -05:00
Ben Johnson
009f4d6d71
Merge pull request #1668 from molecula/extract-max-memory
CORE-473: Add max memory limit to Extract() to prevent OOM
2021-08-02 15:44:27 -06:00
Ben Johnson
60d534c505 Limit translation memory & add max query memory config 2021-08-02 15:28:00 -06:00
Ben Johnson
d16978f5dc Add max memory limit to Extract() to prevent OOM
This commit changes the Extract() query to return an error if the
result set gets too large in order to prevent out-of-memory (OOM)
panics.
2021-08-02 08:20:12 -06:00
Stephanie Yang
317f1e0145
Merge pull request #1665 from molecula/refactor/syang/query-builder
CLOUD-136: Refactor query builder
2021-07-30 09:52:45 -05:00
Stephanie Yang
2947583a95 fix issue with editing saved queries 2021-07-29 12:03:32 -05:00
Stephanie Yang
8dc2105b63 add clear link for sort 2021-07-28 11:38:13 -05:00
Stephanie Yang
d8ac3251f6 replace old query builder 2021-07-28 11:21:54 -05:00
Stephanie Yang
fa353faf72 initial refactor commit 2021-07-28 11:21:54 -05:00
Alan Bernstein
6935ac2667
Merge pull request #1664 from molecula/fix-apt-404
Add apt-get update to dockerfile
2021-07-27 13:52:31 -05:00
Alan Bernstein
a7654ee750 Use -y for apt-get command 2021-07-27 10:21:08 -05:00
Alan Bernstein
9e56335ff9 Add apt-get update to dockerfile 2021-07-26 17:37:39 -05:00
Mahesh Arumugam
abb9b930bf
Merge pull request #1662 from molecula/rowcache-race-again
need to create rowCache lock at the top... otherwise it does nothing
2021-07-20 11:06:38 -07:00
Matthew Jaffee
0d7f1c49c4 need to create rowCache lock at the top... otherwise it does nothing 2021-07-20 12:15:35 -05:00
Matthew Jaffee
e42c96e996
Merge pull request #1661 from molecula/other-client-rowCache-race
fix other batch client rowCache race
2021-07-20 11:06:05 -05:00
Matthew Jaffee
d2e8c5f773 fix other batch client rowCache race 2021-07-20 10:36:17 -05:00
Matthew Jaffee
e450099579
Merge pull request #1660 from molecula/client-batch-race
Fix data race in batch import client by adding locking around rowCache
2021-07-20 09:40:28 -05:00
Matthew Jaffee
11686cac97 add locking around rowCache to avoid data race 2021-07-20 09:00:49 -05:00
Mahesh Arumugam
547d74b0fc
Merge pull request #1658 from molecula/ma/cloud-109
CLOUD-109 FeatureBase Renaming: changing go.mod module name for featurebase
2021-07-19 15:33:10 -07:00
Mahesh Arumugam
bce6d91618 Merge branch 'master' into ma/cloud-109 2021-07-19 14:42:36 -07:00
Travis Turner
695cb10986
Merge pull request #1656 from travisturner/rename-binary
Rename pilosa binary to featurebase
2021-07-19 16:15:59 -05:00
Mahesh Arumugam
44a5e68b3e fix build issue 2021-07-19 13:47:47 -07:00
Mahesh Arumugam
c14c6afbd3 Merge branch 'master' into ma/cloud-109 2021-07-19 13:27:17 -07:00
Travis
7e718743d2
Rename pilosa binary to featurebase 2021-07-19 15:27:14 -05:00
tgruben
eb9adcdec3
Merge pull request #1657 from tgruben/migrate-to-rbf
[ CORE-733] Migration tool for rbf
2021-07-19 15:08:50 -05:00
Mahesh Arumugam
f51fd2351c Merge branch 'master' into ma/cloud-109 2021-07-19 12:40:35 -07:00
Mahesh Arumugam
faf1f93071 fix clustertests 2021-07-19 12:33:22 -07:00
Mahesh Arumugam
a021412d00 fix clustertests 2021-07-19 12:17:59 -07:00
tgruben
fb7f8a69ea
Merge branch 'master' into migrate-to-rbf 2021-07-19 13:05:16 -05:00
Todd Gruben
be0789beb3 use filepath.join 2021-07-19 12:55:39 -05:00
Todd Gruben
bc0c98cca7 applied ben's suggestions 2021-07-19 12:34:43 -05:00
Alan Bernstein
c1cd1d7e4f
Merge pull request #1648 from molecula/usage-disable
CORE-730 Add logging for and allow disabling usageCache
2021-07-19 11:58:57 -05:00
Mahesh Arumugam
858f889745 FeatureBase Renaming: changing go.mod module name for featurebase 2021-07-19 09:20:30 -07:00
Todd Gruben
023d05aaf9 linter fix 2021-07-16 14:22:14 -05:00
Todd Gruben
3c9e1c74af phase 1 complete all data migrated 2021-07-16 13:44:18 -05:00
Alan Bernstein
6415067200 Make duration print format more readable 2021-07-15 14:22:17 -05:00
Alan Bernstein
60f2893152 Add usageCache logging 2021-07-15 14:22:17 -05:00
Alan Bernstein
46df93c521 Unindent 2021-07-15 14:22:17 -05:00
Alan Bernstein
f1e12567a3 Define some constants for usageCache 2021-07-15 14:22:17 -05:00
Alan Bernstein
b7898b0a22 Allow usage-duty-cycle < 20%, and 0 disables 2021-07-15 14:22:17 -05:00
Stephanie Yang
153dea6e1d
Merge pull request #1655 from molecula/bug/syang/query-console-drop-table
CLOUD-137: Wrap field and table names in backticks for sql queries
2021-07-13 17:36:19 -05:00
Stephanie Yang
fa6e179193 handle table-name.field-name syntax sql in console 2021-07-13 14:05:09 -05:00
Stephanie Yang
97ee1b91ef wrap field and table names in backticks for sql queries 2021-07-13 14:05:09 -05:00
Mahesh Arumugam
12fd95d8cf
Merge pull request #1651 from molecula/ma/cloud-110
CLOUD-110 FeatureBase Renaming
2021-07-13 09:43:32 -07:00
Mahesh Arumugam
2cec88e19d Merge branch 'master' into ma/cloud-110 2021-07-13 09:10:36 -07:00
Travis Turner
3bb2b2ff2b
Merge pull request #1653 from travisturner/metric-names
[CLOUD-108] Update metric names to use "featurebase" prefix
2021-07-12 23:55:53 -05:00
Travis
4b494c3ec3
Update metric names to use "featurebase" prefix
If the `--future.rename` flag is set (to true), this commit will cause
metric names to be prefixed with "featurebase" instead of "pilosa".
2021-07-12 17:51:59 -05:00
Mahesh Arumugam
9958e123fb Merge branch 'master' into ma/cloud-110 2021-07-12 15:02:54 -07:00
Alan Bernstein
9c2454e452
Merge pull request #1654 from molecula/fix-changelog-check
CLOUD-113 Rename repository in github API call
2021-07-12 15:01:29 -07:00
Alan Bernstein
27995ffb7b Rename repository in github API call 2021-07-12 14:43:35 -07:00
Mahesh Arumugam
48fcb3a198 FeatureBase renaming: version info in server log 2021-07-12 12:25:43 -07:00
Mahesh Arumugam
2f31ef17e2 VersionInfo 2021-07-09 19:45:54 -07:00
Mahesh Arumugam
eb1cc304cf FeatureBase Renaming: EnvPrefix 2021-07-09 14:52:40 -07:00
Travis Turner
1f04a8d1fe
Merge pull request #1650 from travisturner/cloud-124
[CLOUD-124] Add feature flag --future.rename to support rename to FeatureBase
2021-07-08 14:43:19 -05:00
Travis Turner
1809636319
improve help text
Co-authored-by: Alan Bernstein <alanaaronbernstein@gmail.com>
2021-07-08 13:53:06 -05:00
Travis
3c7ee11ff3
Add feature flag --future.rename to support rename to FeatureBase
This commit adds a `Future` scope to the configuration options, and for
the time being includes a single flag within that scope: `rename`.

Usage:
--future.rename

The value is a boolean available internally at: m.Config.Future.Rename
2021-07-08 13:18:43 -05:00
Stephanie Yang
c9cb87130d
Merge pull request #1645 from molecula/feature/syang/groupby-sort
CLOUD-60: Add ability to sort when building GroupBy queries
2021-07-05 22:30:38 -05:00
Stephanie Yang
9c8b272bb0 fix secondary sort field for sum case 2021-07-02 16:10:10 -05:00
Stephanie Yang
986f1f1d0f clear sort when resetting 2021-07-02 16:10:10 -05:00
Stephanie Yang
46016fce4a add sort option to GroupBy query builder 2021-07-02 16:10:10 -05:00
Stephanie Yang
383b0a69d1 fix group by fields stuff 2021-07-02 16:10:10 -05:00
tgruben
37bb8dee0e
Merge pull request #1649 from tgruben/fix-backup
change alpine install to ubuntu
2021-07-02 15:03:21 -05:00
tgruben
d4efa08c2d
Merge branch 'master' into fix-backup 2021-07-02 14:37:31 -05:00
Todd Gruben
bf26aa9d57 change alpine install to ubuntu 2021-07-02 14:36:23 -05:00
tgruben
7740036717
Merge pull request #1647 from tgruben/core-527
[CORE-527] multi-node to single backup check
2021-07-01 15:17:19 -05:00
Todd Gruben
4739ebf79e multi-node to single backup check 2021-07-01 14:02:16 -05:00
tgruben
69ef605f93
Merge pull request #1646 from tgruben/ci-backup
[CORE-629] CI test for backup restore
2021-07-01 09:55:50 -05:00
Todd Gruben
2f4f75a6cb renamed docker compose image 2021-07-01 08:56:41 -05:00
Todd Gruben
039ebc7ea6 trying docker login 2021-06-30 16:56:57 -05:00
Todd Gruben
74c03b1a33 needed executor 2021-06-30 15:02:22 -05:00
Todd Gruben
bac9ac047c Merge branch 'ci-backup' of github.com:tgruben/privilosa into ci-backup 2021-06-30 14:59:05 -05:00
Todd Gruben
87d2b513d8 corrected ci config 2021-06-30 14:58:39 -05:00
tgruben
72b2896178
Merge branch 'master' into ci-backup 2021-06-30 14:55:59 -05:00
Todd Gruben
3f8047778c CI test for backup restore 2021-06-30 14:52:15 -05:00
Nia
15c6023806
Merge pull request #1643 from seebs/keepInTranslation
[CORE-727] separate backup of index data and index translation keys
2021-06-30 13:39:05 -04:00
Nia
bc01e55280
Merge branch 'master' into keepInTranslation 2021-06-30 13:11:58 -04:00
Nia
37f291bb5b
Merge pull request #1644 from niaow/backup-dir-fsync
[CORE-726] fsync all directories after completing a backup
2021-06-30 13:11:49 -04:00
Seebs
90c424a4d9 separate backup of index data and index translation keys
It's not enough to back up each index's translation keys after
backing up that index's data; we also have to back them up after
backing up any index data from indexes which have foreign key
references to that index. So we do the per-index passes separately.

Since the individual backup data files are being created separately,
the expected output is unchanged for a quiescent database, the only
difference is that the amount of translation info which might be
newer than the data stored for shards is potentially increased.
2021-06-30 11:46:47 -05:00
Nia Weiss
779e27dcf6
fsync all directories after completing a backup
Previously the backup tool only fsync'ed the files.
Since the directories were not synced, it was possible for the references to be lost.
Now we sync the entire output directory tree and its parent.
2021-06-30 12:39:17 -04:00
tgruben
a8161923de
Merge pull request #1642 from tgruben/index-delete-shard
delete index missed index/shard removal [Bug]
2021-06-25 12:10:08 -05:00
tgruben
b15b11462a
Merge branch 'master' into index-delete-shard 2021-06-25 11:26:31 -05:00
Todd Gruben
ccda5f46d5 delete index missed index/shard removal 2021-06-25 11:24:28 -05:00
Mahesh Arumugam
5187d3f862
Merge pull request #1641 from molecula/ma/cloud-119
CLOUD-119 CORE-653 Fix percentile query
2021-06-24 17:45:07 -07:00
Mahesh Arumugam
357caf68c3 Fix percentile query: field is mandatory (should not crash), fieldnames can be unquoted 2021-06-24 15:10:05 -07:00
seebs
3a678c9ce0
Merge pull request #1639 from molecula/ciFailures
address CI failures due to timeouts
2021-06-24 11:11:10 -05:00
seebs
965a325f9d
Merge branch 'master' into ciFailures 2021-06-24 09:48:06 -05:00
tgruben
69dc3593a5
Merge pull request #1640 from tgruben/chksum
chksum sub-command for easier data validation
2021-06-23 16:38:44 -05:00
Todd Gruben
44281fa5c2 add chksum command for easier data validation 2021-06-23 16:10:52 -05:00
Seebs
0e1d448baa explicitly revoke lease on shutdown
If we explicitly shut a node down, we don't want everyone else
thinking it's up for the next 5 seconds. Worse, in CI, we have random
long delays (10+ seconds) with no CPU activity at all, so we have to
set the TTL longer there. Which makes any test checking for responsive
detection of a node going down take even longer. So! We revoke
leases on our way down, and this makes the tests not take so
long, and allows us to have a reasonable timeout on the test, while
having a completely unreasonable HeartbeatTTL to make CI stop
breaking randomly.
2021-06-22 09:02:25 -05:00
Seebs
13dd357ddd bump heartbeatTTL to ludicrous value (60s) for testing
After continuing to see weird test failures, did some more careful testing,
discovered that CI can pause a machine entirely for up to 29 seconds
or so very rarely, and 5-10 seconds quite frequently, which causes
cascading heartbeat failures and so on. Remove those.
2021-06-22 09:02:25 -05:00
Seebs
5898c58a80 try to force TMPDIR to be the ram disk
CircleCI is providing a ramdisk as /mnt/ramdisk. Using the ramdisk
instead of local storage makes fsync operations essentially free,
which removes (some of) the frequent multi-second delays we see during
runs otherwise.
2021-06-22 09:02:25 -05:00
Seebs
01103b26f0 make etcd bootstrap timeout configurable
It turns out that it's desireable to be able to configure the bootstrap
timeout for etcd, because during startup, we end up delaying that long
(N-1) times in series during each cluster creation, which is pointless
when we're starting the whole cluster. Reduces test runtime by several
minutes.
2021-06-22 09:02:25 -05:00
Ben Johnson
e8a3c313ac
Merge pull request #1638 from molecula/parallelize-restore
CORE-640: Parallelize restore command
2021-06-21 15:07:58 -06:00
Todd Gruben
23ba86cbfc linter fix 2021-06-21 14:15:13 -05:00
Ben Johnson
dad2372a8c CORE-640: Parallelize restore command 2021-06-18 16:03:38 -06:00
Ben Johnson
e082f6bce0
Merge pull request #1637 from molecula/parallel-backup
CORE-639: Parallelize backup
2021-06-15 17:44:17 -06:00
Ben Johnson
3df1f2d094 CORE-639: Parallelize backup 2021-06-15 16:55:05 -06:00
Samir Patel
f5844a0eb3
Merge pull request #1633 from 54mir/reset-cache-on-schema
CORE-642 Reset Usage Cache If Outdated On Request
2021-06-15 13:01:58 -05:00
Samir Patel
92ff74c72d
Merge branch 'master' into reset-cache-on-schema 2021-06-15 10:32:43 -05:00
Samir Patel
6b45325ca7 expand comment on duty cycle 2021-06-15 09:37:42 -05:00
Samir Patel
fb11d7f656
Update api.go
Co-authored-by: Alan Bernstein <alanaaronbernstein@gmail.com>
2021-06-15 09:17:53 -05:00
Stephanie Yang
25bf4fdaa7
Merge pull request #1636 from molecula/feature/syang/diskusage-lastupdated
CLOUD-78: Add 'last updated' info to tables UI
2021-06-14 16:25:22 -05:00
Stephanie Yang
7c89eb8033 add cache refresh copy 2021-06-14 16:02:15 -05:00
Stephanie Yang
9c21f6f109 consistency 2021-06-14 15:49:20 -05:00
Stephanie Yang
b14811b4fe add UTC time tooltip when hovering ov er relative time 2021-06-14 15:47:09 -05:00
Stephanie Yang
f48d7998e1 add last updated info for disk usage to ui 2021-06-14 15:47:09 -05:00
Stephanie Yang
e4159a1927 fix UI blow up when index disk usage not available 2021-06-14 15:47:09 -05:00
Ben Johnson
ee3a7a845e
Merge pull request #1635 from molecula/backup-dir
CORE-638: Refactor backup/restore to use directory archive
2021-06-14 11:03:39 -06:00
Samir Patel
d83a502657 change comment 2021-06-14 11:55:23 -05:00
Samir Patel
bfc90d148d Merge branch 'reset-cache-on-schema' of github.com:54mir/pilosa into reset-cache-on-schema 2021-06-14 11:53:46 -05:00
Samir Patel
6bdf685471 change waitMultiplier to float64 2021-06-14 11:43:49 -05:00
Samir Patel
11207fc589
Update api.go
Co-authored-by: Alan Bernstein <alanaaronbernstein@gmail.com>
2021-06-14 11:12:12 -05:00
Samir Patel
8bf472bb75 add duty cycle config flag 2021-06-14 10:48:52 -05:00
Ben Johnson
73f0668fe1 Refactor backup/restore to use directory archive 2021-06-14 09:43:20 -06:00
Samir Patel
011291f19b update comments 2021-06-11 11:28:39 -05:00
Samir Patel
76b899ef82 Merge branch 'reset-cache-on-schema' of github.com:54mir/pilosa into reset-cache-on-schema 2021-06-11 11:24:49 -05:00
Samir Patel
b46b5fc134 remove usage-interval flag 2021-06-11 11:16:32 -05:00
Samir Patel
39c9b7c61a
Merge branch 'master' into reset-cache-on-schema 2021-06-10 18:33:33 -05:00
Samir Patel
268e710e69 update comment 2021-06-10 17:36:03 -05:00
Samir Patel
9b11ded9e3 scale refresh rate by last calculation time 2021-06-10 16:30:22 -05:00
Kuba Podgórski
5013204b6d
Merge pull request #1634 from kuba--/core-649
[CORE-649]: Add support for timestamps in pg writer
2021-06-10 23:28:05 +02:00
Kuba Podgórski
b218901fae Add support for timestamps in pg writer 2021-06-10 21:58:08 +02:00
Stephanie Yang
8f3c4705cc
Merge pull request #1631 from molecula/chore/syang/querybuilder-cleanup
CLOUD-76: Add support for single codepoint keys for like queries
2021-06-10 11:45:33 -05:00
Samir Patel
a7c24c6745 lock read of lastUpdated 2021-06-10 11:28:23 -05:00
Stephanie Yang
db018e5f41 Add support for single codepoint keys for like queries 2021-06-10 11:03:15 -05:00
Stephanie Yang
1bd872e1f4 make keys optional on RowCallType 2021-06-10 11:03:15 -05:00
Samir Patel
486244ab58 reset cache if outdated on call 2021-06-10 10:48:44 -05:00
Nia
d12e4e9f25
Merge pull request #1632 from niaow/fix-time-keys
[CORE-579] Fix batch import of time fields with key translation
2021-06-10 11:29:55 -04:00
Nia Weiss
539d1ffe6b
fix batch import of time fields with key translation
Time fields were not listed as a type which could accept key translation, causing the translation code to fail.
This also adds tests for keyed time and mutex fields.
2021-06-10 09:41:59 -04:00
Stephanie Yang
4baffff847
Merge pull request #1630 from molecula/feature/syang/querybuilder-types
CLOUD-77: Allow all field types for query builder
2021-06-07 20:19:26 -05:00
Stephanie Yang
90d795cc69 update stringifyRowData tests 2021-06-07 17:23:42 -05:00
Stephanie Yang
cc624a9c18 add support for non-keyed set, time, mutex and decimals 2021-06-07 17:23:42 -05:00
Travis Turner
22d46a8afa
Merge pull request #1623 from molecula/feature/syang/querybuilder-like
CLOUD-76: Allow `like` for query builder queries
2021-06-07 17:18:34 -05:00
Stephanie Yang
732040dc80 update like to wrap between % if no wildcard is given 2021-06-07 16:30:39 -05:00
Stephanie Yang
af83e61101 add tests 2021-06-07 16:30:39 -05:00
Stephanie Yang
64c0542c3e implement 'like' for query builder queries 2021-06-07 16:30:39 -05:00
Nia
e6644d25d2
Merge pull request #1626 from niaow/fix-keys
[CORE-579] Standardize key translation on the find and create methods
2021-06-07 16:17:41 -04:00
Kuba Podgórski
118961b911
Merge branch 'master' into fix-keys 2021-06-07 21:21:31 +02:00
Kuba Podgórski
c2a0bba99c
Merge pull request #1629 from kuba--/core-531
[CORE-531]: Additional logging for LookupDB connection
2021-06-07 21:16:49 +02:00
Nia Weiss
c2f58f7af0
fix column key translation test
It previously checked hardcoded values.
This does not work due to shard width differences.
2021-06-07 14:52:04 -04:00
Nia Weiss
39337fa41b
fix shadowing of require in client internal tests
The `require` tool was being shadowed with the outer test's T, causing the testing package to explode sometimes.
2021-06-07 14:52:04 -04:00
Nia Weiss
c0ef297b11
standardize key translation on the find and create methods
This migrates existing code from the old TranslateKey(s) endpoints to the newer CreateKeys and FindKeys endpoints.
The CreateKeys and FindKeys endpoints were created previously as the TranslateKeys endpoint had no way to behave sanely when the looked-up key did not exist (the parallel-arrays representation did not have a good way to represent a missing key).
This change also removes the old TranslateKey(s) functions from the translation stores.
It leaves a wrapper emulating the TranslateKey(s) endpoints so that old idk still works for now.
2021-06-07 14:47:52 -04:00
Kuba Podgórski
46fbde4f0b Update holder.go 2021-06-07 18:41:13 +02:00
Samir Patel
b886d1e571
Merge pull request #1622 from 54mir/lattice-fix
CORE-557 UI/Usage Cache with Lattice Fix
2021-06-04 12:12:34 -05:00
Samir Patel
5ef218977f
Merge branch 'master' into lattice-fix 2021-06-04 10:16:46 -05:00
nagamocha3000
3b6ba01111
Merge pull request #1628 from nagamocha3000/delete-id-allocs
Delete ids allocated for index if any present
2021-06-04 16:51:32 +03:00
tgruben
6f06a6cba3
Merge branch 'master' into lattice-fix 2021-06-04 07:36:24 -05:00
nagamocha3000
a904d9e68e Delete ids allocated for index if any present 2021-06-04 14:34:48 +03:00
Stephanie Yang
e1394c2bdb
Merge pull request #1612 from molecula/feature/syang/groupby-filter
CLOUD-59: Updates saved query list for GroupBy filter
2021-06-03 16:57:22 -05:00
Stephanie Yang
3801d4b072 add gitignore to lattice folder 2021-06-03 16:40:10 -05:00
Stephanie Yang
c1915ff361 filter out saved queries without rowCalls 2021-06-03 16:40:10 -05:00
nagamocha3000
29002b3f62
Merge pull request #1624 from nagamocha3000/fix-percentile-overflow
Fix percentile overflow error
2021-06-04 00:24:19 +03:00
nagamocha3000
b1d18a1ba3 Make percentile checker in test-case match executor implementation 2021-06-03 22:14:05 +03:00
nagamocha3000
af83205032 Fix percentile overflow error 2021-06-02 21:28:07 +03:00
Samir Patel
883fa9ac0b replace sleep with after in select 2021-06-01 21:24:08 -05:00
Samir Patel
15ef157779 remove comment 2021-06-01 20:50:55 -05:00
Samir Patel
2e08b15620 remove lastupdate log to console 2021-06-01 20:48:44 -05:00
Samir Patel
9608c0c2cb move trigger to inside refresh fn 2021-06-01 20:48:12 -05:00
Samir Patel
81f1606242 poll places in indexDetails to check for closing 2021-06-01 20:47:53 -05:00
Samir Patel
041ae01da1 poll places in usage calculation to check for closing 2021-06-01 20:46:44 -05:00
Samir Patel
a9079815b2 remove prints 2021-06-01 14:45:52 -05:00
Samir Patel
6a8bf3acd6 stops calculation on server close 2021-06-01 14:34:51 -05:00
Samir Patel
edf71c1bf7 update comment and remote print 2021-06-01 10:47:10 -05:00
Samir Patel
5437a11216 remove prints 2021-06-01 10:47:10 -05:00
Samir Patel
660c6d10ca rename locks and remove prints 2021-06-01 10:47:10 -05:00
Samir Patel
017d012d51 change lock order 2021-06-01 10:47:10 -05:00
Samir Patel
20b721ad9d add wait group 2021-06-01 10:47:10 -05:00
Samir Patel
81413c4f0a Remove recalculation on new index 2021-06-01 10:47:10 -05:00
Samir Patel
4ac7f6e154 check error from ResetCache 2021-06-01 10:47:10 -05:00
Samir Patel
a5ae6c15fc add locks 2021-06-01 10:47:10 -05:00
Samir Patel
5f46635094 add channel to Refresh goroutine 2021-06-01 10:47:10 -05:00
Samir Patel
0810273ea1 reset cache before test and add test conditions 2021-06-01 10:47:10 -05:00
Samir Patel
fcdefe8bb6 add ability to reset cache 2021-06-01 10:47:10 -05:00
Samir Patel
468a288b72 remove print 2021-06-01 10:47:10 -05:00
Samir Patel
a7620012fa adjust locking 2021-06-01 10:47:10 -05:00
Samir Patel
4b7e0e9194 move where cache updates lastUpdated val 2021-06-01 10:47:10 -05:00
Samir Patel
abcd90b60a remove print statements 2021-06-01 10:47:10 -05:00
Samir Patel
4e2727c255 revert txfactory to original 2021-06-01 10:47:10 -05:00
Samir Patel
3e81406ab0 clean test case and add comments 2021-06-01 10:47:10 -05:00
Samir Patel
eff3b25b97 change test case to reflect cache loading before test 2021-06-01 10:47:10 -05:00
Samir Patel
fe0bb20658 remove intentional failure 2021-06-01 10:47:10 -05:00
Samir Patel
53b0e98bb1 add while loop to wait for holder to populate 2021-06-01 10:47:09 -05:00
Samir Patel
5cbf828588 adjust timing 2021-06-01 10:47:09 -05:00
Samir Patel
8824dddc3a add debug statements 2021-06-01 10:47:09 -05:00
Samir Patel
a0ba9327f7 play with timing 2021-06-01 10:47:09 -05:00
Samir Patel
dbdd3c4998 see if this is the only test failing 2021-06-01 10:47:09 -05:00
Samir Patel
fd58fe1a7d test stuff 2021-06-01 10:47:09 -05:00
Samir Patel
63300db1bd try test with usage always blocking on calc 2021-06-01 10:47:09 -05:00
Samir Patel
108da005b7 test stuff 2021-06-01 10:47:09 -05:00
Samir Patel
f946528053 comment out debug statements 2021-06-01 10:47:09 -05:00
Samir Patel
7799d7c680 Add sleep to wait for holder to load 2021-06-01 10:47:09 -05:00
Samir Patel
f6d7d1af39 move requestNodes() out of refresh loop 2021-06-01 10:47:09 -05:00
Samir Patel
0b083da126 debugging test 2021-06-01 10:47:09 -05:00
Samir Patel
1e5df36fb7 change to not calculate node usage periodically 2021-06-01 10:47:09 -05:00
Samir Patel
1385cf61eb attempt to address missing node uri issue 2021-06-01 10:47:09 -05:00
Samir Patel
79f04f31cb see if this gets test passing 2021-06-01 10:47:09 -05:00
Samir Patel
21e5cda7e0 Add lock to node usage 2021-06-01 10:47:09 -05:00
Samir Patel
14533d88a1 add read lock 2021-06-01 10:47:09 -05:00
Samir Patel
7d56414557 change err response to info messages 2021-06-01 10:47:09 -05:00
Samir Patel
4096c8cb8e go mod tidy 2021-06-01 10:47:09 -05:00
Samir Patel
e7f1c8b66a Reverted directoryUsage back to using old Readdir() 2021-06-01 10:47:09 -05:00
Samir Patel
ae6687e71b change flag name to usage-interval 2021-06-01 10:47:09 -05:00
Samir Patel
42067237f7 simplify if statement in calcUsage() 2021-06-01 10:47:09 -05:00
Samir Patel
e8b9fa0482 update comments and rename nodeUsage() 2021-06-01 10:47:09 -05:00
Samir Patel
f5cc179893 change flag from interval to duration 2021-06-01 10:47:09 -05:00
Samir Patel
0ef16ce634 fix calculation for nodes 2021-06-01 10:47:09 -05:00
Samir Patel
ff6b3fed97 remove initCache 2021-06-01 10:47:09 -05:00
Samir Patel
431db4c1a3 add 'lastUpdated' in http response 2021-06-01 10:47:09 -05:00
Samir Patel
8ce17f405b rename flag to disk-usage-interval 2021-06-01 10:47:09 -05:00
Samir Patel
9beb3f0b3a rename flag and add default value for flag 2021-06-01 10:47:09 -05:00
Samir Patel
827b125c3c rename and set default 2021-06-01 10:47:09 -05:00
Samir Patel
03e0df389d use flag value as refresh value 2021-06-01 10:47:09 -05:00
Samir Patel
cd47a381f2 use flag value as refresh value 2021-06-01 10:47:09 -05:00
Samir Patel
b02188fd15 update usage cache periodically 2021-06-01 10:47:09 -05:00
Samir Patel
52418df4ba start periodic cache recalculation at startup 2021-06-01 10:47:08 -05:00
Samir Patel
835c63011a add server flag 2021-06-01 10:47:08 -05:00
Samir Patel
be10927ca7 set lastUpdated after cache calculation 2021-06-01 10:47:08 -05:00
Samir Patel
20f8479f41 add time based cache 2021-06-01 10:47:08 -05:00
Samir Patel
11d1859830 undo changes to IndexUsageDetails 2021-06-01 10:47:08 -05:00
Samir Patel
4842d93850 adds logic to remove old items from cache 2021-06-01 10:47:08 -05:00
Samir Patel
d71da09db2 add cache update on time 2021-06-01 10:47:08 -05:00
Samir Patel
713ffb723b replace ReadDir 2021-06-01 10:47:08 -05:00
Samir Patel
155003122b replace ReadDir syscall with new one from 1.16 2021-06-01 10:47:08 -05:00
Samir Patel
c812cca58e add cache 2021-06-01 10:47:08 -05:00
tgruben
3c399bc533
Merge pull request #1621 from tgruben/cluster-restore
[CORE-529] Multi-node restore
2021-05-28 11:36:04 -05:00
Todd Gruben
c16a7a06a0 applied bens suggestions mainly using errgroup 2021-05-28 11:02:31 -05:00
Todd Gruben
35672c53ce added node partition endpoint;cluster aware key restore 2021-05-28 09:27:42 -05:00
Nia
9c7ca2380f
Merge pull request #1620 from niaow/fix-like
[CORE-577] Execute like queries on the primary's key translation database
2021-05-28 07:18:11 -04:00
Nia
a77be9dd61
Merge branch 'master' into fix-like 2021-05-28 06:40:57 -04:00
Alan Bernstein
9ca33abadd
Merge pull request #1610 from molecula/remove-oss-readme
Remove readme content that only applies to the open-source fork
2021-05-27 18:29:45 -05:00
Nia Weiss
a8f7ec4a12
execute like queries on the primary's key translation database
This works around an issue where unreplicated keys will not be matched everywhere.
This also avoids the cost of creating millions of bolt read transactions and allocating strings.
2021-05-27 14:45:10 -04:00
Alan Bernstein
052956daaf Remove readme content that only applies to the open-source fork 2021-05-26 17:13:05 -05:00
Stephanie Yang
bfef27205b
Merge pull request #1618 from molecula/chore/syang/remove-prodpad
CLOUD-75: Remove ProdPad integration
2021-05-26 15:43:23 -05:00
Stephanie Yang
d047c45045
Merge branch 'master' into chore/syang/remove-prodpad 2021-05-26 15:11:05 -05:00
Nia
97fee3b7a8
Merge pull request #1619 from niaow/postgres-delete
[CORE-573] Add an option to open a postgres transaction in lookup
2021-05-26 14:54:06 -04:00
Nia Weiss
a72f6425af
add an option to open a postgres transaction in lookup so it isnt actually a lookup 2021-05-26 14:07:52 -04:00
Alan Bernstein
a94dc50b1c
Merge pull request #1617 from molecula/update-circleci-logic
CLOUD-65 Avoid early exit in 'bash -eo pipefail' script
2021-05-26 12:18:48 -05:00
Stephanie Yang
291a9c1329 remove prodpad integration 2021-05-26 12:09:56 -05:00
Alan Bernstein
daed890f8c Avoid early exit in 'bash -eo pipefail' script 2021-05-26 11:55:44 -05:00
Alan Bernstein
10af6d588f
Merge pull request #1616 from molecula/update-circleci-logic
CLOUD-65 Default output to 'true' in CircleCI job skipping steps
2021-05-26 11:31:20 -05:00
Alan Bernstein
529a325880 Default output to 'true' in CircleCI job skipping steps 2021-05-26 11:00:48 -05:00
Alan Bernstein
90e2d15cf0
Merge pull request #1609 from molecula/more-merge-lattice-stuff
CLOUD-65 Finalize UI merge
2021-05-26 10:43:52 -05:00
Alan Bernstein
58f0f42c1e Add /querybuilder path to statik lattice handler 2021-05-26 10:04:46 -05:00
Alan Bernstein
45dd6dd6bc Remove leftovers from lattice submodule 2021-05-26 10:04:46 -05:00
Alan Bernstein
f51bb0ea43 Update and verbosify job-skipping CI steps 2021-05-26 10:04:46 -05:00
Kuba Podgórski
894f599310
Merge pull request #1613 from kuba--/missed-return
Add return to handleCommitIDs
2021-05-26 16:36:41 +02:00
Kuba Podgórski
1ffafd70eb Add return to handleCommitIDs 2021-05-26 15:43:21 +02:00
Stephanie Yang
17a58f1020
Merge pull request #1608 from molecula/feature/syang/groupby-filter
CLOUD-59: Allow filter parameter query builder GroupBy
2021-05-24 23:06:10 -05:00
Stephanie Yang
3edac67c0c update helper text 2021-05-24 21:44:48 -05:00
Stephanie Yang
2966bb5d66 add helper text for using GroupBy filter 2021-05-24 20:27:58 -05:00
Stephanie Yang
4367f58081 oops 2021-05-24 18:30:09 -05:00
Stephanie Yang
2a4c6d3503 cleanup unused code 2021-05-24 17:06:34 -05:00
Stephanie Yang
fc121f40b2 allow optional filter parameter from saved queries for group by 2021-05-24 16:51:44 -05:00
Mahesh Arumugam
aed8727aea
Merge pull request #1597 from ma-molecula/ma/darwin-arm64
CLOUD-69 add darwin-arm64 support
2021-05-24 12:56:20 -07:00
Mahesh Arumugam
9dc750df97 add .idea to .gitignore 2021-05-24 12:18:56 -07:00
Mahesh Arumugam
f57abbf7fc go version set to 1.16.3 in makefile 2021-05-24 12:17:19 -07:00
Mahesh Arumugam
2679fa6cfd restore import syscall, accidentally removed in previous commit 2021-05-24 12:17:00 -07:00
Mahesh Arumugam
277eba9895 update comment 2021-05-24 12:17:00 -07:00
Mahesh Arumugam
ce2b07b650 move to go 1.16.4 2021-05-24 12:16:57 -07:00
Mahesh Arumugam
b6098f05e6 fixing the build for linux,arm 2021-05-24 12:16:30 -07:00
Mahesh Arumugam
25ddc2d3a0 fixing the build tags 2021-05-24 12:16:28 -07:00
Mahesh Arumugam
0523088fed add darwin-arm64 support 2021-05-24 12:15:48 -07:00
Nia
a0f2623b04
Merge pull request #1607 from niaow/fix-get-translate
Correct handling of field translate data fetch in get translate data endpoint
2021-05-24 13:07:42 -04:00
Kuba Podgórski
ba8d4c4ca1
Merge branch 'master' into fix-get-translate 2021-05-24 18:52:41 +02:00
Kuba Podgórski
01c4b11efb
Merge pull request #1605 from kuba--/fix-file-backup
Fix backup to a file
2021-05-24 18:52:23 +02:00
Kuba Podgórski
a1e7755fe7
Merge branch 'master' into fix-file-backup 2021-05-24 18:29:44 +02:00
Nia Weiss
bfe2383f65
correct handling of field translate data fetch in get translate data endpoint
After retrieving field translation, this attempted to fetch index translation which didn't work because this is not an index translation request.
2021-05-24 12:24:00 -04:00
tgruben
576c2d9efc
Merge pull request #1606 from tgruben/restore-fix
Restore arg handling bug
2021-05-24 11:19:33 -05:00
Todd Gruben
94e66b74b5 tls config bug and arge handling 2021-05-24 11:00:37 -05:00
Kuba Podgórski
be06340869
Merge branch 'master' into fix-file-backup 2021-05-24 16:21:56 +02:00
tgruben
89bf845192
Merge pull request #1600 from tgruben/restore
[ CORE-525] Restore
2021-05-24 09:15:10 -05:00
tgruben
5be61772f0
Merge branch 'master' into restore 2021-05-24 08:51:32 -05:00
Ben Johnson
9cb7c2be6c
Merge pull request #1603 from molecula/fix-bench-filename
Fix benchmark file naming
2021-05-24 07:50:53 -06:00
Todd Gruben
69fda13ff4 cleanup arg processing 2021-05-24 08:48:32 -05:00
Ben Johnson
34bd5c9fa2
Merge branch 'master' into fix-bench-filename 2021-05-24 07:11:17 -06:00
Kuba Podgórski
935edba1db Fix backup to a file 2021-05-24 10:36:58 +02:00
tgruben
b5613a6c33
Merge branch 'master' into restore 2021-05-23 21:18:34 -05:00
Todd Gruben
ff86f82ef2 applied ben's suggestions 2021-05-23 10:27:50 -05:00
Alan Bernstein
9992cb886a
Merge pull request #1599 from alanbernstein/merge-lattice-take2
CLOUD-65 Merge lattice take2
2021-05-21 21:04:54 -05:00
Ben Johnson
69e15525d8 Fix benchmark file naming 2021-05-21 14:51:08 -06:00
Alan Bernstein
e4a8293c0e Update lattice makefile to reflect new structure 2021-05-21 14:56:55 -05:00
Alan Bernstein
4aaf3e2fc2 Copy lattice repo @8c29787 into subdirectory lattice/ 2021-05-21 14:56:55 -05:00
Alan Bernstein
4a00bd9d6e Remove lattice submodule steps from pilosa makefile 2021-05-21 14:56:55 -05:00
Alan Bernstein
89891174b6 Add job skipping step to CI jobs 2021-05-21 14:56:55 -05:00
Alan Bernstein
9ea12803a2 Remove lattice submodule 2021-05-21 14:56:55 -05:00
Todd Gruben
05fea53f73 linter 2021-05-21 09:27:53 -05:00
Todd Gruben
3d577d762a cleanup 2021-05-21 09:27:08 -05:00
Todd Gruben
35f4c33de9 first cache rebuild was ineffective 2021-05-21 09:27:08 -05:00
Todd Gruben
7520e0ef28 rebuild rank caches on restore 2021-05-21 09:27:08 -05:00
Todd Gruben
b25ad81e67 restore without restart 2021-05-21 09:27:08 -05:00
Todd Gruben
cc0c1b829a restore idalloc 2021-05-21 09:27:08 -05:00
Todd Gruben
a1a9103f62 restore column translate keys 2021-05-21 09:27:08 -05:00
Todd Gruben
329f86033d restore field translate keys 2021-05-21 09:27:08 -05:00
Todd Gruben
69245ee209 shard import 2021-05-21 09:27:08 -05:00
Todd Gruben
42b465b80c load schema 2021-05-21 09:27:08 -05:00
Todd Gruben
9d24fb07b7 wired in restore command 2021-05-21 09:27:08 -05:00
Todd Gruben
169dc30d62 api compiles 2021-05-21 09:27:08 -05:00
Todd Gruben
7c6423587a skeleton restore 2021-05-21 09:27:08 -05:00
seebs
b784dd88d9
Merge pull request #1602 from seebs/addgo116
add go 1.16.3 to circleci
2021-05-20 18:43:04 -05:00
Seebs
ac5964480b add go 1.16.3 to circleci
Since we're starting to use this more, add it to the matrix. We should
probably make it our default later, but for now let's just start testing
it.
2021-05-20 17:25:07 -05:00
seebs
2f95bd2de8
Merge pull request #1593 from seebs/getTx
write operations can cause deadlocks in GetTx
2021-05-20 17:09:08 -05:00
Seebs
1c7a6da37b write operations can cause deadlocks in GetTx
The GetTx logic is deeply broken, this DOES NOT fix the underlying
bug.

When any call anywhere in a given set of calls has a top-level write,
we perform all transactions as write transactions, and we do not cache or
share those transactions. This means that anything which causes a
second GetTx for the same index/shard deadlocks against itself.

The two easy to find cases by casual inspection are time quantums
and Not queries, so this addresses those, but this should NOT be
considered a general fix.
2021-05-20 16:41:38 -05:00
seebs
479d668045
Merge pull request #1601 from seebs/noTxBitmap
drop unused TxBitmap
2021-05-20 16:41:18 -05:00
Seebs
7cf0ea452a drop unused TxBitmap
TxBitmap was a workaround for performance problems with doing
individual-bit operations directly on RBF, used only in the
large-writes path of importValue. With importValue no longer
using that path, ever, there are zero remaining users of TxBitmap,
and the test for it no longer exercises it.

Solution: Remove it.
2021-05-20 16:28:19 -05:00
seebs
a46e14ef22
Merge pull request #1598 from seebs/importSpeedups
improve performance of importValue in most cases, switching to consistently use importPositions.
2021-05-20 16:26:38 -05:00
seebs
45255d050f
Merge branch 'master' into importSpeedups 2021-05-20 15:42:11 -05:00
Ben Johnson
4ea655a707
Merge pull request #1596 from molecula/cluster-backup
[CORE-501] Add support for clustered backups
2021-05-20 14:32:23 -06:00
Ben Johnson
94d45a36ed
Merge branch 'master' into cluster-backup 2021-05-20 14:10:27 -06:00
Seebs
4bad5defb6 sort import values stably without using sort.Stable
sort.Stable has horrible runtime -- O(n*logn*logn) -- but if we
don't use sort.Stable, our logic for ensuring that we apply the
"last" value for a given column is actually completely wrong in
the first place.
2021-05-20 12:39:27 -05:00
Seebs
7572acb450 drop "another shard" test as it's probably not valid
We've got a fairly consistent thing of the API splitting data up
into shards before sending it to a field, which it has to do because
of clustering, so we don't intend to support the case where you
have data from another shard in a data set.

Also drop the identical but mislabeled test from TestIntField's
corresponding case.
2021-05-20 12:39:27 -05:00
Seebs
aa4a23b2d9 generate sorted positions from bulkImportStandard
Ensure that positions are sorted, and that we don't generate the same
position more than once.
2021-05-20 12:39:27 -05:00
Seebs
7c4b91eef0 simplify field ImportValue
There's only ever one view in importValue, but there's also only ever
one shard, because importValue is only called by things called from
the API after it has split everything up by shard.
2021-05-20 12:39:27 -05:00
Seebs
d2b925d296 make importValueSmallWrite faster and also the only path
Since we don't always have "snapshots" anymore, the arguable benefit of
avoiding the snapshot is reduced, and the primary expense of
importPositions has been dramatically reduced as well, so let's
just use that all the time, and simplify life.

We also want to make it faster. We don't know how many bits there
are to set or clear in the input set, but we do know exactly how
many bits there are to set AND clear. We can subdivide these into
batches by rows, then process each batch by storing sets at the
bottom and clears at the top. We can also do batches by columns,
reducing the memory overhead of unpacking all the bits at once.

(For extra credit, we could alternate set/clear settings, and
thus do batches of "the clears from row 0, followed by the clears
from row 1" and "the sets from row 1, followed by the sets from
row 2", and so on, but this is too fancy.)

Every caller of importValue is in fact already providing values
with column IDs sorted. As such, we don't need a map for checking
the previously-set columns; we just need to check against the
previous value.
2021-05-20 12:39:27 -05:00
Maxton Huff
741dd2d1ca
Merge pull request #1590 from Maxtonian/longmessage
[CORE-279] Bad query parameters gives error with super long list of shards
2021-05-20 10:40:12 -05:00
Maxton Huff
d9d360aa4d
Merge branch 'master' into longmessage 2021-05-20 10:17:04 -05:00
Maxton Huff
e646d7ac79 wrap mapper error with shards by node 2021-05-20 09:55:42 -05:00
Seebs
bb40d6589f change addOrRemove to not sort inputs
We also implement, but disable for now, a check for sortedness of
inputs. This check was useful in development but it's expensive (about
5% of CPU time for large inputs!) and once we've verified that we
can make it through tests without triggering it, we're probably fine.
2021-05-19 17:36:57 -05:00
Seebs
671a0cf5c6 tweak ImportValue benchmark
With timestamps, we probably want to at least check larger BSI fields,
so we add that. Also, tweak the interpretation of b.N (making each
N count for 10,000 bits) so we can see allocation load at all. But we
also reduce the sparse set to be about one bit per 19 bits, because
if we do one per 70,000, and are doing field-at-a-time imports, we're
getting hundreds of imports to try to match a target of, say, around
a million values.

We also sort the inputs, because ImportValue is about to start requiring
that, since the API does it anyway.

Also, extend this to be available on Fields, because field.ImportValue
is ALSO doing things which could be inefficient or expensive.
2021-05-19 16:40:34 -05:00
Ben Johnson
a4f282c8e8 Allow backup to stdout 2021-05-19 15:04:36 -06:00
Maxton Huff
04bf214f81 remove shard list from mapper error message to avoid duplicate output 2021-05-19 12:20:39 -05:00
Ben Johnson
eb79c35cbd Add support for clustered backups 2021-05-18 15:17:28 -06:00
Nia
ed5359468d
Merge pull request #1592 from niaow/remove-attr
[CORE-421] Remove attributes
2021-05-14 12:34:04 -04:00
Nia Weiss
7fe37a83f4
update license header check exceptions
When moving the protobuf files around, the paths to the generated protobuf files were not updated.
This change updates the paths.
2021-05-14 10:45:46 -04:00
Nia Weiss
f4ba34247f
remove attributes
Attributes are unmaintained and unused.
They have become more of a liability than a benefit.
This change eliminates them from the codebase.
The only user-visible change (assuming that attrs are not used) is that the attrs field will no longer appear in row JSON.
2021-05-14 10:28:08 -04:00
Maxton Huff
53da35eb00 add missing String() calls in error messages 2021-05-13 12:01:12 -05:00
Maxton Huff
63196e7981 add String() to shard slices to reduce error length 2021-05-13 11:39:23 -05:00
Kuba Podgórski
e4be3583d7
Merge pull request #1585 from kuba--/available-shards
[CORE-493] Write remote available shards to etcd, instead of local file.
2021-05-12 18:32:08 +02:00
Kuba Podgórski
79eaae7881
Update field_internal_test.go 2021-05-12 17:02:36 +02:00
Kuba Podgórski
1e6b8434eb
Merge branch 'master' into available-shards 2021-05-11 11:53:35 +02:00
Matthew Jaffee
649ce77dd6
Merge pull request #1589 from jaffee/update-lattice
Update to latest UI including Lookup functionality
2021-05-10 19:46:40 -05:00
Matthew Jaffee
c83099bc8a update lattice submodule, should include all the lookup/postgres changes 2021-05-10 17:29:42 -05:00
seebs
e49192af69
Merge pull request #1580 from seebs/mutexOverwrite
[CORE-533] Improve performance on mutex fields with sparse writes
2021-05-10 15:07:54 -05:00
seebs
82bb067d8e
Merge branch 'master' into mutexOverwrite 2021-05-10 14:48:56 -05:00
Maxton Huff
2467431caf
Merge pull request #1588 from Maxtonian/inspect2
[CORE-459] Investigate- Panic accessing "/inspect" in Molecula 4.1.1
2021-05-10 14:46:39 -05:00
Maxton Huff
e21382fab8 remove handleInspect and inspect validator 2021-05-10 13:14:50 -05:00
Kuba Podgórski
606f664fcc remove unused 2021-05-10 20:02:13 +02:00
Kuba Podgórski
17f89f1bf6 flush bytes instead of roaring 2021-05-10 19:20:34 +02:00
Seebs
130b17b621 don't force immediate recalculate of cache on every update
When writing things that cause additions to the cache, mark it dirty and
flag it for recomputing, but only sometimes actually do the recalculation,
currently implying a 10-second window. We still mark the cache dirty,
so if a request comes in, we'll get fresh data, but the query will be
slowed down because the recomputation will happen then. But that's better
than doing thousands of recalculations which are never used...
2021-05-10 11:58:18 -05:00
Seebs
1e00b50953 gratuitously fancy logic for array/array callbacks
When searching for a small array in a large array, scanning ahead
is productive. The switch from counting indexes to reslicing the
slice appears to improve performance in this case. The fairly arbitrary
value `na << 2` is like `nb / 4 > na` except that it computes faster,
and lets us avoid the expensive overhead unless we have reason to
expect that there's significantly more items in b than in a.

Improvements: Not huge in some cases, but sometimes quite noticeable,
especially as the frequency of overlap increases, which is also
the expensive case in other ways.

name                                              old time/op  new time/op  delta
ImportMutexSampleData/64K/2Kr/40/none/write-0-8    501ms ± 4%   486ms ± 2%     ~     (p=0.052 n=6+5)
ImportMutexSampleData/64K/2Kr/40/none/write-1-8    756ms ± 5%   698ms ± 5%   -7.62%  (p=0.002 n=6+6)
ImportMutexSampleData/64K/2Kr/80/none/write-0-8    292ms ± 3%   276ms ± 4%   -5.46%  (p=0.002 n=6+6)
ImportMutexSampleData/64K/2Kr/80/none/write-1-8    511ms ± 6%   482ms ± 4%   -5.72%  (p=0.015 n=6+6)
ImportMutexSampleData/64K/2Kr/240/none/write-0-8   153ms ± 3%   132ms ± 5%  -13.91%  (p=0.008 n=5+5)
ImportMutexSampleData/64K/2Kr/240/none/write-1-8   354ms ± 2%   215ms ± 6%  -39.41%  (p=0.004 n=5+6)
ImportMutexSampleData/1K/2Kr/40/none/write-0-8     565ms ± 3%   543ms ± 3%   -3.89%  (p=0.015 n=6+6)
ImportMutexSampleData/1K/2Kr/40/none/write-1-8     807ms ± 6%   778ms ± 3%     ~     (p=0.180 n=6+6)
ImportMutexSampleData/1K/2Kr/80/none/write-0-8     317ms ± 3%   300ms ± 1%   -5.40%  (p=0.002 n=6+6)
ImportMutexSampleData/1K/2Kr/80/none/write-1-8     462ms ± 3%   437ms ± 4%   -5.31%  (p=0.009 n=6+6)
ImportMutexSampleData/1K/2Kr/240/none/write-0-8    141ms ± 1%   119ms ± 2%  -15.85%  (p=0.004 n=5+6)
ImportMutexSampleData/1K/2Kr/240/none/write-1-8    213ms ± 3%   171ms ± 3%  -19.70%  (p=0.002 n=6+6)
2021-05-10 11:58:18 -05:00
Seebs
54f5cc799c performance hackery: add intersectCallback for use in running callbacks
In BitmapBitmapFilter.ConsiderData, we intersect things solely in order
to perform callbacks on them. Creating these intermediate arrays is
actually somewhat expensive, and all we're going to do with them is
make callbacks anyway.

So, we add a new `intersectCallback`, which behaves similarly to
`intersectionCount`, but which dramatically reduces the amount of memory
allocation associated with doing the callbacks; in some test cases
on mutex data, this code was >90% of all memory allocations, and
getting rid of that helps a lot.

At that point, we no longer need the separate intersectAny check,
because it doesn't save us any time anymore.
2021-05-10 11:58:18 -05:00
Seebs
ffb796448c make mutex tests smarter
The mutex tests had weird and un-idiomatic definitions for b.N, and
in particular would report ludicrously low times for high values of
b.N because they'd still only do a small amount of importing, then
get counted as having done a much larger number of iterations. Also,
the computation of the number of values to create was pretty noticably
wrong so the secondary data set was unduly tiny.

Do tests with ranked cache and larger row counts because we have
reason to suspect that the cache behavior is mattering. We adjust the
range of tests performed to reflect real world data a bit. We also
drop the "don't do large mutex tests" thing because the insanely
bad performance on larger mutex data should be fixed now, we hope.
2021-05-10 11:58:18 -05:00
Kuba Podgórski
252fadf6a0 Merge branch 'available-shards' of github.com:kuba--/molecula-pilosa into available-shards 2021-05-10 18:50:24 +02:00
Kuba Podgórski
6bdca67882 replace roaring.Bitmap by [][]byte 2021-05-10 18:45:23 +02:00
Nia
26b49cca21
fix remote available shard races (#3) 2021-05-10 18:36:40 +02:00
Maxton Huff
882327b0a6 remove inspect router 2021-05-10 10:36:24 -05:00
Kuba Podgórski
046b98bdf9
Merge branch 'master' into available-shards 2021-05-10 13:54:43 +02:00
Kuba Podgórski
b36de3146a write shards per node 2021-05-10 13:54:18 +02:00
Ben Johnson
03d258a3db
Merge pull request #1579 from molecula/backup-poc
[CORE-485] Backup CLI
2021-05-07 13:41:07 -06:00
Ben Johnson
e044a489fa
Merge branch 'master' into backup-poc 2021-05-07 13:09:54 -06:00
seebs
a302071b7f
Merge pull request #1587 from seebs/translateKeys
improve key creation/translation performance for large batches, especially on field keys
2021-05-07 14:09:36 -05:00
seebs
c473ff9925
Merge branch 'master' into translateKeys 2021-05-07 13:56:51 -05:00
tgruben
0fe0ae2b66
Merge branch 'master' into backup-poc 2021-05-07 13:37:11 -05:00
Ben Johnson
97cdc2405d
Merge pull request #1586 from molecula/rbf-rr-cache
Fix RBF root record cache build
2021-05-07 12:35:52 -06:00
Seebs
9e6ec3b17a break boltDB operations into chunks
boltDB's bucket.Put() is quadratic on "new keys put into a bucket during
this transaction", which is why BoltDB has warnings not to use it with over
100k new keys at a time. The translation store logic wasn't actually using
that. The actual value picked is smaller, based on some half-baked benchmarking.

We also avoid heap-allocating separate 16-byte (not 8-byte, of course,
because make(...) is *helping*) chunks twice for each key we insert, instead
allocating a single buffer which we reuse for each new transaction.

Also fixed a check against the nilness of the wrong pointer and generally
made CreateKeys and TranslateKeys a little more similar.
2021-05-07 13:19:15 -05:00
Ben Johnson
21c6203438 Fix linter 2021-05-07 11:15:13 -06:00
Ben Johnson
8a161bc423 Fix RBF root record cache build
This commit fixes an issue where the root record cache is only
built when a write transaction successfully commits. However, if
no write transactions are occurring then the the cache is never
built and saved so it is recomputed on every read tx.
2021-05-07 11:10:47 -06:00
Ben Johnson
7e804d7d08 Fix id alloc backup invocation 2021-05-07 10:59:01 -06:00
Ben Johnson
7284c4dd10 Add id alloc, col attrs, & row attrs backup 2021-05-07 10:59:01 -06:00
Todd Gruben
963bb3ec59 enable apiFieldTranslateData apiTranslateData 2021-05-07 10:59:01 -06:00
Ben Johnson
776b43a3cd Backup CLI 2021-05-07 10:59:01 -06:00
Kuba Podgórski
2517ee1bde remove unused 2021-05-07 15:45:30 +02:00
Kuba Podgórski
a79a36232f Write remote available shards to etcd, instead of local file. 2021-05-07 15:33:18 +02:00
Matthew Jaffee
1af85a818b
Merge pull request #1581 from jaffee/portmapper-npe
avoid nil pointer exception when failing to get listener
2021-05-05 14:18:22 -05:00
Matthew Jaffee
8274a8cfee avoid nil pointer exception when failing to get listener
instead of an opaque NPE on the next line, panic with explicit error
telling you what went wrong (in my case it was too many open files)
2021-05-04 15:17:41 -05:00
Alan Bernstein
7d1f9e33b8
Merge pull request #1577 from alanbernstein/core-478-query-history-nanoseconds
CORE-478 Add 'Nanoseconds' units to query-history 'runtime' json key
2021-04-22 20:23:28 -05:00
Alan Bernstein
7ffc103777 Add 'ns' units to query history runtime json 2021-04-22 15:26:15 -05:00
seebs
8c28a5f8ca
Merge pull request #1576 from seebs/ulimit
centralize attempts to set/check limits [CORE-426]
2021-04-21 15:05:23 -05:00
Seebs
1a5696fe23 centralize attempts to set/check limits
We check mmap limits, and try to set/increase our open file limits,
and we check the mmap limit when we start the server, and try to set
the open file limit every time we open a holder.

It's useless to do these things more than once, though. We migrate
these things to be run through a sync.Once, which runs all of them
the first time a server starts up, and then thereafter just returns
the error code from that first run. This should make test startup
ever so slightly cheaper, saving us potentially several microseconds,
but also reducing the spamminess of the message.

I've taken out the `sudo ulimit` advice since it's wrong, and the
documentation link is updated to point to our (now private!)
customer documentation.
2021-04-21 13:56:42 -05:00
seebs
0adc10d2c1
Merge pull request #1578 from seebs/bitmaaaapMaster
roaring ops log and TxBitmap fixes
2021-04-21 12:16:47 -05:00
Seebs
5a7c0971ca additional fragment tests: bitmap file growth, TxBitmap data loss
Checking issues encountered while tracking down an unexpected disk
usage increase.
2021-04-20 12:03:49 -05:00
Seebs
014a94c9c7 TxBitmap: track seen container keys
We can't assume that a container we've seen stays present in our bitmap
after possible remove operations. Solution: Track keys seen.
2021-04-20 12:03:44 -05:00
Seebs
5ffa4ba803 drop "batched" flag from Add operation
The "batched" flag creates a complexity which is that the return value of Add
might or might not be meaningful, but it doesn't really buy us very much.

If we are concerned about the ops log size of writing single ops as 21-byte
arrays of 1 op rather than as 13-byte ops, we can make the AddN code smarter
about how it writes ops. And probably should.

Along with this, change Remove to use the batched operation form, which
writes a more meaningful ops log, and return a meaningful value for changes
made. Otherwise, it ends up writing potentially thousands of ops to the
ops log without reporting any OpN, because the number of ops written isn't
the same as the number of changes those ops made. This could result in
files growing by megabytes without OpN changing.

There was a comment here about a test failing with RemoveN. I can't prove
it, but I strongly suspect that this was actually a result of that test
case hitting a particular bug that we eventually fixed, and which we might
have fixed sooner if we'd realized why using RemoveN made that test
fail.
2021-04-20 12:03:25 -05:00
Seebs
e93d2fe06c bitmap unmarshalling and testing bug fixes
When unmarshalling ops, we weren't adding a meaningful OpN to them,
resulting in misleading reports from `pilosa inspect`. Also, we were
mistakenly reporting things as "mapped" when they were actually
using their internal storage (as with small array containers).

Add the "sanity check" to `pilosa inspect` so that errors like the
above get noticed more easily and corrected. Also, to make that work,
have roaring.InspectBinary actually put containers in the bitmap
it creates rather than just creating info entries for them.
2021-04-20 12:01:21 -05:00
Seebs
ca216a14c5 fix bitmap.BitwiseEqual bugs
bitmap.BitwiseEqual had a couple of subtle bugs, and the net result
is that if the bitmap you were comparing to had an empty container after
the original bitmap ran out of containers, we'd spuriously report
the container as existing and being... the last container in the original,
actually.

Issues are both that we were grabbing the value from the wrong iterator,
and also that we were iterating twice per loop, and thus could also
have missed a non-empty container immediately following an empty one.
2021-04-20 12:01:13 -05:00
Kuba Podgórski
358e4b860e
Merge pull request #1574 from kuba--/public-name-validator
Make validateName function public,
2021-04-16 17:37:39 +02:00
Kuba Podgórski
74c1c8a86c
Merge branch 'master' into public-name-validator 2021-04-14 22:17:07 +02:00
Ben Johnson
3eca5944d4
Merge pull request #1571 from molecula/timestamp-epoch
Switch timestamp field to use epoch instead of min/max
2021-04-14 12:34:35 -06:00
tgruben
69e50b04d8
Merge pull request #1575 from tgruben/timestamp-client
Timestamp client
2021-04-14 12:58:33 -05:00
tgruben
813687d522
Merge branch 'timestamp-epoch' into timestamp-client 2021-04-14 11:37:40 -05:00
Todd Gruben
5737381d23 clientside timestamp support 2021-04-14 11:28:06 -05:00
Ben Johnson
bc4ad866c6
Merge branch 'master' into timestamp-epoch 2021-04-14 09:56:25 -06:00
seebs
8d1b1f24f9
Merge pull request #1551 from seebs/heartbeat
etcd: overhaul interactions to use heartbeats and cache things only until something changes.
2021-04-14 10:49:57 -05:00
Kuba Podgórski
29fe5cabaa
Merge branch 'master' into heartbeat 2021-04-14 17:10:20 +02:00
seebs
ee629bfd6a
Merge pull request #1569 from ajnavarro/improvement/reduce-executor-test-execution-time
[CORE-438] Reduce executor tests execution time from 2:30 to 30s reusing clusters.
2021-04-14 09:58:59 -05:00
Ben Johnson
ea01f7e37c Switch timestamp field to use epoch instead of min/max 2021-04-14 08:46:37 -06:00
Kuba Podgórski
ca1cbadb45 Make validateName function public, so other packages and projects (like IDK, Ingester) can re-use it 2021-04-14 13:33:26 +02:00
Antonio Navarro Perez
43c230039f Reduce executor tests execution time from 2:30 to 30s reusing clusters.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-04-14 11:30:02 +02:00
Seebs
7497d5fbe2 artificially increase heartbeat TTL for tests only
CI systems sometimes hiccup for five seconds, which causes heartbeat leases
to fail and breaks all sorts of things. As a workaround, update heartbeat
TTL for tests only. This might in turn cause different failures to do
with leader elections, but in theory those should be handled now?
2021-04-13 12:37:07 -05:00
Seebs
0638101d2a cluster state checking cleanups and fixes
A while back we started just polling the reported cluster state of one node
when starting a cluster for tests. This works fine if we're doing fresh
new etcd queries for every single operation -- but that's insanely
expensive, it turns out.

When we use the watcher, some nodes will report stale data for "a
while", where "a while" appears to be easily a couple dozen milliseconds.
This is probably irrelevant in most real-world cases, because the common
case (detecting a node going down) means that we have at least five
seconds after a node goes down before etcd notices the lease expiring,
and a few milliseconds more or less won't matter.

But we have tests that assume either that node 0 is always the
coordinator (wrong) or that waiting for node 0 to think the cluster
is up means that every node in the cluster thinks the cluster is up,
or at least that it means that the coordinator thinks the cluster is
up. We retried later operations but not the initial ones against
the coordinator.

In fact, we probably want to wait for the entire cluster to think
it's up before we start trying things on clusters.

We also replace the "CheckClusterState" function with the existing
AwaitState call, or a new AssertState which errors out since that's
the way we usually use AwaitState anyway.

In the AwaitPrimaryState function, which used to be
AwaitCoordinatorState in a different long-lost revision, we have
to delay until a primary node is available, or fail if one does
not become available, to avoid a panic. This probably shouldn't
happen anymore, because of the last change:

Also, rovide dummy topology.Node entries before metadata is read.

During initial startup, we want to be able to do things like determine
which node is the primary, even before we've read metadata from them.

To do this, we populate the node list with dummy entries that just have
the ID (the only part we need to sort our list), and a node state of
UNKNOWN.

This breaks the fancy logic for determining whether or not to update
the node data, because the initial status of UNKNOWN matches what we
get from SetMetadata giving us new data so we end up not realizing
that this was actually a meaningful change. But actually, that's
a pretty niche optimization; we usually only get state changes when
there's an actual change in state. The updates here are cheap
and only happen after a write (or on the first query) so it's not
worth making the logic a lot fancier to make it work, when we can
just do the simple thing and update any time the dirty flag is set.

We also standardize on a 50ms delay, because 1ms delays were
really expensive when each check was hitting etcd multiple times,
and 50ms is Usually Long Enough.
2021-04-13 12:37:07 -05:00
Seebs
d1752a7af7 switch to using a watcher to watch etcd changes
This is a significant overhaul! Quite a lot of things changed here.

Basically: Prior to this, every request for data from etcd implies
requesting the current live data from etcd, and then unpacking it or
extracting it in some way. This is expensive, which is why we have
a cache in front of it.

We don't need to do that! We can use a Watch, which notifies us
of changes as changes happen. However, there's some challenges and
difficulties along the way, and there's a couple of other changes
which are included here because it's a pain to try to separate them
out.

1. We require a logger to be provided to create our internal Etcd
wrapper. We then use that logger, instead of `fmt.Printf`. This makes
debugging messages work better, and also diagnostics, and so on.

2. The internal client that we are reusing can enter a failed state
after a leader election, in which case we have to recreate the client
to have a working client. We add a new internal-use method,
`retryClient`, which wraps a function which takes an etcd client
and returns an error, and checks for leader-election type errors
and retries creating the client when they happen. That last bit
has not been successfully tested because it's actually really hard
to trigger this now. (Because it was related in part to the
amount of etcd traffic we were producing, which is reduced.)

3. The general swap over from looking things up to unpacking things
as they come in, then returning those already-unpacked things when
we get requests.

With this change, *many tests will fail*. That is addressed by
a separate commit which addresses the secondary problem, which is
that some of our test harness code was relying on the assumption
that if any node in a cluster thinks the cluster is up, every node
will. That was usually true when we were doing everything as
expensive fully-synchronized cluster checks, but becomes significantly
less reliably true in real-world cases where nodes are also
going down sometimes, or nodes are going up and down unexpectedly.
2021-04-13 12:37:07 -05:00
Seebs
fd8a19278c add TestMain wrapper in ctl
The TestMain wrapper gets us the fancy testhook stuff tracking whether we're
deallocating things as expected, and we probably want that.
2021-04-13 12:37:07 -05:00
Seebs
6b1cd1e43b drop etcd-with-cache option
The new etcd implementation has internal caching-like behavior which is
much more reliable (it doesn't use a TTL, it just updates when there's updates
to process) so we don't need this cache.
2021-04-13 12:37:07 -05:00
Ben Johnson
6616b0d6f0
Merge pull request #1570 from molecula/extract-timestamp
Fix timestamp Extract()
2021-04-13 11:18:19 -06:00
Ben Johnson
7863a97add
Merge branch 'master' into extract-timestamp 2021-04-13 10:36:31 -06:00
Alan Bernstein
a0992e0393
Merge pull request #1573 from alanbernstein/logger-prefixes-again
CORE-72 Add log prefix levels
2021-04-12 22:57:42 -05:00
Alan Bernstein
ce4ed1d81d Apply review suggestion
typo fix

Co-authored-by: Travis Turner <travis@pilosa.com>
2021-04-12 22:25:26 -05:00
Alan Bernstein
54ff05c266 Apply review suggestion
typo fix

Co-authored-by: Travis Turner <travis@pilosa.com>
2021-04-12 22:25:26 -05:00
Alan Bernstein
177c27dc31 Switch to new logger in client code (go-pilosa) 2021-04-12 22:25:13 -05:00
Alan Bernstein
285d0a0af8 Add log prefix levels 2021-04-12 20:33:39 -05:00
tgruben
ebbb196a23
Merge pull request #1560 from tgruben/delete
[CORE-245] added pql delete function
2021-04-12 16:47:40 -05:00
tgruben
83eb82f271
Merge pull request #5 from seebs/delete
Delete hackery
2021-04-12 16:22:26 -05:00
Seebs
2833365aae reuse the findExisting filter between fields, drop separate hack for existence
The existence field wasn't working because runs were broken for filters in
RBF. Fixing that allows us to simplify the logic. Also, we reuse the
findExisting filter because the filter's cached collection of containers
can be reused between things, allowing us to reduce allocations when
there's a lot of views.
2021-04-12 16:14:45 -05:00
Seebs
269837414e rbf/intoContainer: ensure correct N, avoid recounting
The remake container logic (used to avoid allocating extra containers while
applying filters) relied on roaring recomputing N, which it did for bitmaps
but didn't do for runs. Fix this both ways; it would now do that for runs,
but also we add "with explicit N" variants and use those since we have a
correct count already, and don't need it. This means fewer popcounts on
bitmaps, and working at all on runs.
2021-04-12 16:13:16 -05:00
Ben Johnson
2864a851ab Fix timestamp Extract() 2021-04-12 13:58:46 -06:00
Ben Johnson
0b76fd5179 Switch timestamp field to use epoch instead of min/max 2021-04-12 13:55:54 -06:00
tgruben
84c269bfc0
Update delete_test.go 2021-04-12 13:38:58 -05:00
tgruben
2d85918f43
Merge branch 'master' into delete 2021-04-09 14:31:40 -05:00
Samir Patel
da749cc757
Merge pull request #1563 from 54mir/timestamp-in-orm
Replicate timefield functionality in pilosaclient
2021-04-09 13:36:39 -05:00
tgruben
b6c80969a1
Merge branch 'master' into timestamp-in-orm 2021-04-09 12:51:36 -05:00
tgruben
f6632bcaca
Merge branch 'master' into delete 2021-04-09 12:51:03 -05:00
Ben Johnson
eb119d2d35
Merge pull request #1568 from molecula/fix-int-fk
Remove integer fk error check
2021-04-09 11:50:41 -06:00
tgruben
3bc4309a96
Merge branch 'master' into delete 2021-04-09 12:41:31 -05:00
tgruben
12748d75d3
Merge branch 'master' into timestamp-in-orm 2021-04-09 12:41:12 -05:00
Ben Johnson
fbd713d435
Merge branch 'master' into fix-int-fk 2021-04-09 11:28:07 -06:00
Ben Johnson
84f9fde25a
Merge pull request #1567 from molecula/import-timestamp-values
Fix timestamp value import
2021-04-09 11:28:01 -06:00
Ben Johnson
e1909661d5 Remove integer fk error check 2021-04-09 11:01:28 -06:00
Ben Johnson
5defbe3ef2 Fix timestamp value import 2021-04-09 10:56:25 -06:00
tgruben
a60c70b2a5
Merge branch 'master' into delete 2021-04-09 10:26:30 -05:00
tgruben
4b484f41f2
Merge branch 'master' into timestamp-in-orm 2021-04-09 10:20:46 -05:00
Ben Johnson
8802856120
Merge pull request #1564 from molecula/timestamp-fixes
Fix timestamp field issues
2021-04-09 09:01:30 -06:00
Ben Johnson
485c1c888b
Merge branch 'master' into timestamp-fixes 2021-04-09 08:31:55 -06:00
Nia
95dd262bb3
Merge pull request #1559 from niaow/id-alloc-desync-structured-error
[CORE-386] Change ID allocation to return a structured error on offset desync
2021-04-09 10:28:26 -04:00
Ben Johnson
d70eb737cb Fix timestamp field issues 2021-04-09 08:26:12 -06:00
Nia
6140fc9d4c
Merge branch 'master' into id-alloc-desync-structured-error 2021-04-09 09:16:25 -04:00
Todd Gruben
ac7a8c3dd5 validate existence 2021-04-09 07:24:43 -05:00
Kuba Podgórski
6caae41432
Merge pull request #1565 from kuba--/fix-panic
Fix panic on field not found on /import
2021-04-09 14:01:07 +02:00
Kuba Podgórski
c021b873d5 Fix panic on field not found on /import 2021-04-09 13:38:39 +02:00
Samir Patel
b1d1ac0cae
Merge branch 'master' into timestamp-in-orm 2021-04-08 13:40:14 -05:00
Samir
83932041a5 Replicate timefield functionality in pilosaclient 2021-04-08 13:21:49 -05:00
tgruben
784c78e313
Merge branch 'master' into delete 2021-04-08 10:05:31 -05:00
Nia
dbf9b14963
Merge pull request #1562 from niaow/update-before-install
Update the package database before installing dependencies in CI
2021-04-08 10:46:47 -04:00
Todd Gruben
dcd6c649e8 skip blue-green on delete test 2021-04-08 09:37:34 -05:00
Nia Weiss
c127f0a959
update the package database before installing dependencies in CI 2021-04-08 10:20:16 -04:00
Todd Gruben
918644820b added pql delete function 2021-04-07 13:57:43 -05:00
Ben Johnson
7e369aeac4
Merge pull request #1558 from molecula/timestamp
CORE-372: Add timestamp field type support
2021-04-06 11:28:10 -06:00
Ben Johnson
cfc725e799 Add timestamp field type support 2021-04-06 10:50:10 -06:00
Alan Bernstein
f75e46c2f6
Merge pull request #1544 from alanbernstein/clarify-longquerytime-log
Add some context to the longquerytime log message
2021-04-06 11:18:07 -05:00
Nia Weiss
7734bcd53c
change ID allocation to return a structured error on offset desync
This is used to handle a possible case where a kafka partition is moved to another ingester while a previous ingester is still processing it, causing 2 ingesters to process it at the same time.
This allows a duplicate ingester to skip past messages which have already been ingested.
2021-04-06 10:39:22 -04:00
Alan Bernstein
2e93b2eea2 Add some context the longquerytime log message 2021-04-05 17:02:58 -05:00
Antonio Navarro Perez
6664e86222
Merge pull request #1556 from ajnavarro/tests/review-skipped-tests 2021-03-31 16:29:02 +02:00
Kuba Podgórski
ddf7ff7b70
Merge branch 'master' into tests/review-skipped-tests 2021-03-31 15:38:36 +02:00
Nia
aa212cb83b
Merge pull request #1547 from niaow/external-lookup
[CORE-388] Add ExternalLookup query
2021-03-31 08:35:54 -04:00
Nia
d5da6e229c
Merge branch 'master' into external-lookup 2021-03-31 08:12:18 -04:00
Antonio Navarro Perez
ebe3afcb96
Merge branch 'master' into tests/review-skipped-tests 2021-03-31 14:03:35 +02:00
Matthew Jaffee
4856c68760
Merge pull request #1542 from Maxtonian/percentile
CORE-412 change percentile value ranges from 0-1 to 0-100
2021-03-30 09:23:12 -05:00
Maxton Huff
ff82447647
Merge branch 'master' into percentile 2021-03-30 08:20:45 -05:00
Maxton Huff
8c20d9a51c remove redundant error message 2021-03-30 08:13:36 -05:00
Antonio Navarro Perez
03659d8d39 Review skipped tests, and try to execute them again.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-30 13:37:33 +02:00
Nia
71b2cb80f7
Merge pull request #1555 from niaow/test-tx-commit-rollback-single-writer-race
Fix DB-close race condition in TestTx_CommitRollback/SingleWriter
2021-03-29 18:13:37 -04:00
Maxton Huff
13ec97abf5 add new test cases for limits and clarify error messages 2021-03-29 16:55:50 -05:00
Nia
1fa3947f8d
Merge branch 'master' into test-tx-commit-rollback-single-writer-race 2021-03-29 17:51:54 -04:00
Maxton Huff
4c8dc8d54f address variable declaration warning 2021-03-29 16:24:56 -05:00
Maxton Huff
377c3f3654 rework checks and reword incorrect type error message 2021-03-29 15:59:30 -05:00
Nia Weiss
c931a3e63f
fix DB-close race condition in TestTx_CommitRollback/SingleWriter
Due to lack of synchronization, this test would sometimes close the DB before terminating a transaction:
=== RUN   TestTx_CommitRollback/SingleWriter
    tx_test.go:132: db still has 1 active transactions; must closed before closing db

The test now waits for the goroutines to terminate before closing the DB.
2021-03-29 15:06:07 -04:00
Kuba Podgórski
6185abacc1
Merge pull request #1552 from kuba--/test-pilosa/client
[CORE-458] Integration tests client against cluster
2021-03-29 19:07:53 +02:00
Nia Weiss
9bc1b23b7e
change "External" DB to "Lookup" DB 2021-03-29 12:54:29 -04:00
Kuba Podgórski
c23bc901e8 Integration tests client against cluster 2021-03-29 18:31:45 +02:00
Kuba Podgórski
b835221ded
Merge pull request #1553 from kuba--/wth-is-vprint
[CORE-452] Move `vprint` to separate package
2021-03-29 18:10:18 +02:00
Kuba Podgórski
9a02004a4f Move vprint to separate pakage 2021-03-29 14:29:19 +02:00
Nia Weiss
c4aad290ed
address ExternalLookup review comments 2021-03-29 08:22:41 -04:00
Kuba Podgórski
8948c4531a
Merge pull request #1550 from ajnavarro/fix/use-at-least-3-nodes-on-cluster-tests
[CORE-432] Add at least 3 nodes on test clusters.
2021-03-27 17:07:17 +01:00
Maxton Huff
4ce71eeddf change nth value limit message and number of test int64 nth values 2021-03-26 16:54:44 -05:00
Maxton Huff
f06c13abcd alter incorrect type error message 2021-03-26 16:11:16 -05:00
Maxton Huff
6c94bfdb5e improve error responses and change switch statement to allow int64 2021-03-26 13:56:22 -05:00
Maxton Huff
87412068f1 add new test to account for int64 nth values 2021-03-26 13:01:31 -05:00
Antonio Navarro Perez
79c6493d9a Fix executor test.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-26 13:21:56 +01:00
Antonio Navarro Perez
0483553b16 Fix two more tests
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-26 13:04:15 +01:00
Antonio Navarro Perez
7ec85a1c0f Add at least 3 nodes on test clusters.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-26 10:16:41 +01:00
Maxton Huff
8746444cdb add error message for invalid type 2021-03-25 16:57:08 -05:00
Maxton Huff
61beef7e5a add Int64() function and include case of int64 2021-03-25 16:27:55 -05:00
Kuba Podgórski
878f7fd4e7
Merge pull request #1546 from kuba--/fix-pb-endpoints
Update internal endpoints
2021-03-25 18:25:38 +01:00
Nia Weiss
e9b92e1cd4
add ExternalLookup query 2021-03-25 13:21:28 -04:00
Kuba Podgórski
65cb2cdf73 Update internal endpoints 2021-03-25 18:00:56 +01:00
Kuba Podgórski
0649ba3f8d
Merge pull request #1545 from kuba--/fix-endpoint
Fix internal endpoint
2021-03-25 17:18:37 +01:00
Kuba Podgórski
761190ec32 Fix internal endpoint 2021-03-25 16:44:05 +01:00
Kuba Podgórski
989a01db33
Merge pull request #1539 from kuba--/core-230/go-pilosa
[CORE-230] Combine go-pilosa and pilosa into one repo
2021-03-25 15:31:32 +01:00
Kuba Podgórski
40337cff09
Merge branch 'master' into core-230/go-pilosa 2021-03-24 21:23:04 +01:00
tgruben
76b676a256
Merge pull request #1537 from tgruben/tds
[CORE-311] etcd tls configuration support
2021-03-24 12:30:50 -05:00
Kuba Podgórski
000f708c40 Address PR comments
+ some docs
2021-03-24 18:09:01 +01:00
Maxton Huff
d3438e8a80 correct k calculation and change test nth values 2021-03-24 10:58:47 -05:00
Kuba Podgórski
d6129517db
Update handler.go
Co-authored-by: Travis Turner <travis@pilosa.com>
2021-03-24 16:49:32 +01:00
Todd Gruben
e46a41638f Merge branch 'tds' of github.com:tgruben/privilosa into tds 2021-03-24 10:44:31 -05:00
Todd Gruben
6bafa989e0 adjust etcd config comments 2021-03-24 10:43:28 -05:00
tgruben
160e64fbf3
Merge branch 'master' into tds 2021-03-24 10:07:50 -05:00
Kuba Podgórski
913c909ef7
Merge branch 'master' into core-230/go-pilosa 2021-03-24 15:19:44 +01:00
Kuba Podgórski
03386392ea Fix typos, replace panics by error 2021-03-24 15:15:50 +01:00
Antonio Navarro Perez
7cf4233fdb
Merge pull request #1541 from ajnavarro/fix/call-cancel-if-any 2021-03-24 11:35:41 +01:00
Antonio Navarro Perez
ffcaa1b500
Merge branch 'master' into fix/call-cancel-if-any 2021-03-24 10:30:39 +01:00
Maxton Huff
40e3acc3e4 change percentile value ranges from 0-1 to 0-100 2021-03-23 16:57:37 -05:00
tgruben
9e6855b315
Merge branch 'master' into tds 2021-03-23 16:40:48 -05:00
Ben Johnson
1228c6e188
Merge pull request #1532 from molecula/fix-delete-field-panic
CORE-334: Fix panic on field deletion
2021-03-23 09:03:46 -06:00
Antonio Navarro Perez
6e6eb962ee Call cancel when we try to renew the lease after an error.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-23 14:20:14 +01:00
Todd Gruben
8c4d7e09ff re-use pilosa tls settings 2021-03-22 16:48:09 -05:00
Kuba Podgórski
1e5388dbe9 Move internals proto files into separate package (pb) 2021-03-22 20:28:00 +01:00
Kuba Podgórski
8131e807bf Add client package with go-pilosa implementation 2021-03-22 20:22:38 +01:00
Ben Johnson
5d2f957404
Merge branch 'master' into fix-delete-field-panic 2021-03-22 08:32:34 -06:00
Todd Gruben
f52b88a962 etcd tls configuration support 2021-03-22 09:10:32 -05:00
Nia
b6810f3ce7
Merge pull request #1535 from niaow/fix-unkeyed-panic
CORE-382 Handle translation errors when using keys against an unkeyed index
2021-03-17 17:16:55 -04:00
Nia Weiss
6f421dad69
handle translation errors when using keys against an unkeyed index
This also adds tests for our error outputs.
2021-03-17 12:02:29 -04:00
Kuba Podgórski
16245b1742
Merge pull request #1534 from kuba--/call-agg/335
CORE-335 Consistency with aggregate functions
2021-03-16 19:54:12 +01:00
Kuba Podgórski
d370452449 Add helper function FirstStringArg 2021-03-16 16:32:35 +01:00
Kuba Podgórski
1dac4c7622 Consistency with aggregate functions 2021-03-16 15:02:40 +01:00
Ben Johnson
195050e20c CORE-334: Fix panic on field deletion 2021-03-15 12:19:43 -06:00
Matthew Jaffee
c6ea56bbad
Merge pull request #1529 from travisturner/cache-bitdepth
[Core-370] Cache BitDepth on bsiGroup during index.Open
2021-03-15 07:38:05 -05:00
Travis
314cf3461d
Cache BitDepth on bsiGroup during index.Open.
Before this change, we were only caching the BitDepth on the
field.options. This was ok as long as applyOptions() was called after
that. But unfortunately, during startup, applyOptions() was called prior
to that being set. So with this commit, we explicitly set the value in
bsiGroup.BitDepth as well.
2021-03-14 22:51:24 -05:00
Matthew Jaffee
9b3cce619a
Merge pull request #1530 from jaffee/revert-custom-json
Revert "Basic pilosa changes for oracle support"
2021-03-14 22:50:37 -05:00
Matt Jaffee
11288c2ae8
Revert "Basic pilosa changes for oracle support"
This reverts commit 47e74f2603.
2021-03-14 22:17:26 -05:00
Nia
c694189648
Merge pull request #1523 from niaow/idalloc-fix
CORE-361 Fix ID allocation API after disco
2021-03-14 16:52:52 -04:00
Nia Weiss
2f4a2bf98f
fix ID allocation API after disco
The ID allocation API was broken because the operations were removed from the list allowed in the NORMAL cluster state.
Additionally the operations were set to only run on non-primaries (where they were actually only supposed to run on the primary).
2021-03-13 07:41:00 -06:00
Nia
ec899bcc64
Merge pull request #1519 from niaow/rbf-typos
fix a typo in the RBF spec
2021-03-13 00:25:12 -05:00
Ben Johnson
ddb8c95737
Merge branch 'master' into rbf-typos 2021-03-12 20:16:17 -07:00
tgruben
29b8501aff
Merge pull request #1527 from tgruben/core-334-fix
[CORE-334]  more graceful error handling for corrupt containers
2021-03-12 15:16:12 -06:00
Todd Gruben
346a248019 Merge branch 'core-334-fix' of github.com:tgruben/privilosa into core-334-fix 2021-03-12 13:28:11 -06:00
Todd Gruben
2711bf321f replace error with wrap 2021-03-12 13:27:28 -06:00
tgruben
fd7ea42451
Merge branch 'master' into core-334-fix 2021-03-12 12:11:52 -06:00
Kuba Podgórski
38c2c4ad6f
Merge pull request #1526 from seebs/testLeaks
CORE-358 Test leaks
2021-03-12 19:10:02 +01:00
Todd Gruben
94d7b295ea added more graceful error handling for corrupt containers 2021-03-12 10:37:40 -06:00
seebs
78ed9a2d57
Merge branch 'master' into testLeaks 2021-03-12 10:02:11 -06:00
Kuba Podgórski
1b486ac812
Merge pull request #1522 from kuba--/core-344
CORE-344: Fix deprecation plan for "github.com/golang/protobuf/protoc-gen-go/generator" package
2021-03-12 15:29:54 +01:00
Kuba Podgórski
61585b251e
Merge branch 'master' into testLeaks 2021-03-12 14:14:03 +01:00
Kuba Podgórski
4043f22db2
Merge branch 'master' into core-344 2021-03-12 14:08:03 +01:00
Travis Turner
81c47b778e
Merge pull request #1525 from travisturner/startup-log-dir
[CORE-362] Create the data directory during "log startup" if it doesn't already exist
2021-03-12 06:47:45 -06:00
Kuba Podgórski
1ba52dbca9 Update go.sum 2021-03-12 13:06:23 +01:00
Kuba Podgórski
a12a130420
Merge branch 'master' into core-344 2021-03-12 12:51:58 +01:00
Kuba Podgórski
ddc924de0c go mod tidy 2021-03-12 12:48:53 +01:00
Seebs
ef8dd91077 report errors more clearly when trying to recreate leases
There's some loose ends here because really we probably want to be
using the top-level server logger, and we should fix that, but in the
mean time, let's not swallow the errors as much, because the last
line printed doesn't actually show what the error was, but it could.

To do this, we distinguish between the current error (which might
be a wrapper around DeadlineExceeded) and a previous error which
we might prefer to return, if one exists, since it's more likely
the "real" cause.
2021-03-11 19:42:10 -06:00
Seebs
1045268f01 use testhook to ensure temporary files and directories are cleaned up
In nearly all cases, we can just switch ioutil.TempDir->testhook.TempDir
and similarly for TempFile. There's one case where we can't because we
need files to be removed before tests are over.

Also in the process give identifiable names to a lot of temporary files
and make sure they're being cleaned up, and don't use "/tmp/foo" as a
file name in a test that could be running in more than one test process
at once. :)
2021-03-11 19:42:10 -06:00
Travis
9e0ea9709a
Create the data directory during "log startup" if it doesn't already exist.
Prior to using etcd for node membership, the data director was created
during the cluster topology setup. Since that no longer exists, we
weren't actually creating the data directory before getting to
logStartup(). So this change ensure that the data directory exists.
2021-03-11 17:31:46 -06:00
tgruben
9b913ce904
Merge pull request #1489 from tgruben/theoracle
Theoracle
2021-03-11 16:11:38 -06:00
tgruben
391588bd1b
Merge branch 'master' into theoracle 2021-03-11 13:56:34 -06:00
Alan Bernstein
7df5375572
Merge pull request #1524 from alanbernstein/fix-null-schema
Represent zero indexes in /schema response as [] instead of null
2021-03-11 13:23:19 -06:00
tgruben
21910ef321
Update main.go 2021-03-11 11:47:57 -06:00
tgruben
a5dceaae11
Update main.go 2021-03-11 11:26:58 -06:00
Alan Bernstein
8e123b821d Replace null with [] in schema response 2021-03-11 11:23:20 -06:00
Todd Gruben
47e74f2603 Basic pilosa changes for oracle support 2021-03-11 11:16:53 -06:00
Kuba Podgórski
95eaab8ffc
Merge pull request #1514 from seebs/discoSyncer
CORE-299 check for nil translate store while reading translate entries
2021-03-11 13:03:24 +01:00
Nia Weiss
e73d9cb61b
fix a typo in the RBF spec 2021-03-10 14:25:38 -05:00
Kuba Podgórski
3fde2dcac2
Merge branch 'master' into discoSyncer 2021-03-10 12:35:10 +01:00
Kuba Podgórski
5af850c64a
Merge pull request #1518 from kuba--/fix-metadata-noder
Get metadata in Tx. Fix Nodes implementation
2021-03-10 11:24:09 +01:00
Kuba Podgórski
4c787870b2 Get metadata in Tx. Fix Nodes implementation 2021-03-10 00:28:49 +01:00
Seebs
810f840839 combine field and index translation readers
There's no need to have two different translation readers, a single
reader can handle both partitions and fields at the same time, so we
can combine them. This may not actually change things much but was
a useful step in diagnosing a different problem with translate readers,
and I think it is a minor improvement so I'm preserving the patch
just in case.
2021-03-09 13:37:51 -06:00
Seebs
76e4181740 don't reuse sync.Mutex between translate readers
The functional option and returned closure combine to result in
us using the same sync.Mutex object for every TranslateReader on
a given server, which means that if one of them isn't producing anything,
we eventually end up waiting on that with all the others blocked
waiting for the lock. Use separate locks for each, of the same
type as the one initially provided as a template. This does mean
that multiple readers can be operating at once, but in theory
no two readers should ever be writing to the same stores, we
think.
2021-03-08 17:04:52 -06:00
Seebs
51744dc77a check for nil translate store while reading translate entries
If we are using replication, we can be a replica translate store for a
partition, which means we start a translate store reader to replicate
data for it. The translation logic does not admit *stopping* the
translate reader, only "resetting" it (stopping and immediately
restarting), so the translate reader just runs until it hits an error
and terminates, which it does even if perhaps it shouldn't. Oops.

Anyway, one potential failure mode is that if you hit timing just
right, you can end up trying to process translation *while* the
index is being closed, and the index can close its translation stores,
and make them all nil, right before we request a store and try to use
it. Another is a similar error, but during the initial startup of the
translate store readers. Either way, we want to error out of the
process cleanly if this happens.

This could also happen during initial creation, perhaps.

We're aborting translation sync on these errors, because otherwise
we'd continue accepting new keys, and then end up with our highest
known key being higher than some keys we missed; this way the next
restart will restart from the last key we have.
2021-03-08 17:04:52 -06:00
Travis Turner
45577494c3
Merge pull request #1517 from travisturner/datadir-take-3
Remove stutter and suffix from backend files
2021-03-08 11:50:42 -06:00
Travis Turner
2a0765d7f0
Merge branch 'master' into datadir-take-3 2021-03-08 11:21:05 -06:00
Kuba Podgórski
d6e9e88872
Merge pull request #1516 from kuba--/test-close
Close resources in TestLeasedKv
2021-03-08 11:01:40 +01:00
Travis
f78a6508f0
Remove stutter and suffix from backend files 2021-03-07 22:11:51 -06:00
Kuba Podgórski
7b005f69c6 Close resources in TestLeasedKv 2021-03-06 12:03:57 +01:00
Travis Turner
ab50403c35
Merge pull request #1512 from travisturner/datadir-take-2
Core-316 Reorganize Pilosa datadir
2021-03-05 17:15:03 -06:00
Travis
cad78f1d34
remove "Default*" from const names 2021-03-05 16:56:44 -06:00
Travis
5191d0c3f4
remove unnecessary skip check 2021-03-05 16:56:44 -06:00
Travis
4661f3ac08
reorganize the storage backends directory 2021-03-05 16:56:44 -06:00
Travis
4738a818d2
change attributes file ".data" to "column/row-attributes" 2021-03-05 16:56:44 -06:00
Travis
345d076fdf
introduce "fields" directory between index and field 2021-03-05 16:56:44 -06:00
Travis
4e7ec34c6d
change directory ".disco" to "disco" 2021-03-05 16:56:44 -06:00
Travis
7789e24965
introduce "indexes" directory between datadir and index 2021-03-05 16:56:43 -06:00
Matthew Jaffee
863e57d5d1
Merge pull request #1513 from ajnavarro/disco/improve-leased-keys
[CORE-312] Improve leased keys.
2021-03-05 16:47:54 -06:00
Antonio Navarro Perez
542a98548a Breaking code at friday afternoon...
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
2927943734 Copy paste fix.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
feea0fa347 Requested changes.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
85a43c519d Fix problem with context errors.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
df0064c55f Add godoc.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
955ab2b5a0 Requested changes
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
851c41cd45 Implement infinite lease renewal logic.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Antonio Navarro Perez
7a1e4cd2d7 Improve leased keys.
Added a leasedKV struct in charge of maintain a lease for a specific
key.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-05 23:35:53 +01:00
Matthew Jaffee
6966c3f7c3
Merge pull request #1515 from jaffee/invalid-pilosa-message-fix
CORE-319 Fix issue where restarting a node fails to sync and logs "invalid pilosa.Message"
2021-03-05 15:58:06 -06:00
Matt Jaffee
f97ac4928c
add test for pilosa.Message issue
this doesn't quite work as-is, but I verified that it reproduced/fixed
the issue by adding a panic where the problem log statement
is. There's a follow up ticket to fix the test... it's just a bit open
ended as to the best way to do that.
2021-03-05 14:16:52 -06:00
Matt Jaffee
08d4511e6c
fix issue where restarting a cluster logged "invalid pilosa.Message"
we were sending pilosa.Message objects from a spool, but actually
passing a pointer to them rather than the Message itself. I'm
concerned this wasn't caught in any test, and also curious if that
needed to be a pointer for some reason or if it's a typo.

Definitely need to write a test still.
2021-03-05 12:51:39 -06:00
Travis Turner
fa9e17878f
Merge pull request #1503 from molecula/disco
DisCo
2021-03-04 17:24:42 -06:00
Matt Jaffee
bb713f94a5
Merge branch 'master' into disco 2021-03-04 16:56:35 -06:00
Cody Soyland
bf050a69d2
Merge pull request #1511 from codysoyland/release-on-tag
Run release stage when tags are pushed
2021-03-04 15:22:01 -06:00
Cody Soyland
ba8fb56a4a
Run release stage when tags are pushed 2021-03-04 15:11:57 -06:00
Matthew Jaffee
911c874fa1
Merge pull request #1510 from jaffee/upgrade-lettuce
upgrade UI for final Molecula 3.x/Pilosa 2.x release
2021-03-04 15:05:08 -06:00
Matt Jaffee
e1f2ffe614
upgrade UI for final Molecula 3.x/Pilosa 2.x release 2021-03-04 14:44:38 -06:00
Travis Turner
10a55040e8
Merge pull request #1509 from travisturner/disco-remove-gossip-config
Remove gossip config
2021-03-04 14:19:35 -06:00
Travis
42d69d6c5d
Remove gossip config 2021-03-04 13:51:18 -06:00
Nia
d2b0749c8a
Merge pull request #1507 from niaow/always-build-release
CORE-313 Build release bundles on every merge
2021-03-04 13:29:46 -05:00
Nia Weiss
0fbdbc7ccb
build release bundles on every merge 2021-03-04 12:34:51 -05:00
Kuba Podgórski
da3116a642
Merge pull request #1504 from kuba--/txn-state
Always Put states in Txn
2021-03-04 00:21:40 +01:00
Kuba Podgórski
d311b0cac4 Comment Status function
+ make waitForStatus more generic
2021-03-03 23:47:47 +01:00
Kuba Podgórski
fa293ba6c3 Address PR comments 2021-03-03 16:13:03 +01:00
Kuba Podgórski
a14baf8c15 waitForStatus for cluster test 2021-03-03 14:22:44 +01:00
Kuba Podgórski
6f7d748c8a Always Put states in Txn 2021-03-03 13:37:20 +01:00
Travis
883e687094
fix missing bracket 2021-03-02 22:14:07 -06:00
Travis
ea8b07d380
Merge branch 'master' into disco 2021-03-02 22:11:04 -06:00
Matthew Jaffee
c4c4a49f13
Merge pull request #1483 from jaffee/core-101-disco
CORE-101 Percentiles on disco
2021-03-02 22:02:27 -06:00
Matt Jaffee
f81c0cab6b
move 0.0 check up to right after Min is queried 2021-03-02 21:59:46 -06:00
Matt Jaffee
1e4cc12bd0
handle 0th percentile properly 2021-03-02 21:47:27 -06:00
Matt Jaffee
b1f9e6ad05
turn off parallel for variousQueries 2021-03-02 20:36:54 -06:00
Matt Jaffee
ad88f4fac8
refactor tests to reuse clusters more 2021-03-02 20:36:54 -06:00
Matt Jaffee
88b093db7a
add 60m timeout to topt-race tests to match topt 2021-03-02 20:36:53 -06:00
nagamocha3000
7da218727d
Separate out tests on Percentile to top level 2021-03-02 20:36:53 -06:00
nagamocha3000
832c6f1a71
Restore filter argument 2021-03-02 20:36:53 -06:00
nagamocha3000
66d12f88e2
Remove filter to check if it's cause of leaks 2021-03-02 20:36:53 -06:00
nagamocha3000
abe8e61539
Remove check for basic response 2021-03-02 20:36:53 -06:00
nagamocha3000
4e81fd8101
Limit size of nums to 100 2021-03-02 20:36:53 -06:00
nagamocha3000
4be9ac7554
Remove percentile tests temporarily to see if they are the cause 2021-03-02 20:36:53 -06:00
nagamocha3000
1947325e00
Fix error on index name for Percentile query 2021-03-02 20:36:53 -06:00
nagamocha3000
2de543bc55
Rename index to avoid possible conflict 2021-03-02 20:36:52 -06:00
nagamocha3000
a6c157d5db
Fix errenous estimation that caused infinite loop 2021-03-02 20:36:52 -06:00
nagamocha3000
ef58b66e2c
Add ability to compose filter Row Call with Percentile 2021-03-02 20:36:52 -06:00
nagamocha3000
131d4fd97c
Make tests for median more extensive 2021-03-02 20:36:52 -06:00
nagamocha3000
72af5f37df
Remove redundant assignment to countCall.children since we already have the reference 2021-03-02 20:36:52 -06:00
nagamocha3000
3fb79b4d97
Fix errors on creating pql Call 2021-03-02 20:36:52 -06:00
nagamocha3000
d740a0cda7
Add execution for median 2021-03-02 20:36:52 -06:00
nagamocha3000
26fd199716
Add basic test for Percentile query 2021-03-02 20:36:51 -06:00
nagamocha3000
30a7e0f0da
Add pql syntax for Percentile 2021-03-02 20:36:51 -06:00
Matthew Jaffee
61e84a01dc
Merge pull request #1500 from jaffee/default-rbf
change default backend to RBF, remove separate RBF race target
2021-03-02 20:34:32 -06:00
Matt Jaffee
52a0c90cd6
change default backend to RBF, remove separate RBF race target 2021-03-02 17:50:56 -06:00
Matthew Jaffee
34e742d9c6
Merge pull request #1502 from niaow/fix-more-kv
fix more incorrect uses of KV
2021-03-02 17:50:29 -06:00
Nia Weiss
a698eeaac2
fix more incorrect uses of KV 2021-03-02 18:35:19 -05:00
Matthew Jaffee
b790d2cc5f
Merge pull request #1501 from travisturner/disco-bitdepth-test-fix
fix SaveMeta test; ensure storage backend env is used
2021-03-02 17:26:52 -06:00
Travis
3d10af9d47
fix SaveMeta test; ensure storage backend env is used 2021-03-02 17:19:45 -06:00
Cody Soyland
acc1175c93
Merge pull request #1498 from codysoyland/docker-ci-version
Workaround CI versioning issue
2021-03-02 15:03:52 -06:00
Cody Soyland
0532987d57
Workaround CI versioning issue 2021-03-02 14:39:32 -06:00
Maxton Huff
068325277d
Merge pull request #1465 from Maxtonian/topNfieldequal
Allow "field=" for TopN()
2021-03-02 14:32:25 -06:00
Matthew Jaffee
0568daaa14
Merge pull request #1486 from ajnavarro/disco/remove-unused-code-and-godoc
[DISCO] Add documentation and try to remove code.
2021-03-02 14:07:06 -06:00
Maxton Huff
d61fdc2521
Merge branch 'master' into topNfieldequal 2021-03-02 14:02:58 -06:00
Cody Soyland
d2f391d650
Merge pull request #1496 from codysoyland/docker-build-ci
Docker login prior to building image
2021-03-02 13:59:26 -06:00
Cody Soyland
a94c6cf8a2
Docker login prior to building image 2021-03-02 13:43:27 -06:00
Maxton Huff
d20dc525f5
Merge branch 'master' into topNfieldequal 2021-03-02 13:35:17 -06:00
seebs
2d1d8afdf3
Merge pull request #1490 from seebs/disco1443c
avoid deadlocks or crashes when clients cancel queries
2021-03-02 10:17:24 -06:00
Cody Soyland
0488dbe8d3
Merge pull request #1492 from codysoyland/fix-flags
Fix incorrect build flags
2021-03-02 07:46:07 -06:00
Antonio Navarro Perez
274540ea0b Requested changes
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-02 13:46:37 +01:00
Kuba Podgórski
0cb311f2b3 Fix Heartbeat TTL for disco test 2021-03-02 11:30:25 +01:00
Matthew Jaffee
94ccd514ea
Merge branch 'master' into topNfieldequal 2021-03-01 22:18:36 -06:00
Cody Soyland
bfa9682ba5
Fix incorrect build flags 2021-03-01 17:01:06 -06:00
Seebs
5258532157 bump usage guesstimate again
Same machine, a week later: Got 618k instead of 500k. I'm doomed.
2021-03-01 14:20:18 -06:00
Seebs
35d360c68d fix up executor shard-counting logic a bit better
Ensure that mapReduce always waits on its ErrGroup, even if it wants to return
early due to a failure somewhere. Also check logic a bit more carefully on
the error returns; we don't want a transient failure from one node to result
in the whole query failing, we just want it to retry on the next node, so that
shouldn't cancel the whole ErrGroup.
2021-03-01 14:03:49 -06:00
Antonio Navarro Perez
f67db5035e Add part of cache back.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-01 19:09:31 +01:00
Antonio Navarro Perez
50fd72f980
Apply suggestions from code review
Co-authored-by: Travis Turner <travis@pilosa.com>
2021-03-01 18:41:58 +01:00
Antonio Navarro Perez
6f5770bf65 Fix nil pointer exception
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-01 18:39:04 +01:00
Maxton Huff
15aa7d1ad8 add field to SetRowAttrs and TopK to prototypes in ast.go 2021-03-01 11:18:31 -06:00
Antonio Navarro Perez
ea7643f8bf Add documentation and try to remove code.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-03-01 16:25:32 +01:00
Nia
a906a9036b
Merge pull request #1482 from niaow/force-transactional-etcd-reads
Force transactional etcd reads
2021-02-26 19:03:21 -05:00
Travis Turner
4add6134b8
Merge pull request #1468 from travisturner/disco-clustertests
adjust clustertests to have etcd config
2021-02-26 17:49:20 -06:00
seebs
d455fb3105
Merge pull request #1476 from seebs/disco1443b
mapper/mapReduce/worker: always wait for jobs to be finished
2021-02-26 17:35:02 -06:00
Nia Weiss
4be4097edd
force transactional etcd reads 2021-02-26 18:29:01 -05:00
Maxton Huff
23f44725cb remove var allowUnderField 2021-02-26 16:36:16 -06:00
Cody Soyland
c328a18889
Merge pull request #1440 from codysoyland/cd
Add new Docker build process and continuous delivery
2021-02-26 16:32:46 -06:00
Maxton Huff
3822e38952 remove z arg from Rows tests 2021-02-26 16:15:37 -06:00
Travis
ef40bbb617
renew heartbeat lease if the lease expires while a node is unavailable 2021-02-26 16:15:06 -06:00
Travis
d416b88dda
adjust clustertests to have etcd config 2021-02-26 16:15:06 -06:00
Maxton Huff
441630d804 try fixing tests 2021-02-26 16:13:00 -06:00
Nia
590dc3b226
Merge pull request #1478 from niaow/start-http-after-server-open
Start HTTP after server open
2021-02-26 16:04:34 -05:00
Cody Soyland
dca19f7e94
Add new Docker build process and continuous delivery 2021-02-26 14:34:14 -06:00
Seebs
7d15fc2f26 don't reduce errors with non-errors
if we got an error, we don't have to merge it. so either ctx.Err or
resp.err being non-nil means we shouldn't be reducing, but we still need
to grab the responses to make sure we waited for them all.
2021-02-26 14:26:02 -06:00
Nia Weiss
4340e90396
start HTTP handler after server initialization
This fixes a variety of bugs where API requests would read uninitialized state, causing crashes or race conditions.

Co-authored-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-26 15:23:47 -05:00
Ben Johnson
eff313d181
Merge pull request #1474 from molecula/bench-autogenerate
Add benchmarking of autogenerated ID data
2021-02-26 12:39:36 -07:00
Nia
d205ea5441
Merge pull request #1442 from niaow/fix-foreignindex-race
Fix a race condition when deferring foreign-index initialization
2021-02-26 14:30:18 -05:00
Maxton Huff
8bc8368c57 change test arguments to be appropriate 2021-02-26 12:58:59 -06:00
Seebs
29fddd40f6 mapper/mapReduce/worker: always wait for jobs to be finished
It's not enough to cancel jobs so their goroutines *will* exit; we have
to be certain that they *have exited* before we finish returning from,
e.g., mapReduce(), or a query can "complete" at a time when there are
still running goroutines accessing data that we're about to invalidate
when we terminate the Qcx.

A better solution would integrate this logic and control into the Qcx
and pass it through everything, rather than having the Qcx bypass
the mapper/mapperLocal and be passed into the mapFn/reduceFn via
closures. But a better solution would be a lot larger.
2021-02-26 12:47:02 -06:00
Maxton Huff
6f76767841 add test in executor.go to compare results of query w/without field= 2021-02-26 12:06:25 -06:00
Ben Johnson
90278b206c Add benchmarking of autogenerated ID data 2021-02-26 10:37:15 -07:00
Maxton Huff
d49a8f953e regenerate pql from modified peg file 2021-02-26 11:27:39 -06:00
Nia
65e4496ea7
Merge pull request #1449 from niaow/deferredcreateshard
Defer cluster messages until startup
2021-02-26 08:13:51 -05:00
Maxton Huff
ab41d0492c add more tests for TopK, Rows, and SetRowAttrs 2021-02-25 16:04:31 -06:00
Nia Weiss
3fbf6993d0
defer cluster messages until startup 2021-02-25 16:01:49 -05:00
Nia Weiss
ca918c187d
fix a race condition when deferring foreign-index initialization 2021-02-25 16:00:56 -05:00
Kuba Podgórski
a1d4418236
Merge pull request #1464 from kuba--/etcd-shared-client
One shared etcd client
2021-02-25 19:45:22 +01:00
Kuba Podgórski
50cbb72619 Remove comments/leftovers 2021-02-25 19:00:52 +01:00
Kuba Podgórski
49dc48f057 Switch to server API for KV Get/Range 2021-02-25 18:34:24 +01:00
Kuba Podgórski
aa15e08558 Reduce number of Txn 2021-02-25 18:12:13 +01:00
Maxton Huff
6b75a8b500 Revert "allow 'field=' for TopN()"
This reverts commit db01237904.
2021-02-25 11:01:22 -06:00
Kuba Podgórski
a5f3bce3bf Use hookedClient 2021-02-25 16:56:30 +01:00
Kuba Podgórski
1623007af1 Add waitgroup - don't close the server wait for all keepaliveFunc 2021-02-25 13:41:10 +01:00
Kuba Podgórski
23f901635e Revert "Remove etcd cache"
This reverts commit 0f4b273d3a.
2021-02-25 13:41:10 +01:00
Kuba Podgórski
0f4b273d3a Remove etcd cache 2021-02-25 11:30:09 +01:00
Kuba Podgórski
1fc3d37134
Merge branch 'disco' into etcd-shared-client 2021-02-25 09:42:00 +01:00
Kuba Podgórski
01e0c44069 One shared etcd client 2021-02-25 09:39:44 +01:00
Nia
0cfd4e9780
Merge pull request #1463 from niaow/dontcachestate
Stop caching node state in Etcd
2021-02-24 18:28:03 -05:00
Nia Weiss
8b645e02a2
stop caching node state in Etcd 2021-02-24 17:19:27 -05:00
Maxton Huff
db01237904 allow 'field=' for TopN() 2021-02-24 15:29:10 -06:00
seebs
bffdee1e8e
Merge pull request #1432 from seebs/discoPorts
possible fix for CI deadlocks after port_mapper messages in CI
2021-02-24 12:03:14 -06:00
Seebs
8d6f97604f use testhook to run server tests so we can have post-processing and audits
This gives more consistency with the other tests and allows us to get audit
checks on the server/ tests. The tests on the clients being closed are
temporarily disabled because they tend to think the last test's clients
are "still open" for a few seconds after the test completes.
2021-02-24 11:25:46 -06:00
Seebs
2ee589ae1d reduce goroutine spam during TestVariousQueries
etcd runs a LOT more goroutines during server startup. Fix a
goroutine/for loop bug causing us to run four 7-node clusters
instead of 1/3/4/7-node clusters, also have the test/cluster
code reduce import workers. We can't do much about the spamminess
of the Raft stuff, but this should tone it down some.
2021-02-24 11:25:46 -06:00
Seebs
9333b1b27e leaseKeepAlive: manage context and shut it down cleanly
Every usage of this just ran keepAlive func as a goroutine with a timer, using
a parent context, but the keepAlive func didn't know about that context, so
it couldn't use that context for its own messages or interactions. Change
it to create its own cancelable context from a provided parent, and use
that to control its inner behavior.

Note that we *do* still need to send the revoke at least sometimes -- otherwise
cluster states don't update correctly. But we can time that send out
rather than using context.Background(), because after a TTL's worth of time,
there's no lease to revoke anyway.

Also, add hooks for testhook tracking so we can confirm/deny that things
are getting shut down, which they weren't.
2021-02-24 11:25:46 -06:00
Seebs
c1c0e828cd lock read from bsig.BitDepth, not just write to it 2021-02-24 11:25:46 -06:00
Seebs
8eaa4e592f shut down GRPC client after running QueryGRPC against a cluster
If you don't shut the client down, it leaves two goroutines running forever.
2021-02-24 11:25:46 -06:00
Seebs
66ed216023 bump UI/usage guesstimated limit because my laptop uses about 6% too much 2021-02-24 11:25:46 -06:00
Seebs
4f5f3e30ea remove port_mapper because it can't work with our unrestartable server
Long story short: Once we create a server and start it, we can't start
it again. We can't close it and restart it, and we can't just start
it without closing it.

Unfortunately, if the server's config needs to change, we have a Problem
here.

This ultimately means that the retry logic for GetListeners can't actually
retry successfully; if we fail on the first attempt, we necessarily fail
on any later attempts also, and if we try to fix that, we get panics.

But!

We don't actually NEED to retry. We just need to ensure that we can
open a :0 port, extract the actual port number, and use that in places
where the port number mattered, without having to rebind it.

The only actual place we needed to rebind things was opening gRPC
servers, so we introduce a gRPC Listener that can be used instead of
trying to bind to a specified port.

In a bunch of other cases where we had similar logic to try to allocate
and then use a port, we can switch to just using a provided listener.
For instance, net/http has `Serve(net.Listener, handler)`, not just
ListenAndServe(addr, handler).

This should eliminate the weird CI failures from eaddrinuse.

NOT fixed: server/cluster_test.go/TestClusterResize_AddNode isn't working
right now. The new node isn't actually being added to the existing cluster.
I attempted this but was outsmarted by it, and I think fixing the
rest of this is worth it as a separate thing.
2021-02-24 11:25:46 -06:00
Travis Turner
4200de481d
Merge pull request #1458 from travisturner/disco-remove-coordinator
remove remaining references to "coordinator"
2021-02-24 09:43:04 -06:00
Travis
2bbe1fdde0
remove remaining references to "coordinator" 2021-02-23 17:23:09 -06:00
Ben Johnson
4454df0af0
Merge pull request #1454 from molecula/remove-rbftx-frag
Remove unused RBFTx.frag field
2021-02-23 09:42:50 -07:00
Travis Turner
c16c543274
Merge pull request #1456 from travisturner/disco-remove-docs
remove docs directory
2021-02-23 10:33:12 -06:00
Travis Turner
aa43367f45
Merge pull request #1448 from travisturner/disco-no-metadata-base
Disco no metadata base
2021-02-23 10:15:52 -06:00
Travis
295101ecbd
remove docs directory 2021-02-23 10:13:16 -06:00
Travis
81fbeb61f9
fix logic in fragment.bitDepth() 2021-02-23 10:09:56 -06:00
Travis
912e51790f
remove Field.saveMeta(). get Feild.options.BitDepth from fragment 2021-02-23 10:09:56 -06:00
Travis
8b0f18721e
remove Field.loadMeta() 2021-02-23 10:09:55 -06:00
Travis
dfd49c3648
add a gob-encoding Serializer implementation for tests 2021-02-23 10:09:55 -06:00
Travis
4e857e8de4
remove some calls to Field.saveMeta() 2021-02-23 10:09:55 -06:00
Travis
d639e228ae
remove Index.saveMeta(). remove support for deleing existence field. 2021-02-23 10:09:55 -06:00
Travis
2c112a73fe
remove Index.loadMeta() 2021-02-23 10:09:55 -06:00
Travis
38d5459e25
convert holder decode* methods to functions 2021-02-23 10:09:55 -06:00
Travis
3f0745647b
set timestamp() on field 2021-02-23 10:09:55 -06:00
Travis
ebb340d83e
remove old BSI upgrade code 2021-02-23 10:09:54 -06:00
Travis
114d74af29
pass cfm to openField() 2021-02-23 10:09:54 -06:00
Travis
24c5b654c6
change IndexOptions to reference by value 2021-02-23 10:09:54 -06:00
Ben Johnson
02de222387
Merge branch 'master' into remove-rbftx-frag 2021-02-23 08:56:45 -07:00
Antonio Navarro Perez
5794a4af69
Merge pull request #1452 from ajnavarro/disco/coordinator-err-to-primary
Change coordinator error to primary
2021-02-23 16:44:50 +01:00
Alan Bernstein
2641e57ddb
Merge pull request #1450 from alanbernstein/dont-limit-before-sort
CORE-182 Add ignoreLimit argument to executeGroupByShard
2021-02-23 09:33:07 -06:00
Ben Johnson
5e477e107a Remove unused RBFTx.frag field 2021-02-23 08:32:07 -07:00
Antonio Navarro Perez
f0a5ca5d3a Change coordinator error to primary
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-23 09:58:22 +01:00
Alan Bernstein
f228a35d52 Add ignoreLimit argument to executeGroupByShard 2021-02-22 16:16:11 -06:00
tgruben
0170167bdf
Merge pull request #1447 from tgruben/cleanup
Provide option to update existence field on import roaring request
2021-02-22 15:36:50 -06:00
Todd Gruben
081d86c04b mixed row test 2021-02-22 15:06:45 -06:00
Todd Gruben
d220426686 doc comment 2021-02-22 11:50:01 -06:00
tgruben
18e31a63b6
Update roaring/roaring.go
Co-authored-by: Matthew Jaffee <matthew.jaffee@gmail.com>
2021-02-22 11:42:48 -06:00
Todd Gruben
8e27e55459 Merge branch 'cleanup' of github.com:tgruben/privilosa into cleanup 2021-02-22 11:38:02 -06:00
Todd Gruben
5cbbb7996e jaffee test handling suggestions 2021-02-22 11:37:30 -06:00
tgruben
c2da1d2671
Update api.go
Co-authored-by: Matthew Jaffee <matthew.jaffee@gmail.com>
2021-02-22 11:07:41 -06:00
tgruben
1b87b7148e
Update api.go
Co-authored-by: Matthew Jaffee <matthew.jaffee@gmail.com>
2021-02-22 11:06:55 -06:00
Todd Gruben
155a4b4a31 comment clarification 2021-02-22 10:07:32 -06:00
Todd Gruben
9e186669d8 update go mod to fix cors bug 2021-02-22 08:33:52 -06:00
Travis
9f14415b58
Merge branch 'master' into disco 2021-02-20 10:28:38 -06:00
Todd Gruben
4e3beb0d10 Provide option to update existence on import roaring 2021-02-19 18:08:25 -06:00
Todd Gruben
6219b4ca8b add optional UpdateExistence on importRoaring 2021-02-19 17:47:28 -06:00
Todd Gruben
5b43a84a3b . 2021-02-19 17:09:50 -06:00
Ben Johnson
8647b80adb
Merge pull request #1435 from molecula/fix-node-removal-error
Clarify node removal error when self-removing
2021-02-19 08:23:21 -07:00
Ben Johnson
841208858f Clarify node removal error when self-removing
Currently, if you issue a node removal from the node that is being
removed, then you will see a "node cannot be removed error". It's
not clear why you aren't able to remove the node. The error message
has been updated to clarify why.
2021-02-18 12:55:06 -07:00
Kuba Podgórski
e724ad53f2
Merge pull request #1437 from kuba--/check-state
Check state in shardsByNode once stator is implemented
2021-02-18 12:50:03 +01:00
Kuba Podgórski
484f709621 Add regression test 2021-02-18 12:33:01 +01:00
Kuba Podgórski
bfc24a1745 Check state in shardsByNode once stator is implemented 2021-02-17 16:02:28 +01:00
Kuba Podgórski
b17d2b6d18
Merge pull request #1431 from kuba--/import-412
Avoid precondition failed (412) on ingest
2021-02-17 11:50:44 +01:00
Travis Turner
5c5712dba1
Merge pull request #1434 from travisturner/disco-replica-failover
don't cancel the context if replicas should be attempted
2021-02-16 22:00:02 -06:00
Travis
0d08a68c28
fix test expected error message 2021-02-16 21:59:35 -06:00
Travis
a7d4226326
only cancel() in mapper on a secondary, replica error
There is another case where cancelling here might be useful,
and that's if the query is on a primary node and the replication
factor is 1, meaning there are no secondary nodes to fail over to.
That case is handled here as well.
2021-02-16 16:29:49 -06:00
Travis
d27afc42f1
don't cancel the context if replicas should be attempted 2021-02-16 15:10:24 -06:00
Kuba Podgórski
de17c51293 Avoid precondition failed (412) on ingest 2021-02-16 20:18:14 +01:00
Travis Turner
42b8522e80
Merge pull request #1429 from travisturner/disco-field-createdat
ensure field.CreatedAt is set on loadField
2021-02-15 21:50:28 -06:00
Travis
e54f7d9a0b
ensure field.CreatedAt is set on loadField 2021-02-15 21:28:20 -06:00
Travis Turner
17c0d73fa2
Merge pull request #1427 from travisturner/disco-simplify-view
stop storing a value for views in etcd
2021-02-15 15:41:36 -06:00
nagamocha3000
4dfd713189
Merge pull request #1395 from nagamocha3000/fix-core-78
CORE-78 Add parsing for partial time inputs
2021-02-16 00:18:36 +03:00
Travis
b5d6c632bf
stop storing a value for views in etcd 2021-02-15 14:39:52 -06:00
nagamocha3000
0927240956 Add parsing for partial time inputs 2021-02-15 22:55:35 +03:00
Travis Turner
062851bae5
Merge pull request #1419 from seebs/discoFever
Performance improvements for disco branch
2021-02-15 12:28:10 -06:00
Seebs
82a975fd2a avoid race conditions on nodes
Turns out we sometimes modify returned nodes. Handle this better, but
also fix up some cases where we were generating node lists we didn't really
need to answer simple questions.
2021-02-15 10:20:31 -06:00
Seebs
07a014e952 cache Nodes calls in EtcdWithCache
The Peers() data is cached, but then every call still has to unmarshal JSON
and that's stunningly expensive. Let's not!
2021-02-15 10:19:56 -06:00
Seebs
e2b6912d1c uninvert test for coordinator node / primary field translation node
If we're the primary field translation node, we don't need to set up
translation replication; we only need that if we're *not*. So it
makes sense to test if !IsPrimaryFieldTranslationNode... except that
the test is to determine whether to return early. So it should not
be inverted.
2021-02-15 10:19:03 -06:00
Seebs
0790fbe866 only persist views to etcd when they're not already known
Persisting views to etcd every time we check for them causes
what ends up being about a factor of 60 slowdown. Let's do it a little
less.
2021-02-15 10:19:03 -06:00
Travis
4097ec155b
Merge branch 'master' into disco 2021-02-13 10:00:20 -06:00
Alan Bernstein
06503813c5
Merge pull request #1420 from alanbernstein/fix-schema-null-fields
Represent zero fields in /schema response as [] instead of null
2021-02-13 06:40:36 -06:00
Travis
9fa271a7b8
remove dead code (api.HostStates()) 2021-02-12 21:51:27 -06:00
Travis
d3ffdafdd8
remove some more TXSRCs that slipped in 2021-02-12 21:44:20 -06:00
Travis Turner
b7db27b7a7
Merge pull request #1416 from travisturner/disco-load-schema-on-open
Load schema from etcd on holder open; validate indexes, fields, views
2021-02-12 21:35:13 -06:00
Travis
a2a6e91f6d
remove old, now conflicting test value 2021-02-12 21:21:56 -06:00
Travis
2d17405e94
fix SchemaDetails test 2021-02-12 21:11:45 -06:00
Travis
8f0270acda
adjust openExistenceField() to check on disk first 2021-02-12 20:35:36 -06:00
Kuba Podgórski
40fe280453
Remove not needed holder test 2021-02-12 20:35:36 -06:00
Kuba Podgórski
2f35b51db8
Fix endpoint tests + change BitDepth type to uint64 2021-02-12 20:35:36 -06:00
Travis
a6297dc48e
WIP: load schema from etcd on holder open; validate indexes, fields, views 2021-02-12 20:32:31 -06:00
Travis
b89c699a8e
fix bug from merge 2021-02-12 20:32:12 -06:00
Travis
5b237cae13
Merge branch 'master' into disco 2021-02-12 20:29:41 -06:00
Alan Bernstein
f758a04e18 Represent zero fields in /schema response as [] instead of null 2021-02-12 19:40:42 -06:00
Matthew Jaffee
421848c86a
Merge pull request #1418 from molecula/fix-lattice
update lattice version to correct from accidental downgrade
2021-02-12 16:16:34 -06:00
Matt Jaffee
0e3461e9f4
update lattice version to correct from accidental downgrade 2021-02-12 14:50:10 -06:00
Alan Bernstein
a75c62c90f
Merge pull request #1391 from alanbernstein/field-cardinality
CORE-92 Add /schema/details endpoint, which includes field cardinality
2021-02-12 09:38:42 -06:00
Antonio Navarro Perez
2089e5eeb4
Merge pull request #1417 from ajnavarro/fix-log-web-ui-http-handler 2021-02-12 10:18:51 +01:00
Alan Bernstein
882b14444b Use consistent behavior in test to add queries to transaction 2021-02-11 16:42:30 -06:00
Alan Bernstein
dc6c92771b Fail entire /schema/details request if one field query fails 2021-02-11 16:42:30 -06:00
Alan Bernstein
2773999190 Simplify response structs 2021-02-11 16:42:30 -06:00
Alan Bernstein
12462886a6 Shorten shard lists in error messages 2021-02-11 16:42:30 -06:00
Alan Bernstein
246c345c49 Eliminate omitempty from /schema/details response type 2021-02-11 16:42:30 -06:00
Alan Bernstein
56c940c6a0 Add /schema/details endpoint, which includes field cardinality computed via Count(Distinct()) 2021-02-11 16:42:30 -06:00
Maxton Huff
2e6a8e2030
Merge pull request #1393 from Maxtonian/30trial
CORE-140 add draft trial version of molecula
2021-02-11 16:38:53 -06:00
Maxton Huff
f8fc69670c Merge branch '30trial' of github.com:Maxtonian/pilosa into 30trial 2021-02-11 16:19:09 -06:00
Maxton Huff
b89dae01cc clarify purpose of trialVersion by changing the name to handleTrialDeadline and adding a doc string 2021-02-11 16:13:04 -06:00
Maxton Huff
d5b96ab5ce
Merge branch 'master' into 30trial 2021-02-11 11:02:21 -06:00
Maxton Huff
136a4b8068 change wording 2021-02-11 11:01:16 -06:00
Maxton Huff
dd8d6ebfb1 Respond to code review feedback
change logic in version.go so that the trial related messages only appear on trial versions of molecula
convert Command methods in trial.go to functions and  pass a loggerLogger variable instead since that was the only piece of Command being used
add a function named expireAfter which seperately runs similar functionality to what was previously in daily check with chnages directed at stopping users from changing their internal clock date
change variable names and placement to be more readable and organized
2021-02-11 11:01:16 -06:00
Maxton Huff
ddcf9fe1e8 add licence header 2021-02-11 11:01:16 -06:00
Maxton Huff
c973fae6aa remove remaining release-build-trial 2021-02-11 11:01:16 -06:00
Maxton Huff
c60893a8ee edit and move trial code from server.go to trial.go and combine release build targets 2021-02-11 11:01:16 -06:00
Maxton Huff
7fd3fc775f remove test code 2021-02-11 11:01:16 -06:00
Maxton Huff
d02ba32743 alter error output to satisfy test 2021-02-11 11:01:15 -06:00
Maxton Huff
9840ae67e4 remove error return type 2021-02-11 11:01:15 -06:00
Maxton Huff
1dbab1ff92 add draft trial version of molecula 2021-02-11 11:01:15 -06:00
Maxton Huff
d357447673 change wording 2021-02-11 10:59:32 -06:00
Maxton Huff
0f952bb594 Respond to code review feedback
change logic in version.go so that the trial related messages only appear on trial versions of molecula
convert Command methods in trial.go to functions and  pass a loggerLogger variable instead since that was the only piece of Command being used
add a function named expireAfter which seperately runs similar functionality to what was previously in daily check with chnages directed at stopping users from changing their internal clock date
change variable names and placement to be more readable and organized
2021-02-11 10:36:04 -06:00
Antonio Navarro Perez
e0787ed8a8 Requested changes.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-11 16:37:41 +01:00
Antonio Navarro Perez
5440e177de Use advertised URL
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-11 11:52:42 +01:00
Antonio Navarro Perez
1f234df86e Really fix url on Web UI log
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-11 11:10:38 +01:00
Kuba Podgórski
d491c26b8e
Merge pull request #1413 from kuba--/stop-server
Do not stop etcd server before closing
2021-02-11 10:50:43 +01:00
Matthew Jaffee
a781d472b8
Merge pull request #1415 from molecula/revert-1412-import-roaring-existence
Revert "Update existence field on import-roaring requests"
2021-02-10 18:40:59 -06:00
Kuba Podgórski
5774a8e066 Do not stop etcd server before closing 2021-02-11 00:36:13 +01:00
tgruben
a61ed011fc
Revert "Update existence field on import-roaring requests" 2021-02-10 14:51:11 -06:00
tgruben
a41a65d7bd
Merge pull request #1412 from tgruben/import-roaring-existence
Update existence field on import-roaring requests
2021-02-10 13:03:54 -06:00
Todd Gruben
e7f272f37f updates existence field on importroaring fixes issue (1411) 2021-02-10 12:43:27 -06:00
Maxton Huff
302093035e add licence header 2021-02-10 12:37:13 -06:00
Travis Turner
88f13d5e8b
Merge pull request #1398 from travisturner/disco-schema
Implement Schemator
2021-02-10 12:01:00 -06:00
Travis
7a5192aba6
handle error on LoadSchema() message 2021-02-10 12:00:36 -06:00
Travis
c37424f24f
remove commented code 2021-02-10 11:57:23 -06:00
Travis Turner
5a09b5196e
Merge pull request #23 from travisturner/disco-schema-views
store views in etcd via Schemator
2021-02-10 11:55:58 -06:00
Travis
f3d1572232
update comment 2021-02-10 11:55:34 -06:00
Travis
1c3b0f364d
implement ApplySchema, LoadSchema, and LoadSchemaMessage 2021-02-10 11:51:52 -06:00
Travis
bcb71b023a
fix misplaced _exists check 2021-02-10 11:47:26 -06:00
Travis
8fe1b9a37c
store views in etcd via Schemator 2021-02-10 11:47:26 -06:00
Kuba Podgórski
86f45e9e62 Fix TestClusterResize_AddNode 2021-02-10 16:33:22 +01:00
Kuba Podgórski
ecba5e3636 Fix TestCRUDIndexes 2021-02-10 16:22:34 +01:00
Maxton Huff
4bcdfcc9a2 remove remaining release-build-trial 2021-02-10 08:21:36 -06:00
Kuba Podgórski
2d666f8ee8 Test cleanup 2021-02-10 14:56:48 +01:00
Kuba Podgórski
8c0ece5b7e Merge branch 'disco-schema' of github.com:travisturner/privilosa into pr/travisturner/1398 2021-02-10 14:30:06 +01:00
Kuba Podgórski
9faabd8535 Fix Test_TxFactory_UpdateBlueFromGreen_OnStartup 2021-02-10 14:26:52 +01:00
Kuba Podgórski
1dd9aa866f Fix Test_TxFactory_UpdateBlueFromGreen_OnStartup 2021-02-10 14:09:20 +01:00
Kuba Podgórski
efc598a68b
Merge pull request #1410 from ajnavarro/web-enabled-url-fix
Fix enabled Web UI url log
2021-02-10 13:40:22 +01:00
Antonio Navarro Perez
484abe9cdb Fix enabled Web UI url log
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-10 13:36:19 +01:00
Travis Turner
c85c42c58a
Merge pull request #25 from kuba--/index-exists
Fix TestHandler_PostSchemaCluster
2021-02-09 21:23:55 -06:00
Maxton Huff
7ae1599c12 edit and move trial code from server.go to trial.go and combine release build targets 2021-02-09 15:39:32 -06:00
Cody Soyland
f1f7bd6327
Merge pull request #1406 from codysoyland/upgrade-lattice
Upgrade lattice
2021-02-09 15:19:04 -06:00
Cody Soyland
0227d8306f
Upgrade lattice 2021-02-09 15:00:11 -06:00
Kuba Podgórski
40063a6aa9 Fix TestHandler_PostSchemaCluster 2021-02-09 20:13:38 +01:00
Kuba Podgórski
8591599b4c
Merge pull request #24 from kuba--/delete-views
Fix TestAPI_Import. Delete views when deleting a field.
2021-02-09 16:39:58 +01:00
Kuba Podgórski
d827f63148 Fix ApplySchema API 2021-02-09 16:21:25 +01:00
Kuba Podgórski
5d9fd0906c Fix TestClusterResize_AddNodeConcurrentIndex 2021-02-09 15:51:27 +01:00
Kuba Podgórski
0f97066914 Fix TestAPI_Import. Delete views when deleting a field. 2021-02-09 13:36:53 +01:00
Travis Turner
ccd89bbe2a
Merge pull request #22 from kuba--/index-schemator
Move schemator from API to index. Fix TestExecutor_Execute_SetRow
2021-02-08 15:43:15 -06:00
Kuba Podgórski
37b309be16 Move schemator from API to index. Fix TestExecutor_Execute_SetRow 2021-02-08 21:54:39 +01:00
Kuba Podgórski
2a9423e7f8
Merge pull request #21 from ajnavarro/disco/add-nop-schemator-serializer
Add NopSchemator and NopSerializer
2021-02-08 18:50:49 +01:00
Antonio Navarro Perez
17a5bc51ca Add NopSchemator and NopSerializer
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-08 18:36:53 +01:00
Travis
3542134100
WIP: implement Schemator 2021-02-08 10:42:55 -06:00
Travis
114f6a8751
add withViews argument to api.Schema() method 2021-02-08 10:42:55 -06:00
Travis Turner
ecd8e3fa10
Merge pull request #1397 from travisturner/disco-unify-state
Unify state
2021-02-08 10:00:36 -06:00
Antonio Navarro Perez
b1ff8e55cd
Unify state
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-06 16:53:42 -06:00
Travis Turner
968b1ade50
Merge pull request #1394 from travisturner/disco-clean-topology
Remove pilosa-chk, Topology and ClusterCluster
2021-02-06 16:18:00 -06:00
Kuba Podgórski
218d14df3f
Merge pull request #1396 from kuba--/mod-tidy
cleanup memberlist
2021-02-06 23:16:45 +01:00
Kuba Podgórski
750a684b51 cleanup memberlist 2021-02-06 23:12:08 +01:00
Travis
4bcdbf1bff
go mod tidy 2021-02-05 16:33:35 -06:00
Travis
30d4687a99
remove type Topology 2021-02-05 16:13:43 -06:00
Travis
002aee63e3
remove code related to pilosa-chk 2021-02-05 16:13:43 -06:00
Travis
b7d6db51a3
remove dead code related to pilosa-chk 2021-02-05 16:13:43 -06:00
Travis
4dd6bddf7f
remove pilosa-chk 2021-02-05 16:13:43 -06:00
Travis
b2d666a1d0
remove unused tx function 2021-02-05 16:13:17 -06:00
Travis
d192c1f24f
Merge branch 'master' into disco 2021-02-05 15:58:36 -06:00
Maxton Huff
c967bc96f4 remove test code 2021-02-05 15:40:55 -06:00
Maxton Huff
f37ec5b425 alter error output to satisfy test 2021-02-05 14:25:57 -06:00
Maxton Huff
fb47cb875a remove error return type 2021-02-05 13:40:57 -06:00
Travis Turner
86abf22e6d
Merge pull request #1392 from travisturner/disco-deadcode
remove dead code
2021-02-05 12:22:25 -06:00
Maxton Huff
fec0337630 add draft trial version of molecula 2021-02-05 12:16:08 -06:00
Travis
ec91dad198
remove dead code 2021-02-05 11:31:33 -06:00
Travis Turner
4a408a895a
Merge pull request #1378 from travisturner/disco-config-noder
Disco config noder
2021-02-05 10:37:56 -06:00
Kuba Podgórski
ab3353fb56 Add resize messages for broadcaster 2021-02-05 14:02:28 +01:00
Kuba Podgórski
e4fb58132b
Merge pull request #19 from kuba--/resizer-interface
Apply resizer interface (remove and add node)
2021-02-05 12:48:55 +01:00
Kuba Podgórski
bdbffe8d96 Update cluster_internal_test.go 2021-02-05 12:48:22 +01:00
Kuba Podgórski
35b9d41da1
Merge branch 'disco-config-noder' into resizer-interface 2021-02-05 11:57:51 +01:00
Travis Turner
e48fd9bf88
Merge pull request #18 from travisturner/disco-config-noder-remove-gossip
remove the rest of the gossip code (except config)
2021-02-04 21:35:22 -06:00
Travis
c8c59b649d
remove pilosa-fsck 2021-02-04 21:34:15 -06:00
Kuba Podgórski
ab37bf5c7b Apply resizer interface (remove and add node) 2021-02-04 20:26:41 +01:00
Travis
a4b37273ea
remove the rest of the gossip code (except config) 2021-02-04 13:03:02 -06:00
Travis Turner
3e90a88c34
Merge pull request #17 from ajnavarro/do-not-write-on-degraded
Stop writes on DEGRADED state
2021-02-04 13:01:22 -06:00
Antonio Navarro Perez
87ba73fa16 Stop writes on DEGRADED state
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-04 17:30:14 +01:00
Antonio Navarro Perez
39eacfb9a3
Merge pull request #16 from travisturner/disco-config-noder-primaryid-remove-gossip 2021-02-04 10:45:23 +01:00
Antonio Navarro Perez
add5065144
Merge pull request #13 from travisturner/disco-config-noder-primaryid 2021-02-04 10:38:15 +01:00
Travis
afc53e1163
remove ReceiveEvent 2021-02-03 23:31:38 -06:00
Travis
652014539c
remove temporary Gossiper interface 2021-02-03 23:06:51 -06:00
Travis
6e4ea21ce5
remove gossip listenForJoins 2021-02-03 22:34:45 -06:00
Travis
6a0f67278a
revert a test boolean 2021-02-03 21:44:05 -06:00
Travis
fbdca3c622
refactor the PrimaryNodeID logic 2021-02-03 20:58:25 -06:00
Alan Bernstein
8e637cc34a
Merge pull request #1390 from alanbernstein/memory-usage
CORE-162 Add memory info to /ui/usage response
2021-02-03 16:36:57 -06:00
Travis
da804ee6d5
linter fixes 2021-02-03 15:11:24 -06:00
Travis
f9661b7b81
add PrimaryNodeID() method to Noder interface 2021-02-03 15:11:24 -06:00
Kuba Podgórski
893b5ea6ab
Merge pull request #15 from kuba--/no-mu
No mu
2021-02-03 22:06:39 +01:00
Alan Bernstein
6c139935f7 Add memory info to /ui/usage response 2021-02-03 14:18:29 -06:00
Kuba Podgórski
377ef73fbd
Merge pull request #14 from kuba--/remove-cluster-state
Remove state member from cluster.
2021-02-03 19:40:22 +01:00
Kuba Podgórski
6601835ba1 Remove public mutex from Node 2021-02-03 19:37:54 +01:00
nagamocha3000
52ab7e5a99
Merge pull request #1379 from nagamocha3000/fix-core-26
Close process on fragment.openStorage error
2021-02-03 19:18:58 +03:00
nagamocha3000
92426a9d1b Close process on fragment.openStorage error
When *fragment.openStorage is invoked in both f.importValue and
f.importValueSmallWrite and it returns an error, this means there's
some underlying error with the storage device and at the point of this
commit, the sane thing to do is to close the process, otherwise the
operation of Pilosa might proceed in an inconsistent state thus
precipiatting other silent but hairy errors along the way such as
dereferencing *fragment.gen later on which is set to nil once
openStorage fails.
2021-02-03 18:47:10 +03:00
Kuba Podgórski
6826997852 Remove state member from cluster.
Remove all function SetState like. Stop broadcasting cluster state.
2021-02-03 15:16:59 +01:00
Travis
4c1d94da14
remove some dead code related to coordinator 2021-02-02 15:59:36 -06:00
Antonio Navarro Perez
c45e21640c
Change coordinator to primary
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-02-02 15:56:12 -06:00
Travis
28a19cdff7
Merge branch 'disco-config-noder' of github.com:travisturner/privilosa into disco-config-noder 2021-02-02 15:54:01 -06:00
Travis Turner
71084a0429
Merge pull request #12 from kuba--/apply-stator
Apply stator
2021-02-02 15:53:35 -06:00
Kuba Podgórski
a16a83445b Apply stator 2021-02-02 19:36:34 +01:00
Kuba Podgórski
0e34409ff0 Close etcd client after Revoke 2021-02-02 11:47:06 +01:00
Travis
91c0df29a1
remove disco debugging printlns 2021-02-01 22:28:43 -06:00
Travis
629bfa3ac8
add more AwaitState calls in the tests 2021-02-01 21:21:06 -06:00
Travis
4811958de4
add AwaitState to test which re-opens node 2021-02-01 17:34:12 -06:00
Travis
26176c15eb
fix linter issues (wrap all ClusterStates in string() until we update the type) 2021-02-01 16:57:35 -06:00
Kuba Podgórski
b611480499
disco State 2021-02-01 16:37:04 -06:00
Kuba Podgórski
6058fc22e4
Porting disco.Stator (next step) 2021-02-01 16:35:59 -06:00
Ben Johnson
c75d5553b9
Merge pull request #1373 from molecula/bench
Update keyed/unkeyed benchmarks
2021-02-01 14:39:21 -07:00
Ben Johnson
0900e7b9d2
Merge branch 'master' into bench 2021-02-01 14:10:15 -07:00
Cody Soyland
a057cc9899
Merge pull request #1375 from codysoyland/duration-header
CORE-27 Add duration header to all gRPC query results
2021-02-01 11:55:55 -06:00
Cody Soyland
0e22ed71cc
Fix instances of context.Background that need mocked context 2021-02-01 11:40:45 -06:00
Cody Soyland
c30e3f0c2d
Move duration header to fix error handling 2021-02-01 11:40:45 -06:00
Cody Soyland
e2331372d8
Handle errors 2021-02-01 11:40:45 -06:00
Cody Soyland
367425bba1
Add duration header to all gRPC query results 2021-02-01 11:40:43 -06:00
Alan Bernstein
51e41ee6b2
Merge pull request #1331 from alanbernstein/field-usage
Show disk usage broken down by field and keys
2021-02-01 11:31:29 -06:00
Travis
855e1b35f5
more use of noder; remove c.nodes
disable some of the gossip logic

implement some of the stator logic
2021-01-31 23:42:49 -06:00
Travis
97eaff5c82
use Etcd Noder; actually use EtcdWithCache 2021-01-31 23:42:44 -06:00
Travis
7ed1417893
set node metadata in server.Open() 2021-01-30 09:12:07 -06:00
Travis
457194f6a8
update config to support etcd arguments 2021-01-29 19:43:48 -06:00
Alan Bernstein
e981b162f0 Upgrade lattice 2021-01-29 17:48:24 -06:00
Alan Bernstein
1e7c4d7e8e Include metadata AKA 'other' in response 2021-01-29 17:48:24 -06:00
Alan Bernstein
5beb2664b0 Use simpler test 2021-01-29 17:48:24 -06:00
Alan Bernstein
c81ea88847 Fix total summation 2021-01-29 17:48:24 -06:00
Alan Bernstein
15443b371c Force consistent timestamp width in startup log 2021-01-29 17:48:24 -06:00
Alan Bernstein
5dc00883bd Add more involved diskUsage test 2021-01-29 17:48:24 -06:00
Alan Bernstein
703bd14048 Fix errors in usage check 2021-01-29 17:48:24 -06:00
Alan Bernstein
85fad859e2 Correct some disk usage computations 2021-01-29 17:48:24 -06:00
Ben Johnson
32a35805a4 Add RBF index/field usage stats 2021-01-29 17:48:24 -06:00
Alan Bernstein
e397d35ed5 Include roaring field and key details in usage endpoint 2021-01-29 17:48:24 -06:00
Travis
e459c9a77b
change Config.DisCo to Config.Etcd 2021-01-29 14:11:51 -06:00
Ben Johnson
ea653eb9a4
Merge branch 'master' into bench 2021-01-29 12:46:26 -07:00
Nia
20d55f0805
Merge pull request #1369 from niaow/count-global
CORE-29 Invoke pre-calls directly in count operations (fixes Count(Distinct()) on negative integers)
2021-01-29 11:20:29 -05:00
Nia
2961a69bd2
Merge branch 'master' into count-global 2021-01-29 11:14:02 -05:00
Alan Bernstein
1f87b54e5f
Merge pull request #1361 from alanbernstein/distinct-crash
CORE-32 Handle nil result in signed row translation
2021-01-29 10:13:48 -06:00
Nia
13db91379f
Merge branch 'master' into count-global 2021-01-29 10:57:46 -05:00
Alan Bernstein
c4455acbd8 Use inconsistent JSON schema to reach Distinct translation error condition 2021-01-29 09:39:31 -06:00
Alan Bernstein
4fba6bea82 Prevent nil pointer exception during Distinct key translation 2021-01-29 09:39:01 -06:00
Kuba Podgórski
9a70e15cb3
Merge pull request #1372 from travisturner/disco-groupby-fix
Fix Groupby test which uses RowKey instead of RowID
2021-01-29 11:31:11 +01:00
Travis
58ff92d3d6
Fix Groupby test which uses RowKey instead of RowID
This commit introduces a CheckGroupByOnKey function which acts like the
CheckGroupBy function, but it only ensures equality on RowKey, not
RowID.
2021-01-28 21:12:02 -06:00
Travis
1c0b926eae
Merge master into disco 2021-01-28 18:03:38 -06:00
Ben Johnson
60b6eecc7a Update keyed/unkeyed benchmarks 2021-01-28 16:36:45 -07:00
Travis Turner
92ee314891
Merge pull request #1362 from travisturner/disco-node-id
use etcd for node.ID
2021-01-28 15:26:48 -06:00
Travis Turner
1726aa137e
Merge pull request #11 from kuba--/fix-server_tests
Fix server tests
2021-01-28 14:36:02 -06:00
Kuba Podgórski
cef6925e7b Fix server tests 2021-01-28 17:39:58 +01:00
Maxton Huff
4b33a7fe16
Merge pull request #1368 from Maxtonian/mmap
Mmap limit comparison warning message for Linux
2021-01-27 10:33:43 -06:00
Maxton Huff
7d82c55274
Merge branch 'master' into mmap 2021-01-27 10:15:50 -06:00
Maxton Huff
927db378b4 add linux OS check and the way mmap limit is read 2021-01-27 09:52:13 -06:00
Nia Weiss
0d97ec559b
switch signed count distinct test to use TestVariousQueries 2021-01-27 10:29:40 -05:00
Travis
4380a05bbd
address some coord/node0 test issues 2021-01-26 22:46:37 -06:00
Matthew Jaffee
f84f43ec64
Merge pull request #1370 from travisturner/distinctset-empty-row
Return zero-bit row (with Index/Field) instead of nil in executeDistinctShardSet
2021-01-26 20:50:38 -06:00
Travis
48ac989e6a
Return zero-bit row (with Index/Field) instead of nil in executeDistinctShardSet 2021-01-26 15:47:28 -06:00
Travis
315cad679d
Return zero-bit row (with Index/Field) instead of nil in executeDistinctShardSet 2021-01-26 15:41:47 -06:00
Travis
4f47862b48
remove code which was forcing etcd logging 2021-01-26 15:40:58 -06:00
Nia Weiss
ac09c11bad
Invoke precalls directly in count operations
This changes Count(Precall()) operations to execute the precall directly inside of the count operation, bypassing the transformation to a Precomputed() call.
Eliminating the Precomputed() step causes Count(Distinct()) to work properly on negative integers.
2021-01-26 12:44:03 -05:00
Maxton Huff
8c36da9eeb Merge branch 'mmap' of github.com:Maxtonian/pilosa into mmap 2021-01-26 11:27:12 -06:00
Maxton Huff
3982a8e970 format messages and change mmap comparison logic 2021-01-26 11:26:36 -06:00
Maxton Huff
bd680ef144
Merge branch 'master' into mmap 2021-01-26 10:21:18 -06:00
seebs
89f1dfb239
Merge pull request #1367 from seebs/countRange
RBF countRange: Handle partial counts on bitmapPtr containers
2021-01-26 09:51:09 -06:00
Maxton Huff
3809fe6734 add error check 2021-01-26 09:35:51 -06:00
Travis
b80f5099b2
more coordinator/primary cleanup 2021-01-25 23:20:08 -06:00
Maxton Huff
55a9952b92 mmap limit comparison error message 2021-01-25 16:19:12 -06:00
Seebs
a238afb21a Handle BitmapPtr cells in countRange
We need to be able to count bits in BitmapPtr containers. This only
comes up if you have a non-container-aligned range count, which we
never do in real production yet, but the API allows it so it should
work. In order to do this, we need to provide the tx to countRange
so it can grab pages as needed. Arguably, we should be able to avoid
actually creating/copying that page since we're only using it
internally, never returning it, but this is a pretty rare case
and probably not performance-critical.
2021-01-25 15:41:35 -06:00
Seebs
d1a9c91a96 Test CountRange on non-container ranges.
This test was supposed to check against all the container types,
but especially bitmaps, but turns out not to work because the
containers turn into RLE containers. Oops. Now, we start with
every-other-bit for the first 8k, then start filling in the holes,
so we get some bitmap containers and then start generating
RLE containers.
2021-01-25 15:41:35 -06:00
Nia
13c63baa14
Merge pull request #1365 from niaow/groupby-cluster-rows
CORE-28 Fix GroupBy with a global Rows filter
2021-01-25 15:37:48 -05:00
Nia
60ab9e84dd
Merge branch 'master' into groupby-cluster-rows 2021-01-25 15:26:13 -05:00
Travis Turner
f5c1454a0d
Merge pull request #9 from kuba--/get-coord
Replace Node(0) by GetCoordinator
2021-01-25 14:06:39 -06:00
Kuba Podgórski
32b5c5bcea Replace Node(0) by GetCoordinator 2021-01-25 19:54:25 +01:00
Nia
ed9fc962d5
Merge pull request #1359 from niaow/intersectany-single-word-run
CORE-31 Fix intersectionAnyRunBitmap when processing single-word runs
2021-01-25 11:16:30 -05:00
Nia
70d87a7950
Merge branch 'master' into intersectany-single-word-run 2021-01-25 11:03:51 -05:00
Nia Weiss
dde318ac8c
Move globally computed GroupBy rows calls into EmbeddedData
This fixes a bug where a globally computed Rows call would be computed with a subset of the shards.
2021-01-25 10:17:58 -05:00
Ben Johnson
66bc79634b
Merge pull request #1363 from molecula/pilosa-bench-vars
Add ingest time & latency stats to query benchmarks
2021-01-25 08:16:34 -07:00
Cody Soyland
649202b081
Fix cluster size setter: expose failures 2021-01-25 10:16:19 -05:00
Ben Johnson
a30fd9957e
Merge branch 'master' into pilosa-bench-vars 2021-01-25 07:56:20 -07:00
Travis
ace4dea46f
address some test failures due to random ordered etcd ID 2021-01-25 00:52:49 -06:00
Travis
2f66501160
finish implementing snap := ClusterSnapshot() 2021-01-24 23:22:32 -06:00
Travis
1473e11a27
update test cluster GetNode() to consider the etcd-assigned ID (which affects node order) 2021-01-23 19:52:59 -06:00
Travis
a196e1e74c
use etcd for node.ID
this commit adds a temporation interface for starting gossip.
we needed this so we can start gossip AFTER setting up the node,
but before waitingForJoins.
2021-01-23 19:52:58 -06:00
Travis
208b81b5f4
fix merge error 2021-01-23 19:52:34 -06:00
Travis
c9e6f17ae0
Merge branch 'master' into disco 2021-01-23 19:22:20 -06:00
Cody Soyland
3da3d23b21
Merge pull request #1364 from codysoyland/lattice-submodule
Add git-submodule to manage UI version
2021-01-22 16:57:57 -06:00
Alan Bernstein
852057533b Add lattice submodule upgrade instructions 2021-01-22 16:51:17 -06:00
Cody Soyland
671c7262c9
Add lattice to PHONY 2021-01-22 16:26:09 -06:00
Cody Soyland
34f728521c
Add git-submodule to manage lattice version 2021-01-22 15:05:19 -06:00
Ben Johnson
acdff02fed Add ingest time & latency stats to query benchmarks 2021-01-22 11:41:44 -07:00
nagamocha3000
6c3c460c83
Merge pull request #1344 from nagamocha3000/bnm-fix-1080
Fix filtering on time fields in Rows() embedded within GroupBy
2021-01-22 19:56:08 +03:00
nagamocha3000
b5fdc6609a Update tests to remove sum column on GroupBy 2021-01-22 18:44:36 +03:00
Kuba Podgórski
2c4c722a1b
Merge pull request #1348 from travisturner/disco-storage-config
introduce storage.Config
2021-01-22 11:12:15 +01:00
Travis
19f91782e7
remove all instances of txsrc 2021-01-21 21:59:51 -06:00
Travis
13984353e4
remove instances of os.Getenv("PILOSA_TXSRC") 2021-01-21 21:18:46 -06:00
Nia Weiss
0d9179f10c
roaring: fix intersectionAnyRunBitmap when processing single-word runs
When a run started and ended within a single word, the entirety of the word would be checked.
This would cause small runs to be processed incorrectly, and caused Distinct-on-sets to select rows that did not match the specified filter.
2021-01-21 18:09:27 -05:00
nagamocha3000
16b5fbe40b
Merge branch 'master' into bnm-fix-1080 2021-01-21 17:37:08 +03:00
nagamocha3000
6cbcde3a82 Add more tests for GroupBy on Time fields 2021-01-21 16:20:46 +03:00
nagamocha3000
113bec2474 Remove unnecessary nil check 2021-01-21 15:48:52 +03:00
Travis
f292d6061a
replace pilosa.DefaultTxsrc with storage.DefaultBackend 2021-01-20 22:06:13 -06:00
Travis
08fae2be4c
introduce storage.Config 2021-01-20 22:05:38 -06:00
Alan Bernstein
b273f3ba60
Merge pull request #1327 from alanbernstein/sql-history
Include SQL string in query-history
2021-01-20 19:05:36 -06:00
Alan Bernstein
eaf3ef153e Test SQL behavior 2021-01-20 15:58:55 -06:00
Alan Bernstein
bed03ba490 Update tests 2021-01-20 10:48:35 -06:00
Alan Bernstein
a0d6c253d1 Pass SQL query string from mapper to tracker 2021-01-20 10:48:35 -06:00
Cody Soyland
06241d1f84
Merge pull request #1258 from codysoyland/distinct-failure
Test to demonstrate failure running Distinct
2021-01-20 10:37:47 -06:00
Cody Soyland
0a325dcdb8
Merge branch 'master' into distinct-failure 2021-01-19 16:50:25 -06:00
seebs
38ded7963e
Merge pull request #1342 from seebs/aggregate
Handle aggregate functions better in sql/grpc/json
2021-01-19 16:28:32 -06:00
Seebs
932e84b681 handling aggregate types: add to protobuf, etc
We want to distinguish different *kinds* of GroupCounts, so we're
making the GroupCounts parent object track its type so we can keep that
correct.

Adding this to protobuf, etc, then creates some weird behaviors
because sometimes we expect []GroupCount, and sometimes we expect
*GroupCounts. This implies changes to test cases. Also, the
changes to test cases imply that some test cases are probably now
wrong; for instance, they're expecting a "sum" column, equal to zero,
when no sum was requested.

We try to make the encoder handle a []*GroupCount gotten from another
node without panicing, and avoid breaking the semantics of the existing
messages, renumbering messages or components, etc.

Since a previous version, the `.Groups` member has been privatized,
and the `.Get()` convenience accessor has been renamed `.Groups()`
and is now used consistently in a way that should reduce the risk
of nil pointers causing crashes. Also, NewGroupCounts is used in
a couple more places.
2021-01-19 16:23:15 -06:00
Cody Soyland
4ebf6f6ff7 Customize serialization of []GroupCount based on aggregate type/presence 2021-01-19 12:10:56 -06:00
Travis Turner
07d9cbe380
Merge pull request #1345 from travisturner/disco-config
port disco config to ctl/server
2021-01-19 10:50:17 -06:00
nagamocha3000
0437f5d28a Handle case where row returned might be nil 2021-01-19 16:51:26 +03:00
Travis
f47800a920
add DisCo config to ctl/server 2021-01-18 23:47:35 -06:00
Ben Johnson
56c001d288
Merge pull request #1341 from molecula/bench-vars
Update benchmarks to use expvar URL list
2021-01-18 16:06:43 -07:00
nagamocha3000
d26c6b048e Sort all rowIDs gathered before storing them 2021-01-19 02:00:50 +03:00
nagamocha3000
9b23dcdd0a Gather rows for each fragment in a much smarter way 2021-01-19 01:44:54 +03:00
tgruben
ef05968e20
Merge pull request #1340 from jaten-molecula/noder_impl
Noder impl
2021-01-18 15:22:17 -06:00
Ben Johnson
01e6781abd Update benchmarks to use expvar URL list 2021-01-18 13:43:53 -07:00
jaten-molecula
3928b6854b
Merge pull request #1338 from jaten-molecula/etcd-listner
Etcd listener
2021-01-18 14:40:32 -06:00
Jason E. Aten
b1a0e0ae8b allow retry at the cluster level to work; remove retry for server/server.go Command.setupNetworking() that retries a single gossip node 2021-01-18 20:39:23 +00:00
Jason E. Aten
ed12f3585c etcd/embed.go implemented Noder 2021-01-18 20:30:21 +00:00
Jason E. Aten
9b635068d9 cleanup 2021-01-18 20:16:49 +00:00
Jason E. Aten
ad1c3ff3fb go mod tidy 2021-01-18 19:18:08 +00:00
Jason E. Aten
e58b464b29 add port.GetListeners 2021-01-18 18:42:21 +00:00
nagamocha3000
f51ff4dc85 Add tests for Rows() on time fields 2021-01-18 20:54:31 +03:00
Todd Gruben
766e3b90bc wip 2021-01-18 10:59:01 -06:00
Todd Gruben
de7d69234e initial listner 2021-01-18 10:34:18 -06:00
Travis Turner
d6d51705fa
Merge pull request #1334 from travisturner/disco-merge
Disco merge
2021-01-15 18:42:13 -06:00
Travis
1d55e671a2
go mod tidy and linter
fix race

cleanup
2021-01-15 17:48:44 -06:00
nagamocha3000
b77f9e8a43 Add timeFragments rowIterator 2021-01-15 23:36:54 +03:00
Travis
9855f4d0a0
Merge branch 'travis-test-ci' into disco-try 2021-01-15 14:31:19 -06:00
nagamocha3000
f91b4bc016 Add queries to test GroupBy Rows on time field 2021-01-15 22:58:18 +03:00
nagamocha3000
54d79d1e4d Populate 'places_visited' field for 'users' index 2021-01-15 22:50:54 +03:00
nagamocha3000
4dc3e49a0d Add test helper for inserting to time quantum fields 2021-01-15 22:42:37 +03:00
Jason E. Aten
8909517dfd
cluster_internal_tests use getport 2021-01-15 11:47:37 -06:00
Jason E. Aten
530fd4e768
GlobalPortMapper avoids many races in port allocation for cluster setup 2021-01-15 11:47:37 -06:00
Travis
4355bdd8f0
temporarily have cluster implement Noder 2021-01-15 11:47:37 -06:00
Travis
10380a1da1
Implement snap := ClusterSnapshot()
Below is the list of instance of `ClusterSnapshot()` in the latest
`with-etcd` code. Some of these may not yet exist in the `disco` branch,
but this commit is implementing any that currently apply.

==========================
Done:
==========================
index.go
930:	snap := NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)
1072:	snap := NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)

cmd/pilosa-fsck/fsck.go
786:	snap := pilosa.NewClusterSnapshot(cfg.topo, cfg.topo.Hasher, cfg.topo.ReplicaN)

boltdb/translate.go
558:	snap := pilosa.NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)
1264:	snap := pilosa.NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)

fragment.go
3448:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
3568:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
3620:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)

==========================
Remaining:
==========================

cluster.go
371:	snap := NewClusterSnapshot(NewLocalNoder(nodes), c.Hasher, c.ReplicaN)
474:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
639:	fSnap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
640:	toSnap := NewClusterSnapshot(to.noder, c.Hasher, to.ReplicaN)
703:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1475:		snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1502:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1941:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1986:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
2049:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
2126:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)

api.go
475:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
604:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
690:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
1684:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
1946:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)

executor.go
3781:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4157:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4200:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4243:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4517:	snap := NewClusterSnapshot(NewLocalNoder(e.Cluster.Nodes()), e.Cluster.Hasher, e.Cluster.ReplicaN)

holder.go
1465:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
1668:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
1889:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
1963:	snap := NewClusterSnapshot(c.Cluster.noder, c.Cluster.Hasher, c.Cluster.ReplicaN)
2021-01-15 11:47:37 -06:00
Travis
7875fb8e5a
remove pilosa.DefaultPartitionN 2021-01-15 11:47:37 -06:00
Jason E. Aten
dd7f0f3c88
use bbolt v1.3.5 that has fixed the checkptr bugs 2021-01-15 11:47:37 -06:00
Travis
f633fcd4ae
remove pilosa.URI 2021-01-15 11:47:36 -06:00
Travis
ff2d235702
change all references to use subpackages: topology, net 2021-01-15 11:47:36 -06:00
Travis
0add3fc7c6
fix linter and go.mod issues 2021-01-15 11:47:36 -06:00
Travis
85560323dc
add licence headers 2021-01-15 11:47:36 -06:00
Travis
b251d4c6c1
change bbolt version back to 1.3.3 2021-01-15 11:47:36 -06:00
Travis
9d8a6ad28d
add subpackages: topology, net 2021-01-15 11:47:35 -06:00
Kuba Podgórski
ba7108dedb Revert "Cleanup etcd dir"
This reverts commit 886ba15e88.
2021-01-15 17:50:34 +01:00
Kuba Podgórski
886ba15e88 Cleanup etcd dir 2021-01-15 15:41:16 +01:00
Kuba Podgórski
a4f9aee28e Set etcd log level to error 2021-01-15 14:11:48 +01:00
Kuba Podgórski
6cd8f6a970 Less TestMain_Set_Quick parallel tests 2021-01-15 13:24:41 +01:00
Kuba Podgórski
17b1eeb0d0 Increase timeout (30s) for cluster NORMAL state 2021-01-15 12:55:03 +01:00
Kuba Podgórski
64425736b0 Create disco dir outside pilosa 2021-01-15 12:30:57 +01:00
Travis
684b20edb3
disco open/close debugging 2021-01-14 23:02:58 -06:00
Kuba Podgórski
4afaaa5e25 remove zap 2021-01-14 20:59:17 +01:00
Kuba Podgórski
9a0facaaa3 set even more ports for Node Command 2021-01-14 20:20:23 +01:00
Kuba Podgórski
201e851511 set more ports for Node Command 2021-01-14 20:04:09 +01:00
Kuba Podgórski
33c4c77495 revert bind port to 0 2021-01-14 18:33:22 +01:00
Kuba Podgórski
36f17eee1d global mutex on GetPorts 2021-01-14 18:04:16 +01:00
Kuba Podgórski
a100a38b4a don't close disco on Server.Close 2021-01-14 17:47:06 +01:00
Kuba Podgórski
0e4a7a29fb close disco before holder 2021-01-14 17:35:30 +01:00
Kuba Podgórski
2713be9329 check error as string 2021-01-14 17:12:52 +01:00
Kuba Podgórski
1f6ed4feca bangbang theory 2021-01-14 16:25:44 +01:00
Antonio Navarro Perez
1a5ab4b155 Fix some more problems
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-01-14 13:10:51 +01:00
Antonio Navarro Perez
052aadb3b0 Wrap some missing constructors using ports.
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-01-14 10:48:46 +01:00
Travis
27614c42f7
Finish implementing port wrapper 2021-01-13 22:56:54 -06:00
Antonio Navarro Perez
d20b831084 Add port wrapper POC
Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2021-01-13 20:14:33 +01:00
Kuba Podgórski
61edff3eee Apply closed channel fix
45619a5b7b
2021-01-13 15:37:13 +01:00
Kuba Podgórski
4afb0ecc51 Close TCP listeneer on port mapper 2021-01-13 13:53:27 +01:00
Travis
877af6dad9
replace a MustNewCluster with MustRunCluster 2021-01-12 23:30:10 -06:00
Travis
ef8d0759d5
add retry to pg test ServerTLS() 2021-01-12 23:04:49 -06:00
Travis
f2234929d8
add retry to MustRunCluster 2021-01-12 22:09:09 -06:00
Travis
bc13834343
disco/etcd work: fix lots of races, start all cluster nodes at once.
port mapper gives out ports from 63000-65000 for the tests

fix another race

http test uses port.MustGetPort

rbf: remove :0 port request

ocd happy

test fix for grpc listener address already in use

test/disco allocates BindGRPC port from the port mapper

dump stack on each GetPort

verify each port is usable right away

server/config.go has Config.Validate() now

panic if gossip port is 0. validate server.Config

fix another gossip port 0

builds

quiet, don't dump stack on each port alloc

builds

happy linter

even gossip fallback should not be zero but rather use the port mapper
2021-01-12 21:06:12 -06:00
Ben Johnson
fbf546f131
Merge pull request #1319 from molecula/pilosa-bench 2021-01-12 16:51:27 -07:00
Ben Johnson
b7973e2612 Add read benchmarks 2021-01-12 13:48:09 -07:00
Matthew Jaffee
701d6448cc
Merge pull request #1307 from jaffee/1292-panic-groupby-int-distinct-aggregate
Fix potential panic when grouping on int field with Distinct aggregate
2021-01-08 16:38:00 -06:00
Matt Jaffee
48552553dc
guard against NPE when setting precomputed data
If a precomputed call returns a nil Row result somehow, that could
cause a nil pointer exception when handling the result in
handlePreCall.

In this particular case, A Distinct call on a BSI field with a filter
which returned no results could return a SignedRow{} with nil *Rows
inside of it. This only manifested if there was data in a single shard
as otherwise the reduce logic created a SignedRow with empty *Row
objects rather than nil ones. Isn't that fun?

Extra fun: the reason the filter was returning no results was not
because it was actually empty, but because of another bug where
constructing the Distinct calls to compute the aggregate of a GroupBy
doesn't take into account that the group might include an integer
field which means that the call needs to be constructed
differently. That bug is not fixed in this commit, hence the tests are
still failing, but not panicking.
2021-01-08 15:03:49 -06:00
Matthew Jaffee
616ba408f8
Merge pull request #1308 from codysoyland/groupby-distinct-int
Fix GroupBy Distinct aggregate on int field
2021-01-08 13:55:38 -06:00
Cody Soyland
83ce30f1c4
Fix GroupBy Distinct aggregate on int field 2021-01-08 13:35:58 -06:00
Ben Johnson
55fad52c59
Merge pull request #1306 from molecula/rbf-remove-cursor-arena
Remove RBF cursor arena.
2021-01-08 10:13:52 -07:00
Ben Johnson
489f33a173 Remove RBF cursor arena.
Previously there were two implementations of cursor reuse: sync pool &
an arena. This commit removes the arena in favor of the global pool.
2021-01-08 07:59:10 -07:00
Ben Johnson
1865de8248
Merge pull request #1301 from molecula/fix-rbf-cursor-close 2021-01-07 19:22:34 -07:00
jaten-molecula
b3854e867b
Merge branch 'master' into fix-rbf-cursor-close 2021-01-07 20:14:59 -06:00
Jason E. Aten
ecada682ae cluster_internal_tests use getport 2021-01-07 22:30:04 +00:00
jaten-molecula
0c1f2f06ba
Merge pull request #1304 from jaten-molecula/portmap
GlobalPortMapper avoids many races in port allocation for cluster setup
2021-01-07 16:24:02 -06:00
Jason E. Aten
1aabcb3d14 GlobalPortMapper avoids many races in port allocation for cluster setup 2021-01-07 22:20:49 +00:00
Cody Soyland
476767f150
Merge pull request #1285 from codysoyland/grpc-crd
Add create, read, and delete index methods to gRPC interface
2021-01-07 15:24:13 -06:00
Cody Soyland
4f57b4d07b
Remove TrackExistence configuration from gRPC CreateIndex 2021-01-07 15:19:08 -06:00
Cody Soyland
d8ebfda1bd
Undo error cause changes due to broken logic in other places, check for ConflictError explicitly 2021-01-07 14:49:18 -06:00
Travis Turner
4eb36a34f6
Merge pull request #1294 from travisturner/disco-cleanup
Disco cleanup
2021-01-07 14:08:55 -06:00
Cody Soyland
219714a18e
Fix linter problems 2021-01-07 13:50:59 -06:00
Travis
8dbfae1d86
temporarily have cluster implement Noder 2021-01-07 13:45:46 -06:00
Cody Soyland
daa8c9bd8b
Add tests for new gRPC create/get/delete calls 2021-01-07 13:05:48 -06:00
Cody Soyland
fdf5818fc2
Add create, read, and delete index methods to gRPC interface 2021-01-07 13:05:48 -06:00
Ben Johnson
93f06e0f9d Fix rbf.Cursor.Close() panic 2021-01-07 11:28:46 -07:00
Maxton Huff
17e010cca2
Merge pull request #1293 from Maxtonian/verbose-message
Fix formatting bug in verbose log message
2021-01-07 09:38:29 -06:00
Travis
134abda51b
Implement snap := ClusterSnapshot()
Below is the list of instance of `ClusterSnapshot()` in the latest
`with-etcd` code. Some of these may not yet exist in the `disco` branch,
but this commit is implementing any that currently apply.

==========================
Done:
==========================
index.go
930:	snap := NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)
1072:	snap := NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)

cmd/pilosa-fsck/fsck.go
786:	snap := pilosa.NewClusterSnapshot(cfg.topo, cfg.topo.Hasher, cfg.topo.ReplicaN)

boltdb/translate.go
558:	snap := pilosa.NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)
1264:	snap := pilosa.NewClusterSnapshot(topo, topo.Hasher, topo.ReplicaN)

fragment.go
3448:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
3568:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
3620:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)

==========================
Remaining:
==========================

cluster.go
371:	snap := NewClusterSnapshot(NewLocalNoder(nodes), c.Hasher, c.ReplicaN)
474:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
639:	fSnap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
640:	toSnap := NewClusterSnapshot(to.noder, c.Hasher, to.ReplicaN)
703:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1475:		snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1502:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1941:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
1986:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
2049:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)
2126:	snap := NewClusterSnapshot(c.noder, c.Hasher, c.ReplicaN)

api.go
475:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
604:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
690:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
1684:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)
1946:	snap := NewClusterSnapshot(api.cluster.noder, api.cluster.Hasher, api.cluster.ReplicaN)

executor.go
3781:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4157:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4200:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4243:	snap := NewClusterSnapshot(e.Cluster.noder, e.Cluster.Hasher, e.Cluster.ReplicaN)
4517:	snap := NewClusterSnapshot(NewLocalNoder(e.Cluster.Nodes()), e.Cluster.Hasher, e.Cluster.ReplicaN)

holder.go
1465:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
1668:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
1889:	snap := NewClusterSnapshot(s.Cluster.noder, s.Cluster.Hasher, s.Cluster.ReplicaN)
1963:	snap := NewClusterSnapshot(c.Cluster.noder, c.Cluster.Hasher, c.Cluster.ReplicaN)
2021-01-06 22:53:20 -06:00
Travis
3f26d667b4
remove pilosa.DefaultPartitionN 2021-01-06 22:45:44 -06:00
jaten-molecula
a6bf52d753
Merge pull request #1290 from travisturner/disco-subpackages
add subpackages: topology, net
2021-01-06 17:23:56 -06:00
Jason E. Aten
6a845f1de1 use bbolt v1.3.5 that has fixed the checkptr bugs 2021-01-06 23:19:53 +00:00
Travis
20816ffa20
remove pilosa.URI 2021-01-06 16:19:14 -06:00
Travis
4515a24e48
change all references to use subpackages: topology, net 2021-01-06 16:09:24 -06:00
Maxton Huff
d10e45648b change f.path to f.path() 2021-01-06 15:58:01 -06:00
Travis
f8e6115c0e
fix linter and go.mod issues 2021-01-06 15:01:50 -06:00
Travis
2c1a019c9e
add licence headers 2021-01-06 14:42:28 -06:00
Travis
bd989f464a
change bbolt version back to 1.3.3 2021-01-06 13:26:35 -06:00
Travis
0da35fb72b
add subpackages: topology, net 2021-01-06 13:21:36 -06:00
Matthew Jaffee
d6cba17a01
Merge pull request #1274 from jaffee/generalized-groupby-sort-2
Add ability to sort on count or aggregate in GroupBy. Fix bug with offset being unsupported. Fix bugs with limit interacting poorly with other arguments.
2021-01-05 09:41:18 -07:00
Matt Jaffee
216e28a77e
add getSorter tests, fix bugs 2021-01-05 09:54:46 -06:00
Matt Jaffee
6dccb3d6be
remove (unused) sorting code related to fields, add comments 2021-01-03 08:34:53 -06:00
Matt Jaffee
6094663e7a
fix bug with "having" and "limit" in GroupBy
the limit could get applied before "having" in some cases which could
result in results being discarded which met the having condition while
results were kept which did not, ultimately resulting in GroupBy
falsely reporting fewer results than actually existed.
2021-01-01 21:56:59 -06:00
Matt Jaffee
ea539d8241
simplify groupby sorting and fix bugs
Back out support for sorting on fields (only count and aggregate
supported for now).

Fix bug where default return of "true" caused sort to be unstable. (If
they are equal, Less should return false)

Fix bug where limit was being applied before sorting.

Fix bug where offset was not actually allowed to be an argument to
GroupBy (weird! guess we weren't testing that very well)

Apply "having" after calculating Count(Distinct) aggregate so that
having can apply to that.

Switch to stable sort to make testing easier.
2020-12-31 14:42:03 -06:00
Matt Jaffee
5fdae74812
draft of sorting groupby results 2020-12-31 14:41:52 -06:00
Matthew Jaffee
46bbff786e
Merge pull request #1245 from codysoyland/groupby-aggregate-distinct
Add Distinct call as GroupBy aggregate
2020-12-30 10:05:37 -07:00
Matt Jaffee
16fd6a7edd
add tests for GroupBy(Distinct), fix various problems
We execute the aggregate Distinct calls after the GroupBy is complete,
and we need these to act like non-remote calls in that they forward to
all nodes, but like remote calls in that they bypass key
translation. Added a "PreTranslated" flag to the QueryRequest to
achieve this.

Discovered an issue where a nil *Row in EmbeddedData would cause a
panic in the protobuf serialization. Changed the encoding code we
control to never pass a nil *Row.

Got fed up with lack of context on errors and added wrapping to all
calls under executor.executeCall as well as a few other places.

Handled a situation where not having data on a shard for a particular
field could cause a query to error instead of just treating that
fragment as being empty. (see the switch in executeDistinctShardSet)

Stopped GroupBy from executing the Count(Distinct) aggregate on Remote
calls.

Fixed a longstanding issue where errors retrieved from remote query
calls had a garbage character at the front due to treating a protobuf
payload as an error message instead of decoding it. (see
http/client.go)
2020-12-30 08:13:41 -06:00
Cody Soyland
fd7417a49b
Use shardwidth instead of hardcoded value 2020-12-30 08:12:09 -06:00
Cody Soyland
f099a90264
Modify aggregate distinct logic and add tests
Use execute instead of directly using executeCount
Address code review feedback (add additional filters if provided)
Add basic tests
2020-12-30 08:12:09 -06:00
Cody Soyland
b435e9d793
Add Distinct call as GroupBy aggregate 2020-12-30 08:12:08 -06:00
Matthew Jaffee
fd3a423342
Merge pull request #1248 from jaffee/make-tests-more-robust
fix test failures in case of running Pilosa on system
2020-12-29 15:46:19 -07:00
Matt Jaffee
bed2cffd5e
fix test failures in case of running Pilosa on system
If you're running a Pilosa with mostly default configuration on your
system, some of these tests would fail due to things like port
conflicts. These changes address the most common failures.
2020-12-29 13:57:18 -06:00
Cody Soyland
1fa2a65c0b
Test to demonstrate failure running Distinct 2020-12-28 16:50:06 -06:00
Matthew Jaffee
4447d6fa76
Merge pull request #1261 from jaffee/some-distinct-bugs
fix Count(Distinct) bug and add better tests
2020-12-28 15:24:50 -07:00
Matt Jaffee
1ed91ebad3
simplify error messages
also remove test which was accidentally committed
2020-12-28 16:06:40 -06:00
Matt Jaffee
790bea147f
make view and fragment not found errors constant
based on code review feedback
2020-12-28 15:59:49 -06:00
Matt Jaffee
a3b07ff519
re-add log line which has more utility than I thought
From Nia:
While debugging the Q2 bugs this was somewhat useful in analyzing cluster events. As for the spammy part. . . that seems to be more of an issue with spamming our resets than an issue with the log itself.
2020-12-28 15:30:38 -06:00
Matt Jaffee
21c67352af
remove paranoia mode in top level Pilosa 2020-12-28 15:25:13 -06:00
Matt Jaffee
757c8a86b5
add comments, simplify tests, move ToCSV code
generally, address code review feedback
2020-12-28 15:22:31 -06:00
Matt Jaffee
27ca9dab36
don't hide error getting sign bitmap 2020-12-28 11:14:04 -06:00
Matt Jaffee
446950979a
fix potential nil dereference in SignedRow.ToRows
This used to be possible to hit, but I think now that Distinct on a
set field returns a *Row rather than a SignedRow it isn't an issue. (I
wasn't able to trigger it in the tests). Adding the fix anyway as it
seems safer than not.

The rest of the changes are test infrastructure to make it easy to
call GRPC queries and verify the results as CSV.
2020-12-28 11:00:46 -06:00
Matt Jaffee
1372bafe02
fix bugs where row index and field weren't always being propagated
I used a "paranoia" check to find these, but then realized the check
had a ton of false positives and doing it properly wasn't going to be
straightforward. I'm leaving the paranoia stuff in unless there are
objections, because I've wanted it before and not had it.

I also removed a log line that is very verbose and I don't think helps
anyone.
2020-12-23 19:08:10 -06:00
Matt Jaffee
427e9cb538
fix executor tests which were expecting a signedrow from Distinct 2020-12-23 15:33:15 -06:00
Matt Jaffee
6ff6fa7bb8
fix comments/capitalization 2020-12-23 14:44:18 -06:00
Matt Jaffee
9ee5f52a11
fix some Distinct key translation issues (e.g. empty index)
This commit changes executeDistinct to return either a *Row or a
SignedRow (instead of only being able to return a SignedRow). Distinct
on a set field will return a *Row while an int field will still return
a signed row.

We then add Field and Index fields to the Row object so that we can
determine how to translate the rows IDs to keys (if needed). This adds
a lot of logic around the translation which fixes bugs where Distinct
calls would fail to get translated.

There are, I think, still issues if you were to try to join a keyed
field to a keyed index which wasn't explicitly specified as the
field's foreign index. The IDs in the field wouldn't be using the same
translation as the IDs in the index, so the query might appear to work
but give incorrect results.
2020-12-23 14:37:03 -06:00
Matt Jaffee
385381e5f3
fix issue where a shard with no data can cause query to fail
add Distinct test with integer data, and because one of the records
had a null value (and was in a shard by itself), it uncovered this
issue. I added a special error type if a view or fragment is not found
when so that we can match against it and ignore it when calculating
the results for a query.

I also added an implementation within executeCount to handle the
SignedRow case, but discovered that handlePrecalls always dumps the
negative data and that will be a bigger thing to fix
2020-12-23 14:37:03 -06:00
Matt Jaffee
121f3fb610
fix Count(Distinct) bug and add better tests
the Distinct call would get precomputed correctly, but then the
executeCount would happen in the available shards context of the
index. So if the index only had records in (e.g.) shards 10,12,18,22,
and all the values of the Distinct call were in shard 0, you'd see 0
results.

The fix skips the whole map/reduce step of executeCount (which was
basically fake anyway when the argument is precomputed), and just adds
up all counts of all the precomputed segments.

This currently won't properly count Distinct values from an int field
which contains negative numbers... going to add a test and fix for
that next.

There is also still a key translation bug which is why the one test
case is commented out... fix coming for that soon as well.
2020-12-23 14:37:03 -06:00
Ben Johnson
fc7f7d6a7c
Merge pull request #1260 from molecula/bench-1month 2020-12-22 09:42:55 -07:00
Ben Johnson
02c4c1dff4
Merge branch 'master' into bench-1month 2020-12-22 08:51:18 -07:00
Ben Johnson
c189cb8e81
Merge pull request #1259 from molecula/bench-chmod-x
Make scripts/bench.sh executable
2020-12-22 08:51:03 -07:00
Ben Johnson
64f2ff6b78 Change benchmark script to test against GH 1 month of data 2020-12-22 08:10:29 -07:00
Ben Johnson
34c46cf084 Make scripts/bench.sh executable 2020-12-22 07:44:43 -07:00
tgruben
4b36805190
Merge pull request #1254 from jaten-molecula/migration_speedup
smaller batches of write Tx help boost migration speed
2020-12-21 13:28:31 -06:00
Jason E. Aten
1efff0c99b smaller batches of write Tx help boost migration speed 2020-12-21 19:00:13 +00:00
tgruben
e290e13d0b
Merge pull request #1252 from jaten-molecula/minimal_view_opening
pilosa: only open views with data
2020-12-18 18:41:44 -06:00
jaten-molecula
264f4382d5
Merge branch 'master' into minimal_view_opening 2020-12-18 18:19:24 -06:00
Ben Johnson
2d35f0d96a
Merge pull request #1243 from molecula/nightly-benchmark
Add nightly benchmark script.
2020-12-18 17:18:36 -07:00
jaten-molecula
94c38a59af
Merge branch 'master' into nightly-benchmark 2020-12-18 18:09:35 -06:00
Jason E. Aten
035073555a pilosa: only open views with data
- Previously, on timequantum schemas, we would
create and open a view for the cartesian
product of every possible view and shard.

- This caused us to be very slow on re-open,
and to use lots of memory for views that
held nothing.

- This change makes startup faster, memory
use much lower, and should speed migration.
2020-12-19 00:03:31 +00:00
Matthew Jaffee
7b6c6303ce
Merge pull request #1246 from jaffee/1242-createdAtBug
Fix field "createdAt" race by sending schema changes to coordinator
2020-12-18 12:06:29 -07:00
Ben Johnson
d635ece5a9 Add workflow name to benchmark 2020-12-18 09:33:50 -07:00
Matt Jaffee
b8cbd54d1b
forward all CreateIndex/CreateField requests to coordinator
this should avoid a race condition with CreateField where createdAt
can get out of sync if there are multiple concurrent requests.

The client methods didn't allow specification of the URI, so I
modified the implementation to find the coordinator and send to it
explicitly.
2020-12-18 10:16:46 -06:00
Matt Jaffee
58b9418f3c
add failing test for field creation race 2020-12-17 16:30:23 -06:00
Ben Johnson
cfdc7f4c63 Add nightly benchmark script.
This commit adds a script for executing a nightly benchmark and posting
the results to Slack.
2020-12-17 09:23:40 -07:00
jaten-molecula
513743f30d
Merge pull request #1241 from jaten-molecula/tests_for_NewBitmapBitmapFilter
add tests for NewBitmapBitmapFilter constructor
2020-12-16 21:39:18 -06:00
Jason E. Aten
0db4914bc4 add tests for NewBitmapBitmapFilter constructor
- document sort.Stable need
2020-12-17 00:27:34 +00:00
seebs
ad35f11a27
Merge pull request #1208 from seebs/fastRows2
Performance improvements for transactional backends scanning fragments
2020-12-16 17:14:54 -06:00
jaten-molecula
5b43513063
Merge branch 'master' into fastRows2 2020-12-16 17:09:46 -06:00
Seebs
cc5e822799 fix comment, remove unneeded step
It turns out NewSliceBitmap can take an initial set of values
already.
2020-12-16 17:00:34 -06:00
Nia
26ab79ecb8
Merge pull request #1238 from niaow/fix-snapshot-queue
Fix automatic snapshot queue enable check
2020-12-16 17:01:09 -05:00
jaten-molecula
6263f0bcfd
Merge branch 'master' into fix-snapshot-queue 2020-12-16 13:45:04 -06:00
Seebs
4ddbadcea7 review issues: fix unclearSets (now sliceDifference) and prune/fullPrune
unclearSets was completely broken and I have no idea why the test I thought
was testing it didn't actually catch that problem. Added unit tests and fixed
the logic. Improved/clarified prune and fullPrune, and unexported their
names because why export methods on an unexported type.

Also improve some comments and rename a variable or two to improve clarity.
2020-12-16 13:18:18 -06:00
Seebs
0952db5af7 Add (temporary, perhaps) locking on TestTx_CountRange
On roaring, CountRange needs to have exclusive access to a fragment, but
doesn't currently require a lock, because it's usually used from inside
other already-locked things.
2020-12-16 13:18:18 -06:00
Seebs
de14762661 create Tx tests for CountRange
CountRange for RBF had a subtle bug which wasn't noticed, so, let's
have some CountRange testing and also a benchmark.

We also fix a couple of subtle bugs caught in the process of developing
and testing this.

SliceContainers will allow nil containers, but doesn't return them when
iterating because there's various things that can panic if called on a nil
container. Since countEmptyContainers() has to traverse the whole bitmap
anyway, it doesn't matter which it counts, so we replace it with
countNonEmptyContainers(), and adjust test cases accordingly. This fixes
an issue where if roaring is smart enough to insert a nil container
into a SliceContainers, trying to write it to a file produces an invalid
bitmap with offsets off by 16 and one container fewer than its header predicts.

RBF: don't try to count 0 bits in a container

If we're to the "last container", and we'd be counting all the bits less than
zero, we can skip that. This avoids hitting a bug, which is that c.countRange
doesn't handle BitmapPtr.
2020-12-16 13:16:46 -06:00
Seebs
17c24c236a don't try to use the rowCache for CountRange
Several issues:
1. tx.frag could be non-nil but not the fragment requested.
2. start and end need not be exact row boundaries.
3. therefore this could be returning the count of the row containing
"start", for a fragment other than the one requested.
4. also in fact the rowcache wasn't populated before this so in one
memory profile, this function alone was responsible for nearly
100GB of cached values...
2020-12-16 13:16:46 -06:00
Seebs
dec0a00155 add container N to ConsiderKey 2020-12-16 13:16:46 -06:00
Seebs
23e16474ae use ApplyFilter instead of roaring.ApplyFilterToIterator
In some cases, ApplyFilter can be significantly faster. On the other hand, it doesn't
matter as much as you might think on the mutex imports, because we've already sucked
most of the time out of those.
2020-12-16 13:16:46 -06:00
Seebs
e4e94a5668 prevent weird rare failures in mutex imports
Added additional mutex sample data and batches of it so we can
confirm that overwrite works. It didn't work, so that needed to be fixed.

Couple of things:
(1) Wasn't updating "last value seen" so the check for an unsorted list
didn't work.
(2) Also didn't handle the case where there were to-clear values higher
than any to-set value.

This could result in bits not getting cleared, which could result in
there being more than N bits to clear for N new bits. And that could cause
really strange problems when the input slices were parts of a single
larger slice, because bit positions to clear could get shoved in as
possible columns in a future batch.
2020-12-16 13:16:46 -06:00
Seebs
e99744c8da Do benchmarks with read-only Tx after committing write sometimes
For the Rows benchmark, we were continuing to use the original writable
transaction, meaning RBF was spending all its time looking up dirty
pages in the transaction's dirty page cache rather than working with
the disk in any way. It wasn't clear whether this was hurting or
helping performance, but it was clear that it wasn't testing the
"real" workload use case, where queries are done against the RBF
file rather than the dirty page cache.

Modify the benchmark to test it both ways for comparison. Answer:
The RBF file is faster than the in-memory map (!).
2020-12-16 13:16:46 -06:00
Seebs
9b13ab7dd3 use readLeafCellKey to read a leaf cell's key 2020-12-16 13:16:46 -06:00
Seebs
dc67149326 read leaf cells through a pointer
This reduces noticably the cost of reading leaf cells, by passing
a single pointer down the stack instead of the entire data structure
up the stack. It's only a few percent overall, but it's noticeable.
2020-12-16 13:16:46 -06:00
Seebs
7c415b4217 Implement rbf-specific ApplyFilter
This gives RBF an ApplyFilter that can run without instantiating containers
when the filter it's using doesn't need them instantiated. We can also seek
ahead in cases where we know the next key we care about is not just the next
key numerically.
2020-12-16 13:16:46 -06:00
Seebs
2c4aff2d18 add benchmarks for f.rows()
This is a simplistic benchmark for f.rows() to let us evaluate its performance
in preparation for trying to do some profiling and tuning.
2020-12-16 13:16:46 -06:00
Seebs
30d5f891c0 create naive ApplyFilter 2020-12-16 13:16:46 -06:00
Seebs
59d89dda99 Allow arbitrary and potentially more efficient filtering of bitmaps
This is a partial solution to a nasty performance problem, which is that
a ContainerIterator has to *generate* all the containers. With roaring, this
was cheap because they already exist in memory; with transactional backends,
it's an allocation per container, *even for the containers we don't use*.

This design admits filters which can distinguish between answers they
can give just based on keys and times when they actually need containers
instantiated, and can also give hints as to future answers -- saying "yes"
or "no" to entire rows at a time, or indicating when they're done.

This is only part of the solution; we also need a Tx API hook for
doing scans like this which doesn't rely on ContainerIterator.
2020-12-16 13:16:46 -06:00
jaten-molecula
440b90f3c8
Merge pull request #1240 from jaten-molecula/roaring_printutil
roaring: print utility AsContainerMatrixString for diagnostics
2020-12-16 13:02:47 -06:00
Jason E. Aten
1a6f573739 roaring: print utility AsContainerMatrixString for diagnostics
AsContainerMatrixString returns a string showing
 the matrix of rows in a shard, showing the count of hot (1) bits
 in each container.
2020-12-16 18:50:45 +00:00
Nia Weiss
eab70e2314
use the txf to determine if snapshots are needed 2020-12-16 11:00:27 -05:00
Nia Weiss
aaf94c6aeb
fix the automatic snapshot queue enable check
The "needs snapshot queue" check was broken, as it only checked inside a loop over indices.
If there are no indexes yet (or more likely if the indices have not yet been loaded off of disk), then this would never use the snapshot queue on roaring.
2020-12-16 08:15:17 -05:00
Cody Soyland
87bf0df786
Merge pull request #1234 from codysoyland/rbf-usage-calc
Fix disk usage calculation in RBF backend
2020-12-15 15:57:17 -06:00
Cody Soyland
4cb21da6e9 Fix disk usage calculation in RBF backend 2020-12-15 13:39:27 -06:00
Cody Soyland
765bac992d
Merge pull request #1225 from codysoyland/upgrade-gopsutil
Upgrade gopsutil
2020-12-14 11:36:07 -06:00
Cody Soyland
5eb726ce59 Upgrade gopsutil 2020-12-14 10:58:28 -06:00
tgruben
3beaed1645
Merge pull request #1220 from jaten-molecula/avoid_dynamic_dispatch
FragSpec as struct, fragment fields to avoid dynamic dispatch
2020-12-14 09:21:57 -06:00
Jason E. Aten
b254c6776b FragSpec as struct, fragment fields to avoid dynamic dispatch
- allow inlining of getters index(), view().
 - GOMAXPROCS set to 128
2020-12-12 16:39:24 +00:00
tgruben
b0755577b3
Merge pull request #1218 from jaten-molecula/short_txkey
short_txkey elides index and shard from the txkey
2020-12-11 17:30:40 -06:00
Jason E. Aten
b52a814b3c short_txkey elides index and shard from the txkey
- use short_txkey for rbf
 - short_txkey breaks a bunch of bolt_test.go, so leave it on (long) txkey for now.
 - remove SliceOfShards method from Tx interface
2020-12-11 22:24:56 +00:00
tgruben
c5302f2f57
Merge pull request #1212 from tgruben/fragment-refactor
Fragment refactor (wip)
2020-12-11 15:08:19 -06:00
Todd Gruben
8ad7afbe43 FragProxy reduces string memory consumption drastically
for datasets with lots of views, because we don't
replicate path, index, field, view strings so often.
2020-12-11 21:01:15 +00:00
jaten-molecula
30502c99ab
Merge pull request #1214 from jaten-molecula/readwrite_locks
use tx.mu.RLock for OffsetRange, Lock for AddRoaring
2020-12-11 08:13:52 -06:00
Jason E. Aten
2b569b1edf use tx.mu.RLock for OffsetRange, Lock for AddRoaring 2020-12-11 13:53:27 +00:00
tgruben
f5e656138f
Merge pull request #1211 from jaten-molecula/skip_serz_1node
avoid serializing for sync shards in 1 node cluster situation
2020-12-10 17:16:10 -06:00
Jason E. Aten
7571792401 avoid serializing for sync shards in 1 node cluster situation 2020-12-10 20:54:32 +00:00
Maxton Huff
8c20255b12
Merge pull request #1210 from Maxtonian/lonquerytime2
deprecate cluster.long-query-time and create long-query-time
2020-12-10 11:14:09 -06:00
Maxton Huff
dee700741a deprecate cluster.long-query-time and create long-query-time
moved lonquerytime from cluster into server and moved cluster.longquerytime into top level config
kept cluster.longquerytime for backwards compatibility, favored if both longquerytime options are present
2020-12-10 10:51:31 -06:00
tgruben
087418566b
Merge pull request #1204 from jaten-molecula/clear_cursors
reset cursor stacks before reuse
2020-12-09 19:01:08 -06:00
jaten-molecula
21cb390d2f
Merge branch 'master' into clear_cursors 2020-12-09 17:01:21 -06:00
Jason E. Aten
81b9586a4b reset cursor stacks before reuse 2020-12-09 21:41:41 +00:00
Cody Soyland
1990ecf2b6
Merge pull request #1205 from codysoyland/docker-build-make
Use "make" inside docker build so that CGO_ENABLED uses exported value from Makefile
2020-12-09 15:02:04 -06:00
Cody Soyland
f351b7efa6 Use "make" inside docker build so that CGO_ENABLED uses exported value from Makefile 2020-12-09 13:21:07 -06:00
Cody Soyland
1add244f8a
Merge pull request #1201 from codysoyland/default-roaring
Default TxSrc to roaring
2020-12-09 09:36:28 -06:00
Cody Soyland
c1fe8b214a Default TxSrc to roaring 2020-12-09 09:31:40 -06:00
Cody Soyland
53f6a127af
Merge pull request #1198 from codysoyland/docker-build-test
Disable cgo on all builds, add additional tests for docker
2020-12-09 09:17:03 -06:00
Cody Soyland
5d18c0af2b Enable cgo on test -race 2020-12-09 09:00:03 -06:00
Cody Soyland
bc94c7bcdf Remove lmdb dependency and references, vendor Barrier 2020-12-09 08:43:23 -06:00
Cody Soyland
eef6359db3 Disable cgo on all builds, add additional tests for docker 2020-12-08 19:42:51 -06:00
tgruben
d05531b77a
Merge pull request #1197 from jaten-molecula/rowcache_off_by_default
rowcache off by default. pilosa server --rowcache-on turns it back on.
2020-12-08 19:32:19 -06:00
Jason E. Aten
03a54c6d5f rowcache off by default. pilosa server --rowcache-on turns it back on. 2020-12-08 23:18:45 +00:00
tgruben
d4d30e160b
Merge pull request #1196 from jaten-molecula/diagn
pilosa debugstats and rbf tooling for enhanced debugging/diagnostics
2020-12-08 16:58:54 -06:00
Jason E. Aten
82d07bc123 debugstats and rbf tooling for enhanced debugging/diagnostics 2020-12-08 22:47:40 +00:00
tgruben
9f7fa7eaad
Merge pull request #1195 from jaten-molecula/rbf_doc
document pattern of branch splits
2020-12-08 16:19:56 -06:00
tgruben
63d67ac65e
Merge branch 'master' into rbf_doc 2020-12-08 15:52:46 -06:00
tgruben
662073c284
Merge pull request #1194 from jaten-molecula/fix_freepageset
fix bug in pgno computation in freePageSet
2020-12-08 15:52:25 -06:00
Jason E. Aten
cbff5bd29d document pattern of branch splits 2020-12-08 20:50:29 +00:00
Jason E. Aten
96abbfa059 fix bug in pgno computation in freePageSet 2020-12-08 20:45:54 +00:00
Cody Soyland
bd060b6fd2
Merge pull request #1191 from codysoyland/docker-disable-cgo
Dockerfile: switch back to alpine and disable cgo
2020-12-07 10:07:56 -06:00
Cody Soyland
2bd27cdf5e Upgrade alpine and disable cgo 2020-12-07 09:26:52 -06:00
Cody Soyland
5d08d54518 Revert "ubuntu 20:10 image instead of alpine, for cgo support"
This reverts commit ef156f6172.
2020-12-07 09:26:52 -06:00
Nia
8a6d20d314
Merge pull request #1168 from niaow/pilosa-id-gen
Add ID auto-generation on the coordinator
2020-12-07 09:58:13 -05:00
Nia
a4f538ffec
Merge branch 'master' into pilosa-id-gen 2020-12-07 09:46:58 -05:00
Nia
2a863e5c13
clarify OptServerOpenIDAllocator
Co-authored-by: Matthew Jaffee <matthew.jaffee@gmail.com>
2020-12-07 08:08:51 -05:00
jaten-molecula
d38184a5ff
Merge pull request #1183 from jaten-molecula/rm_lmdb
remove lmdb as tx backend
2020-12-04 17:32:15 -06:00
Jason E. Aten
7a9e0969cb remove lmdb as a Tx backend
- test only still uses a Barrier utility from the go-lmdb package;
  it could be ported in at some point.
2020-12-04 23:17:59 +00:00
Cody Soyland
4f14774883
Merge pull request #1174 from codysoyland/query-timing
Add query duration to gRPC responses
2020-12-04 15:47:03 -06:00
Cody Soyland
fc3b64e500 Add table conversion to duration timing 2020-12-04 15:19:12 -06:00
Cody Soyland
c33eafc27e Add tests for streaming queries 2020-12-04 15:19:12 -06:00
Cody Soyland
6830657d12 Add query duration to gRPC responses
This adds a "duration" parameter to RowResponse and TableResponse, which
will be populated with the query duration in nanoseconds.

For QueryPQLUnary and QuerySQLUnary, the duration is a included in the
returned TableResponse.

For QuerySQL and QueryPQL, only the first RowResponse in the stream will
contain the duration.
2020-12-04 15:19:12 -06:00
Ben Johnson
26789ef0b5
Merge pull request #1163 from molecula/page-pool
Add sync.Pool for RBF pages
2020-12-04 08:08:11 -07:00
Nia Weiss
7ea2e4b7e3
add ID auto-generation on the coordinator 2020-12-03 13:04:14 -05:00
Ben Johnson
79e6156003 Add sync.Pool for RBF pages 2020-12-03 07:32:36 -07:00
Ben Johnson
1ce15a51c9
Merge pull request #1157 from molecula/put-leaf-cell-faster 2020-12-01 15:49:16 -07:00
jaten-molecula
836540151b
Merge branch 'master' into put-leaf-cell-faster 2020-12-01 16:24:09 -06:00
tgruben
dd856378d1
Merge pull request #1156 from jaten-molecula/container_key_span
RoaringIterator.ContainerKeySpan method
2020-12-01 16:22:57 -06:00
Ben Johnson
df958f40dd Optimize putLeafCellFast() 2020-12-01 12:12:54 -07:00
jaten-molecula
53b64bd939
Merge branch 'master' into container_key_span 2020-12-01 09:15:11 -06:00
Matthew Jaffee
c8c7b98654
Merge pull request #1142 from alanbernstein/update-ui-paths
Maintain list of frontend routes, update 'vds' to 'tables'
2020-12-01 07:42:50 -07:00
Jason E. Aten
6f4ca78bc4 RoaringIterator.ContainerKeySpan method
- enables rbf ingest optimization. When we know there won't be
   updates involved we can bulk import faster.
2020-12-01 01:52:58 +00:00
Alan Bernstein
4dc38bee02 Maintain list of frontend routes, updates 'vds' to 'tables' 2020-11-25 13:30:28 -06:00
Nia
df13c72351
Merge pull request #1145 from niaow/err-id-on-keyed
Report an error when an ID is used on a keyed field
2020-11-25 13:48:04 -05:00
Nia Weiss
353fd3937d
report an error when an ID is used on a keyed field 2020-11-25 11:37:18 -05:00
Alan Bernstein
9e3e0a6be7
Merge pull request #1013 from alanbernstein/query-activity-api
Add query history endpoint
2020-11-24 08:46:43 -06:00
Alan Bernstein
65877c1e56 Store start instead of age, skip remote, fix timing bug 2020-11-23 21:31:40 -06:00
Alan Bernstein
0c8e4afe45 Set test nodeIDs to guarantee iteration order in executor 2020-11-23 20:23:28 -06:00
Alan Bernstein
a8a7e53382 Add query-history test 2020-11-23 20:23:28 -06:00
Alan Bernstein
c5a7a259aa Make minor fixes to query tracker 2020-11-23 20:23:28 -06:00
Alan Bernstein
2bc2a32263 Make query history length configurable 2020-11-23 20:23:27 -06:00
Alan Bernstein
b172f4d05b Include index in query history response 2020-11-23 20:23:27 -06:00
Alan Bernstein
542a6ffdb6 Gather query history from remote nodes 2020-11-23 20:23:27 -06:00
Alan Bernstein
bbd147d18f Replace query history map with ringBuffer 2020-11-23 20:23:27 -06:00
Alan Bernstein
65de5df2a9 Update tracker test 2020-11-23 20:23:27 -06:00
Alan Bernstein
c94d242097 Add basic implementation of query history endpoint 2020-11-23 20:23:27 -06:00
seebs
55d0c12703
Merge pull request #1131 from seebs/randomerQuery
Improve random-query
2020-11-23 11:58:53 -06:00
Seebs
3d802f428b add Distinct, be more consistent about using correct rand.Rand
The RandomQueryConfig has its own seeded RNG, but we didn't always use
it (especially in the last two commits, but also I think in one previous
thing), so let's use it more consistently.

We check for int fields (as opposed to decimal), and if we find them,
we add Distinct to our list of potential queries to use if and only
if we've got a depth of at least one so there'd be a child query under
the current query, and if we do, grab one of the int (not decimal)
fields and do a query on that.
2020-11-23 09:54:59 -06:00
Seebs
796d646a0c handle integer fields
Extend field handling to include int (and decimal) fields, allowing them
to have range operations specified on them.
2020-11-23 09:51:29 -06:00
Seebs
2a2a8abbd4 support time fields
For time fields, allow specifying a range of times, then 19/20 times,
specify "from" and "to" times in that range when querying those fields,
rather than just looking at the standard view all the time.
2020-11-23 09:51:29 -06:00
Seebs
48b97d6ad4 report QPS after last query
More generally, report QPS not at 0 queries, which is boring, but every
100 queries *and* after the last query if the last query wasn't at a
multiple of 100 queries. Makes the output slightly more useful, I think.
2020-11-23 09:51:29 -06:00
Matthew Jaffee
7271fbf396
Merge pull request #1015 from alanbernstein/dont-create-keys-directory
Check index.keys before opening translate store to avoid unnecessary keys directory
2020-11-20 14:30:37 -07:00
Matt Jaffee
a48bf28be2
don't try to translate keys on unkeyed indexes
this causes a few things to error earlier than they otherwise would
have, hence the changed tests.
2020-11-20 14:48:28 -06:00
Alan Bernstein
063a3b96e3
Check index.keys before opening translate store 2020-11-20 12:43:15 -06:00
Nia
106952dc5e
Merge pull request #1106 from niaow/topk-time
TopK on time
2020-11-20 13:24:05 -05:00
Nia
c8ab2a9fb3
Merge branch 'master' into topk-time 2020-11-20 13:11:51 -05:00
Nia Weiss
d7b9568960
add licesnse header to bsi_test.go 2020-11-20 12:40:28 -05:00
Nia Weiss
410a372351
clarify bsi-building preconditions 2020-11-20 12:38:53 -05:00
Nia Weiss
f9c196e418
skip roaring add test in race
Otherwise it overloads the race detector.
2020-11-20 12:16:09 -05:00
tgruben
72f4024e99
Merge pull request #1122 from jaten-molecula/inlined_immutable_map_rb
rbf: use an inlined immutable.Map<uint32, int64> for the PageMap
2020-11-20 10:44:44 -06:00
Nia Weiss
5d2c42b7bf
address documentation todo in pivotDescending 2020-11-20 11:13:44 -05:00
Matthew Jaffee
64b83137a0
add tests for addBSI 2020-11-20 11:07:30 -05:00
Nia Weiss
46818863e8
implement TopK on time
This replaces the former TopK BSI building algorithm, as the row cache was too expensive.
Additionally, BSI addition has been optimized with specialized adders inside of roaring.
2020-11-20 11:06:55 -05:00
Jason E. Aten
e1bb6e303a rbf: use an inlined immutable.Map<uint32, int64> for the PageMap
- goes 7% faster on kitchen sink import test

- reduces total allocations by 5% on same test.
2020-11-20 00:49:41 +00:00
jaten-molecula
47202b0ed2
Merge pull request #1095 from molecula/fast-write
Implement optimized fast leaf write.
2020-11-19 16:04:31 -06:00
Ben Johnson
a9831ad5a1 Replace literals with leafCellHeaderSize 2020-11-19 14:18:53 -07:00
Ben Johnson
d125c68275 Fix estimated page size calculation to include index padding. 2020-11-19 14:12:43 -07:00
Ben Johnson
33334511c4
Merge branch 'master' into fast-write 2020-11-19 13:44:09 -07:00
jaten-molecula
5b8cda3c88
Merge pull request #1120 from molecula/fix-root-record-overflow
Fix rbf write root record iterator reset
2020-11-19 13:11:09 -06:00
Ben Johnson
a31487b873 Fix rbf write root record iterator reset 2020-11-19 11:15:24 -07:00
jaten-molecula
61bdc2257b
Merge pull request #1111 from jaten-molecula/sync_pool
rbf: reuse cursors with sync.Pool/arena
2020-11-19 11:17:20 -06:00
Jason E. Aten
9c7bc603af rbf: reuse cursors with sync.Pool or arena
- the sync.Pool default uses little memory under CI.

- arena approach provides ability to control the maximum memory
  used by rbf Cursors.

- cursor caching is adjustable with --rbf-cursor-cache
  currently 0 by default (meaning use sync.Pool), and
  larger than 0 meaning use an arena of this size.
  With the arena, 20 or less is needed to pass CI.

- rbf test suite runs ~ 4x faster

- kitchen sink ingest test runs 16% faster.

- report TotalAlloc in CALLSTATs

fixes #1105
2020-11-19 17:02:49 +00:00
jaten-molecula
274a95c4da
Merge pull request #1115 from molecula/remove-rbtree
Use immutable.SortedMap for root records
2020-11-19 11:00:57 -06:00
Ben Johnson
26d0e9d958
Merge branch 'master' into remove-rbtree 2020-11-19 07:27:09 -07:00
tgruben
b849fe4b98
Merge pull request #1116 from jaten-molecula/pilosa_txsrc
use pilosa server --txsrc instead of --tx to prevent viper env var shadowing
2020-11-18 14:37:10 -06:00
Jason E. Aten
524c78623f repair pilosa/ctl/server_test too 2020-11-18 18:53:22 +00:00
Ben Johnson
0175c66756 Use immutable.SortedMap for root records
This commit fixes a bug where the root record cache was being
updated in-place causing a race condition with other transactions
using it. The cache implementation has been changed from `rbtree`
to an `immutable.SortedMap`.
2020-11-18 11:22:52 -07:00
Jason E. Aten
06eb3afaaa use pilosa server --txsrc to prevent viper env var shadowing from stopping PILOSA_TXSRC getting through 2020-11-18 18:21:31 +00:00
jaten-molecula
a9c1ff3047
Merge pull request #1107 from jaten-molecula/fix_tx
restore the env variable PILOSA_TXSRC's affect
2020-11-16 17:26:22 -06:00
Jason E. Aten
744827d5cc restore the env variable PILOSA_TXSRC's affect 2020-11-16 23:18:50 +00:00
Ben Johnson
89ae5ad4b7
Merge branch 'master' into fast-write 2020-11-16 09:10:01 -07:00
Ben Johnson
519dc5069d Implement optimized fast leaf write.
This commit adds an optimized implementation for `putLeafCell()` if
the insert/update will not cause the page to overflow.
2020-11-16 08:13:35 -07:00
Nia
6dfbbf91d6
Merge pull request #1098 from niaow/topn-v3
Add TopK with perpendicular BSI bitmaps
2020-11-16 08:39:50 -05:00
Nia Weiss
02498ce57a
add TopK with perpendicular BSI bitmaps 2020-11-13 18:31:55 -05:00
tgruben
43443d10ff
Merge pull request #1097 from jaten-molecula/bitmap_foreach
rbf: BitN needs int32 to hold its maximum value.
2020-11-13 17:12:19 -06:00
Jason E. Aten
4120024b10 rbf: BitN needs int32 to hold its maximum value.
- decrease ArrayMaxSize and RLEMaxSize by 1
  to make space
- add TestForEachRange, fix bugs found in ForEach,
  where the call f() logic was backwards.
2020-11-13 22:59:18 +00:00
tgruben
b2e9e3904a
Merge pull request #1094 from jaten-molecula/elem_rb
rbf: keep ElemN and BitN up to date.
2020-11-13 15:44:15 -06:00
Jason E. Aten
d46b603cd6 rbf: keep ElemN and BitN up to date.
- fix a bug in computing leafCell.BitN in a run after a bit Remove
- shrink bitmaps on remove
- util_test.go has Cursor.DebugSlowCheckAllPages to verify;
  used by cursor_test.go
2020-11-13 21:18:09 +00:00
Cody Soyland
dc0ac0ccd0
Merge pull request #1092 from codysoyland/ci-go-version-cve-2020-28362
Ci: Go version update for CVE-2020-28362
2020-11-13 11:48:16 -06:00
Cody Soyland
e53b74261b Update default Go version 2020-11-13 11:23:39 -06:00
Cody Soyland
a2f49b6a84 Fix yaml syntax, add requires section 2020-11-13 11:23:39 -06:00
Cody Soyland
dca606dea8 Add pilosa (binary build) to .gitignore 2020-11-13 11:23:39 -06:00
Cody Soyland
671250d273 Update Go version for CVE-2020-28362, use param matrix 2020-11-13 11:23:39 -06:00
tgruben
d15dc4204b
Merge pull request #1086 from jaten-molecula/rbtree_root_records
rbf: use a red-black tree to manage the root records list
2020-11-13 11:14:51 -06:00
Jason E. Aten
eae82b72c2 rbf: use a red-black tree to manage the root records list
- 40% faster on ingest_test when putting 10K roots/containers.
 - 15% fewer bytes allocated total
 - clarifying renames leafCell.N -> ElemN, allocate -> allocatePgno,
   deallocate -> freePgno
2020-11-13 16:49:26 +00:00
jaten-molecula
cb73c71e02
Merge pull request #1072 from molecula/uni-wal
Refactor RBF to use a single WAL file
2020-11-11 15:44:45 -06:00
jaten-molecula
563c70dc43
Merge branch 'master' into uni-wal 2020-11-11 15:27:15 -06:00
tgruben
b3d2704066
Merge pull request #1085 from jaten-molecula/uniq_dbnames
unique db names so parallel test runs don't collide
2020-11-11 14:26:04 -06:00
Jason E. Aten
fd9210b31c unique db names so parallel test runs don't collide 2020-11-11 20:04:02 +00:00
Ben Johnson
81a64c5902 Add RBF halting; remove time based checkpoint 2020-11-11 11:17:07 -07:00
Ben Johnson
9eba299d35 Restrict max RBF transaction size 2020-11-10 08:14:14 -07:00
Ben Johnson
78eb9e0711 Fix linter 2020-11-10 07:07:06 -07:00
Ben Johnson
52340212f6 Add RBF dirty page cache 2020-11-09 16:11:20 -07:00
Ben Johnson
8de1959938 Remove RBF exclusive/direct write. 2020-11-09 08:23:09 -07:00
Ben Johnson
3554048877 Refactor RBF to use a single WAL file 2020-11-09 08:03:22 -07:00
tgruben
e99f7f0fc3
Merge pull request #1074 from jaten-molecula/fsync_applies_to_all
apply --fsync flag to all tx backend
2020-11-06 12:34:28 -06:00
Jason E. Aten
a38d4fa46c apply --fsync flag to all tx backend
- rename from --rbf-fsync to --fsync, as it
   now effects bolt, lmdb too.
2020-11-06 18:11:02 +00:00
jaten-molecula
822c7482a5
Merge pull request #1071 from jaten-molecula/parallel_migration_rb
run migration in parallel
2020-11-05 14:09:31 -06:00
Jason E. Aten
7e22994a6d run migration in parallel
- migration can be slow. parallelize it.
2020-11-05 18:31:27 +00:00
tgruben
bc26de63b0
Merge pull request #1070 from jaten-molecula/slurp_profile_rbf_comments
rbf default. Add TODO comments, slurp -profile returns a cpu profile
2020-11-03 19:52:54 -06:00
Jason E. Aten
458095a707 rbf default. Add TODO comments, slurp -profile returns a cpu profile
- default Tx is once again RBF, changed from bolt.
- document the RBF code review comments that were not addressed
  before #1052 was merged, so they don't get lost.
- they should be easily addressed by replaying the entire WAL file
  rather than from the DB meta page 0 notion of the last WalID
- cleanup rbf/cfg/cfg.go stale comments, ensure default0 respected.
  1 msec checkpoint time, 1MB wal segment defaults.
- return a specific error, ErrNoMetaFound, from findNextWALMetaPage()
  rather than io.EOF, since there actually wasn't any file IO involved.
- add http handlers for /cpu-profile/start and /cpu-profile/stop
  in http/handler.go enable CPU profiling at specific time points
  during an ingest or other operation.
2020-11-04 01:36:17 +00:00
tgruben
a55cdad139
Merge pull request #1069 from jaten-molecula/faster_new_tx
take a mutex off the fast path of TxFactory.NewTx
2020-11-03 19:15:26 -06:00
Jason E. Aten
bf36f54b8d take a mutex off the fast path of TxFactory.NewTx 2020-11-04 01:04:04 +00:00
tgruben
40a773b839
Merge pull request #1068 from jaten-molecula/qcx_gettx_error
qcx.GetTx returns an error
2020-11-03 18:34:24 -06:00
Jason E. Aten
6aadd13095 qcx.GetTx returns an error
- to indicate that the query context is already
   done.
 - handles the case where the import worker is
   interrupted early by a ctx cancellation,
   thus avoiding a panic.
2020-11-04 00:01:02 +00:00
Ben Johnson
06cb04f87a
Merge pull request #1052 from molecula/fix-wal-not-found
Fix RBF WAL ID panic.
2020-11-03 11:16:33 -07:00
Ben Johnson
731a1ef25e Refactor RBF WAL to only only checkpoint-in-full. 2020-11-03 10:41:31 -07:00
Ben Johnson
ea3732fa62 Fix WAL ID not found panic.
This commit changes the checkpointing to determine a minimum WAL ID
for readers and a max ID based on the writer. Pages are checkpointed
from the WAL up to the writer's max WAL ID but segments are removed
only up to the reader's minimum WAL ID. This ensures that WAL pages
are not removed out from under current read transactions.
2020-11-03 10:41:31 -07:00
Ben Johnson
c47b49a06e
Merge pull request #1053 from molecula/increase-rbf-wal-write-cache 2020-11-03 07:37:05 -07:00
Ben Johnson
db74f0dffa Increase RBF WAL write cache size to 1MB.
Previously we dropped the cache size to 64KB but that seems much
too low. Write performance suffers considerably.
2020-10-30 17:09:33 -06:00
Matthew Jaffee
3ff85ccb53
Merge pull request #1051 from molecula/default-txn-bolt-fix-ci
default to Bolt txn due to CI failures blocking other team
2020-10-30 15:01:57 -05:00
Matt Jaffee
83dd8026d5
default to Bolt txn due to CI failures blocking other team
Our nightly CI has been failing for a week due to WAL issues and it's
making it difficult for Kuba and Antonio to do things on the
integration repo. Hoping bolt backend will solve that in the short
term. I think the issue is Pilosa #1046 (that's from memory though)
2020-10-30 13:55:36 -05:00
Ben Johnson
bb5153a7c1
Merge pull request #1049 from molecula/rbf-cli-help
Improve RBF CLI help
2020-10-30 08:38:14 -06:00
Ben Johnson
d5369a084e Improve RBF CLI help 2020-10-30 07:25:36 -06:00
tgruben
f446eee088
Merge pull request #1048 from jaten-molecula/delete_empty
DeleteEmptyContainer true by default now
2020-10-30 06:30:09 -05:00
Jason E. Aten
9c66cd5a81 DeleteEmptyContainer true by default now 2020-10-30 04:15:53 +00:00
tgruben
4113a3d85b
Merge pull request #933 from molecula/qcx_no_auto_reset
pilosa: no automatic reuse of Qcx
2020-10-29 20:03:42 -05:00
Jason Aten
016e5e0774 no automatic reuse of Qcx
Per slack discussion with Seebs and Nia,
we'll try not automatically resetting the Qcx.

The worry was that our goroutine shutdown
management is so poor that we are asking for
GetTx on a goroutine that still has a Qcx
from a query that was cancelled.

If this is the case, we will now panic instead of
issuing a new Tx. Then we can fix the poor
goroutine management.

 - also require Qcx.Finish or Abort before Reset
2020-10-30 00:36:46 +00:00
tgruben
51c9f4feeb
Merge pull request #1044 from jaten-molecula/startup_shards
don't apply startup shard cache to roaring with a specified view path
2020-10-29 18:24:57 -05:00
Jason E. Aten
18e253870e cleanup TypedDBPerShardGetShardsForIndex logic 2020-10-29 22:25:06 +00:00
Jason E. Aten
f8e7b27a6f don't apply startup shard cache to roaring with a specified view path
- avoids creating a new empty 8 byte shard file under all the
   views that don't have them already.
2020-10-29 22:09:55 +00:00
tgruben
ed6f59a827
Merge pull request #1042 from jaten-molecula/migration_logging
better migration logging
2020-10-29 04:38:53 -05:00
Jason E. Aten
2d55ffbd28 short circuit if no data to migrate 2020-10-29 02:44:22 +00:00
Jason E. Aten
d4df15721d allow migration of empty to empty 2020-10-29 02:41:09 +00:00
Jason E. Aten
aa47cf5bf4 fix verify test 2020-10-29 02:35:38 +00:00
Jason E. Aten
0e354aedf2 error expected trying to migration to roaring 2020-10-29 02:29:57 +00:00
Jason E. Aten
f9f94aab0d fix typo 2020-10-29 02:15:43 +00:00
Jason E. Aten
bceabc9127 error on un-implemented migrate to roaring 2020-10-29 02:11:28 +00:00
Jason E. Aten
3baa8ea0f6 check if roaring data present with RoaringHasData 2020-10-29 01:47:26 +00:00
Jason E. Aten
639e9b3bf0 quiet 2020-10-29 01:32:04 +00:00
Jason E. Aten
6e20e6439f more logging 2020-10-29 01:30:16 +00:00
Jason E. Aten
b1ff3791b8 better error when green does not exist on migration 2020-10-29 01:20:41 +00:00
Jason E. Aten
85fc785296 timed progress 2020-10-29 01:12:19 +00:00
Jason E. Aten
509348260f better migration logging 2020-10-28 22:54:58 +00:00
Ben Johnson
e332f6fd7e
Merge pull request #1018 from molecula/rbf-cli 2020-10-28 06:26:27 -06:00
jaten-molecula
6386587f12
Merge branch 'master' into rbf-cli 2020-10-28 05:35:43 -05:00
jaten-molecula
9d233c4849
Merge pull request #1040 from jaten-molecula/rowcache_lock
pilosa: write lock the fragment when rowcache used
2020-10-27 20:11:10 -05:00
Jason E. Aten
062bd5c8c7 pilosa: write lock the fragment when rowcache used
- only allocate the rowcache if it is in use (avoid allocation per fragment)
 - when the rowcache is use, fragment.go intRowIterator must write lock the
   fragment because the f.rowCache will be updated.
 - eliminate unused bitmapCache interface to keep the linter happy.
 - fixes #1035
2020-10-28 00:53:38 +00:00
jaten-molecula
1784384153
Merge pull request #1039 from jaten-molecula/rbf_logging
pilosa server --rbf-checkpoint-dur to 0 by default
2020-10-27 18:19:04 -05:00
Jason E. Aten
1ca8a45357 pilosa server --rbf-checkpoint-dur to 0 by default
- we return to checkpointing after every commit, by default.
  - the internal rbf logic is not ready to have
    checkpoints deferred. Doing so results in
    references to WAL segments that are not
    in the current slice of live segments.
2020-10-27 22:38:18 +00:00
jaten-molecula
c9912e3607
Merge branch 'master' into rbf-cli 2020-10-27 15:03:43 -05:00
Cody Soyland
7855cd4d21
Merge pull request #1038 from jaten-molecula/dockerfile_go1.14.10
use go1.14.10 for now because of https://github.com/molecula/pilosa/issues/1036
2020-10-27 14:04:03 -05:00
Jason E. Aten
24bd1543f3 Makefile to go1.14.10 2020-10-27 18:07:13 +00:00
Jason E. Aten
2fb53b982a update .circleci/config.yml to use go1.14.10 2020-10-27 18:00:15 +00:00
Jason E. Aten
03f24303d7 use go1.14.10 for now because of https://github.com/molecula/pilosa/issues/1036 2020-10-27 17:44:53 +00:00
Jason E. Aten
85f3fa9836 merge with the update to rbf to take a Config parameter 2020-10-27 15:11:45 +00:00
jaten-molecula
4543237e09
Merge branch 'master' into rbf-cli 2020-10-27 10:09:24 -05:00
jaten-molecula
305f81a310
Merge pull request #1034 from jaten-molecula/rbf_checkpoint_rb
performance tuning: rbfcfg package, binary search for wal segment
2020-10-27 10:07:47 -05:00
Ben Johnson
2b1d790625 Fix tree key formatting; add --with-tree option 2020-10-27 08:24:56 -06:00
Ben Johnson
7fa1a5edd2 Add RBF CLI commands 2020-10-27 08:12:22 -06:00
Jason E. Aten
957cba1768 performance tuning: rbfcfg package, binary search for wal segment
- rbfcfg package holds Config for --rbf- command line flags
- wal.go: replace linear search with bisection for wal segment
2020-10-27 00:49:56 +00:00
jaten-molecula
14cb29ea7d
Merge pull request #1024 from jaten-molecula/avoid_excessive_directory_scans
pilosa: avoid re-scanning shards during holder open
2020-10-23 20:31:05 -05:00
Jason E. Aten
233b3cbc0f versioned map cleanup 2020-10-24 00:35:25 +00:00
Jason E. Aten
c5e46e4618 one copy of shard map during a reload 2020-10-24 00:20:30 +00:00
Jason E. Aten
8ff6e8e0fd versioned readonly shards map 2020-10-23 23:50:22 +00:00
Jason E. Aten
2503fe5b66 pilosa: avoid re-scanning shards during Holder.Open()
- view.openFragmentInTx was forcing a directory scan
   for shards on every open fragment during Holder.Open().
   Seen by pprof profile having excessive allocations
   from dbshard.go listDirUnderDir().
2020-10-23 23:50:22 +00:00
seebs
2b6cb5fc6c
Merge pull request #1020 from seebs/distinctSet
Distinct operations on set fields
2020-10-23 17:09:23 -05:00
seebs
7558afd7ec
Merge branch 'master' into distinctSet 2020-10-23 16:41:00 -05:00
Cody Soyland
35706a3372
Merge pull request #1017 from codysoyland/docker-build
Fix Docker build target, enable when building Linux releases
2020-10-23 16:31:30 -05:00
Seebs
765d28bf9d add test case and bug fix for distinct code
The "seenThisRow" value was never getting cleared, which meant that
if the first container on a row didn't happen to contain any post-filter
bits, the rest of the row wouldn't get evaluated.
2020-10-23 16:18:19 -05:00
Cody Soyland
fc29bf5ec8 Fix Docker build target, enable when building Linux releases 2020-10-23 14:27:00 -05:00
Seebs
a2151358ba Partial implementation: Distinct() supporting set fields
Add an exported IntersectionAny() from roaring to let us quickly
check whether two containers have overlap, so we can avoid performing
intersections we don't need to when evaluating containers within
the same row as a previous match. (IntersectionCount on the whole
bitmap would imply doing up to 16 intersections even if we find a bit
right away.)

We also allow ForeignIndex to be set on set, mutex, and time fields,
since all of those could now be reasonable operands for Distinct
ops.

Not yet present: Handling time quantums, but that seems really
desireable.
2020-10-23 13:36:40 -05:00
Nia
c1db627593
Merge pull request #989 from niaow/translate-maybe
Allow querying without creating keys
2020-10-23 14:23:35 -04:00
Nia
3b93b767fa
Merge branch 'master' into translate-maybe 2020-10-23 13:59:10 -04:00
Nia Weiss
ddee7ae35e
address review comments for #989 translate-maybe 2020-10-23 10:59:08 -04:00
jaten-molecula
8f1aae9a69
Merge pull request #1016 from jaten-molecula/rowcache_optional
pilosa server --rowcache-off disables the row cache
2020-10-22 22:14:51 -05:00
Jason E. Aten
8d2ad048fa pilosa server --norowcache disables the row cache
- this can lessen memory pressure
- certain backends may not need it
- enables performance benchmarking and tuning
2020-10-22 22:20:48 +00:00
seebs
9eb251ec85
Merge pull request #69 from seebs/ctbench
Container op benchmarks
2020-10-22 15:03:09 -05:00
Seebs
8095455355 container performance benchmarking
This adds a series of archetypal containers that represent the
common use cases (arrays, bitmaps, or runs of various cardinalities)
and runs the basic operations against them for benchmarking purposes.

`benchpretty` is an app to snatch the BenchmarkCt* lines from
benchmark runs and display them in a possibly more usable form,
mostly as a precursor to cool analysis things.

This also adds a test to verify that intersectionCount(a, b)
is the same as intersect(a, b).N() for all the archetypal
containers.

This also includes a performance fix for intersectBitmapRun which
was spotted while running these tests.
2020-10-22 14:33:03 -05:00
Nia Weiss
afbbc93047
add basic tests for queries with missing keys 2020-10-22 13:19:05 -04:00
Nia Weiss
9204298d06
fix broken rebase on GetNodeUsage 2020-10-22 11:10:36 -04:00
Nia Weiss
8340b9ea64
re-apply single equals fix 2020-10-22 11:03:51 -04:00
Nia Weiss
b0a588f8dd
finish translate-if-exists 2020-10-22 10:50:09 -04:00
Nia Weiss
a74eda1eb0
cleanup of key translation fix 2020-10-22 10:50:08 -04:00
Nia Weiss
c60c699664
deal with linter false positives 2020-10-22 10:47:30 -04:00
Nia Weiss
da52b134bf
the tests pass now 2020-10-22 10:47:30 -04:00
Nia Weiss
5315579378
add some validation 2020-10-22 10:47:29 -04:00
Nia Weiss
1fe0edae08
fix find & create foreign index keys 2020-10-22 10:47:29 -04:00
Nia Weiss
a6e3723190
it mostly works now 2020-10-22 10:47:29 -04:00
Nia Weiss
13a19aeb42
query translation WIP 2020-10-22 10:47:29 -04:00
Nia Weiss
15036787a7
test new translation paths via API 2020-10-22 10:47:29 -04:00
Nia Weiss
8a130c150e
address review comments 2020-10-22 10:47:28 -04:00
Nia Weiss
22d6011d05
apply "maybe" key translation WIP 2020-10-22 10:47:25 -04:00
jaten-molecula
d12639b890
Merge pull request #1014 from jaten-molecula/log_in_utc
log in UTC in fixed width microseconds RFC3339 format
2020-10-21 20:01:36 -05:00
Jason E. Aten
aad38d1c60 log in UTC in fixed width microseconds 2020-10-21 18:36:28 +00:00
seebs
4cea813ae8
Merge pull request #999 from seebs/pqlCleanup
Fixes some minor PQL issues; adds support for case-insensitive PQL calls
2020-10-20 16:02:42 -05:00
jaten-molecula
fb6feb04f9
Merge branch 'master' into pqlCleanup 2020-10-20 15:21:54 -05:00
seebs
a1e1d86ae3
Merge pull request #1012 from seebs/ignoreCN
Supply "subject alternative name" for TLS certificates
2020-10-20 14:50:18 -05:00
Travis Turner
52b91b2df1
Merge branch 'master' into pqlCleanup 2020-10-20 14:19:45 -05:00
Seebs
5e36638e10 Supply "subject alternative name" for TLS certificates
Go killed off using the common name for hostnames starting with 1.15,
but this can be addressed by recreating the certs using a Subject
Alternative Name for the domain for "localhost". This allows tests
to pass without hanging, at least for me.
2020-10-20 14:14:26 -05:00
jaten-molecula
d929c945bc
Merge pull request #1011 from jaten-molecula/rbf_default
rbf is the default Tx type. Dogfood it.
2020-10-20 13:53:21 -05:00
Jason E. Aten
18ad4a8230 rename test-golang-1.14 -> test-golang-1.14.9 2020-10-20 13:37:13 -05:00
Travis Turner
4db93db0c1
Merge branch 'master' into pqlCleanup 2020-10-20 13:19:55 -05:00
Jason E. Aten
275779173d go1.15.3 support with GODEBUG=x509ignoreCN=0 2020-10-20 12:23:35 -05:00
Jason E. Aten
996b2ccb23 go1.13.15 -> go1.15.3 as our supported versions 2020-10-20 11:58:12 -05:00
Jason E. Aten
1216b93d73 rbf is the default Tx type. Dogfood it. 2020-10-20 11:07:07 -05:00
tgruben
c356498c19
Merge pull request #1010 from jaten-molecula/avoid_bg_deadlock
CI catches red blue-green tests. Qcx write flag
2020-10-20 11:01:53 -05:00
Travis Turner
7be3cd6a36
Merge branch 'master' into pqlCleanup 2020-10-20 10:59:48 -05:00
Jason E. Aten
2b4e6d25f5 CI catches red blue-green tests. Qcx write flag
- fix a CI/Makefile issue that was hiding red tests in CI.
 - the testv and testv-race targets now require /bin/bash
 - In executor.go, the top-level query context Qcx now
   has a write flag. It will upgrade read-Tx to write-Tx
   when Store() wraps some inner local-read operations,
   to avoid deadlocking against its own query. This deadlock
   happens in TestExecutor_Execute_SetRow/Set_NewRow
   under rbf_lmdb blue-green testing without the upgrade.
2020-10-20 10:38:40 -05:00
jaten-molecula
0dd3486b95
Merge pull request #1005 from jaten-molecula/bglimits
Fix blue-green Tx cleanup and document single import at once
2020-10-20 07:31:54 -05:00
Jason E. Aten
d9783406bd Fix blue-green Tx cleanup and document single import at once
- correct string constants for txtype so that
  blue-green cleanup correctly detects when
  2nd transaction in a pair has Committed and
  thus the blue-green RWMutex can be relased

- test that txtype.String() is consistent with
  the corresponding string constants.

- document in bluegreentx.go the current limitations
  of blue-green testing: only one github archive import
  (a single writing client) is supported by blue-green
  testing. Multiple importers will deadlock eventually
  on the DBShard.mut RWMutex. We could fix this by
  ordering the write locks and obtaining them in
  strictly increasing order (by shard number), but
  that would require alot of change to the executor
  and that would introduce more risk for a test-only
  pathway.
2020-10-20 07:09:08 -05:00
jaten-molecula
2ebff707a9
Merge pull request #1004 from jaten-molecula/bluegreenlock
introduce a per shard blue-green RWMutex
2020-10-19 18:02:29 -05:00
Jason E. Aten
81013999e5 introduce a per shard blue-green RWMutex
- allows blue-green testing with concurrent readers/writers.
 - otherwise we don't start/end the blue and green Tx
   together, and they get split by a read/write concurrently.
2020-10-19 17:28:35 -05:00
Travis Turner
f37a63e5cf
Merge branch 'master' into pqlCleanup 2020-10-19 15:45:04 -05:00
Cody Soyland
d3ae2614ce
Merge pull request #1001 from seebs/updateLint
uprev golangci-lint, fix a minor lint in rbf
2020-10-19 14:54:38 -05:00
Seebs
ed309821ae uprev golangci-lint, fix a minor lint in rbf
I have a newer staticcheck and golangci-lint on my laptop, and it started
complaining about something. The first comment added disables the check
in staticcheck-as-a-command, the second disables it when it's being done
by golangci-lint, which invokes the analysis passes directly and displays
the output differently, and also doesn't recognize the hints used by
staticcheck.

Newer golangci-lint doesn't find anything else that it wants to complain
about.
2020-10-19 14:25:11 -05:00
Seebs
6e725d50ce check error return from peg parser Init
The updated peg tool produces an Init that can return an error. As
of this writing, the error can't be non-nil unless you specified an
option which itself returned an error, but that could change later,
so let's be careful.
2020-10-19 13:47:42 -05:00
Seebs
e84d2d2a59 refactor number parsing a bit
There are subtle inconsistencies, like "01" being a valid decimal but not
a valid integer, which vaguely bug me. Cleaning this up, and the corresponding
parser logic.

A number can't have leading spaces because the grammar doesn't
put spaces in them in the first place, so stop accepting them in the
number syntax. This should never have any impact on anything,
it's just simpler.

Update a couple of test cases to reflect this -- no longer testing
that trailing spaces are okay, now testing that they're not, for
instance.
2020-10-19 13:37:21 -05:00
Seebs
c19d571112 more consistent spacing
We still prohibit a space before a leading '(', which maybe we shouldn't,
but we now allow spaces on both sides of a closing ')' more consistently.
Drop the unneeded "sp" before "close" in the special handling after
null, true, and false, because close now implies that.

Also, refactored the two instances of "sp '=' sp" into a thing called eq,
which may not be worth it.
2020-10-19 13:35:49 -05:00
Seebs
28d18920b9 Make PQL case-insensitive about call names.
Use "" strings for fixed string names. In startCall(), look up the
lowercase conversion of a call name in a table mapping all-lowercase
representations to canonical case, so we don't have to chase down
everyplace in the rest of the code base that assumes "Row" is
capitalized exactly like that.
2020-10-19 13:35:49 -05:00
Seebs
18ed02d7fb drop float/decimal distinction in PQL
PQL always produces decimals, which have effectively-arbitrary range,
but can convert them to floats when required; the executor then requests
this conversion in the handful of cases (SetRowAttrs and SetColumnAttrs)
where it wants floats rather than decimals.

Not yet fixed: The "Range" call may also be wrong now. It was specifying
an "fvalue" but is now effectively getting what used to be called a
"dvalue". However, so far as I can tell, that didn't work before either.
2020-10-19 13:35:49 -05:00
Seebs
b8bb438b69 trivial cleanup of PEG grammar
Drop irrelevant (), simplify the expression of the sp rule.

Perhaps shockingly, this *does not change the generated grammar at all*. The
generated code for:
	sp <- [ \t\n]*
and is identical to the code for:
	sp <- ( ' ' / '\t' / '\n' )*

And in fact, is spelled the latter way in the generated comments.
2020-10-19 13:35:49 -05:00
Seebs
0ea324129f update to new version of peg tool
Want to do some PQL cleanup. A new version of peg turns out to dramatically
alter performance in some cases, so I'm doing the commit for "don't change any
PQL, just change the version of peg" checkin separately.
2020-10-19 13:35:49 -05:00
tgruben
092177aea4
Merge pull request #997 from molecula/bolt_in_badger_out
Use boltdb instead of badger as our all-Go Tx oracle
2020-10-16 17:41:23 -05:00
Jason E. Aten
266b92c025 Use boltdb instead of badger as our all Go Tx oracle.
- remove all badgerdb code.
 - use boltdb instead.
2020-10-16 17:21:21 -05:00
Cody Soyland
3dff03907d
Merge pull request #942 from codysoyland/grpc-web
Add grpc-web to http handler
2020-10-16 15:46:25 -05:00
Cody Soyland
b86b0519af go mod tidy 2020-10-16 15:10:48 -05:00
Cody Soyland
a2ee047868 grpc-web cors test 2020-10-16 11:36:41 -05:00
Cody Soyland
31cd119a7e Move grpc.Server creation into initializer
This fixes an issue with the grpc-web middleware using a nil
grpc.Server instance.
2020-10-16 11:36:41 -05:00
Cody Soyland
04b1152224 Add grpc-web to http handler 2020-10-16 11:36:41 -05:00
jaten-molecula
8da638f685
Merge pull request #979 from seebs/bbolt
switch to etcd boltdb fork
2020-10-15 19:58:31 -05:00
Seebs
0905e858cd uprev golang to 1.14.9
1.14 had a bug in the checkptr code (well, not exactly a bug) which
made it enforce alignment requirements on x86. This turns out not
to be the problem I was seeing, but we should be on 1.14.9 anyway.

To keep this from breaking CI integration with Github, we also
use explicit job names instead of matrix-generated ones, and fix
the CI config syntax up a bit after almost getting that right the
first try. (This patch includes fixes contributed by Cody, and since
I had to rebase and re-approve AGAIN anyway, I might as well squash
the commit history up.)
2020-10-15 19:13:28 -05:00
Seebs
76fe49d390 un-disable checkptr by fixing the memory problems
Step one: switch to etcd.io's bbolt fork of boltdb.

The etcd-io fork of boltdb isn't archived, and has fixes for boltdb's
interactions with checkptr, allowing us to drop the checkptr-disabling
hackery.

This seems to be a drop-in replacement; etcd/bbolt says that the file
format is "fixed" (I believe in the sense of "unchanging"), and I can
run pilosa on an existing data directory with this.

Step two:

Fix missing caps in roaring.go that were also triggering the same
issues.
2020-10-15 19:12:47 -05:00
tgruben
de642ed90c
Merge pull request #993 from molecula/fix983
bluegreentx: default to not dumping full databases
2020-10-15 17:31:55 -05:00
Jason E. Aten
e5a56f1cd2 bluegreentx: default to not dumping full databases 2020-10-15 16:23:19 -05:00
Matthew Jaffee
c859a8aa2b
Merge pull request #981 from jaffee/single-equal-data-race
Fix data race on call map in single '=' logic
2020-10-15 11:40:16 -05:00
Matt Jaffee
00f1f70779
fix data race on call map in single = logic
Add test of single = int query over multiple shards which reproduces
the race

move the code which modifies the PQL call object if a Row query
on an int field uses a single = instead of ==. Instead of processing
this at the shard level, we'll process it during the initial
translation step so that it isn't operated on concurrently.
2020-10-15 10:26:14 -05:00
alanbernstein
4bf81444ba
Merge pull request #951 from molecula/shard-dist-api
Add ui-specific endpoint to report shard distribution data
2020-10-14 21:58:05 -05:00
Alan Bernstein
94e82aea86 Consider available shards 2020-10-14 21:11:02 -05:00
Alan Bernstein
ab502a0f8d Add basic test 2020-10-14 21:11:02 -05:00
Alan Bernstein
510902625e Update test hasher implementations 2020-10-14 21:11:02 -05:00
alan
2a902b3a7b Finish basic shard-distribution endpoint 2020-10-14 21:11:02 -05:00
Alan Bernstein
98cd2dc441 WIP shard distribution endpoint 2020-10-14 21:11:02 -05:00
Cody Soyland
8c9569faca
Merge pull request #982 from codysoyland/circle-config-fix
Fix PR detection logic in CI
2020-10-14 21:07:23 -05:00
Cody Soyland
316bd87a8a Fix PR detection logic in CI 2020-10-14 20:36:04 -05:00
jaten-molecula
fa21c81a27
Merge pull request #963 from molecula/rbf_config
rbf: add DBConfig
2020-10-14 20:12:46 -05:00
jaten-molecula
577600d17b
Merge branch 'master' into rbf_config 2020-10-14 19:57:05 -05:00
jaten-molecula
39a31cc63e
Merge pull request #976 from seebs/impossible
Check more carefully for, and also fix, containers with invalid N
2020-10-14 18:57:02 -05:00
jaten-molecula
eb4b9974ac
Merge branch 'master' into impossible 2020-10-14 18:40:50 -05:00
alanbernstein
ca223c4a79
Merge pull request #934 from alanbernstein/cluster-usage
Collect size-on-disk usage data from all nodes
2020-10-14 16:33:03 -05:00
Alan Bernstein
aff5c0fc57 Skip missing directories 2020-10-14 15:46:19 -05:00
Jason E. Aten
244ba21da7 better names 2020-10-14 13:19:14 -05:00
Jason E. Aten
3a40b586b3 disk usage per index 2020-10-14 12:53:35 -05:00
Alan Bernstein
e2cafd98ef Move index size calculation to TxFactory 2020-10-14 12:20:05 -05:00
Alan Bernstein
7a32eadc64 Move disk capacity lookup to gopsutil wrapper package 2020-10-14 12:20:05 -05:00
Alan Bernstein
6a298590be Set omitempty for disk capacity json 2020-10-14 12:20:05 -05:00
Alan Bernstein
ba4ca1a93e Include disk capacity in usage response 2020-10-14 12:20:05 -05:00
Alan Bernstein
2a44bdd25c Collect size-on-disk usage data from all nodes 2020-10-14 12:20:05 -05:00
Cody Soyland
e1e0b298f5
Merge pull request #964 from codysoyland/check-changelog-label
Check for changelog label in CI
2020-10-14 10:11:45 -05:00
Seebs
c88192b4ac Check more carefully for, and also fix, containers with invalid N
In rare cases, RBF can produce containers which have a recorded N value which
is incorrect. This rarely affects anything, but on some particular queries,
this can result in very strange outcomes, like array containers with more
than 1<<16 entries.

To fix this, we have toContainer specify that it doesn't know the correct
N for the bitmap containers it's creating, which costs extra time for counting,
and should be considered a temporary workaround.

Also, we add a CheckN() function which is controlled by the
roaringparanoia flag, and add a number of calls to it, for instance, as
deferred calls after every container operation when roaringparanoia is
enabled. This means that we get improved confidence that we've caught
the relevant errors, but is not suitable for production use.
2020-10-14 10:03:18 -05:00
Cody Soyland
ca5dbe8d39 Fix pull request filter 2020-10-14 09:42:07 -05:00
Cody Soyland
2ac09af894 Only run on pull requests 2020-10-14 09:29:51 -05:00
Cody Soyland
4e66bbb76b Check for changelog label in CI 2020-10-14 09:29:51 -05:00
seebs
6c14aa965d
Merge pull request #895 from seebs/appendSemantics
use append-like semantics consistently for *Container
2020-10-14 09:04:56 -05:00
jaten-molecula
3d4da8f51b
Merge branch 'master' into appendSemantics 2020-10-14 07:24:18 -05:00
jaten-molecula
20d4268676
Merge branch 'master' into rbf_config 2020-10-14 07:19:37 -05:00
jaten-molecula
a997e713dc
Merge pull request #977 from molecula/readers
pilosa-fsck: the -readers flag controls parallelism
2020-10-13 19:14:09 -05:00
Jason E. Aten
50a8db854d pilosa-fsck: the -readers flag controls parallelism
- add path info to the panic if we find a corrupt boltdb
   translation store.
2020-10-13 18:58:38 -05:00
J
3ad8ec7f0f rbf: add runtime options to DB struct
- FsyncEnabled and DoAllocZero moved to DB struct.
 - deletes unused xrbrsupport.go and cmd/convert
 - fixes #941
2020-10-12 18:35:00 -05:00
tgruben
db9e8cd8ef
Merge pull request #966 from molecula/fix843
pilosa/dbshard: allow deleteIndex and then re-use of index
2020-10-12 18:10:04 -05:00
Jason E. Aten
b3e6cdc0d8 pilosa/dbshard: allow deleteIndex and then re-use of index
- fixes #843
2020-10-12 17:46:06 -05:00
jaten-molecula
54255eae15
Merge pull request #957 from molecula/fix-tx-deadlock
Fix deadlock in importWorker()
2020-10-12 17:04:11 -05:00
Ben Johnson
676208ea73 Add test to reproduce deadlock 2020-10-12 12:32:58 -06:00
Ben Johnson
9b83b71c8f Fix error check reference in importWorker() 2020-10-12 11:28:18 -06:00
Ben Johnson
bfe570ef9d Fix deadlock in importWorker()
This commit wraps the work for a view in a function so that the
defer on the finisher executes after each view is processed instead
of at the end.
2020-10-12 11:25:28 -06:00
Cody Soyland
279be13a46
Merge pull request #958 from codysoyland/grpc-compat-update
Better VDSM gRPC compatibility
2020-10-12 09:27:04 -05:00
Cody Soyland
e40b224a4f
Merge branch 'master' into grpc-compat-update 2020-10-12 09:08:42 -05:00
tgruben
d3811634d6
Merge pull request #959 from molecula/parallel_fsck
pilosa-fsck: parallelize Index.ComputeTranslatorSummary
2020-10-09 16:12:36 -05:00
Jason Aten
8da15b18d4 pilosa-fsck: parallelize Index.ComputeTranslatorSummary
- add -index option
2020-10-09 15:53:29 -05:00
Cody Soyland
6c10917ceb Use vdsm.QueryPQLRequest for vdsm.QueryPQLUnary 2020-10-09 13:34:20 -05:00
Cody Soyland
3039aa44af Use copy of vdsm InspectRequest for better compatibility 2020-10-09 13:22:24 -05:00
Cody Soyland
a58c345232 Use copy of vdsm QueryPQLRequest for better compatibility 2020-10-09 13:22:24 -05:00
tgruben
d3ce4fa70e
Merge pull request #948 from molecula/randomquery
pilosa/cmd/random-query: generate random queries from existing schema/data
2020-10-09 12:16:28 -05:00
Jason Aten
937a1afade pilosa/cmd/random-query: generate random queries from existing schema
- fixes molecula/molecula#136
 - flag -n 0 does continuous queries until process is killed.
2020-10-08 18:38:01 -05:00
jaten-molecula
06ee8b16ac
Merge pull request #940 from molecula/fsck_2index_repair
pilosa-fsck: multi-index counts and repairs.
2020-10-07 07:35:08 -05:00
Jason Aten
a63c6ee2b2 pilosa-fsck: multi-index counts and repairs.
- multiple indexes repaired at once could crosstalk. Fixed.
 - the counts of keys and ids are now broken down by index.
2020-10-06 21:10:52 -05:00
tgruben
d41de17503
Merge pull request #931 from molecula/fsck_msg
pilosa-fsck: correct repair -> analysis in pilosa-fsck logging
2020-10-06 13:21:21 -05:00
jaten-molecula
bc8fc23ac9
Merge branch 'master' into fsck_msg 2020-10-06 13:12:46 -05:00
tgruben
3a742a0caa
Merge pull request #938 from molecula/ci_rbf
run CI on rbf and rbf_lmdb
2020-10-06 12:52:33 -05:00
Jason Aten
83f230bbfb run CI on rbf and rbf_lmdb 2020-10-06 12:22:03 -05:00
Ben Johnson
ab6581446d
Merge pull request #889 from molecula/rbf-immutable-wal 2020-10-06 10:45:47 -06:00
Ben Johnson
3b7758a4f2 Add comment explaining rbf.DB.checkpoint() args 2020-10-06 10:36:57 -06:00
Ben Johnson
2440413c49 Remove test skips based on race detector 2020-10-06 10:29:17 -06:00
Ben Johnson
7b64abbb53 Reduce default RBF DB size to 4GB; remove race skips 2020-10-06 09:36:31 -06:00
Ben Johnson
644969e6a9 Add log.* and tourna.* to gitignore 2020-10-06 09:36:31 -06:00
Ben Johnson
265452cf3d Add rbf.SyncEnabled 2020-10-06 09:36:31 -06:00
Ben Johnson
cf208cfaa3 Increase test http client timeout
The timeout was increased to allow additional time for RBF to process
a lot of individual `Set()` commands in `TestMain_RecalculateHashes`.
2020-10-06 09:36:31 -06:00
Ben Johnson
3852ac79c4 Add rbf.DB.TxN() function and test check 2020-10-06 09:36:31 -06:00
Ben Johnson
c978e2242e Skip some RBF tests during race detection 2020-10-06 09:36:31 -06:00
Ben Johnson
c51ba69c09 Fix RBF sync calls 2020-10-06 09:36:31 -06:00
Ben Johnson
3429421148 Fix RBF checkpoint off-by-one WAL ID issue 2020-10-06 09:36:31 -06:00
Ben Johnson
d826cec4b3 fix RBF WAL segment reference error 2020-10-06 09:36:31 -06:00
Ben Johnson
cdd10a26f0 Refactor RBF to use immutable list of WAL segments.
Previously, RBF shared a list of WAL segments between the DB & Tx.
However, this increased the need for mutexes to access the data.

WAL segments are effectively immutable on-disk so the list of segments
has been refactored so that changes to the segment list are done via
copy-on-write which allows read transactions to access segment data
without a mutex.

The database checkpointing can remove early, unused segments and
there is an update/add check to make sure that Tx segments pushed back
to the DB do not include removed segments.
2020-10-06 09:36:31 -06:00
tgruben
8dbfaf5045
Merge pull request #932 from jaten-molecula/pr919
api usage should ignore tx stores. fixes #919
2020-10-06 09:45:43 -05:00
jaten-molecula
ce3a51eb87
Merge branch 'master' into fsck_msg 2020-10-06 09:28:36 -05:00
Jason Aten
6ddeec2ee8 print time at end of fsck run, even if we return 1 to shell 2020-10-06 08:19:53 -05:00
jaten-molecula
4ca42d7f14
Merge branch 'master' into pr919 2020-10-05 21:29:28 -05:00
Travis Turner
12cd4ea69e
Merge pull request #922 from travisturner/design-typos
adjust some wording and typos in the fsck design doc
2020-10-05 20:57:44 -05:00
Jason Aten
c82a1593ff api usage should ignore tx stores. fixes #919
- avoid deadlock in txfactory_internal_test w Qcx
2020-10-05 20:51:38 -05:00
Jason Aten
2f9c51349a correct repair -> analysis in pilosa-fsck logging 2020-10-05 19:59:32 -05:00
Travis Turner
69e15b4719
Merge branch 'master' into design-typos 2020-10-05 18:45:24 -05:00
jaten-molecula
d55ce8723b
Merge pull request #917 from molecula/pr224
ensure that Inspect generates a result for every header item
2020-10-05 17:37:15 -05:00
jaten-molecula
a14b81edbf
Merge branch 'master' into design-typos 2020-10-05 17:29:42 -05:00
Kuba Podgórski
5e2a14400a
Add an extra else branches 2020-10-05 17:13:48 -05:00
Jason Aten
fd87e8d2f3
follow suggestion on https://github.com/molecula/idk/issues/224, does it fix Q2 delete consumer issue?
- apparently not, but this might still be worth doing.
2020-10-05 17:13:48 -05:00
Nia
84830d8361
Merge pull request #921 from niaow/fix-rows-type-error
Generate errors for all unsupported types in Rows calls
2020-10-05 16:32:37 -04:00
Travis
675373f0f3
adjust some wording and typos in the fsck design doc 2020-10-05 14:38:57 -05:00
Nia Weiss
bb0d8bea14
generate errors for all unsupported types in Rows calls 2020-10-05 15:37:05 -04:00
jaten-molecula
9d7945e5be
Merge pull request #918 from molecula/fsck-design
DESIGN.md for pilosa-fsck
2020-10-05 13:36:57 -05:00
Jason E. Aten
05d4b664df groom 2020-10-05 13:29:29 -05:00
Jason E. Aten
9dacbccf8d DESIGN.md for pilosa-fsck
- Orient users to pilosa-fsck by giving an overview of its operations.
2020-10-05 12:51:26 -05:00
jaten-molecula
75b8fa0aa8
Merge pull request #900 from molecula/pilosa-fsck-rb
pilosa-fsck: fsck-like scan and repair of pilosa backups
2020-10-02 16:53:57 -05:00
Jason E. Aten
fe425a84c0 pilosa-fsck: scan and repair of pilosa backups
- the -fix flag repairs replication errors by copying from the primary.
 - the -fixkeys flag repairs any string key translation issues.
 - make pilosa-fsck installs pilosa-fsck and builds release-pilosa-fsck.COMMIT.GOOS.tar.gz release tarbar
2020-10-02 16:47:56 -05:00
jaten-molecula
d9f8de170c
Merge pull request #906 from jaffee/revert-confirm-down-retries
retrun confirmDownRetries to 10, tourney mac compatible
2020-10-02 15:15:57 -05:00
Matt Jaffee
c2a93cc886
retrun confirmDownRetries to 10, tourney mac compatible
At some point the cluster code was modified to do 120 tries to confirm
if a node was down which is a bit excessive for production. My
understanding is that this was done to help trigger or fix a problem
during testing which is hopefully no longer relevant.

Also changed the tournament script to use what I think are more
standard bash-isms that work on mac. Please confirm this still works
on Linux as well.
2020-10-02 14:24:16 -05:00
seebs
df89ebf394
Merge pull request #844 from seebs/setRowCache
Update cache entries when setting a row even in shards with no new data
2020-10-02 13:20:54 -05:00
Seebs
aec11ff713 Update cache entries when setting a row even in shards with no new data
The logic assumes that the lack of a corresponding rowSegment means that
there's no changes, but that's not true -- we just deleted all the
existing data! Update to match clearRow behavior better.

Also, add a corresponding test case for this.

Also, change references to 'defaultSnapshotQueue' to use
[fragment].holder.SnapshotQueue, because defaultSnapshotQueue was
the queueless queue, but holders were getting a snapshot queue,
meaning that "awaiting" a snapshot could result in moving on
and closing the holder before the actual snapshot queue finished
snapshotting.
2020-10-02 12:57:18 -05:00
Nia
7006233cf8
Merge pull request #915 from niaow/distinct-error-handling
Fix panic when "field" parameter not present on Distinct call (error instead)
2020-10-01 14:58:29 -04:00
Nia
ad0f0b1725
Merge branch 'master' into distinct-error-handling 2020-10-01 14:47:16 -04:00
alanbernstein
afc6f432bd
Merge pull request #647 from alanbernstein/ui-feature-support
Add more info to some endpoints to support UI
2020-10-01 13:19:35 -05:00
Nia Weiss
415f7d20b8
add field parameter error handling to Distinct 2020-10-01 12:09:34 -04:00
Alan Bernstein
8a3d93fe78 Move TransactionList endpoint to UI namespace 2020-10-01 10:45:08 -05:00
Alan Bernstein
46d010fe18 Remove 'NodeStates' from /status until it is reliable 2020-10-01 10:43:49 -05:00
Alan Bernstein
1a04e94fc1 Remove clusterID and default name to ID 2020-10-01 10:43:49 -05:00
Alan Bernstein
5705b45864 Add a CLI flag for cluster name and include it in /status response 2020-10-01 10:43:49 -05:00
Alan Bernstein
8fad2b92c2 Add all node states to /status response 2020-10-01 10:43:49 -05:00
Alan Bernstein
664c911791 Include replicaN in /info response 2020-10-01 10:43:49 -05:00
alanbernstein
11e4bbfc67
Merge pull request #907 from alanbernstein/cluster-data-endpoint
Add single-node 'bytesOnDisk' object to /status response
2020-10-01 10:42:27 -05:00
Alan Bernstein
b6af0e5219 Move usage data to new ui-specific endpoint 2020-10-01 10:25:48 -05:00
Alan Bernstein
6f2fe3afe1 Address linter issue 2020-10-01 10:25:48 -05:00
Alan Bernstein
474261f12f Add single-node 'bytesOnDisk' object to /status response 2020-10-01 10:25:48 -05:00
Nia
cac89f4c96
Merge pull request #913 from niaow/misaligned-distinct
Fix misaligned bitmaps in Distinct
2020-10-01 11:17:29 -04:00
Nia Weiss
e0f9870378
fix misaligned bitmaps in Distinct
This resolves an issue in which a filter would eliminate all bits in all shards other than shard 0.
2020-10-01 10:07:08 -04:00
Nia
f030792b8a
Merge pull request #905 from niaow/syncrace
Fix race condition when resetting translation
2020-09-30 09:26:43 -04:00
Nia
c31d2f143c
Merge branch 'master' into syncrace 2020-09-30 09:17:59 -04:00
Cody Soyland
86c5e040b1
Merge pull request #870 from codysoyland/grpc-compat
Fully backwards-compatible VDSM gRPC interface
2020-09-29 15:58:20 -06:00
Jason Aten
0e8564e2be fix license exceptions for vdsm/proto 2020-09-29 15:30:41 -05:00
Cody Soyland
949ca882fc Remove unused helper func 2020-09-29 15:30:12 -05:00
Cody Soyland
fdce92eb40 Use shared types from pilosa proto file and enable generic proxying of query calls 2020-09-29 15:30:12 -05:00
Cody Soyland
83704e7973 Proxy unary methods to Pilosa gRPC handler 2020-09-29 15:29:37 -05:00
Cody Soyland
c1e50ed909 Remove VDS references from pilosa proto file, begin porting VDSM service 2020-09-29 15:29:37 -05:00
Nia Weiss
1b210080c6
fix race condition when resetting translation
Previously, we never waited for translation sync goroutines to stop.
That issue should be mostly harmless in the normal path.
Additionally, this waits for the translation sync to shut down when stopping the server.
2020-09-29 13:54:16 -04:00
Seebs
fbb648b1fb enforce append-like semantics for *Container more consistently
The copy-on-write/rowCache changes require that functions that
modify containers be able to generate new containers. Once that
became possible, some significant pool of other operations
started relying on it -- for instance, operations might return
a new container even though they're in theory "in place" operations.

I developed a tool for checking for unused function return
values (github.com/molecula/noticeme), and ran it on this, and
picked out the places where `*Container` values were generated
but not used, and some of them seem to be potentially-real
bugs, and a few are probably harmless. Updated code to make
those diagnostics go away.
2020-09-28 12:19:24 -05:00
tgruben
82cdffd309
Merge pull request #899 from jaten-molecula/better_err_on_closed_db
better error reporting when making Tx on closed lmdb
2020-09-26 09:59:15 -05:00
Jason Aten
5a3170a9a4 better error reporting when making Tx on closed lmdb
- return error instead of panic.
2020-09-26 06:24:58 -05:00
Nia
3d07d13a7c
Merge pull request #897 from niaow/no-explicit-recalculate
Stop explicitly recalculating caches in tests
2020-09-25 11:18:37 -04:00
Nia Weiss
79f68f7a2e
stop explicitly recalculating caches in tests
This is no longer necessary, as caches now recalculate on read.
Also, in general a user will not explicitly request recalculation, so it would make sense for our tests to reflect that.
2020-09-25 10:36:00 -04:00
jaten-molecula
f026c43649
Merge pull request #891 from molecula/optimize_directadd
Bitmap.DirectAdd avoids returning overfull containers
2020-09-23 17:25:29 -05:00
Jason Aten
7ae8accfa8 Bitmap.DirectAdd avoids returning overfull containers
- log Debugf when we repair a fragment block
- better run-run roaring testing for over-sized containers
- add which fragment path to panic on container too big
- include container contents in roaring hash for pilosa-chk/pilosa-check-backup
2020-09-23 17:13:25 -05:00
Nia
4b5572da1d
Merge pull request #893 from niaow/limit-cluster
Fix Limit when used as an input to another query
2020-09-23 13:51:11 -04:00
Nia
e0f25f1d20
Merge branch 'master' into limit-cluster 2020-09-23 13:46:02 -04:00
Nia Weiss
2158417f34
fix Limit when used as an input to another query 2020-09-23 13:08:48 -04:00
Kuba Podgórski
8b855b97d0
Merge pull request #892 from kuba--/fix-545
Translate field IDs on coordinator
2020-09-23 17:49:15 +02:00
Kuba Podgórski
ba5438e02b Trabnslate field IDs on coordinator 2020-09-23 15:21:33 +02:00
jaten-molecula
f7afd5d2e1
Merge pull request #875 from molecula/remove_debug_tooling
turn on row cache. tx: remove debug tooling
2020-09-22 15:56:02 -05:00
Jason Aten
55d4c29933 turn off debug machinery on tx backends
- enable row cache again. Was off for tx perf measurement.
 - centralize UseRowCache choice to just one point, in rbf.EnableRowCache
2020-09-22 15:47:52 -05:00
Kuba Podgórski
886318931d
Merge pull request #882 from kuba--/fix-869
Fix holes in grpc response for inspect
2020-09-22 14:20:10 +02:00
Kuba Podgórski
b54a289cd8 Fix holes in grpc response for inspect 2020-09-22 12:02:26 +02:00
jaten-molecula
ba2851229d
Merge pull request #871 from molecula/bluegreen_verify
blue_green verify accepts empty fragments
2020-09-18 11:55:22 -04:00
Jason Aten
57be5392cf blue_green verify accepts empty fragments 2020-09-18 10:49:36 -05:00
tgruben
8ec10ec1e8
Merge pull request #868 from molecula/with_primary_instead_owner
Translate only on coordinator/primary
2020-09-17 17:12:56 -05:00
Kuba Podgórski
650244214d Translate only on coordinator/primary
- This is the commit message #3:
2020-09-17 17:03:29 -05:00
jaten-molecula
7dc59c4d9c
Merge pull request #831 from molecula/rbf-tx-cursor-stack-allocate
Stack allocate return from rbf.Tx.cursor()
2020-09-16 23:40:32 -04:00
Jason Aten
9b99009871 allow rbf-tx-cursor-stack-allocate to merge; fix conflict with the new HasData code 2020-09-16 22:35:30 -05:00
jaten-molecula
c04642f34b
Merge branch 'master' into rbf-tx-cursor-stack-allocate 2020-09-16 23:21:35 -04:00
jaten-molecula
0f5838816b
Merge pull request #857 from molecula/rbf-fix-direct-write-corruption
Fix RBF write corruption during direct write.
2020-09-16 23:07:57 -04:00
jaten-molecula
71033f78b5
Merge branch 'master' into rbf-fix-direct-write-corruption 2020-09-16 22:32:47 -04:00
Nia
16c5212e2d
Merge pull request #858 from niaow/deprecate-inspect
Add a deprecation warning to Inspect
2020-09-16 15:31:57 -04:00
Nia Weiss
f03ba0e682
add a deprecation warning to Inspect 2020-09-16 12:30:12 -04:00
Ben Johnson
6918fe2f60
Merge branch 'master' into rbf-fix-direct-write-corruption 2020-09-16 09:55:26 -06:00
jaten-molecula
75b01ba87d
Merge pull request #850 from molecula/db_has_data_rb
blue_green verification and migration capabilities.
2020-09-16 11:22:34 -04:00
Ben Johnson
458984c756 Fix RBF write corruption during direct write.
This commit fixes an issue where direct writes would overwrite the
source page where data was being copied from because writes are
immediate (instead of going to the WAL first).
2020-09-16 08:59:53 -06:00
Jason Aten
31d54010f8 blue_green verification and migration capabilities.
- on startup in blue_green mode, we will migrate
   blue to green if blue is empty.
 - otherwise, when blue has data, we verify
   against green before proceeding with the
   blue_green run.
 - small optimization in the rbf cursorx.go to
   short-circuit processing on a nil bitmap.
   This avoids a roaringparanoia tag panic.
 - back out holdbkg.go, was too slow.
   add a distinct Holder.imu lock instead.
2020-09-16 09:41:05 -05:00
Kuba Podgórski
dd4ffff704
Merge pull request #853 from kuba--/fix-translate_index_keys
Fix translation index keys
2020-09-16 15:21:31 +02:00
Kuba Podgórski
fa159c9a17
Merge branch 'master' into fix-translate_index_keys 2020-09-16 15:09:49 +02:00
jaten-molecula
47926092ee
Merge pull request #855 from molecula/cleanup_cherrypick
cleanup lmdb tests that were leaving test directories behind
2020-09-16 07:51:23 -04:00
Jason Aten
c093aa9d0e cleanup lmdb tests 2020-09-16 06:46:12 -05:00
Kuba Podgórski
ab26134992
Merge branch 'master' into fix-translate_index_keys 2020-09-16 10:39:32 +02:00
Kuba Podgórski
a8a9a73b6c Fix translation index keys 2020-09-16 10:36:44 +02:00
tgruben
793cf934b8
Merge pull request #848 from molecula/fix_843
don't panic if dbs is reopened under roaring only. fixes #843
2020-09-15 16:54:52 -05:00
Jason Aten
439ac243b4 don't panic if dbs is reopened under roaring only. fixes #843 2020-09-15 15:52:05 -05:00
Kuba Podgórski
e83e18832a
Merge pull request #847 from kuba--/fix-writable
Fix TranslateStore writable
2020-09-15 20:36:27 +02:00
Kuba Podgórski
dcc237413e
Merge branch 'master' into fix-writable 2020-09-15 19:14:24 +02:00
Nia
c7a0b17600
Merge pull request #846 from niaow/typenames
Fix type names in PQL Extract and SQL Show
2020-09-15 13:13:32 -04:00
Kuba Podgórski
76715a3f9d Fix TranslateStore writable 2020-09-15 19:09:59 +02:00
Nia Weiss
19e0f3601b
fix type names in PQL Extract and SQL Show 2020-09-15 12:53:21 -04:00
tgruben
9649819c09
Merge pull request #845 from molecula/rebal_together_rb
fine tune Tx placement, make it lazier so we don't create extra shards.
2020-09-14 18:34:15 -05:00
jaten-molecula
28fa1d036e
Merge branch 'master' into rebal_together_rb 2020-09-14 19:21:31 -04:00
Jason Aten
748f6a61bc fine tune Tx placement, isolate Tx backends more.
- Tx creation is lazier so we don't create xtra shards.

 - Then the dir scan for blue-green state checking finds only the right shards.
2020-09-14 18:03:25 -05:00
Travis Turner
37196b5e03
Merge pull request #834 from travisturner/metric-typos
Fix typos in transaction metric names
2020-09-14 17:32:53 -05:00
Travis Turner
d2c6a8ddde
Merge branch 'master' into metric-typos 2020-09-14 17:20:49 -05:00
seebs
72b1eec2e9
Merge pull request #829 from seebs/storeDistinct
Test cases for Store(Distinct)
2020-09-14 14:28:05 -05:00
Seebs
e7b239d2d8 Test cases for Store(Distinct)
This adds testing for Store(Distinct(...)) with and without filters, to verify that
we can, in fact, store the results of a Distinct() query directly. This was at one
point unsupported, now we think it should work so we're testing it.

The change to the testdata is because the specific structure used for this test doesn't
work with a keyed index, and changing things to be "foreign keys" seems annoying and
more complicated, but possibly that should become part of a future test.

There was talk of testing this with non-BSI fields, but they don't seem to
actually work with Distinct right now, so that will be later.
2020-09-14 14:15:29 -05:00
seebs
88d0f541aa
Merge pull request #841 from seebs/setMapped
export SetMapped from roaring, use it in Tx stores
2020-09-14 14:15:11 -05:00
Seebs
8ab9174a09 export SetMapped from roaring, use it in Tx stores
Thaw() is supposed to always provide writable storage, which it does
by ensuring that containers aren't frozen, but also by cloning or
copying their data if the data is marked as being memory-mapped.

But only the roaring backend had the ability to mark data as memory-mapped,
because that wasn't exported. Fixed this, and added corresponding code
to badger, lmdb, and rbf.
2020-09-14 14:08:00 -05:00
Ben Johnson
343c446b7e
Merge pull request #839 from molecula/rbf-fix-checkpoint
Remove tx before issuing checkpoint.
2020-09-14 12:56:03 -06:00
jaten-molecula
d0ce2e1207
Merge branch 'master' into rbf-fix-checkpoint 2020-09-14 13:58:24 -04:00
alanbernstein
1e40af7e25
Merge pull request #830 from alanbernstein/metrics-json-fix
Fix panicking metrics.json endpoint
2020-09-14 12:28:39 -05:00
Ben Johnson
77661a891d Remove tx before issuing checkpoint. 2020-09-14 10:36:59 -06:00
Alan Bernstein
18a593008a Add simple tests for metrics endpoints 2020-09-14 11:34:59 -05:00
Alan Bernstein
acbd6ec37c New channel per node 2020-09-14 11:34:59 -05:00
jaten-molecula
fc2518e2d1
Merge pull request #838 from molecula/fix_rr_leaks
fix TestImportClearRestart resource leaks under roaring, better skipForRoaring func
2020-09-14 11:38:26 -04:00
Jason Aten
7028bcfc9d fix resource leaks in fragment_internal_test.go under roaring, better skipForRoaring func
- add tournament.sh to do all pair-wise comparisons of blue-green backends.
- isolate txstores away from roaring index/ directories with indexname.index.txstores@@@ dirs.
2020-09-13 22:45:39 -05:00
Travis Turner
a0db828701
Merge pull request #835 from travisturner/port-vdsm-metrics
Port over VDSM metrics
2020-09-11 16:28:36 -05:00
Travis
41e0465eda
Port over VDSM metrics 2020-09-11 16:03:50 -05:00
Travis
75644af64d
Fix typos in transaction metric names 2020-09-11 15:18:39 -05:00
tgruben
5e00dbadc2
Merge pull request #812 from molecula/bgdev_rb
blue_green migration; holdbkg.go holder goroutine.
2020-09-11 14:32:09 -05:00
Jason Aten
2eb097c14d blue_green migration. holdbkg.go holder goroutine.
- blue_green for doing migration. Called before Holder.Open finishes.
- holdbkg.go added for index lookup. Less wedging between a deadlock and a race.
- fix fault under read-only map under lmdb at
  TestExecutor_Execute_Row_Range/RowIDColumnID by doing cow in roaring.
- roaring -tags gofuzz builds again
- roaringparanoia build tag added to make test targets in Makefile
- add rbf.NewDBWithAllocZero for out-of-bounds memory checks
- .circleci/config.yml test-shardwidth-22 with large run container, kept OOM-ing we suspect.

Fixes #819
2020-09-11 14:24:15 -05:00
Antonio Navarro Perez
a68ee73f00
Merge pull request #782 from ajnavarro/remove-blake3-duplicated-code 2020-09-11 11:23:25 +02:00
jaten-molecula
2cc7c829cd
Merge branch 'master' into remove-blake3-duplicated-code 2020-09-11 01:14:02 -04:00
Ben Johnson
5b72a68628 Stack allocate return from rbf.Tx.cursor() 2020-09-10 14:58:22 -06:00
Nia
be944a6247
Merge pull request #822 from niaow/inspect-panic
Fix inspect panic from incorrect handling of the many types of empty argument
2020-09-09 09:39:20 -04:00
Nia Weiss
6ff224308d
fix inspect panic from incorrect handling of the many types of empty argument 2020-09-09 09:11:21 -04:00
seebs
db578423bb
Merge pull request #818 from seebs/roaringDoc
Roaring documentation updates and fixes resulting from them
2020-09-08 22:41:48 -05:00
Seebs
c079d4764b Check for possibly-dirty N values in containers modified in-place
After documenting the semantics, I noticed an arguable hole in them,
which is that you could Freeze() a dirty container, and then Repair()
wouldn't work on it. On further study, I added a roaringparanoia
check for attempts to access the N of dirty containers.

It turns out there's several such. But also, it turns out, there's
circumstances where unionInPlace is relying on the assumption that
N is valid, which it isn't always for dirty containers. Also, there's
at least one case where we rely on the assumption that forcibly
thawing a container, then calling unionInPlace on it, always modifies
that container. But that's not supposed to be true for an empty
container -- an empty container might be better handled by just
returning the container it's being unioned with. So, we drop the
unnecessary thaw (all the *InPlace ops are already thawing if/when
they need to), but we use the return from unionInPlace.
2020-09-08 13:16:54 -05:00
Seebs
17ba2e35a9 call helper functions every time to get new run slices
If you just stash the results of the function when defining the test cases, the
outcome is in part that you are reusing the same slices for multiple things. So,
for instance, if you perform a union on the OddBitsSet slice, with the EvenBitsSet
slice, the result is to overwrite the first entry in that slice with the 0-ffff
run... But the original slice still exists, and then we reuse it and get a slice
with a bit count of around 98,000. The underlying issue is that doContainer()
is calling NewContainerRun(), which is simply using the provided slice, not
copying it -- which is intentional, but the test has to be careful about it.

We call repair on the one we think should be a bitmap. Theoretically
maybe we should also repair the other one in case unionRunRun some day
starts returning unrepaired bitmaps, which in principle it's allowed to
do...
2020-09-08 12:38:49 -05:00
Seebs
ecacbf65d4 Document copy-on-write semantics, at all.
The copy-on-write semantics were previously documented only in
the 125-line commit log from the patch which introduced them. Add
documentation for them in a few likely places.
2020-09-08 11:44:56 -05:00
Ben Johnson
8397696a59
Merge pull request #813 from molecula/import-roaring-direct
Add direct import option; remove tx from fragment.Open()
2020-09-08 08:19:24 -06:00
Ben Johnson
a51c530763 Add direct import option; remove tx from fragment.Open() 2020-09-08 08:13:16 -06:00
Ben Johnson
62635e7668
Merge pull request #811 from molecula/fix-wal-replay
Fix RBF WAL replay/truncation
2020-09-08 08:11:00 -06:00
Ben Johnson
f2bde49d25 Fix RBF WAL replay/truncation 2020-09-07 09:39:26 -06:00
Antonio Navarro Perez
ca340f7e62 [hash] Remove duplicated blake3 code
blake3 code is used in several places on the code. The file was
duplicated on root and rbf package.

To avoid cyclic dependencies, I moved it to hash package. Some methods
must be public to use them in different places.

HashOfDir method was removed. Not used.

Signed-off-by: Antonio Navarro Perez <antnavper@gmail.com>
2020-09-07 12:24:22 +02:00
jaten-molecula
1994560cf6
Merge pull request #803 from molecula/fgen_refined
refine our f.gen nil handling to support blue/green
2020-09-04 18:52:32 -04:00
Jason Aten
63187f59ee refine our f.gen nil handling to support blue/green 2020-09-04 17:28:38 -05:00
Ben Johnson
278d518f03
Merge pull request #800 from molecula/rbf-exclusive-write
Add RBF exclusive lock mode
2020-09-04 13:41:52 -06:00
Ben Johnson
90663e070e
Merge branch 'master' into rbf-exclusive-write 2020-09-04 13:10:02 -06:00
jaten-molecula
bb101ebef2
Merge pull request #802 from molecula/fgen
restore former f.gen nil behavior
2020-09-04 14:56:45 -04:00
Ben Johnson
159d01b55d Add exclusive write option for RBF.
This commit adds the ability to start a transaction with an exclusive
lock for the entire database. This ensures no other read or write
transactions can run at the same time. Writes in this mode write
directly to the database and skip the WAL entirely.
2020-09-04 12:46:42 -06:00
Jason Aten
4b6e773c7c panic if f.gen is nil because it means the storage wasn't open 2020-09-04 13:19:46 -05:00
jaten-molecula
aebe028854
Merge pull request #777 from molecula/dbshard2
database per shard, HolderConfig, rbf bit-wise import speedups.
2020-09-04 14:04:13 -04:00
Ben Johnson
150c8a5b06 database per shard, HolderConfig, rbf bit-wise import speedups.
- introduce Query Context (Qcx) for managing database-per-shard.
- replaces the MultiTx, so mtx.go is retired and removed.
- introduces the HolderConfig struct and all Holders now have
  a path from birth.
- rbf speedups on bitwise writes
- badgerdb is removed due to unresolvable write conflicts.

fixes #703 #676
2020-09-04 13:00:33 -05:00
Nia
60da12a8e5
Merge pull request #784 from niaow/remove-sql-limit
Remove SQL artificial limit
2020-09-04 08:46:33 -04:00
Nia
ec41481523
Merge branch 'master' into remove-sql-limit 2020-09-04 08:11:48 -04:00
jaten-molecula
921f15991b
Merge pull request #788 from molecula/fldschk
pilosa-chk: show col, row translation, -v for fragment details
2020-09-03 19:20:11 -04:00
Jason Aten
1e87d113f1 pilosa-chk: col, row translation reported, -v shows fragment checksum 2020-09-03 18:14:49 -05:00
tgruben
17ddcacbd4
Merge pull request #787 from molecula/chktrans
cmd/translatorchk checksums and summarizes key counts from column key translators
2020-09-03 15:29:31 -05:00
Jason Aten
56803e6632 pilosa/cmd/translatorchk checksums and summarizes key counts from column key translators.
opens ~/.pilosa/index/_keys boltdbs and hashes the StringKey->ID mappings.
2020-09-03 15:23:05 -05:00
Nia Weiss
b676292d67
add named returns to clarify extractLimitOffset 2020-09-03 10:37:09 -04:00
Nia Weiss
daa784319c
remove SQL artificial limit 2020-09-03 09:14:11 -04:00
jaten-molecula
d3485dbdb3
Merge pull request #776 from niaow/configure-slurp
Configure slurp
2020-09-03 02:33:58 -04:00
jaten-molecula
0a548a9009
Merge branch 'master' into configure-slurp 2020-09-03 01:56:30 -04:00
Nia
82e5f09cb3
Merge pull request #779 from niaow/pg-race
Fix race condition in pg cancellation test
2020-09-02 19:07:28 -04:00
Nia Weiss
c9995bfae1
fix race condition in pg cancellation test 2020-09-02 19:01:47 -04:00
Nia
bd1b76e25e
Merge pull request #760 from niaow/pg-local-cancel
Add support for local cancellation to postgres endpoint
2020-09-02 15:05:31 -04:00
Nia
219e22cc64
Merge branch 'master' into pg-local-cancel 2020-09-02 14:02:18 -04:00
Nia Weiss
95d261b4d7
configure slurp 2020-09-02 12:53:16 -04:00
jaten-molecula
c213cb5457
Merge pull request #762 from molecula/optimize-import
rbf bitwise import optimizations
2020-09-01 21:44:46 -04:00
jaten-molecula
55cb448c37
Merge branch 'master' into optimize-import 2020-09-01 21:18:57 -04:00
Travis Turner
836d055978
Merge pull request #759 from travisturner/join-bug
fix bug on left/right join mapping
2020-09-01 19:06:49 -05:00
Kuba Podgórski
6255c3f07f
Merge branch 'master' into join-bug 2020-09-02 01:51:48 +02:00
Travis Turner
72c068a64f
Merge pull request #773 from travisturner/row-pointer
return *Row instead of Row on empty key result
2020-09-01 18:31:29 -05:00
Travis
32b5826d1a
fix bug on left/right join mapping 2020-09-01 18:22:55 -05:00
Travis
d02cb10687
return *Row instead of Row on empty key result 2020-09-01 17:34:29 -05:00
alanbernstein
58007ab7ef
Merge pull request #765 from alanbernstein/lattice-release
Add embedded UI to default release process
2020-09-01 13:27:08 -05:00
Alan Bernstein
007b3ffc3c re-re-arrange error checks 2020-09-01 11:32:58 -05:00
Alan Bernstein
4ce3879e2c Revert UI->Lattice name change, correct the ordering of error checks in statikHandler 2020-09-01 10:16:31 -05:00
Alan Bernstein
a597a79e2d Add embedded UI to default release process 2020-09-01 10:16:31 -05:00
Kuba Podgórski
2d202d6aa3
Merge pull request #766 from kuba--/fix-null
support null results
2020-09-01 15:33:02 +02:00
Kuba Podgórski
ceb72fc3a9 support null results 2020-09-01 13:00:30 +02:00
Nia
1e5f0ecc5d
Merge pull request #763 from niaow/sql-leak
Fix SQL memory leak
2020-08-31 14:38:23 -04:00
Nia Weiss
d421558f58
fix SQL memory leak 2020-08-31 13:10:49 -04:00
Nia
96a8fd5cb7
Merge pull request #724 from niaow/pg-primitive
Add primitive types to pg encoder
2020-08-31 13:04:39 -04:00
Nia Weiss
9f368b06bd
add licesnse header to pg formatter test 2020-08-31 12:42:37 -04:00
Nia Weiss
542eb2dba3
pg formatter tests 2020-08-31 12:39:55 -04:00
Nia Weiss
cfcc1da0bb
add primitive types to pg encoder 2020-08-31 12:27:10 -04:00
Nia
9b12c01c2b
Merge pull request #736 from niaow/dirtycache
Force ranked cache recalculation in Top after a skipped invalidation
2020-08-31 11:56:50 -04:00
Nia
ac57a0bd42
Merge branch 'master' into dirtycache 2020-08-31 11:28:52 -04:00
Ben Johnson
1672158e65
Merge branch 'master' into optimize-import 2020-08-31 08:58:12 -06:00
Ben Johnson
627b50d89d misc import optimizations 2020-08-31 08:46:53 -06:00
alanbernstein
b2cad11c99
Merge pull request #733 from alanbernstein/enlattice
Embed lattice via statik
2020-08-31 09:40:02 -05:00
Alan Bernstein
b14ebcadae Unexport statik filesystem 2020-08-31 09:02:46 -05:00
Cody Soyland
a3e122dc5e Fix CORS support by applying middleware to router. 2020-08-31 09:02:46 -05:00
Alan Bernstein
f9d3040827 Update gitignore and makefile 2020-08-31 09:02:46 -05:00
Alan Bernstein
384b6511cd Replace null with [] in /schema field response 2020-08-31 09:02:46 -05:00
Alan Bernstein
659a2bb560 Silence stderr in makefile 2020-08-31 09:02:46 -05:00
Alan Bernstein
6e917b6a9a Log lattice version info 2020-08-31 09:02:46 -05:00
Alan Bernstein
99869ce792 Minor fixes 2020-08-31 09:02:46 -05:00
Alan Bernstein
b039bd50a1 Switch to mux PathPrefix matcher entirely 2020-08-31 09:02:46 -05:00
Alan Bernstein
19ee27fdb6 Use SPA handler to serve from filesystem, to test routing behavior 2020-08-31 09:02:46 -05:00
Alan Bernstein
d912403eb2 Add missing file 2020-08-31 09:02:46 -05:00
Alan Bernstein
88a288e775 Embed lattice via statik 2020-08-31 09:02:46 -05:00
Kuba Podgórski
b88c5cd5ea
Merge pull request #753 from kuba--/grpc-errcode
Add rich error types to gRPC interface
2020-08-31 15:45:24 +02:00
Kuba Podgórski
bfff643f34 Fix error code for PostVDS 2020-08-31 12:16:07 +02:00
Kuba Podgórski
f7a0e5f536 Fix error code for DeleteVDS 2020-08-31 12:14:58 +02:00
Kuba Podgórski
bf17385409
Merge branch 'master' into grpc-errcode 2020-08-31 10:25:35 +02:00
Nia Weiss
bf7e4b5583
add support for local cancellation to postgres endpoint 2020-08-29 14:56:49 -04:00
Nia
9c0d45a2d9
Merge pull request #752 from niaow/batch-translate
Batch the translation of field keys in results
2020-08-28 15:25:19 -04:00
Nia
5bc5991bd7
Merge branch 'master' into batch-translate 2020-08-28 15:09:05 -04:00
Kuba Podgórski
25ead95967
Merge branch 'master' into grpc-errcode 2020-08-28 20:42:28 +02:00
Nia Weiss
8549b74421
merge groupcount translations check into an else-if 2020-08-28 14:22:35 -04:00
Nia
a872548b01
Merge pull request #756 from niaow/postgres-sql-empty
Write empty column headers in postgres when there is no response
2020-08-28 14:20:22 -04:00
Nia Weiss
57fdabfe40
write empty column headers in postgres when there is no response 2020-08-28 13:28:50 -04:00
Travis Turner
81d32a6eeb
Merge pull request #751 from travisturner/sql-mapper-stuff
add sql mapper routes for count(*) on joins
2020-08-28 11:55:49 -05:00
Travis Turner
27c2368b9a
Merge branch 'master' into sql-mapper-stuff 2020-08-28 11:43:16 -05:00
Nia Weiss
0a9699490b
batch the translation of field keys in results 2020-08-28 11:56:37 -04:00
Kuba Podgórski
2b1c9950f4 Add rich error types to gRPC interface 2020-08-28 17:24:49 +02:00
jaten-molecula
f2fb2c98f8
Merge pull request #737 from molecula/bulk-import-value
Implement TxBitmap to cache up many bit changes in a Tx
2020-08-28 00:43:46 -04:00
Travis
ae07aacd51
add sql mapper routes for count(*) on joins 2020-08-27 22:49:54 -05:00
jaten-molecula
4883424205
Merge branch 'master' into bulk-import-value 2020-08-27 21:43:32 -04:00
Nia
9c621d7622
Merge pull request #742 from niaow/pg-require-tls
Fix postgres configuration
2020-08-27 12:49:45 -04:00
Nia Weiss
f0f8336f57
rename postgres.addr to postgres.bind for consistency 2020-08-27 11:35:54 -04:00
Ben Johnson
e3db6c9cec Implement bulk value import 2020-08-27 09:20:23 -06:00
Nia Weiss
68542ddc35
force ranked cache recalculation in Top after a skipped invalidation 2020-08-27 11:05:18 -04:00
Nia Weiss
288593231f
require TLS when configured 2020-08-27 10:59:40 -04:00
Nia Weiss
47dd6b5b8f
fix postgres endpoint config 2020-08-27 10:49:43 -04:00
Nia Weiss
c2823a933b
add a config option to require TLS on postgres 2020-08-27 10:49:43 -04:00
Kuba Podgórski
475a9e3910
Merge pull request #732 from kuba--/translatekey-writable
Add writable argument to TranslateKey functions.
2020-08-27 16:15:49 +02:00
Kuba Podgórski
248ec3a296
Merge branch 'master' into translatekey-writable 2020-08-27 16:10:29 +02:00
Kuba Podgórski
6b9eed3af4
Merge pull request #743 from kuba--/fix-info
Pass name to newNotFoundError
2020-08-27 16:08:40 +02:00
Kuba Podgórski
2ca8ca0605 Pass name to newNotFoundError 2020-08-27 15:35:23 +02:00
Nia
c3174efdeb
Merge pull request #740 from niaow/xor-array-array
Speed up xorArrayArray
2020-08-26 17:30:57 -04:00
Nia Weiss
6e06cc0c30
speed up xorArrayArray 2020-08-26 17:14:24 -04:00
Kuba Podgórski
9cf58ddb1c Add writable argument to TranslateKey functions. 2020-08-26 09:57:50 +02:00
Kuba Podgórski
ca5e27ad8e
Merge pull request #721 from kuba--/invalid-query/fix-706
Fix https://github.com/molecula/pilosa/issues/706
2020-08-25 21:33:54 +02:00
Kuba Podgórski
b67148ccfc
Merge branch 'master' into invalid-query/fix-706 2020-08-25 20:38:30 +02:00
Nia
6db4c8bb3a
Merge pull request #725 from niaow/storekeyed
Fix Store() into a keyed set
2020-08-25 14:08:46 -04:00
Kuba Podgórski
24980c7af8
Merge branch 'master' into invalid-query/fix-706 2020-08-25 19:30:03 +02:00
Nia Weiss
a8e7c2d0ef
fix Store() into a keyed set 2020-08-25 11:39:03 -04:00
jaten-molecula
8ad3dd2de6
Merge pull request #728 from molecula/skip_cluster_tests_bg
TestClusterResize_AddNode,AddNodeConcurrentIndex skipped blue-green roaring
2020-08-25 04:06:49 -04:00
tgruben
06281fc0c8
Merge branch 'master' into skip_cluster_tests_bg 2020-08-25 02:30:00 -05:00
tgruben
15315e47ee
Merge pull request #729 from molecula/fix683
test roaring.Container.UnionInPlace does not overflow
2020-08-25 02:29:29 -05:00
jaten-molecula
bc18e4dc42
Merge branch 'master' into skip_cluster_tests_bg 2020-08-25 03:28:00 -04:00
Jason Aten
ca7552b4a8 test that roaring.Container.UnionInPlace does
not overflow two big arrays into an invalid array.

recreate badloader from git history, at 85fa67e8. Could not
reproduce this, but lots of container usage
also got updated in the meantime.

Fixes #683
2020-08-24 17:06:41 -05:00
jaten-molecula
c5660ed712
Merge pull request #701 from molecula/fix-rbf-race
Remove duplicate checkpoint() invocation
2020-08-24 16:19:20 -04:00
jaten-molecula
ec02d5a00e
Merge branch 'master' into fix-rbf-race 2020-08-24 16:06:25 -04:00
jaten-molecula
0e6b65d3c2
Merge branch 'master' into skip_cluster_tests_bg 2020-08-24 16:02:13 -04:00
Jason Aten
48f31ddce7 TestClusterResize_AddNode and TestClusterResize_AddNodeConcurrentIndex skipped under blue-green test with roaring 2020-08-24 14:57:08 -05:00
alanbernstein
14a9a838eb
Merge pull request #690 from alanbernstein/prometheus-json
Add metrics.json endpoint using prometheus/prom2json
2020-08-24 14:29:27 -05:00
Alan Bernstein
9b027a89b9 Return dict of all node metrics 2020-08-24 14:04:02 -05:00
Alan Bernstein
d9b670c83c Add metrics.json endpoint using prometheus/prom2json 2020-08-24 14:04:02 -05:00
Sarah
6c4e8aeff5
Merge branch 'master' into fix-rbf-race 2020-08-24 13:23:56 -05:00
jaten-molecula
0e4144c302
Merge pull request #709 from molecula/audit3rb
testhook: Leak auditing infrastructure
2020-08-24 12:32:20 -04:00
Seebs
cecaf99ee4 testhook: leak auditing infrastructure
The testhook/ package provides an easy way to set up multiple
hooks to run before/after tests are run.

The audit hooks track open and closes of storage backends,
files, indexes, and holders, for example. A tempdir wrapper
creates temporary directories which are automatically cleaned up
when the test ends. Any kind of resource creation that
should be closed at test conclusion can be tracked. We
will complain at the end of the TestMain if resources are
leaking.

Leaks under go1.13:

We use a wrapper function which is a no-op for go 1.13, but actually
calls testing.TB.Cleanup in go1.14, so we can still build with 1.13 even though
tests will leak files all over the place there. Because of this,
don't run the testhook tests when using 1.13, as they'll always fail.

- the test/pilosa.go http client now times out after 10 seconds
to help diagnose hung server situations.

- Makefile targets added to get better progress reports.
2020-08-24 11:26:39 -05:00
jaten-molecula
7e326fb833
Merge pull request #722 from tgruben/rbf-add
copied optimized add/remove to rbf
2020-08-24 11:42:57 -04:00
Todd Gruben
edf6608129 copied optimized add/remove to rbf
use large test container for CI
2020-08-24 10:37:25 -05:00
Kuba Podgórski
397d37a129 Fix https://github.com/molecula/pilosa/issues/706 2020-08-24 15:34:09 +02:00
Kuba Podgórski
bc3f329e8f
Merge pull request #720 from kuba--/sql-drop
Add support for SQL 'drop table...'
2020-08-24 14:52:49 +02:00
Kuba Podgórski
ceda4ab61b Add support for drop table 2020-08-24 13:24:18 +02:00
tgruben
9caa670c90
Merge pull request #719 from tgruben/lmdb-add
copied badger addRemove implementation to lmdb
2020-08-23 08:50:07 -05:00
tgruben
9e94c86932
Merge branch 'master' into lmdb-add 2020-08-23 08:40:16 -05:00
Todd Gruben
4dd4b441c4 copied badger addRemove implementation to lmdb 2020-08-23 08:39:03 -05:00
jaten-molecula
4a6d8bc5df
Merge branch 'master' into fix-rbf-race 2020-08-22 23:23:57 -04:00
Nia
0ce9062588
Merge pull request #716 from kuba--/sql-show
Add support for SHOW queries
2020-08-21 19:46:47 -04:00
Kuba Podgórski
ad9e3338b5 Add support for SHOW queries 2020-08-22 01:25:35 +02:00
Nia
c137efbe44
Merge pull request #707 from niaow/pg-sql
Add SQL to postgres endpoint
2020-08-21 19:13:26 -04:00
Kuba Podgórski
cb89a4a831
Merge branch 'master' into pg-sql 2020-08-22 01:01:22 +02:00
Kuba Podgórski
37a4cda454
Merge pull request #563 from kuba--/fix-210/translate-entry
Fix 210/translate entry
2020-08-22 00:52:53 +02:00
Kuba Podgórski
7c13fa71d7
Merge branch 'master' into fix-210/translate-entry 2020-08-22 00:18:34 +02:00
Kuba Podgórski
6d0baa82b3
Update http/translator_test.go
Co-authored-by: Travis Turner <travis@pilosa.com>
2020-08-22 00:18:25 +02:00
Kuba Podgórski
cc66775ea4
Update http/translator_test.go
Co-authored-by: Travis Turner <travis@pilosa.com>
2020-08-22 00:18:19 +02:00
Nia
842377ba17
Merge pull request #713 from niaow/dont-log-100000-times
Stop logging in TestStartupInvalidLength
2020-08-21 17:29:52 -04:00
Nia Weiss
dd73bf3960
stop logging in TestStartupInvalidLength 2020-08-21 17:20:10 -04:00
jaten-molecula
8d397babdf
Merge pull request #710 from molecula/clear_importvals
ImportRequest.Clear and ImportValuesRequest.Clear respected by api.Import() and api.ImportValues()
2020-08-21 15:42:24 -05:00
tgruben
056d5990da
Merge branch 'master' into clear_importvals 2020-08-21 15:33:04 -05:00
Jason Aten
40a9d01f46 ImportRequest.Clear and ImportValuesRequest.Clear respected by api.Import() and api.ImportValues()
- tested in TestAPI_ClearFlagForImportAndImportValues api_test.go
2020-08-21 15:17:44 -05:00
Nia Weiss
49c3bd9701
add SQL to postgres endpoint 2020-08-21 14:47:59 -04:00
Ben Johnson
91c8c5b5e9
Merge branch 'master' into fix-rbf-race 2020-08-21 10:33:43 -06:00
Kuba Podgórski
a2f24bc115
Merge pull request #663 from kuba--/sql-mapper
SQL mapper
2020-08-21 17:24:59 +02:00
Ben Johnson
162bd0303a Remove duplicate checkpoint() invocation 2020-08-21 08:25:04 -06:00
Kuba Podgórski
17fa1e578b Add benchmark for translation reader 2020-08-21 15:15:41 +02:00
Kuba Podgórski
bbbeb22d31
Merge branch 'master' into sql-mapper 2020-08-21 03:17:46 +02:00
tgruben
57babb3269
Merge pull request #700 from molecula/atomicrecord
AtomicRecord allows the client to request atomic updates.
2020-08-20 17:42:15 -05:00
Jason Aten
df5dd1557e AtomicRecord allows the client to request atomic updates.
- Atomic record contains multiple ImportRequest and
   ImportValueRequest, plus ability to Clear individual requests.
 - adds http handlers for importing AtomicRecord.
2020-08-20 17:33:52 -05:00
Kuba Podgórski
0e0a405184
Merge branch 'master' into sql-mapper 2020-08-20 21:53:59 +02:00
Nia
272f6708a3
Merge pull request #679 from niaow/pg
Add a postgres endpoint to pilosa
2020-08-20 14:24:56 -04:00
Kuba Podgórski
6fa69fb81a
Merge branch 'master' into sql-mapper 2020-08-20 20:17:53 +02:00
Nia Weiss
14676c0713
remove postgres debugging types 2020-08-20 14:17:50 -04:00
Nia
44061923c7
Update pg/message/io.go
Co-authored-by: Travis Turner <travis@pilosa.com>
2020-08-20 14:14:14 -04:00
Nia Weiss
128e02046a
add a postgres endpoint to pilosa 2020-08-20 11:29:16 -04:00
alanbernstein
68b17312e0
Merge pull request #687 from alanbernstein/unicode
Use _buffer instead of buffer
2020-08-19 17:12:26 -05:00
Alan Bernstein
6fc5465aaa Use rune slice in all cases, add tests 2020-08-19 16:32:27 -05:00
Alan Bernstein
0a96043c23 Use _buffer instead of buffer 2020-08-19 16:32:27 -05:00
Kuba Podgórski
0be436e18d
Merge branch 'master' into sql-mapper 2020-08-19 21:33:58 +02:00
Ben Johnson
0a37f396f8
Merge pull request #671 from molecula/wal-write-cache
Add RBF WAL write cache
2020-08-19 09:54:55 -06:00
Ben Johnson
9dbb82cf3e WAL mutex fixes 2020-08-19 08:42:53 -06:00
Ben Johnson
51504f4fe4 Add WAL write cache mutex; update name; add benchmarks 2020-08-19 08:33:19 -06:00
Ben Johnson
5849794a1b Add RBF WAL write cache 2020-08-19 08:33:19 -06:00
Cody Soyland
776de471db
Merge pull request #693 from molecula/ubuntu_dockerfile
ubuntu 20:10 image instead of alpine, for cgo support
2020-08-18 20:40:26 -05:00
Jason Aten
ef156f6172 ubuntu 20:10 image instead of alpine, for cgo support 2020-08-18 16:55:44 -05:00
Kuba Podgórski
2b34976c22 porting sqlmapper from vdsm 2020-08-18 15:53:26 +02:00
Cody Soyland
039780a85e
Merge pull request #685 from molecula/discard-test-386
no more test-386
2020-08-17 20:15:14 -05:00
Jason Aten
aea7d4a812 no more test-386
- lmdb won't build under 386
 - still have to keep lmdb_other.go for arm/arm64
2020-08-17 19:54:50 -05:00
jaten-molecula
ba1d5e9f9f
Merge pull request #681 from molecula/fix-rbf-reopen
Fix RBF checkpoint on reopen. Fixes #673
2020-08-17 19:16:17 -05:00
jaten-molecula
3e4da916e8
Merge branch 'master' into fix-rbf-reopen 2020-08-17 19:09:55 -05:00
tgruben
d84ae88944
Merge pull request #677 from molecula/lmdb_as_backend
add lmdb, Tx call stats, and prep for db/shard.
2020-08-17 18:43:57 -05:00
Jason Aten
123ce41840 add lmdb, Tx call stats, and prep for db/shard.
- lmdb as a backend (lmdb.go)
   (lmdb is the fastest known transactional storage backend)
 - per Tx call statics report enabled with PILOSA_CALLSTAT=true (stattx.go)
 - framework for per-shard db (dbshard.go)
 - txfactory handles any pair under blue-green testing (txfactory.go)
 - enable CGO in Dockerfiles for lmdb
2020-08-17 18:26:58 -05:00
seebs
4f7e4feaf8
Merge pull request #680 from seebs/cachefix
when updating a container, drop the single-container cache
2020-08-17 15:03:10 -05:00
Ben Johnson
b1e806a518 Fix RBF checkpoint on reopen.
Previously, the `rbf.DB.opened` flag was set after `checkpoint()`
when reopening, however, this flag is checked by `checkpoint()` so
it was not properly executing.
2020-08-17 13:28:28 -06:00
Seebs
16ba54293a when updating a container, drop the single-container cache
This can cause incredibly weird and hard-to-debug problems if the previous
container value is still in the cache after an update, and in particular,
can result in having a stale container value cached after a roaring import
that modified the container. Coupled with another bug which could corrupt
containers on a delete, this produces a very strange bug where a value is
present in a fragment, but an attempt to delete it reports failure.
2020-08-17 11:23:47 -05:00
Travis Turner
c5e9b8d917
Merge pull request #674 from travisturner/container-corrupt
stop setting N on a frozen container
2020-08-16 15:59:58 -05:00
Travis
ff5925aa8b
stop setting N on a frozen container 2020-08-14 17:25:14 -05:00
Matthew Jaffee
cd83f7965c
Merge pull request #672 from molecula/remove-transaction.md
remove old transactions doc
2020-08-14 14:40:10 -05:00
Matt Jaffee
b11bdeab87
remove old transactions doc 2020-08-14 11:57:28 -05:00
jaten-molecula
05ca83c2f5
Merge pull request #669 from molecula/autocommit2
build-tag out lmdb-go from builds; lower autocommit limits to avoid ErrTxnTooBig; improve txn size estimation
2020-08-13 11:52:42 -05:00
Jason Aten
c90c4c275d lower autocommit limits to avoid ErrTxnTooBig; improve txn size estimation 2020-08-13 16:42:47 +00:00
Travis Turner
1f53e86e47
Merge pull request #662 from travisturner/transaction-list
transactions as a list endpoint; added Transaction.CreatedAt
2020-08-13 08:40:57 -05:00
Travis
1837811ce1
transactions as a list endpoint; added Transaction.CreatedAt 2020-08-12 23:11:54 -05:00
tgruben
0dea018fb7
Merge pull request #665 from molecula/autocommit
tested working autocommit approach
2020-08-12 21:56:03 -05:00
Jason Aten
5e49e10cda tested working autocommit approach 2020-08-13 01:12:14 +00:00
jaten-molecula
c7d6229380
Merge pull request #664 from molecula/bigtx
PutContainer() handles large txn with autocommit
2020-08-12 19:18:19 -05:00
Jason Aten
6dc9727796 PutContainer() handles large txn with autocommit 2020-08-12 23:15:23 +00:00
jaten-molecula
973e9a7955
Merge pull request #659 from molecula/rbf_99pct
all test green on rbf. WOOT.
2020-08-12 16:13:47 -05:00
Todd Gruben
547ee14f5b all test green on rbf. WOOT.
- rbf had races around the new rootRecords cache in tx
 - rbf tx needed a write lock on the db now that rootRecords are written
 - added a global registry for rbfDB to correctly dedup instances
 - implement DeleteFragment, DeleteIndex for rbf
 - use badger style keys for rbf to allow content checksumming to be list
    containers in the same order
 - lots of other integration of rbf into pilosa layer.
2020-08-12 21:08:30 +00:00
Cody Soyland
123e0b6376
Merge pull request #644 from codysoyland/grpc-crd-sql
Add gRPC methods to support the functionality of VDSM
2020-08-12 14:55:24 -05:00
Cody Soyland
21456827ae
Merge branch 'master' into grpc-crd-sql 2020-08-12 14:21:53 -05:00
Cody Soyland
3361033c5b Add PostVDS and DeleteVDS 2020-08-12 14:21:22 -05:00
Cody Soyland
3771bd43b5 Add note about gRPC unary methods and futures 2020-08-12 14:08:30 -05:00
Nia
50a2e3c5fa
Merge pull request #650 from jaddr2line/limit
Add a "Limit" query
2020-08-12 14:04:12 -04:00
Nia
911c039991
Fix incorrect negative in Limit query documentation
Co-authored-by: Travis Turner <travis@pilosa.com>
2020-08-12 13:53:57 -04:00
Jaden Weiss
40a6fbd79e
add a "Limit" query 2020-08-12 12:27:23 -04:00
Nia
2a1fafb227
Merge pull request #652 from jaddr2line/constrow
Add ConstRow query
2020-08-12 12:22:06 -04:00
Nia
a19ca16810
Merge branch 'master' into constrow 2020-08-12 11:47:46 -04:00
Travis Turner
683b8dfe31
Merge pull request #660 from travisturner/error-rows-int
error on Rows(field=<int>)
2020-08-11 19:44:46 -05:00
Travis
eae038a07e
error on Rows(field=<int>) 2020-08-11 18:07:03 -05:00
Jaden Weiss
0e16192aeb
add ConstRow query 2020-08-11 08:25:32 -04:00
Jaden Weiss
96c2364c1b
Merge pull request #642 from jaddr2line/query-extract
Add an "Extract" query
2020-08-10 19:32:36 -04:00
Jaden Weiss
590bd07995
add an "Extract" query 2020-08-10 09:33:55 -04:00
Cody Soyland
559a2c6864 Add GetVDS and GetVDSs gRPC implementations 2020-08-07 16:28:06 -05:00
Ben Johnson
2bc3442ae8
Merge pull request #649 from molecula/fix-rbf-rollback
Fix RBF checkpoint high water mark
2020-08-07 14:29:31 -06:00
Ben Johnson
faa1662bf6 Fix RBF checkpoint high water mark
Previously, the `checkpoint()` function determined the segments to drop
based on the current active transactions' WAL ID references. However, if
no transactions are active then the checkpoint would drop segments too
aggressively.

This changes the determination by using the highest WAL ID that is
actually checkpointed to disk to determine the high water mark. If no
page are checkpointed then no segments can be dropped.
2020-08-07 10:07:33 -06:00
Ben Johnson
5644867507
Merge pull request #643 from molecula/fix-rbf-hanging-tests
Fix RBF/pilosa hanging tests
2020-08-07 10:06:57 -06:00
Cody Soyland
35675a3e59 Add stubbed gRPC types to support python-molecula
This adds the following rpc calls: GetVDS, GetVDSs, PostVDS, DeleteVDS, QuerySQL, QuerySQLUnary

Currently, they are not implemented.
2020-08-06 14:19:16 -05:00
Ben Johnson
78f9fbe332 Fix RBF/pilosa hanging tests 2020-08-06 11:43:41 -06:00
alanbernstein
5306426b19
Merge pull request #641 from alanbernstein/more-docs-updates
Fix various docs issues
2020-08-05 12:34:57 -05:00
Alan Bernstein
5f26290f92 Fix various docs issues 2020-08-05 12:26:22 -05:00
Ben Johnson
3fb2cccb00
Merge pull request #637 from molecula/rbf-fixes
Multiple RBF test fixes
2020-08-05 09:02:06 -06:00
Ben Johnson
f8cacd8081 Multiple RBF test fixes 2020-08-05 08:20:34 -06:00
Travis Turner
df709af10e
Merge pull request #638 from travisturner/fix-executeclearrow
safe cast of bool in executeClearRow
2020-08-04 15:52:48 -05:00
Travis
ddee2cb0a8
safe cast of bool in executeClearRow 2020-08-04 15:16:23 -05:00
tgruben
7f6c6956d8
Merge pull request #635 from molecula/efence_off
DetectMemAccessPastTx flag added, default false.
2020-08-03 22:03:36 -05:00
tgruben
86b5d89bc9
Merge branch 'master' into efence_off 2020-08-03 21:24:23 -05:00
alanbernstein
dede69f04d
Merge pull request #590 from alanbernstein/improve-tx-error-messages
Improve 'shouldn't ever happen' error messages
2020-08-03 12:44:30 -05:00
alanbernstein
27edff60b0
Merge branch 'master' into improve-tx-error-messages 2020-08-03 12:34:22 -05:00
Jason Aten
b806322c5a DetectMemAccessPastTx flag added, default false. Allow badger to run at full speed rather than with debugging code on by default 2020-08-01 21:40:54 -04:00
tgruben
0820babc44
Merge pull request #634 from molecula/unionfix
Follow roaring.Union() with optimize() to avoid overly large containers.
2020-08-01 08:58:47 -05:00
Jason Aten
394b8522d1 Follow roaring.Union() with optimize() to avoid overly large containers.
The cmd/loader is a preliminary sketch of the load testing tool.
2020-07-31 20:10:43 -04:00
tgruben
d0c2b80021
Merge pull request #631 from molecula/rbf_thurs
rbf: OffsetRange, ImportRoaringBits, CountRange work
2020-07-30 19:30:04 -05:00
Jason Aten
a3d802f8a3 rbf: OffsetRange, ImportRoaringBits, CountRange work
green:
TestFragment_RowsIteration/combinations
TestFragment_RoaringImportTopN

red: (needs Ben's attention)
PILOSA_TXSRC=rbf go test -v -run TestFragment_TopN_IDs  -tags=' shardwidth20'  "-gcflags=all=-d=checkptr=0"

also red: (one for Ben)
TestCursor_FirstNext_Quick/9 is throwing
  panic: cannot find segment containing WAL page: 1
  as we check the error back from checkpoint() in Rollback().
2020-07-30 20:20:38 -04:00
jaten-molecula
2fb76ba919
Merge pull request #626 from molecula/rbf_dump
rbf Dump() and DumpString() debug methods.
2020-07-30 13:57:30 -04:00
Jason Aten
8903d8c117 rbf Dump() and DumpString() debug methods. 2020-07-30 13:50:36 -04:00
jaten-molecula
d2586210a2
Merge pull request #621 from molecula/bluegreen_atg
blueGreenTx roaring vs badger is all tests green (atg)
2020-07-30 12:04:11 -04:00
Jason Aten
72c893a3d1 blueGreenTx roaring vs badger is all tests green (atg).
back to github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200709123515-8e896a7af361  b/c github.com/dgraph-io/badger/v2 v2.0.1-rc1.0.20200718033852-37ee16d8ad1c had issues with CI on 386 and arm
2020-07-30 11:50:25 -04:00
Cody Soyland
5c5cd1e1fd
Merge pull request #620 from codysoyland/go-mod-tidy
Add CI job to ensure go mod files are tidy
2020-07-29 18:18:37 -05:00
Cody Soyland
55313bd69d Add CI job to ensure go mod files are tidy. 2020-07-29 15:28:58 -05:00
Ben Johnson
55c0785215
Merge pull request #597 from molecula/rbf-tx
Implement pilosa.Tx for RBF
2020-07-29 11:42:20 -06:00
Ben Johnson
64de208170 Implement pilosa.Tx for RBF 2020-07-29 11:25:41 -06:00
jaten-molecula
4cdf62ab89
Merge pull request #615 from molecula/parallelized_open_frag
Parallelize view.OpenFragmentsInTx
2020-07-28 11:18:13 -04:00
Jason E. Aten
71eccd121d fix race in view.openFragmentsInTx 2020-07-28 07:55:28 -04:00
Jason Aten
38eea9b4a7 reparallelize view.go openFragmentsInTx() 2020-07-28 07:55:28 -04:00
jaten-molecula
1a89fc27a1
Merge pull request #605 from molecula/badger_atg
Tx integration milestone
2020-07-27 20:44:12 -04:00
Jason Aten
ac7be132ef Tx integration milestone
a) All tests green under -race for both PILOSA_TXSRC=roaring and PILOSA_TXSRC=badger.

b) Distinct is merged back into mainline pilosa.

Seebs notes on the Distinct work:

merge Distinct plugin back into main source tree, convert to Tx

We drop all references to the Preemptively Deprecated Don't You Dare
Use This extension interface, and move the one and only extension we had
(Distinct) into the main executor.

Also this fixes an arguable bug, which is that Container.AsBitmap()
would panic on a nil parameter, but it should have returned an empty
bitmap, because a nil *Ccontainer is a valid empty container. This
simplifies logic significantly in Distinct.

Fixes #569 #570 #571 #572 #573 #584 #585
2020-07-27 19:29:46 -04:00
Ben Johnson
efc90a6d36
Merge pull request #596 from molecula/rm-rbf-fun-dot
Remove generation of rbf/fun.dot in tests
2020-07-23 10:12:17 -06:00
Ben Johnson
75930ed82f Remove generation of rbf/fun.dot in tests 2020-07-23 09:37:50 -06:00
alanbernstein
7c94828a3c
Merge pull request #589 from alanbernstein/broken-index-translation
Fix broken index key translation in state DEGRADED
2020-07-22 21:22:06 -05:00
Alan Bernstein
5ffc7d7b59 Move checkClusterStatus to test package 2020-07-22 19:54:44 -05:00
Travis
339b76a091 use c.Topology, when available, to determine partitionNodes 2020-07-22 16:41:53 -05:00
Alan Bernstein
a727c74d35 Use nodes from topology to calculate partitionNodes 2020-07-22 16:41:53 -05:00
Alan Bernstein
6c8e2e9450 Add test 2020-07-22 16:41:53 -05:00
Alan Bernstein
fa77a36e83 Improve 'shouldn't ever happen' error messages 2020-07-22 16:36:02 -05:00
Jaden Weiss
fd65384faa
Merge pull request #583 from jaddr2line/bsi-test
Test every possible BSI comparison up to 6 bits
2020-07-21 15:58:31 -04:00
Jaden Weiss
9072b4c290
test every possible BSI comparison up to 6 bits 2020-07-21 13:56:36 -04:00
seebs
f5a228e56d
Merge pull request #579 from seebs/shutdownresize
Handle cluster shutdown during a resize
2020-07-21 12:45:18 -05:00
seebs
aae1d25152
Merge branch 'master' into shutdownresize 2020-07-21 12:27:33 -05:00
Jaden Weiss
adde0fa0bc
Merge pull request #564 from jaddr2line/fix-between-common-bits
Fix BSI range queries with nonzero common upper bits and oversized BSI queries
2020-07-21 13:24:00 -04:00
Jaden Weiss
9fb5f8b349
Merge branch 'master' into fix-between-common-bits 2020-07-21 13:19:15 -04:00
Seebs
99420b564e Handle cluster shutdown during a resize
The new logic to send resize instructions more makes it easier
to hit this, but it's probably always been a theoretically possible
bug to hit: If you are shutting a cluster down, then you stop accepting
connections, which means that if you have an existing resize job, you
can't get responses for it. Which means that the other nodes will
fail to notify you of the success or failure of resize instructions,
so the code waiting on the resize job's status waits forever.

When closing, we bail immediately on that; we don't need to wait for
those notifications. We still have a buffer, and a reasonable confidence
that we'll never write more than one result status, so if one of them
*does* somehow show up and cause the job to have a status,
writing the status won't block.
2020-07-21 12:16:38 -05:00
jaten-molecula
4c0d66703e
Merge pull request #582 from molecula/fix575b
remove premature configuration of Txsrc in test config
2020-07-20 21:04:46 -04:00
Jaden Weiss
e6b4cc2f32
fix oversized rangeEQ 2020-07-20 20:43:50 -04:00
Jaden Weiss
b9b0dd293f
fix rangeBetween when there are nonzero common upper bits and oversized rangeGT 2020-07-20 20:38:32 -04:00
Jason Aten
f5688fa700 remove premature configuration of Txsrc in test config 2020-07-20 20:22:47 -04:00
jaten-molecula
d23ea94ec0
Merge pull request #581 from molecula/fix575
pilosa server --tx compatible with PILOSA_TXSRC. fixes #575
2020-07-20 18:48:40 -04:00
Jason Aten
7fe7ed907f env PILOSA_TXSRC is reinjected into the env if pilosa server --tx overrides it. fixes #575
1. Tests can choose the Tx engine desired by setting the PILOSA_TXSRC
      env variable. For example:

         PILOSA_TXSRC=badger go test -v -run TestImportClearRestart

   2. pilosa server --tx is enabled now.

     Examples:
      pilosa server --tx roaring    # gives the legacy approach.
      pilosa server --tx rbf        # will activate RBF
      pilosa server --tx badger     # will activate BadgerDB
      pilosa server --tx badger_rbf # will run Blue-Green badger to RBF comparisons.

      and so forth. See pilosa server -h or txfactory.go for all valid --tx choices.

   3. Mechanism that makes both tests(1) and pilosa server(2) work at once:
       pilosa/server/server.go injects PILOSA_TXSRC into env to
       communicate with NewIndex in pilosa/index.go.
2020-07-20 17:56:12 -04:00
jaten-molecula
22fd24566a
Merge pull request #580 from molecula/fix568
green TestImportClearRestart on PILOSA_TXSRC=badger. fixes #568
2020-07-20 17:24:29 -04:00
Jason Aten
8a1dabb3ba 60m timeout on race 2020-07-20 17:09:32 -04:00
Jason Aten
f59f8a369e green TestImportClearRestart on PILOSA_TXSRC=badger. fixes #568 2020-07-20 16:32:34 -04:00
jaten-molecula
1c9ef3d321
Merge pull request #565 from molecula/tx_roaring_badger
integration of Tx, RoaringTx and BadgerTx implementations.
2020-07-20 16:01:45 -04:00
Jason Aten
97b530ca78 integration of Tx, RoaringTx and BadgerTx implementations.
- all tests green on RoaringTx
  - RoaringTx on by default
  - blueGreenTx testing framework available for A-vs-B comparison
    of Tx implementations
  - flag -tx added to server command line but not wired to
    change NewIndex() selection yet.
  - 918 green tests, 14 tests red on BadgerTx.

    A full list of the 14 red tests on BadgerTx follows.
    Note that these red tests represent not defects in BadgerDB
    or BadgerTx but rather failures of the pre-existing pilosa infrastructure to yet
    be fully adapted from files to using a transactional storage engine.

    As such these are tests that RBF should not be expected to
    pass yet either.

    Fixing the pilosa infrastructure to allow these tests
    to go green under Badger is the next and highest priority
    order of business, but RBF can get much testing benefit
    from the 918 green tests we do have, and hence we merge
    as much as we have today.

    The 14 red tests when NewIndex() is set to use
    BadgerTx are as follows. Note in particular
    that pilosa cluster resizing is not working yet under a
    transactional store.

     TestCluster_ResizeStates/Multiple_nodes,_with_data
     TestImportClearRestart/0MaxOpN10000
     TestImportClearRestart/1MaxOpN10000
     TestImportClearRestart/2MaxOpN10000
     TestImportClearRestart/3MaxOpN10000
     TestExecutor_Execute_Existence/Row
     TestExecutor_ForeignIndex
     TestExecutor_Execute_CountDistinct/Distinct
     TestExecutor_Execute_CountDistinct/Count(Distinct)
     TestExecutor_Execute_CountDistinct/GroupBy(Distinct)
     TestExecutor_BareDistinct
     TestExecutor_Execute_TopNDistinct/TopN
     TestHolderSyncer_IntField/BasicSync
     TestHolderSyncer_IntField/MultiShard
2020-07-20 15:50:08 -04:00
seebs
ab6a3aff10
Merge pull request #458 from seebs/eaddrinuse
Fix very-sporadic EADDRINUSE failures in CI testing (and related cluster test issues)
2020-07-20 10:58:48 -05:00
Seebs
364b533ead various cluster test fixups/cleanups
Some cluster tests failed sporadically. In order to fix them, I
introduced some debugging-related functionality, which revealed
several new bugs that were actually existing bugs we just happened
not to hit in testing. This combines various fixes.

We start with "make the nodes used in testing have distinct names
based on the test case name", which lets us discover that we are
leaking clusters, which continue to sit around talking with each
other. That in turn causes significantly higher load on access to
ephemeral ports, which causes sporadic failures when we shut a
node down and try to restart it, but something else has gotten assigned
its ephemeral port number since then.

Part of the fix is to try to rebind on port 0 if an attempt to
bind to a specified port over 32k fails. This is a guess; the
actual ephemeral port range could be 16k+, 32k+, or 48k+, or just
about anything else really, but it seems reasonable in
practice.

There were bugs in the oft-repeated loops to await the cluster
achieving a given state, and it could hang forever if it didn't,
so we add a timeout and a standard function on the test.Cluster
type to handle that. Note that the timeout seems irrelevant; in
every case I've tried, a timeout of 0 is fine because the node
start doesn't complete until the cluster state has changed.

Add a method to test.Command to run a query, expecting a specific
result. Also clean up some of the formatting and generation of
queries, and allow parameterized (badly) queries. This lets us fix
a subtle bug, which is that test cases were depending on assumptions
about shardwidths. Also improve the diagnostic output from some of
these functions so test failures are more comprehensible.

But actually that dependency on shardwidths was ALSO revealing a
genuine underlying bug, which is that a node resize did not correctly
propagate the schema to a new node if there was no data present
on shards that node would own. We now also have a test case that
hits that (or would, if we hadn't fixed it).

Add comments explaining the server options parameters for MustNewCluster
and MustRunCluster.

Also, we implement the ReadFrom and WriteTo behaviors for
InMemTranslateStore, without which some of the cluster resize tests
fail. Props to the comment for specifically stating that they wouldn't
work if that happened, which probably saved me several hours of
debugging. The implementations may not be robust, but
InMemTranslateStore is intended to be used only in lightweight
and transient testing.
2020-07-20 10:45:59 -05:00
Seebs
ef8b054367 move Cluster type and methods into existing almost-empty cluster.go 2020-07-20 10:45:47 -05:00
tgruben
1067d29784
Merge pull request #547 from tgruben/refactor-putleaf
refactor putleaf
2020-07-17 13:39:35 -05:00
Todd Gruben
cd4bd016f9 skipping a test for ci issue 2020-07-17 09:30:07 -05:00
Todd Gruben
848359a36b skipped test for race wip 2020-07-17 09:15:20 -05:00
Todd Gruben
e61f0f6b1f missing liscense 2020-07-17 09:09:42 -05:00
tgruben
88bf29ea40
Merge branch 'master' into refactor-putleaf 2020-07-17 09:06:31 -05:00
Todd Gruben
9bbceb931a missing license 2020-07-17 09:05:53 -05:00
Todd Gruben
7c5c693fcb linter fix 2020-07-17 09:03:32 -05:00
Todd Gruben
59d2d89a5c removed leafArg and added conatinertypebitmapptr; lint fixes 2020-07-17 02:16:35 -05:00
Jaden Weiss
3f45a90582
Merge pull request #549 from jaddr2line/microseconds
Add microseconds to log
2020-07-16 17:13:10 -04:00
Jaden Weiss
de061ff21d
Merge branch 'master' into microseconds 2020-07-16 17:01:50 -04:00
Todd Gruben
bbd83e4618 . 2020-07-16 08:31:09 -05:00
Kuba Podgórski
2ee5e3d8e5
Merge pull request #538 from kuba--/translation-coordinator
Translation coordinator
2020-07-15 22:53:18 +02:00
Kuba Podgórski
ce628c96cd
Merge branch 'master' into translation-coordinator 2020-07-15 22:45:43 +02:00
Kuba Podgórski
1d6a4dea88
Merge pull request #554 from kuba--/i0-i1
Remove test leftovers
2020-07-15 14:06:23 +02:00
Kuba Podgórski
559e71f62a Remove test leftovers (holder's path). 2020-07-15 13:50:59 +02:00
Jaden Weiss
5579d632c7
Merge pull request #539 from jaddr2line/remove-arm64-binary
remove an arm64 pilosa binary that was committed for some reason
2020-07-14 20:08:23 -04:00
Kuba Podgórski
1edd773e90
Merge branch 'master' into remove-arm64-binary 2020-07-15 01:42:26 +02:00
Jaden Weiss
c99d35a793
Merge pull request #552 from jaddr2line/queries-docs
Add /queries endpoint to API reference
2020-07-14 18:26:27 -04:00
Jaden Weiss
b442ff8336
add /queries endpoint to API reference 2020-07-14 15:58:59 -04:00
Jaden Weiss
9036a16b08
add microseconds to log 2020-07-14 11:44:55 -04:00
Todd Gruben
e68f0a0d8f missing license 2020-07-14 09:00:09 -05:00
Todd Gruben
b61bdbd7a0 fix linter errors 2020-07-14 08:54:30 -05:00
Todd Gruben
374a4ec9ce fixed missing refactor test;refactor GetBitmap 2020-07-14 07:57:02 -05:00
Todd Gruben
b8fe08c765 simplify Walker interface 2020-07-13 20:34:33 -05:00
Todd Gruben
d6986b78a5 . 2020-07-13 20:08:22 -05:00
Todd Gruben
b2b614a686 refactor cursor.GetBitmap->tx.GetBitmap;rename to WalkRootRecordPages;err check 2020-07-13 19:32:26 -05:00
Todd Gruben
b11b43af43 refactor putleaf 2020-07-13 10:48:25 -05:00
Travis Turner
3c619fa2ef
Merge pull request #543 from travisturner/foreign-index-todos
Get ForeignIndex keys in GroupBy
2020-07-11 19:45:31 -05:00
Travis Turner
9f80619f19
Merge branch 'master' into foreign-index-todos 2020-07-11 18:24:55 -05:00
Kuba Podgórski
92ab76b621
Merge pull request #399 from molecula/alisharawal-patch-1
Update README.md
2020-07-11 21:28:14 +02:00
Kuba Podgórski
51ba2492e9
Merge branch 'master' into translation-coordinator 2020-07-11 19:22:48 +02:00
Kuba Podgórski
51891040d0
Merge branch 'master' into alisharawal-patch-1 2020-07-11 19:17:30 +02:00
Travis
a9dc8b8add
translate GroupBy previous value from foreign index 2020-07-11 10:18:45 -05:00
Travis
8f6b876af0
get ForeignIndex keys in GroupBy 2020-07-10 22:48:35 -05:00
alanbernstein
07d3cfe23b
Merge pull request #542 from alanbernstein/validate-transaction-id
Restrict allowed characters in transaction IDs
2020-07-10 20:18:42 -05:00
Kuba Podgórski
0fc7b89b48
Merge branch 'master' into remove-arm64-binary 2020-07-11 01:59:35 +02:00
Kuba Podgórski
010ab5ef8b Extend translate coordinator test 2020-07-11 01:51:03 +02:00
Alan Bernstein
65febc37fd Allow '' in ID regex 2020-07-10 18:07:17 -05:00
Alan Bernstein
7c37ececfd Restrict allowed characters in transaction IDs 2020-07-10 17:58:47 -05:00
Jaden Weiss
a947bc8ad9
Merge pull request #540 from jaddr2line/fix-inspect-query-validate
Fix incorrect validation of query specification in Inspect
2020-07-10 15:56:07 -04:00
Jaden Weiss
2f8d8345c1
fix incorrect validation of query specification in Inspect 2020-07-10 14:35:30 -04:00
Jaden Weiss
8940402e76
remove an arm64 pilosa binary that was committed for some reason 2020-07-10 13:28:27 -04:00
Travis Turner
c7ccd62b3b
Merge pull request #537 from travisturner/grpc-port-0
Replace grpc port code that I removed for some reason
2020-07-10 11:06:40 -05:00
Travis
85bd306eb5
replace grpc port code that i removed for some reason 2020-07-10 10:57:20 -05:00
Jaden Weiss
bb9b3d4e6f
Merge pull request #527 from jaddr2line/like
Add `Rows(like=...)` and `UnionRows` queries
2020-07-09 19:10:29 -04:00
Jaden Weiss
239aacc160
Merge branch 'master' into like 2020-07-09 19:04:03 -04:00
Jaden Weiss
62ce26e7b8
Merge pull request #534 from jaddr2line/inspect-query-v2
Add support for inspecting with a query
2020-07-09 14:09:47 -04:00
Jaden Weiss
f4e9e1688f
add support for inspecting with a query 2020-07-09 13:29:15 -04:00
Travis Turner
85d1fa30dc
Merge pull request #530 from travisturner/advertise-grpc
add --advertise-grpc configuration option
2020-07-09 11:38:18 -05:00
Travis
944a6dca78
add --advertise-grpc configuration option 2020-07-09 11:17:12 -05:00
Ben Johnson
3c021fc2e3
Merge pull request #526 from molecula/rbf
Roaring Bitmap Format
2020-07-08 13:39:37 -06:00
Ben Johnson
de51b538f3 rbf: roaring bitmap format
Co-authored-by: Todd Gruben <todd@pilosa.com>
2020-07-08 13:27:18 -06:00
Jaden Weiss
4bacab6524
update query language docs to include like and UnionRows 2020-07-08 13:08:11 -04:00
Jaden Weiss
c9edccb267
add executor tests and license headers for like & UnionRows 2020-07-08 12:55:18 -04:00
Jaden Weiss
7a16ffff68
add UnionRows query 2020-07-08 12:55:18 -04:00
Jaden Weiss
227881cb67
simplify suffix matching 2020-07-08 12:55:17 -04:00
Jaden Weiss
0611ef3418
initial implementation of Rows like 2020-07-08 12:55:17 -04:00
Jaden Weiss
ed8e5a933e
optimize & document & test like matcher
optimize suffix matching
add some descriptive comments to the like matcher
test all paths in the like tokenizer and matcher
2020-07-08 12:55:17 -04:00
Jaden Weiss
9eb8fcb37f
initial impl of like 2020-07-08 12:55:17 -04:00
alanbernstein
7f1b1f63ef
Merge pull request #506 from alanbernstein/docs-updates
Docs updates
2020-07-07 15:27:07 -05:00
alanbernstein
0aae064310
Merge branch 'master' into docs-updates 2020-07-07 15:17:42 -05:00
Alan Bernstein
94038f4446 Update wording 2020-07-07 03:48:37 -05:00
Ben Johnson
d53d8ef010
Merge pull request #508 from molecula/tx
Tx Interface
2020-07-02 17:20:23 -06:00
Ben Johnson
bf55bbc717 Tx Interface
This commit adds a transaction interface which will be used in the
future to add support to RBF (Roaring B-tree Format).
2020-07-02 10:43:15 -06:00
Kuba Podgórski
549c98dc64
Merge pull request #447 from kuba--/union-run-run
Add unionRunRunInPlace
2020-07-02 11:05:27 +02:00
Kuba Podgórski
751383ecb1
Merge branch 'master' into union-run-run 2020-07-02 10:52:59 +02:00
Jaden Weiss
a52c5d803d
Merge pull request #510 from jaddr2line/roaring-cleanup-3
Roaring cleanup
2020-07-01 17:21:14 -04:00
Jaden Weiss
6d692487ed
Merge branch 'master' into roaring-cleanup-3 2020-07-01 17:15:10 -04:00
Kuba Podgórski
ec73bf5906
Merge branch 'master' into union-run-run 2020-07-01 22:25:06 +02:00
Kuba Podgórski
e777a28283
Merge pull request #513 from kuba--/todo-501
Address the overflow issue with values outside the int64 range
2020-07-01 21:09:09 +02:00
Kuba Podgórski
4bed1df101 Address the overflow issue with values outside the int64 range 2020-07-01 20:40:47 +02:00
Kuba Podgórski
d6caf34c02
Merge pull request #509 from kuba--/todo-503
Add test for Rows on bool
2020-07-01 16:32:24 +02:00
Kuba Podgórski
f0abb5e8b4
Merge branch 'master' into todo-503 2020-07-01 16:23:38 +02:00
Kuba Podgórski
e52b1c04fc
Merge pull request #512 from kuba--/todo-504
FieldValue - check if column arg exists
2020-07-01 16:06:16 +02:00
Kuba Podgórski
5bbb3e2065 FieldValue - check if column arg exists 2020-07-01 11:36:42 +02:00
Kuba Podgórski
58964947d4
Update executor_internal_test.go
Co-authored-by: Travis Turner <travis@pilosa.com>
2020-07-01 10:17:30 +02:00
Kuba Podgórski
f921c5ded0 Add test for Rows on bool 2020-07-01 01:30:36 +02:00
Jaden Weiss
3e0ce32d00
roaring cleanup 2020-06-30 16:38:16 -04:00
Alan Bernstein
3841419907 Use more believable words 2020-06-30 12:23:36 -05:00
Alan Bernstein
31ae30f703 Replace smart quotes 2020-06-30 11:26:25 -05:00
Alan Bernstein
5a6db1cc2b Document topn heuristic behavior 2020-06-30 11:26:16 -05:00
Jaden Weiss
ad2390444a
Merge pull request #500 from molecula/seebs-big-inspect-pr
Improve inspect output, switch roaring over to using new unmarshal, handle inspecting whole holders
2020-06-29 15:31:01 -04:00
Jaden Weiss
31014d11e5
remove unnecesary slice operation when processing holder 2020-06-29 15:22:27 -04:00
Seebs
4d494f6699
shared/generic functionality for iterating holders
This is sort of large, but it's annoyingly difficult to
separate out.

The basic idea is to allow us to have a single holder-iterating
block of code, which is associated with the holder, that can be used
for various things, like the snapshot queue background scan, or
for inspect operations.

We invent the concept of a HolderFilter, which is a thing that
can decide what things in a holder it cares about, and a HolderOperator,
which can also process those things selectively.

In the process, we fix up a couple of subtle bugs in the
inspect logic; specifically, the assumption that the mapped flag could
tell you whether a container was modified by the ops log doesn't
work with mmap, so we have a shiny new flag which is used to track
that, internal to the roaring/container code.

All of this leads to the actual *point* of this exercise, which is
making it easier to create an /inspect endpoint which produces almost
the same data we'd have gotten from `pilosa inspect` on a data directory;
the distinction is that it doesn't try to identify the distinction
between data from disk and data from operations since the file was
loaded. Possibly it should, but it doesn't yet.

The snapshot queue is now implemented using the HolderOperator
design, which requires some subtle changes to how it works, but
overall makes it easier to follow the snapshot queue logic,
and also shares that logic with the way Inspect works.

The holder's snapshot queue is now provided by the server, in
a default environment.

The queueless snapshot queue no longer triggers snapshots on
enqueue -- it turns out that breaks badly, because a key
point about enqueueing a snapshot is that it's safe to do it
*during* a transaction on that fragment, and triggering a
snapshot during a transaction actually causes horrible errors
as the ops log ends up being the old file, which we close.
Related to this, we also need to prevent closed fragments from
trying to snapshot, so we track fragment openness when opening
or closing, and bail on trying to snapshot a fragment which is closed.

We also stop using the queueless snapshot queue during tests,
because that's a horrible idea.

We copy a little bit of the partition logic from the cluster code so
we don't have to expose it all, this lets us check whether the node
we're looking at is the one which should be primary for a given shard,
and if not, identify which node would be. This works only when
pointed at a data directory, for now.

The test cases for the holder have to be internal, because pilosa
doesn't export view/fragment, just Index/Field. This means that the
holder test cases can't just use the test/* package, so they duplicate
some of its logic, approximately.
2020-06-29 15:18:47 -04:00
Seebs
2826ecc0b7
track retries correctly in truncation case 2020-06-29 15:13:51 -04:00
Seebs
176d49e4b5
use syswrap to close file after opening it with syswrap 2020-06-29 15:13:50 -04:00
Seebs
3e7f0b32e9
drop old Call data while processing a list of calls
We don't need the Calls anymore, and especially Precomputed calls
(like Distinct) could be a significant memory load that's increased
as we process additional calls, so we drop the Precomputed references.
We can't drop the calls entirely -- translation can require lookups of
call arguments.
2020-06-29 15:13:50 -04:00
Seebs
7e7051d387
don't try to truncate files when invoked read-only 2020-06-29 15:13:50 -04:00
Seebs
ceaf5c15d1
thread the holder through things, and improve snapshot queue logic
This is logically two separate things, but the individual changes
are thoroughly intertwined in the code.

The first change is a logical change to the design of the snapshot
queue, which is that it now adjusts the maxOpN the background scan
targets, allowing it to lower that value over time when things are
quiet. We do this because it turns out that on large data sets,
this can make a factor-of-four difference in memory usage!

So, in general, on a quiet system, each pass through the holder
aims for about 1/4 of the existing fragments to get snapshotted.
When there's more load, we adjust those values up.

We also make the snapshot queue a bit less chatty, to make testing
less annoying -- we only print stats if the queue enqueues at least
two snapshots, or skips any.

The second change is threading the holder through things. We've
always threaded the logger through, and then added the snapshot
queue, and some of the Inspect-related work led to wanting to
have a way to thread options through, so what if we just threaded
the holder itself through, and removed the direct copying around
of the logger, snapshot queue, and so on. Similarly, everything
can now use holder.PartitionN instead of having to get its own
copy of PartitionN handed out to each index.

This does imply ensuring that test cases always get a reasonable
default holder.

This is a precursor to adding additional information to the holder,
such as whether it's in a special read-only mode, which would imply
not modifying on-disk files. This is already semi-supported for
the specific case of the background snapshot queue and cache flushing,
which are attached to the (created in a previous commit) new
holder Activate method, instead of being automatic on holder Open.

The change to a snapshot queue can also cause races in tests, because
the fragment.Clean method's "sanity check" accesses a fragment without
a lock. Fix that. Since there's a couple of t.Fatalf(), but we need
to release the lock before closing, we use an anonymous function
with a defer to handle that. Whee!
2020-06-29 15:13:50 -04:00
Seebs
121717594b
improve inspect output, switch roaring over to using new unmarshal
At some point the code changeover to use roaring iterators for
unmarshal got dropped, but the old unmarshal code is way harder to
make work for inspect, so this change is back.

This exports some of the names from the things returned by Info,
but also adds a roaring function to use the unmarshalling logic on
arbitrary data, allowing us to get more insight into a file -- in
particular, letting us distinguish between the bitmaps specified by
the roaring data and the bitmaps resulting from applying the ops log.
2020-06-29 15:13:47 -04:00
Jaden Weiss
c1612851af
Merge pull request #498 from jaddr2line/transaction-test-timeout
TestTransactionManager: raise transaction timeouts to avoid sporadic failures
2020-06-29 14:42:21 -04:00
Jaden Weiss
0d05e413d3
TestTransactionManager: raise transaction timeouts to avoid sporadic failures 2020-06-29 13:44:20 -04:00
Jaden Weiss
a175858375
Merge pull request #496 from jaddr2line/molecula-rebrand
Rebrand pilosa binaries
2020-06-26 17:51:21 -04:00
Jaden Weiss
fedb1f7dbd
set version to match Molecula convention 2020-06-26 17:41:19 -04:00
Jaden Weiss
4a4252bb28
Merge pull request #1 from codysoyland/enterprise-removal
Remove a few more enterprise references
2020-06-26 17:24:02 -04:00
Cody Soyland
4f22c388b3 Remove a few more enterprise references 2020-06-26 15:57:21 -05:00
Jaden Weiss
cd317d7e91
tweak VERSION_ID 2020-06-26 16:49:06 -04:00
Jaden Weiss
aa1995073f
rebrand pilosa binaries
This change rebrands the Pilosa binaries from "Pilosa Enterprise" to "Molecula Pilosa" and simplifies the version info string.
2020-06-26 16:49:05 -04:00
Kuba Podgórski
d99971a6c2
Merge branch 'master' into union-run-run 2020-06-26 22:32:07 +02:00
Kuba Podgórski
8b33a073b4
Merge pull request #495 from kuba--/int-eq
Support '=' condition for int/decimal fields
2020-06-26 22:30:03 +02:00
Kuba Podgórski
4351464f84
Merge branch 'master' into int-eq 2020-06-26 21:26:44 +02:00
Jaden Weiss
a78b1cfe19
Merge pull request #446 from jaddr2line/fastrank
Remove allocations from ranked cache when possible
2020-06-26 12:46:58 -04:00
Kuba Podgórski
3782c3ac14 Support '=' condition for int/decimal fields 2020-06-26 18:14:59 +02:00
Jaden Weiss
94b55f8556
remove allocations from ranked cache when possible 2020-06-26 12:12:51 -04:00
Jaden Weiss
079bee5711
Merge pull request #489 from jaddr2line/field-cleanup
Remove unused field code
2020-06-26 11:37:15 -04:00
Jaden Weiss
5523587435
pilosa: remove unused field code 2020-06-26 10:14:56 -04:00
Kuba Podgórski
76324f1498
Merge branch 'master' into union-run-run 2020-06-26 01:28:25 +02:00
Jaden Weiss
0a030e9a77
Merge pull request #482 from jaddr2line/rm-invalid-unsafe
Remove invalid uses of unsafe from roaring containers
2020-06-25 15:02:33 -04:00
Jaden Weiss
934048bb02
roaring: remove invalid uses of unsafe 2020-06-25 11:48:21 -04:00
Kuba Podgórski
47481432ef
Merge pull request #468 from kuba--/fix-DEGRADED
Lets the remote node to proceed
2020-06-25 17:05:30 +02:00
Kuba Podgórski
80cfb5c182
Merge branch 'master' into fix-DEGRADED 2020-06-25 16:41:41 +02:00
Kuba Podgórski
0bdb420b4c
Merge pull request #475 from kuba--/fix-iface-conv
Make a safe cast
2020-06-25 15:36:53 +02:00
Kuba Podgórski
ed86f6ea5d Make a safe cast 2020-06-25 14:44:14 +02:00
Cody Soyland
bc9d13206f
Merge pull request #490 from codysoyland/ci-fixes
Fix/refactor CircleCI config
2020-06-24 13:52:45 -05:00
Cody Soyland
2024228153 Fix/refactor CircleCI config
- Fix incorrect usage of workspaces (vendor dir in current directory no
  longer primary cache of go modules)
- Refactor checkout, github-auth, and mod cache into a reusable command
- Fix issue with dockerhub upload and github authentication
2020-06-24 13:45:17 -05:00
Kuba Podgórski
413ce4f1ab
Merge branch 'master' into fix-DEGRADED 2020-06-24 19:56:24 +02:00
Jaden Weiss
2925101b09
Merge pull request #487 from jaddr2line/cluster-message-error
Differentiate between cluster message request errors and cluster message processing errors
2020-06-24 09:44:03 -04:00
Jaden Weiss
b5b60b8912
http: differentiate between cluster message request errors and cluster message processing errors 2020-06-24 09:23:08 -04:00
Kuba Podgórski
905cda7f08 Add benchmarks 2020-06-23 22:18:13 +02:00
Kuba Podgórski
443f2d8f7c The third attempt to implement unionRunRunInPlace 2020-06-23 22:18:13 +02:00
Kuba Podgórski
eddbb7d0b0 Optimize run intervals by combnining neighbours 2020-06-23 22:18:13 +02:00
Kuba Podgórski
2b0cd2f234 Add unionRunRunInPlace 2020-06-23 22:18:13 +02:00
Jaden Weiss
89ac3f4737
Merge pull request #486 from jaddr2line/handlerfixes
Fix incorrect error handling in HTTP handler and output raw error text when JSON is not selected
2020-06-23 12:57:55 -04:00
Jaden Weiss
66aef92cfa
http: fix incorrect error handling and output raw error text when JSON is not selected 2020-06-23 12:26:37 -04:00
Cody Soyland
16ebdf290d
Merge pull request #479 from codysoyland/ci-dockerhub-fix
Fix and simplify CI DockerHub integration
2020-06-23 09:13:41 -05:00
Cody Soyland
7cb9548097 Fix and simplify CI DockerHub integration 2020-06-19 11:41:54 -05:00
Jaden Weiss
5dc02a3998
Merge pull request #474 from jaddr2line/timeclr
Fix Clear() returning `false` when it should return `true`
2020-06-19 09:03:42 -04:00
Jaden Weiss
a270bff67b
fix Clear() returning false when clearing a bit with no time views 2020-06-19 08:51:08 -04:00
Kuba Podgórski
739935c3f6
Merge branch 'master' into fix-DEGRADED 2020-06-18 16:13:58 +02:00
tgruben
21888703e5
Merge pull request #469 from tgruben/splat-init
Functionalize  fillerBitmap initialization
2020-06-17 09:39:16 -05:00
tgruben
3103da2c19
Update roaring/container_stash.go
Co-authored-by: Jaden Weiss <jaden@jadendw.dev>
2020-06-17 08:51:25 -05:00
Todd Gruben
f47888989a shorten fillerBitmap initialization 2020-06-17 07:12:24 -05:00
Kuba Podgórski
87306d3145 Lets the remote node to proceed, instead of waiting in DOWN state because cluster is in STARTING state. 2020-06-17 11:37:30 +02:00
Jaden Weiss
7f4142497e
Merge pull request #467 from jaddr2line/splat
Optimize `splatRun`
2020-06-16 13:50:27 -04:00
Jaden Weiss
8fc7861148
roaring: optimize splat 2020-06-16 13:04:50 -04:00
Travis Turner
cf24ee161f
Merge pull request #465 from travisturner/document-shift
Add comments warning that Shift() is unsupported
2020-06-15 17:53:38 -05:00
Travis
c5786e1d78
Add comments warning that Shift() is unsupported 2020-06-15 17:16:00 -05:00
alisharawal
4a68b46597
Merge branch 'master' into alisharawal-patch-1 2020-06-15 11:15:14 -05:00
Jaden Weiss
d9baea83f4
Merge pull request #454 from jaddr2line/groupbyoffset
Apply base in GroupBy on BSI
2020-06-11 17:24:39 -04:00
Jaden Weiss
837d0a1465
Merge branch 'master' into groupbyoffset 2020-06-11 12:20:35 -04:00
Jaden Weiss
32e47642ae
address review of "Apply base in GroupBy on BSI" 2020-06-10 17:49:00 -04:00
tgruben
8bc303793c
Merge pull request #453 from tgruben/includes-perf
Optimized performance of row.Includes
2020-06-10 15:50:50 -05:00
Jaden Weiss
535257af75
apply base in GroupBy 2020-06-10 16:16:53 -04:00
Todd Gruben
416f332070 Optimize row.Includes 2020-06-10 13:12:38 -05:00
Jaden Weiss
ec9474114a
Merge pull request #449 from jaddr2line/fixbsioffbyone
Fix BSI comparison match-all-but-one operation
2020-06-10 10:41:35 -04:00
Jaden Weiss
8887927dbd
add regression test for BSI match-all-but-one operations 2020-06-10 10:09:33 -04:00
Jaden Weiss
d478dd9d94
fix BSI comparison match-all-but-one operation 2020-06-10 09:23:39 -04:00
Kuba Podgórski
058ed747c7
Merge pull request #437 from kuba--/err-check
Return error instead of panicking on Store(Distinct())
2020-06-09 14:53:23 +02:00
Kuba Podgórski
9c3b080bf0 Check result before return 2020-06-09 11:39:16 +02:00
Cody Soyland
a519907822
Merge pull request #440 from codysoyland/ci-size
Use xlarge executor in CircleCI
2020-06-08 15:24:31 -05:00
Cody Soyland
8352f5d273 Add configurable resource class, enable only for test-race. 2020-06-08 15:20:31 -05:00
Cody Soyland
ecbb5b2a0d Use xlarge executor in CircleCI 2020-06-08 15:20:31 -05:00
Jaden Weiss
12e6534244
Merge pull request #426 from jaddr2line/simplebsi
Simplify BSI comparisons
2020-06-08 16:14:41 -04:00
Jaden Weiss
ee8036d376
Merge branch 'master' into simplebsi 2020-06-08 16:07:29 -04:00
Jaden Weiss
120cc02536
process BSI ops more efficiently 2020-06-08 14:52:19 -04:00
Jaden Weiss
721a968d63
Merge pull request #438 from jaddr2line/cpumhz
fix CPU speed on non-Intel platforms
2020-06-08 13:34:27 -04:00
Jaden Weiss
a4e53b4bc1
Merge branch 'master' into cpumhz 2020-06-08 13:26:49 -04:00
seebs
c0c027ef67
Merge pull request #429 from seebs/racetime
Improve time requirements for tests with race detector on
2020-06-08 12:25:07 -05:00
Seebs
44569fa210 Reduce iterations in TestFragment_RowsIteration
We don't really learn more from trying every multiple of 10,000 than we do
from trying maybe 32 values, and it's worse at larger shard widths.
2020-06-08 12:10:40 -05:00
Seebs
52aa3e2e23 Improve container/bitmap comparison logic for testing
We have a "deadcode" bitmapsEqual which is actually used in testing but
probably shouldn't be, and we don't have a good container equality test.

Problem is, equality tests are sort of slow in the things-are-equal case,
which is the most common case, so we've got some moderately-specialized
code here; specifically, special comparison code that takes advantage
of knowing that if two containers have the same number of bits, you only
have to check whether all the bits from one are present in the other,
because that can't be true for differing containers with the same number
of bits. This reduces the runtime for the ContainerCombinations case
from about 24 seconds to a bit under 2 on my laptop, or from around
10 minutes to about 37 seconds with the race detector on.

Also simplify the InPlaceWrapper functions not to invoke bitmaps, because
it's not really necessary.
2020-06-08 12:10:40 -05:00
Seebs
3f0c9925f4 Don't test quite so many values for BtreeSeek and BtreeDelete
BtreeSeek is O(N^2) on its N, and there's not a ton of extra utility
to testing a larger range of values, so we reduce N by a bit, cutting
runtime from ~10s to <1s on my laptop. Also reduce the scale of the
BtreeDelete1/BtreeDelete2 tests a bit because, again, lots of runtime
for little marginal information.
2020-06-08 12:10:40 -05:00
Seebs
e223c79ace Don't use a whole shard of values for Execute_All test.
This is pretty expensive even for default shard width, and very expensive
for ShardWidth = 1<<22, and we don't really get much extra benefit from
having a million values instead of a hundred or so.
2020-06-08 12:10:40 -05:00
Seebs
1484674a1c Add and use bitmap-to-slice-or-set comparison functions
The generation of slices from things, and use of reflect.DeepEqual to compare
the slices, is a lot more expensive than it needs to be. Omitting it removes most
of the runtime of the marshal tests.
2020-06-08 12:10:40 -05:00
Seebs
1952a43ed4 Write fewer bits to test the rowcache behavior
The failure mode in question was pretty predictable and tied to number of
snapshots, not to number of bits written, so we can probably use a lot fewer
bits and still get good results, but this is really slow under -race testing.
2020-06-08 12:10:40 -05:00
Seebs
1460756b3f Provide option for adjusting node timeouts, set it for tests.
There's no reason to have 10-20 seconds of delays for testing this,
because in testing, we're running things on the local machine and don't
need to worry about significant network lag. Make retry count and delay
settable options, and set them lower. Moves the Replica2 test in
server/server_test.go from ~21s to ~2s.
2020-06-08 12:10:40 -05:00
Seebs
55ff03a2d6 Lower scale of some random-value tests
The random-value tests can be pathological, and in particular, the
test of arbitrarily-spaced values is in effect O(N^2), and with race
testing on, that test *alone* can take ten minutes to run, but
it's not really all that exciting. We just reduce a bunch of values
and/or test fewer things for these, which doesn't significantly alter
coverage, but reduces test runtime on my laptop with `-race` from
21 minutes to a bit under 5.
2020-06-08 12:10:40 -05:00
Jaden Weiss
7695e63bc5
fix CPU speed on non-Intel platforms 2020-06-08 11:40:53 -04:00
Jaden Weiss
0a17b3713c
Merge pull request #428 from jaddr2line/cleanshutdown
Cleanly shut down the executor
2020-06-05 18:32:57 -04:00
Jaden Weiss
b0a0524ffe
cleanly shut down the executor 2020-06-05 15:25:35 -04:00
Jaden Weiss
0ce5d92407
simplify BSI comparisons 2020-06-05 14:13:29 -04:00
seebs
33728e65d9
Merge pull request #408 from seebs/execontext
thread contexts better through executor
2020-06-04 15:18:12 -05:00
seebs
610d72dbfc
Merge branch 'master' into execontext 2020-06-04 14:57:16 -05:00
Jaden Weiss
0095810e4d
Merge pull request #419 from jaddr2line/trackqueries
track active queries
2020-06-04 14:58:22 -04:00
Jaden Weiss
06517075bf
add unit test to active query tracker 2020-06-04 14:05:06 -04:00
Jaden Weiss
1099a57945
fix pretty printing of active queries list to handle special characters and multiline queries 2020-06-04 14:04:46 -04:00
Jaden Weiss
023efcaba6
track active queries 2020-06-04 10:50:15 -04:00
Seebs
439c710ca9 thread contexts better through executor
When a mapper hits an error, we want it to immediately tell the
other things in that same mapper that they can stop now. But we
don't want to propagate that all the way back up; if a specific
node has a failure executing a query, we will in some cases want
to send a new query to other backup nodes, so the overall
context isn't cancelled yet.

In general, mapFn and reduceFn have been closures that inherit
a context from the function defining them -- but we don't want
that! We want them to be stopped if their specific mapper gets
cancelled, too, because otherwise they can consume a lot of
resources long after the mapper has stopped being interested
in them.  So now those are parameters passed into them,
and mapperLocal puts *those* contexts in the jobs shoved into
the job queue, and the workers pass the context in to the
mapFn/reduceFn.

We also check responses from reduceFn now; both mapReduce
and mapperLocal check for a possible error, and return that,
and reduce functions doing anything nontrivial check their
context.

We also add a few more explicit checks for context cancellation
in various places, especially in the GroupByIterator which is
what bit us that one time. The explicit check against ctx.Err
is officially safe as of Go 1.9 or so. (It was previously
unspecified, but on further study, the Go team concluded that
no actual implementation did anything else, and existing code
was already depending on that.) This also affects the rows
function, because that could potentially take quite a while to
run for a large fragment.
2020-06-03 16:09:01 -05:00
seebs
33a90fd328
Merge pull request #297 from seebs/nofreeze
Don't automatically freeze the results of RowSegment ops
2020-06-03 14:54:12 -05:00
Seebs
6abe7dc12f Don't automatically freeze the results of RowSegment ops
I think when this code was written, I thought "freeze" would be
really cheap. It's not actually that cheap. As a result, freezing
things preemptively when it may be that nothing ever tries to write
to them anyway is possibly disadvantageous, to the tune of being
roughly 20% of a sample profile we were shown. Instead, we don't
mark the components "writable", so if anything wants to write to
them, it'll end up freezing itself new copies of their bitmaps
later. But in practice that probably doesn't happen.
2020-06-03 13:21:41 -05:00
Kuba Podgórski
0bba9c81e8
Merge pull request #417 from kuba--/rev-mtx
Change order of cluster/index locks
2020-06-03 15:37:20 +02:00
Kuba Podgórski
0320228b99 Change order of cluster/index locks 2020-06-03 15:09:56 +02:00
Kuba Podgórski
a8e6846e78
Merge pull request #401 from kuba--/etag
Add (in memory) CreatedAt to index and fields
2020-06-03 15:09:22 +02:00
Kuba Podgórski
bb048da241
Update docs/api-reference.md
Co-authored-by: Matthew Jaffee <matthew.jaffee@gmail.com>
2020-06-03 14:47:51 +02:00
Kuba Podgórski
6a892102e4 Update api-reference.md 2020-06-03 13:26:16 +02:00
Kuba Podgórski
d8a417f657 Move applyCreatedAt from mergeClusterStatus directly to ClusterStatus message, to avoid deadlocks 2020-06-03 13:26:16 +02:00
Kuba Podgórski
0c98c887ac Pass Schema in ClusterStatus message 2020-06-03 13:26:16 +02:00
Kuba Podgórski
ba7f039dd1 Rename etag to createdAt 2020-06-03 13:26:16 +02:00
Kuba Podgórski
3d270f45d2 Add (in memory) ETag to index and fields 2020-06-03 13:26:16 +02:00
tgruben
43195ae2dd
Merge pull request #416 from tgruben/fix-grpc-address
add address for listening
2020-06-02 16:25:53 -05:00
Todd Gruben
fdaae31c2c add address for listening 2020-06-02 15:39:28 -05:00
Matthew Jaffee
31c5e7363d
Merge pull request #412 from jaffee/escape-query-strings-411
modify PQL parser to handle escapes in string values
2020-05-29 08:51:54 -05:00
Matt Jaffee
1c1204fc77
modify PQL parser to handle escapes in string values
This modifies the parser to properly "unquote" incoming strings. So if
a string comes in double or single quoted, we approximately follow Go
rules for removing the quotes and processing escape sequences.

The differences from Go are:
1. we only support backslash, quote, tab and newline escape
sequenences.
2. Single quoted strings are supported and work just like double
quoted strings.
3. The peg parser won't actually accept backquoted strings (I don't
think)

Fixes: #411
2020-05-29 07:58:50 -05:00
tgruben
c177bf831d
Merge pull request #409 from tgruben/transaction-doc-update
correction to endpoint
2020-05-29 07:22:18 -05:00
tgruben
242b3d4b14
Merge branch 'master' into transaction-doc-update 2020-05-29 07:02:02 -05:00
seebs
6aa5041de6
Merge pull request #313 from seebs/roaring4g
Handle file sizes over 4GB
2020-05-28 22:55:24 -05:00
Seebs
1ca9435af9 Handle file sizes over 4GB
We only have 4 bytes for offsets, but what if a file is
over 4GB? Someone came to us with a file with 265 *million* containers,
in a single fragment, which means that over 3GB of their 4.7GB file
is actually just the container headers alone. But we can't easily make
the offsets larger, or change the file format.

So we don't. We just track how many 4GB hunks of the file we've
been through and bump that every time the 32-bit offset wraps. And this
appears to... just work.

This is fixed for both the roaring iterator and the old unmarshalBinary
logic. The logic to handle this will work on 32-bit hosts in the sense
that it will correctly error out for excessively large file sizes or
container counts, but it doesn't actually handle the large files since
it can't.
2020-05-28 17:08:32 -05:00
Todd Gruben
4d1ce90b32 correction to endpoint 2020-05-28 15:36:00 -05:00
tgruben
a777eddfcf
Merge pull request #405 from tgruben/trace-tagging
added some context to tracing
2020-05-28 13:34:19 -05:00
tgruben
5cd15b250a
Merge branch 'master' into trace-tagging 2020-05-27 15:46:51 -05:00
Todd Gruben
4274d2d141 convert to camelCase 2020-05-27 15:23:13 -05:00
Kuba Podgórski
6ed3bde54e
Merge pull request #407 from kuba--/status
Add grpc uri to status
2020-05-27 17:26:32 +02:00
Kuba Podgórski
604f3b3373 Add grpc uri to status 2020-05-27 16:41:38 +02:00
Jaden Weiss
e0291e9d25
Merge pull request #398 from jaddr2line/transactionmetrics
add metrics for transactions
2020-05-27 08:52:53 -04:00
Jaden Weiss
efef42ae97
Merge branch 'master' into transactionmetrics 2020-05-27 08:36:23 -04:00
Todd Gruben
022019c6cc removed shard level tracing tag 2020-05-26 23:23:57 -05:00
Travis Turner
ffa40b1bdb
Merge pull request #387 from travisturner/int-eq-null
Add support for `intfield == null`
2020-05-26 21:05:42 -05:00
Todd Gruben
a2f825a32e added some context to tracing 2020-05-26 17:18:23 -05:00
Jaden Weiss
a4643084bd
Merge branch 'master' into transactionmetrics 2020-05-26 17:55:12 -04:00
Jaden Weiss
5644fb2275
add metrics for transactions 2020-05-26 17:51:28 -04:00
Travis
e4b9293f26
Add support for int == null 2020-05-22 12:29:52 -05:00
Travis Turner
d36f397a35
Merge pull request #404 from travisturner/row-todos
clean up the TODOs and some comments
2020-05-22 12:05:58 -05:00
Travis
041726fbf7
clean up the TODOs and some comments 2020-05-22 11:00:22 -05:00
Travis Turner
2586661812
Merge pull request #402 from travisturner/roaring-tests
Address TODOs in roaring tests
2020-05-21 19:50:38 -05:00
Travis
0a94f8393f
Address TODOs in roaring tests
In addition to adding some tests, this commit moves the
`GenerateUint64Slice()` helper function into  a new `generator` package
so that it can be used in both internal and non-internal tests.
2020-05-21 13:28:54 -05:00
Jaden Weiss
c04143fd61
Merge pull request #394 from jaddr2line/nextdelete
fix use-after-free in b-tree bitmap update
2020-05-20 13:39:05 -04:00
alisharawal
aa0cfecdb3
Update README.md 2020-05-20 11:37:22 -05:00
Jaden Weiss
6e3e513425
roaring: fix use-after-free in b-tree bitmap update 2020-05-20 12:01:21 -04:00
Travis Turner
8eae053fe6
Merge pull request #395 from travisturner/roaring-todos
clarify a few of the TODO comments
2020-05-19 15:16:05 -05:00
Travis
631d3deeed
clarify a few of the TODO comments 2020-05-19 13:50:48 -05:00
Travis Turner
4b4fd590ca
Merge pull request #389 from travisturner/proto-todos
finish implementing PairField proto encoding
2020-05-19 08:54:58 -05:00
Travis
4fb3820afb
finish implementing PairField proto encoding 2020-05-18 20:19:22 -05:00
Travis Turner
231fef27eb
Merge pull request #390 from travisturner/deadline-skew
increase test deadlineSkew to 1s
2020-05-18 20:18:51 -05:00
Travis
42814bb70c
increase test deadlineSkew to 1s 2020-05-18 19:57:44 -05:00
Travis Turner
63dd5e1174
Merge pull request #386 from travisturner/bsigroup-edges
Fix edge case bugs in range queries
2020-05-18 15:02:50 -05:00
Travis
d0de49ef39
handle edge cases in range queries 2020-05-16 10:35:35 -05:00
seebs
c6d61391d2
Merge pull request #249 from seebs/roaringrow
use roaring row support internally
2020-05-15 17:00:17 -05:00
Seebs
0ddc968001 cache result of marshalling import-was-OK message
This message gets generated millions of times and it's unchanging
for the life of the program, and small.
2020-05-15 16:22:08 -05:00
Seebs
79940cf077 encoding/proto: allow distinct serializers
We want to be able to control whether or not we use roaring to
serialize Rows, which means serializers have to be able to be
distinct.

We also make corresponding changes to http/handler.go to have
it use the exported serializers directly rather than the API's
serializer (which is always the base protobuf serializer
right now, and if it weren't, that would be bad because we
were assuming it was).

When we're accepting protobuf from a pilosa server, flag that
we'll accept roaring bitmaps as opposed to the naive column
representation.
2020-05-15 16:22:08 -05:00
Seebs
ce0761050e less spammy snapshotqueue
During testing we spawn a lot of tiny snapshot queues. Make the message
less spammy by printing it only if any enqueues were skipped (shouldn't
ever happen) or more than one thing got enqueued (likely in real usage,
but doesn't happen in testing usually).
2020-05-15 16:22:08 -05:00
Kuba Podgórski
3151d83136
Merge pull request #383 from kuba--/grpc-err/356
Wrap grpc resp.Err
2020-05-15 23:14:41 +02:00
Kuba Podgórski
3fe85d0f91 Move grpc_internal_test to grpc_test 2020-05-15 19:52:03 +02:00
Kuba Podgórski
ea08cce8fe
Update api.go
Co-authored-by: Travis Turner <travis@pilosa.com>
2020-05-15 19:39:36 +02:00
Kuba Podgórski
f40601f6f5 Wrap grpc resp.Err 2020-05-15 18:16:31 +02:00
Kuba Podgórski
e39334ca92
Merge pull request #377 from kuba--/opt-indiagnostics/310
Disable diagnostics by default
2020-05-15 02:09:31 +02:00
Kuba Podgórski
7ee8f80012
Merge branch 'master' into opt-indiagnostics/310 2020-05-15 00:53:33 +02:00
Kuba Podgórski
fc9e75edc2
Merge pull request #378 from kuba--/off-ae/340
Turn anti-entropy off by default
2020-05-13 14:26:13 +02:00
Kuba Podgórski
fd27cbb886
Update server/config.go
Co-authored-by: Matthew Jaffee <matthew.jaffee@gmail.com>
2020-05-12 18:51:53 +02:00
Kuba Podgórski
889f79d11a Turn anti-entropy off by default 2020-05-12 16:49:43 +02:00
Kuba Podgórski
368cb8cb53 opt-in diagnostics 2020-05-12 15:37:47 +02:00
Travis Turner
2f44a16755
Merge pull request #374 from travisturner/todo-fixes
tidy up some of the TODO comments
2020-05-10 21:45:13 -05:00
Travis
bc8244a581
well, put the TODO back, just in a different place 2020-05-10 19:18:54 -05:00
Travis
d546b8ac01
use pilosa.ErrNotImplemented for unused interface implementations 2020-05-10 18:50:05 -05:00
Travis
9255d43e9a
tidy up some of the TODO comments 2020-05-09 22:26:12 -05:00
Cody Soyland
16f0b5eaba
Merge pull request #343 from codysoyland/branch-rename
Rename enterprise branch to master
2020-05-08 17:50:02 -05:00
Cody Soyland
b96666d06a Rename enterprise branch to master 2020-05-08 16:29:17 -05:00
Kuba Podgórski
5578eb8daa
Merge pull request #258 from kuba--/intersect-inplace
The first implementation of intersect in place
2020-05-07 11:23:40 +02:00
Kuba Podgórski
c802caeddd The first implementation of intersect in place 2020-05-06 23:59:07 +02:00
Kuba Podgórski
1a00008dbd
Merge pull request #339 from kuba--/getridof-rowid
get rid of rowID from groupby on ints response
2020-05-06 23:43:56 +02:00
Kuba Podgórski
19df3211f9 get rid of rowID from groupby on ints response 2020-05-06 23:23:43 +02:00
Travis Turner
04f09870ec
Merge pull request #338 from travisturner/remove-lookup
remove extra index lookup
2020-05-06 13:54:18 -05:00
Travis
2ca4e971f1
remove extra index lookup 2020-05-06 13:04:46 -05:00
Travis Turner
994ac5aad8
Merge pull request #337 from travisturner/fieldvalue
add FieldValue call
2020-05-06 12:29:39 -05:00
Travis
a91014c7bb
add FieldValue call 2020-05-06 11:52:27 -05:00
Travis Turner
a72de2c68a
Merge pull request #329 from travisturner/cluster-startup
avoid deadlock on translationSync.Reset during startup
2020-05-05 08:56:23 -05:00
Travis
92a94c9ec1
remove noSleep option 2020-05-05 08:31:43 -05:00
Travis
7b36f417d8
avoid deadlock on translationSync.Reset during startup 2020-05-05 08:31:42 -05:00
Travis Turner
f9cb7abccf
Merge pull request #334 from travisturner/block-limits
Fix off-by-one maxRowID in block limits
2020-05-04 14:02:30 -05:00
Travis
de0785d305 add a test for the "clears" bug 2020-05-01 16:15:42 -05:00
Travis
1f308066a7 fix test error messages 2020-05-01 15:54:56 -05:00
Travis
b25796f532 Fix off-by-one maxRowID in block limits
In the case where a block merge needed to occur
on a replica containing a row on the edge of the block,
the existing logic would inadvertently clear the first
row in the next block. This PR fixes that.
2020-05-01 15:15:47 -05:00
Matthew Jaffee
8e0a787ec0
Merge pull request #332 from jaffee/tracing-off
change default tracing config to 'off'
2020-04-30 21:25:02 -05:00
Matt Jaffee
8aa7a76d31
change default tracing config to 'off'
also fix a typo
2020-04-30 15:02:15 -05:00
Cody Soyland
ea99f32d36
Merge pull request #327 from codysoyland/docker-bind-grpc
Bind to public interface in docker image
2020-04-28 14:45:06 -05:00
Cody Soyland
0c7a83dc0b Bind to public interface in docker image 2020-04-28 14:20:22 -05:00
Travis Turner
95d44dce28
Merge pull request #318 from travisturner/config-cmd
suppress test config arguments from pilosa config output
2020-04-24 13:23:36 -05:00
Travis
9405463911 suppress test config arguments from pilosa config output 2020-04-24 11:02:42 -05:00
Travis Turner
022b135538
Merge pull request #316 from travisturner/json-header
Ensure content-type header is application/json where appropriate
2020-04-23 22:10:44 -05:00
Travis
af6eb94c1d increase deadlineSkew so TestTransactionsAPI doesn't fail during race test 2020-04-23 17:26:35 -05:00
Travis
5da907d469 ensure content-type header is application/json where appropriate 2020-04-23 16:24:40 -05:00
Travis Turner
8cf06bf5d9
Merge pull request #314 from travisturner/decimal-adjust-precision
Adjust decimal precision if we have decimal places to sacrifice.
2020-04-23 08:43:23 -05:00
Travis
432e18d571 return early on mantissa=0 2020-04-22 19:11:23 -05:00
Travis
809a02d986 Adjust decimal precision if we have decimal places to sacrifice. 2020-04-22 17:10:05 -05:00
Travis Turner
2795a3f7e2
Merge pull request #309 from molecula/transactions
Transactions
2020-04-22 15:52:42 -05:00
Matt Jaffee
97ae8e0db7
add kuba testcase, fix race
we fix the race by not returning pointers to the things which we're
keeping in the in-memory store
2020-04-22 15:17:25 -05:00
Matt Jaffee
85f57f9975
fix lint 2020-04-22 14:30:14 -05:00
Matt Jaffee
7c7836f16f
convert transactions to be pointers everywhere
I think this will improve the transaction response messages Kuba
mentioned where it was an empty transaction instead of a nil or not
there... if not it should make it easier to do that anyhow.
2020-04-22 14:01:24 -05:00
Matt Jaffee
9dbc6f89db
address minor feedback from previous PR 2020-04-22 12:31:25 -05:00
Matt Jaffee
7da137277c
tweak comment, add validation TODO 2020-04-22 10:42:59 -05:00
Matthew Jaffee
afcb3e7f96
Merge pull request #2 from travisturner/backups
minor code adjustments during review
2020-04-22 07:35:05 -05:00
Travis Turner
c9b7ed51aa
Update deadline comment
Co-Authored-By: Matthew Jaffee <matthew.jaffee@gmail.com>
2020-04-21 17:49:57 -05:00
Travis
08583cf2d0 minor code adjustments during review 2020-04-21 16:54:17 -05:00
Matt Jaffee
a3c5f4822e
keep the zone info back in deadline strings (but output in UTC)
instead of defining them as being in UTC, but not including the zone
info, we will keep the standard format with zone info, but always
output the time in UTC. This means that we can parse incoming
deadlines that happen to have zone information, though I don't think
we ever need to.
2020-04-21 12:29:19 -05:00
Matt Jaffee
5e29effa93
don't wrap error, dedup compare transactions code 2020-04-20 22:30:14 -05:00
Matt Jaffee
b23d27f507
add cluster state validation to API methods for transactions 2020-04-20 22:22:40 -05:00
Matt Jaffee
662ed4f324
invert if statements and fix typos 2020-04-20 22:12:07 -05:00
Matt Jaffee
432ab57822
add license headers 2020-04-20 14:41:05 -05:00
Matt Jaffee
89c1d48a0f
transaction deadline format UTC, lint
also change "deadlineSkew" comparison in tests to account for race tests in CI
seeing false differences
2020-04-20 14:37:28 -05:00
Matt Jaffee
c36952a0f1
propagate context throughout transaction stuff 2020-04-20 13:30:48 -05:00
Matt Jaffee
41975de6b8
add transactions external documentation
- make sure client reads/closes all bodies
- support blank transaction ID in http handler
2020-04-20 13:30:48 -05:00
Matt Jaffee
210c7239ab
add HTTP handlers and client for transactions 2020-04-20 13:30:48 -05:00
Matt Jaffee
9ad1106647
implement transaction API layer and intra-cluster messaging
also adds a "noSleep" option to the server command to avoid the 5
second sleep we introduced on startup for non-coordinator cluster
nodes. The sleep doesn't seem to be needed in the tests and makes them
much slower.
2020-04-20 13:30:48 -05:00
Matt Jaffee
088e60b830
better defer that Unlock 2020-04-20 13:30:48 -05:00
Matt Jaffee
38cec6f20e
add TransactionManager and TransactionStore for transactions/backups
This all needs to be wired into API/Server/Cluster/Holder etc. but I
think the TransactionManager will be a pretty good building block for
managing transaction state at the coordinator level.
2020-04-20 13:30:48 -05:00
Seebs
c3ef9a1768
draft outline of transaction API 2020-04-20 13:30:47 -05:00
Cody Soyland
a353527705
Merge pull request #307 from codysoyland/copy-reopen
Copy reopen.FileWriter into pilosa
2020-04-20 12:41:09 -05:00
Cody Soyland
761b090f3c Fix linter error 2020-04-20 12:10:44 -05:00
Cody Soyland
5e1c72e6f2 Copy reopen.FileWriter into pilosa 2020-04-20 11:58:09 -05:00
Travis Turner
53500e5ad5
Merge pull request #304 from travisturner/grpc-listener
move gRPC listener creation outside of grpcServer
2020-04-18 13:14:12 -05:00
Travis
7de8399b17 move gRPC listener creation outside of grpcServer
For tests, we need to create the grpc listener with port 0 in order to
automatically assign a port. This PR moves the lister creation outside
of the grcpServer itself so that we can access that auto-created port.
2020-04-18 11:38:15 -05:00
Travis Turner
72d496f5c7
Merge pull request #302 from travisturner/grpc-client-queryunary
add QueryUnary to the grpc client api
2020-04-17 16:32:41 -05:00
Travis
2b98ef5edb add QueryUnary to the grpc client api 2020-04-17 16:12:10 -05:00
seebs
26091bd3ed
Merge pull request #301 from codysoyland/makefile-checkptr
Use makefile variable for NOCHECKPTR
2020-04-17 15:57:33 -05:00
Cody Soyland
3b5908332d Use makefile variable for NOCHECKPTR 2020-04-17 15:15:43 -05:00
seebs
f8f924e972
Merge pull request #300 from seebs/groupby
GroupBy should terminate even if the last result is empty
2020-04-17 15:13:49 -05:00
Seebs
3a7ab3b8eb GroupBy should terminate even if the last result is empty
If you have two criteria, and the last result you generate is
empty, the nextAtIdx iterator for i==1 will try to continue
poking the i==0 iterator. That one produces a nil result, and
declares the entire group-by iterator done... But the nextAtIdx
call above it isn't checking that, and just loops forever.
This causes some queries to become stuck permanently, consuming
ridiculous amounts of resources almost entirely focused on
calling Intersect millions of times to get empty results.
2020-04-17 14:39:03 -05:00
Cody Soyland
398ce117ec
Merge pull request #287 from codysoyland/logger
Reopen log file on SIGHUP
2020-04-17 12:40:25 -05:00
Cody Soyland
1058440cfe Do not reuse error object (data race) 2020-04-16 17:08:50 -05:00
Cody Soyland
e4cd1b8871 Add -v flag to test-race 2020-04-16 17:08:50 -05:00
Cody Soyland
a00e93f699 Add TODO about fork 2020-04-16 17:08:50 -05:00
Cody Soyland
2155d6cab8 Move some things around, fix linter warnings. 2020-04-16 17:08:50 -05:00
Cody Soyland
a66ee26a6b Reopen log file on SIGHUP 2020-04-16 17:08:50 -05:00
Cody Soyland
08fa90e0f3 Reduce duplication of setupLogger arch-specific code 2020-04-16 17:08:50 -05:00
Travis Turner
46fb6859ed
Merge pull request #296 from travisturner/grpc-tabler-rowser
gRPC tabler rowser
2020-04-16 15:19:47 -05:00
Travis
c45a4bf3dc ToTable and ToRows interface for gRPC 2020-04-16 14:16:54 -05:00
Travis Turner
0691b6c015
Merge pull request #294 from travisturner/overflow-fix
error on potential overflow
2020-04-15 16:24:37 -05:00
Travis
80f1bdebd7 error on potential overflow 2020-04-15 15:50:03 -05:00
Travis Turner
468b69fba9
Merge pull request #291 from travisturner/range-problems
fix some range query problems
2020-04-15 15:27:12 -05:00
Travis
8a22a3ede3 fix some range query problems 2020-04-15 14:42:16 -05:00
Travis Turner
37f05fc3ea
Merge pull request #288 from travisturner/upgrade-min-max
upgrade decimal min/max with scale
2020-04-15 08:08:00 -05:00
Travis
79a6c1e5ab upgrade decimal min/max with scale 2020-04-15 00:14:07 -05:00
seebs
f41bced2ec
Merge pull request #286 from seebs/storeauto
in Store/SetRow, create field if it doesn't already exist
2020-04-14 15:33:10 -05:00
Seebs
70bfe86f75 in Store/SetRow, create field if it doesn't already exist
If you try to Store to a nonexistent field, we create an automatic
Set field with no cache for it, assuming it won't be used for TopN
queries. If you want TopN to work, you need to actually create it
yourself.
2020-04-14 15:12:36 -05:00
alanbernstein
18d01dd62a
Merge pull request #280 from alanbernstein/snake-case-node
Snakify
2020-04-11 13:25:58 -05:00
Alan Bernstein
615c1bd186 Snakify 2020-04-10 22:15:43 -05:00
Matthew Jaffee
76404142ba
Merge pull request #246 from molecula/prometheus-improvements
Prometheus improvements
2020-04-10 21:55:35 -05:00
Matt Jaffee
68276159ca
don't access req.Query before knowing req is a QueryRequest 2020-04-10 21:07:43 -05:00
Alan Bernstein
18c6d8f76f
Update a few metric names 2020-04-10 20:59:20 -05:00
Alan Bernstein
71b9762501
Address review feedback again 2020-04-10 20:59:20 -05:00
Alan Bernstein
9947c92e8e
Add stats labels and slow-query log in GRPC endpoints 2020-04-10 20:59:20 -05:00
Alan Bernstein
eaf21eb19b
Add metrics for GRPC request timing 2020-04-10 20:59:19 -05:00
Alan Bernstein
5df680fb9f
Remove old metric from tests 2020-04-10 20:59:19 -05:00
Alan Bernstein
d79f04b7b3
Remove MetricMaximumRow 2020-04-10 20:59:19 -05:00
Alan Bernstein
a7bfacbee2
Revert "Add tags to MaxRow metric"
This reverts commit 6013e7211b3aef93d0880401c8ef74b34a620328.
2020-04-10 20:59:19 -05:00
Alan Bernstein
b37a0addb3
Add tags to MaxRow metric 2020-04-10 20:59:19 -05:00
Alan Bernstein
b1838159f2
Minor fixes 2020-04-10 20:59:19 -05:00
Alan Bernstein
df2503dfa6
Switch to Timing helper function 2020-04-10 20:59:19 -05:00
Alan Bernstein
2423ecf8d5
Update some metric names to follow conventions better 2020-04-10 20:59:19 -05:00
Alan Bernstein
f883d61c28
Consolidate BlockRepair metrics with tags 2020-04-10 20:59:18 -05:00
Alan Bernstein
389acfc8ed
Fix minor issues with metric labels and tests 2020-04-10 20:59:18 -05:00
Alan Bernstein
c2c0a5c32f
Address review feedback 2020-04-10 20:59:18 -05:00
Alan Bernstein
8b405c226c
Add 'prometheus' option in other help text/comments 2020-04-10 20:59:18 -05:00
Alan Bernstein
a3fb1c022b
Use metrics consts in tests 2020-04-10 20:59:18 -05:00
Alan Bernstein
8c9db373d0
Fix some metrics names 2020-04-10 20:59:18 -05:00
Alan Bernstein
5137f56f9c
Use const from package 2020-04-10 20:59:18 -05:00
Alan Bernstein
34c6d42063
Fix broken metrics label and log when others are encountered 2020-04-10 20:59:17 -05:00
Alan Bernstein
3c275681d2
Profile -> Column 2020-04-10 20:59:17 -05:00
Alan Bernstein
b1adcd91fc
Use consistent metric name convention 2020-04-10 20:59:17 -05:00
Alan Bernstein
70111b5604
Define metrics names as constants 2020-04-10 20:59:17 -05:00
Alan Bernstein
84e6a25bad
Update help message 2020-04-10 20:59:17 -05:00
Alan Bernstein
857ddf73c2
Reduce snapshot verbosity 2020-04-10 20:59:17 -05:00
Alan Bernstein
eceef6b42b
Use 'query_' prefix to identify query metrics 2020-04-10 20:59:16 -05:00
tgruben
550fcec9ee
Merge pull request #279 from tgruben/fix-closers
Closed all post request bodies and optimized available shard with new view capabilities
2020-04-10 20:29:04 -05:00
Todd Gruben
ccc7ca3aa5 close not needed 2020-04-10 20:12:32 -05:00
Todd Gruben
5590f1d954 lint fix 2020-04-10 19:07:01 -05:00
Todd Gruben
ef5a8cefef Added request Close and optimized availble shard with new view capabilities 2020-04-10 17:59:44 -05:00
seebs
4325d62fe7
Merge pull request #277 from seebs/between
Return empty rows for impossible ranges
2020-04-10 16:21:09 -05:00
Seebs
017e65cd99 Return empty rows for impossible ranges
If the high end of a range is below the low end of the range, there's
no values in it, so we can short-circuit that. If we don't, if the
low end is zero or higher, and the high end is below zero, we can
get very surprising behaviors, such as accepting values up to the
inverse of the high end. Add a test case for this and treat it the
same as a low range end above the field's maximum or a high end
below the field's minimum, returning an empty row immediately.
2020-04-10 13:24:08 -05:00
seebs
9b002bcc24
Merge pull request #271 from seebs/decimalfault
Handle nonexistent shards in min/max decimal queries.
2020-04-09 22:01:07 -05:00
Seebs
8e662d33a5
Handle nonexistent shards in min/max decimal queries.
If a shard has never had any decimal values in it at all for a
field, the ValCount object returned has no DecimalVal, which could
cause a segfault if we don't check for it. Add a test case which
sporadically triggers that behavior (it's timing/luck related,
unfortunately), and then also fix it.
2020-04-09 21:30:34 -05:00
Matthew Jaffee
179cab91e7
Merge pull request #275 from travisturner/serialize-null
serialize null operation (!= null)
2020-04-09 21:25:05 -05:00
Travis
88b2d79812 serialize null operation (!= null) 2020-04-09 17:56:27 -05:00
alanbernstein
0e6ed80bd4
Merge pull request #269 from alanbernstein/long-query-full
WIP Show full query string when logging slow queries
2020-04-09 16:12:11 -05:00
Alan Bernstein
92416018d5
Use more general log message 2020-04-09 15:53:40 -05:00
Alan Bernstein
5aebb242f8
Fix off-by-one error 2020-04-09 15:53:40 -05:00
Alan Bernstein
e3ace544ca
Show full query string when logging slow queries 2020-04-09 15:53:39 -05:00
tgruben
57b2f32fa1
Merge pull request #260 from tgruben/sync-start
delay start for non-coordinator
2020-04-09 14:42:41 -05:00
Todd Gruben
e7bbc3a0a8 Added delay to allow cooridinator a head start in launch on multi node clusters.
considered using Cluster.Disabled to identify if pilosa was stand alone but settled
on using an empty gossip seeds list
2020-04-09 14:20:01 -05:00
alanbernstein
bdfad719df
Merge pull request #263 from alanbernstein/grpc-multi
Support multiple dialTargets and cycle through on connection reset
2020-04-08 13:39:58 -05:00
alanbernstein
1846d21765
Merge pull request #1 from travisturner/dialtargets
cycle through dial targets regardless of error
2020-04-08 12:55:17 -05:00
Travis
8f0ae1b6f5 cycle through dial targets regardless of error 2020-04-08 12:29:15 -05:00
Alan Bernstein
adb21589f0 Support multiple dialTargets and cycle through on connection reset 2020-04-08 10:09:49 -05:00
seebs
1b5d86c8f0
Merge pull request #240 from seebs/q2perf
improve performance of difference/not
2020-04-07 20:24:51 -05:00
Seebs
be379e7806 cache AvailableShards
The computation of available shards is cheap, because realistically, virtually
no one has enough shards that the resulting bitmap is more than one container.

We don't try to fix this at the field/index levels because it's significantly
harder to do there, but I think the creation of these bitmaps is probably
the most expensive part, and switching the unions to union-in-place probably
reduces cost significantly.

Note that the bitmaps being unioned almost certainly have exactly one small
container in them.
2020-04-07 19:33:21 -05:00
Seebs
6c797e0c4e TODO => TODONE: use masks for runToBitmap
Had the code lying around from mad science elsewhere, backported.
2020-04-07 19:33:21 -05:00
Seebs
d4e496887b make differenceRunBitmap smarter
We avoid using bitmapContains so often because that turns out to be expensive.
Also, if we produce more than runMaxSize runs, we're going to convert to
a bitmap container (or possibly an array container if there were over
2048 items, but they're all singletons), and we can streamline that by just
converting the source to bitmap and returning differenceBitmapBitmap, which
is faster in this case.

This appears to overall take about half as long in the workload I was
looking at.
2020-04-07 19:33:20 -05:00
Kuba Podgórski
7868188670
Merge pull request #200 from kuba--/groupby-int/124
Group by on ints
2020-04-08 01:47:17 +02:00
Kuba Podgórski
1217deee1c Rebase 2020-04-08 01:06:18 +02:00
tgruben
64caffebe8
Merge pull request #196 from tgruben/async-available-shards
limit frequency of writes for available shards broadcast
2020-04-06 09:08:04 -05:00
Todd Gruben
6712f8cf06 removed debug log 2020-04-06 08:43:30 -05:00
Todd Gruben
5470753cb5 fix conflict 2020-04-05 18:37:11 -05:00
Travis
0e2bb550db add deleted (rebalanced) shards to remoteAvailableShards 2020-04-05 18:37:11 -05:00
Todd Gruben
6bd81b87eb unexport availableShardFileFlushDuration 2020-04-05 18:37:11 -05:00
Todd Gruben
000ea90877 unbuffer channel 2020-04-05 18:34:43 -05:00
Todd Gruben
af068e08e7 cleanup and comments 2020-04-05 18:34:43 -05:00
Todd Gruben
40a3dce93c Co-authored-by: Travis Turner <github@calfrope.com> 2020-04-05 18:34:43 -05:00
Todd Gruben
bb04f7f6ac limit frequency of writes for available shards 2020-04-05 18:31:28 -05:00
Cody Soyland
0a86f6a97b Increase gRPC maximum message length 2020-04-03 16:35:57 -05:00
Travis
b7fcfb41d9 add proto OldMin/OldMax for backward compatibility 2020-04-03 12:25:07 -05:00
Travis Turner
48879107b0
Merge pull request #244 from travisturner/fix-race
make sure frag.maxRow() call is lock-protected
2020-04-02 23:52:38 -05:00
Travis
b4f1781d30 make sure frag.maxRow() call is lock-protected 2020-04-02 23:25:57 -05:00
seebs
632f6856ab
Merge pull request #229 from seebs/checkptr
disable checkptr with go 1.14
2020-04-02 22:19:45 -05:00
seebs
a20532073b
Merge branch 'enterprise' into checkptr 2020-04-02 20:48:49 -05:00
alanbernstein
4faacad4cf
Merge pull request #242 from molecula/prometheus-options
Add options to prometheus client to support setting namespace
2020-04-02 20:24:15 -05:00
Alan Bernstein
dad4ccf103 Propagate namespace to tags client 2020-04-02 19:29:46 -05:00
Alan Bernstein
110d2b6024 Restore lost comment 2020-04-02 19:07:43 -05:00
Alan Bernstein
f15d031c55 Add options to prometheus client to support setting namespace 2020-04-02 19:05:55 -05:00
Travis Turner
7432546af8
Merge pull request #241 from travisturner/shardwidth22-tests
alter tests to allow for shardwidth22
2020-04-02 18:25:29 -05:00
Travis
182c1d3c42 alter tests to allow for shardwidth22
also, reset BitDepth on field and bsiGroup during
importRoaringOverwrite
2020-04-02 17:32:49 -05:00
Cody Soyland
da503776e2
Merge pull request #237 from codysoyland/ci-tweaks
CI: Modify Docker Hub rules and use "make test-race" for running race detector
2020-04-02 12:25:40 -05:00
Cody Soyland
6a639efdba Modify Docker Hub deployment filter rules.
The documentation is unclear/incorrect, and these filters aren't
behaving correctly. This is an attempt at fixing that. More info at:
https://discuss.circleci.com/t/job-runs-even-when-tags-ignore-filter-is-triggered-when-combined-with-branches-only/20664/11
2020-04-02 12:14:37 -05:00
Cody Soyland
14319cc54b Use "make test-race" instead of custom test flags in CI 2020-04-02 12:14:37 -05:00
Seebs
c6799bd604 disable checkptr with go 1.14
The checkptr feature is actually probably right about a few
things in roaring and boltdb, but we can ignore them for now, and
that prevents checking for races, so we disable that temporarily.

Also supply NOCHECKPTR in non-race tests because CI uses "make test"
with -race in $TESTFLAGS and we might do that on other occasions.
2020-04-02 11:37:06 -05:00
Matthew Jaffee
44fcbee447
Merge pull request #235 from jaffee/nil-check-indexmeta
add nil check for index meta
2020-04-02 11:33:25 -05:00
Matt Jaffee
35fa26918d
add nil check for index meta 2020-04-02 11:09:07 -05:00
Travis Turner
794bc5b168
Merge pull request #232 from travisturner/decimal-grcp
convert grpc response to use pql.Decimal
2020-04-02 07:55:26 -05:00
Travis
4d985653ae convert grpc response to use pql.Decimal 2020-04-01 23:59:50 -05:00
Travis Turner
0b480f8405
Merge pull request #231 from travisturner/reintroduce-decimal
Reintroduce decimal
2020-04-01 21:44:26 -05:00
Travis
22cca67d6a Revert "back out the pql.Decimal changes"
This reverts commit 741ba9b268.
2020-04-01 17:46:46 -05:00
Matthew Jaffee
e77bf45643
Merge pull request #227 from travisturner/backout-decimal
back out the pql.Decimal changes
2020-04-01 11:32:02 -05:00
Travis
741ba9b268 back out the pql.Decimal changes 2020-04-01 11:10:33 -05:00
Cody Soyland
1284791d22
Merge pull request #224 from codysoyland/ci-fixes
CI fixes: quote TESTFLAGS and fix stable release filter
2020-04-01 09:41:38 -05:00
Cody Soyland
dc5a471939 Downgrade golangci-lint to 1.23.8 (attempt fix for OOM failures) 2020-04-01 09:07:11 -05:00
Cody Soyland
39d83e7b6f Add no_output_timeout for the race detector 2020-04-01 09:07:11 -05:00
Cody Soyland
01033d4fff CI fixes: quote TESTFLAGS and fix stable release filter 2020-04-01 09:07:11 -05:00
Kuba Podgórski
b0f1ee3fce
. (#225) 2020-04-01 15:19:05 +02:00
seebs
c6083d6816
Merge pull request #163 from seebs/distinctshards
Address issues with Distinct failures in testing, or across shards, or in cases where the range of Distinct results is not the same as the range of shards available in any index.
2020-03-31 21:06:16 -05:00
Travis
0374bda45f Adjust bare-distinct logic.
If an index is provided to a bare distinct which happens
to be the index handling the query, then the query needs
to behave as if no index argument was provided.

For example:

When querying against index `i`,
```
Distinct(index="i", field="ints")`
```
should behave exactly like
```
Distinct(field="ints")
```
2020-03-31 19:51:06 -05:00
Seebs
a495b6c227 make Distinct work across nodes, probably
Problem: A top-level bare "Distinct" call returns results only
for shards on the current node.

Analysis: We don't actually want to limit Distinct calls to "available"
shards at all. We just want to run them on everything. But we already
did that in generating the precomputed results; all we need to do is,
if we get a non-shard-specific request for precomputed values, just
return all the values.

It's pretty hard to create logic for this using our fancy mapReduce,
but also we could just... not do that.
2020-03-31 19:51:06 -05:00
seebs
12ba11a437
Merge pull request #215 from seebs/mmap-v-cache
clear container lookup cache when updating every container, handle nils with differenceInPlace, use transaction/ops log for mergeBlock.
2020-03-31 19:49:43 -05:00
Seebs
76e7470559 make mergeBlock use transactions
mergeBlock was bypassing the transaction setup stuff, which means that
if we ran out of open files, mergeBlock wouldn't generate ops log
entries (!), also it didn't update the cache (!). This came up because
it also didn't enjoy the "catch your segfaults and issue a diagnostic"
behavior offered by the generation code.

Switch to computing positions directly and calling importPositions,
which does a transaction.
2020-03-31 16:22:41 -05:00
Seebs
28b9d6d7fc ditch lastKey cache on UpdateEvery
UpdateEvery can change every key, and I think it strongly suggests no
reasonable expectation of repeated access to a previously-accessed key,
but also it can change the containers and replace them.

We were avoiding caching mapped containers in some but not all cases,
and that was causing segfaults. But really, the *problem* is that
the remap operation wasn't clearing (or updating) the cache. Cleaning
that up allows us to take advantage of the caching performance advantage
even when working with read-only/mapped bitmaps.

The only way to hit this:

* Have mmapped containers to begin with.
* Do reads so those containers get frozen.
* Access, either reading or writing, a specific container with key K.
* Snapshot, so the bitmap gets its containers replaced.
* Remember, they have to be frozen -- if they aren't frozen,
  we'll update the containers in place.
* Now have GC run so it actually unmaps the data.
* Now try to write to the container with key K *before reading or
  writing any other key*. You have to get through the whole snapshot
  and GC process without any other reads or writes.
* You get the cached value. You try to use it. You explode.

The sliceContainers code was also setting lastKey to 0 in some cases,
but also setting lastContainer to nil, so this wouldn't have caused
problems, but just to be careful, I've standardized on ^uint64(0)
for everything.
2020-03-31 16:20:05 -05:00
Seebs
1ac00291f3 Add test for the weird remapping/cache interaction.
This test is really a test of a very specific bit of the internals
of containers_btree/containers_slice, but we can't easily test it from
there because they don't have all the logic for remapping files.

The underlying issue is that they maintain a single-item "most recent
container" cache, and this wasn't getting updated during the remap
operations, happening through containers.UpdateEvery. The fix is
probably just to make sure that UpdateEvery invalidates the cache.
2020-03-31 16:20:05 -05:00
Seebs
d26e221a91 don't call isArray on a nil *Container
differenceInPlace wasn't checking for nil containers, which are
theoretically valid empty containers. Also added a couple of other
N==0 checks to streamline the higher-level operation.
2020-03-31 16:20:05 -05:00
Cody Soyland
3b6a26e5c6
Merge pull request #219 from codysoyland/ci-updates
Add updated CircleCI config
2020-03-31 16:18:10 -05:00
Cody Soyland
3a7f385a01 Add updated CircleCI config
- Remove YAML magic
- Remove a lot of duplication
- Update linter
- Use parameterized jobs and matrix build
- Update Docker Hub CD to produce versioned and "latest" images
- Add custom shard width test to workflow
2020-03-31 15:17:11 -05:00
Travis Turner
b5aa280ced
Merge pull request #220 from travisturner/decimal-yaml
yaml marshal/unmarshal for pql.Decimal
2020-03-31 13:53:00 -05:00
Travis
7cb265098f yaml marshal/unmarshal for pql.Decimal 2020-03-31 12:43:42 -05:00
Kuba Podgórski
6dc3837c9a
WIP: fix 'unknown call: Distinct' error (#213) 2020-03-31 16:29:14 +02:00
Travis Turner
dca2120c06
Merge pull request #199 from travisturner/cluster-resize-translation-partitions
include translate partitions in cluster resize instructions
2020-03-30 22:01:09 -05:00
Kuba Podgórski
ac76f6227d
Make internal.IndexMeta.TrackExistence true 2020-03-30 21:24:16 -05:00
Travis
98c5603965
close reader. include all replias in translation partition rebalance 2020-03-30 21:24:16 -05:00
Travis
4c311aa1a7
write to temp partition file. use io.Copy 2020-03-30 21:24:16 -05:00
Travis
2724ecfd5f
WIP: include translate partitions in cluster resize instructions
This commit adds `TranslationSources` to the cluster
`ResizeInstruction`. These are the sources of translation
partitions which the receiving node needs in order to support
partition distribution in the new, resized cluster.

This also fixes a bug where index options were not being
encode in the proto Index object. That meant that the schema
transferred via protobuf was not correct. The reason why
things normally worked is because index creation typically
happens on the CreateIndex message, which does include the
options.

TODO:

- [ ] implement the TranslateStore interface for `InMemTranslateStore`
and `mock.TranslateStore`
- [ ] surely need some more tests around the `ReadFrom` and `WriteTo`
2020-03-30 21:24:16 -05:00
Travis Turner
2ad06f9423
Merge pull request #212 from travisturner/decimal-min-max-args
support pql.Decimal for decimal field min/max arguments
2020-03-30 14:32:02 -05:00
Travis
80da129861 require scale argument for decimal fields 2020-03-30 13:38:50 -05:00
Travis
1da7cf09bb support pql.Decimal for decimal field min/max arguments 2020-03-27 16:02:47 -05:00
Cory LaNou
2a4088e0ec
Merge pull request #206 from corylanou/test-helpers
Make better use of t.Helper
2020-03-25 07:35:35 -05:00
Cory LaNou
391fda9849
Merge branch 'enterprise' into test-helpers 2020-03-24 15:51:01 -05:00
corylanou
f84185230d
make use of t.Helper 2020-03-24 15:00:32 -05:00
Cody Soyland
7ba5c0e3d3
Merge pull request #201 from codysoyland/queryunary
Add QueryPQLUnary gRPC call
2020-03-23 16:58:27 -05:00
Cody Soyland
1aa1ec51aa Add QueryPQLUnary gRPC call 2020-03-23 16:24:31 -05:00
Cory LaNou
69a1365bf0
Merge pull request #202 from corylanou/sum/194
Fixed sum for negative values
2020-03-23 16:22:11 -05:00
corylanou
f32f9f64a4
fix sum for negative values 2020-03-23 14:02:46 -05:00
Travis Turner
532f746f25
Merge pull request #195 from travisturner/sync-mutex-bool
support mutex/bool fields in anti-entropy
2020-03-19 11:47:37 -05:00
Travis Turner
5cfb29beb2
Merge branch 'enterprise' into sync-mutex-bool 2020-03-19 11:28:56 -05:00
Travis Turner
564eee0bdf
Merge pull request #190 from travisturner/decimal-between
serialize decimal between pql for internode queries
2020-03-19 11:26:12 -05:00
Travis
57c30b9dae support mutex/bool fields in anti-entropy 2020-03-19 11:11:33 -05:00
Travis
4d38723fd4 serialize decimal between pql for internode queries 2020-03-19 07:50:43 -05:00
Travis Turner
419c2179b5
Merge pull request #185 from travisturner/decimal-min-max-overflow
Avoid overflow on decimal min/max default values
2020-03-18 08:01:40 -05:00
Travis
298f290e86
Avoid overflow on decimal min/max default values
If the min/max provided are already on the boundary of int64,
then we don't want to operate on them and cause overflow.
there are still overflow scenarios where a user provides a
min/max which is not on the boundary, but overflow once the
scale is applied. This does not address those cases, but at
least it addresses the default case (where a min/max is not
provided)
2020-03-18 07:41:35 -05:00
Kuba Podgórski
73ca124944
Fix runCountRange when range start == interval start (#181)
When the interval is a proper superset of the range with start equal to
interval start, the range must be considered a superset or it will be
completly ignored (since it neither a subset nor it overlaps)

Co-authored-by: Pierre Fersing <pierre.fersing@bleemeo.com>
2020-03-17 20:31:35 +01:00
Travis Turner
ba5b133e1e
Merge pull request #180 from travisturner/mu-anti-entropy
add mutex for anti-entropy and node join/leave
2020-03-17 13:05:53 -05:00
Travis
fbbd474978 add mutex for anti-entropy and node join/leave 2020-03-17 12:46:09 -05:00
Travis Turner
22ae1139d1
Merge pull request #172 from travisturner/float-to-decimal
use pql.Decimal instead of float64
2020-03-16 08:35:19 -05:00
Travis
c60241b5a9 Get rid of Sign from pql.Decimal struct
It turns out that it's not very useful to keep the sign
value as a separate argument in the pql.Decimal struct.
This commit incorporates it into Value, and makes Value
an `int64` (for some bone-headed reason I had made it a
`uint32` before which is just dumb).
2020-03-15 23:00:00 -05:00
Travis
30e08eb532 add error conditions to tests 2020-03-15 16:18:59 -05:00
Travis
513edeae9c fix min/max bug for decimal fields 2020-03-14 22:35:24 -05:00
Travis
963affcc30 WIP: use pql.Decimal instead of float64
This commit introduces a new type: pql.Decimal
We use that instead of float64 in order to ensure
that the string representation is consistent.

One unfortunate discovery during implementation is
that the RowAttrs and ColAttrs support floats, and
the PEG file was treating them as such. So I had
to split the PEG definitions into float-specific
items and decimal-specific items.
2020-03-14 22:33:52 -05:00
Travis Turner
334eb3cd08
Merge pull request #175 from travisturner/int-min-max-with-offset
Fixes the min/max bug for `int` fields with offset.
2020-03-14 15:18:48 -05:00
Travis
3863ab4b41 Fixes the min/max bug for int fields with offset.
Methods `MinForShard` and `MaxForShard` were not adjusting
their return value by the offset.
2020-03-14 14:01:40 -05:00
Travis Turner
0d55d6eab2
Merge pull request #160 from travisturner/int-fragment-sync-better-fix
support fragment sync for int and decimal fields
2020-03-13 18:42:12 -05:00
Travis
a5cba75855 fix typos in comment 2020-03-13 12:15:54 -05:00
Travis
3b676a7cbd fix linter warnings 2020-03-13 12:15:54 -05:00
Travis
cbf80370cb support fragment sync for int and decimal fields
This PR adds support for anti-entropy syncing for integer
and decimal fields. It differs from the logic for other
field types in that it does not rely on a consensus to determine
what the value should be; instead, it considers the correct
values to be those of the primary replica. From there, data
is pushed to all non-primary replicas.
2020-03-13 12:15:54 -05:00
Cody Soyland
8b5848f615
Merge pull request #164 from codysoyland/dockerfile-env-config
Use env variables instead of flags in Dockerfile
2020-03-12 14:44:45 -05:00
Cody Soyland
c6a293f818 Use env variables instead of flags in Dockerfile
This allows you to override those attributes without overriding the
entire command.
2020-03-12 11:22:31 -05:00
Travis Turner
93a804f7ab
Merge pull request #165 from travisturner/range-ast-fix
fix Call stringer for range conditional
2020-03-12 08:29:38 -05:00
Travis
0c6f0e2ba5 fix Call stringer for range conditional 2020-03-11 22:53:37 -05:00
Travis Turner
d76e8fc17c
Merge pull request #162 from travisturner/makefile-helpers
add linter and test-race targets to makefile
2020-03-11 10:10:41 -05:00
Travis
dde1e26baa add linter and test-race targets to makefile 2020-03-11 09:24:00 -05:00
Travis Turner
cdbb274a2b
Merge pull request #157 from travisturner/int-fragment-sync-quick-fix
temporary fix for int field replica sync bug
2020-03-09 15:22:41 -05:00
Travis Turner
f747501473
Merge branch 'enterprise' into int-fragment-sync-quick-fix 2020-03-09 14:56:06 -05:00
Matthew Jaffee
d0aad872e2
Merge pull request #144 from jaffee/min-con-reuse
Min con reuse
2020-03-09 14:54:56 -05:00
Matt Jaffee
f0f86500c7
add minimal fix for connection reuse issue - @tgruben has a more complete fix 2020-03-07 09:46:47 -06:00
Travis
70c3cf1775 include a basic test which covers the temp fix 2020-03-05 21:16:10 -06:00
Travis
86da5c7adf temporary fix for int field replica sync bug 2020-03-05 20:57:16 -06:00
Travis Turner
b99bdb8169
Merge pull request #156 from travisturner/forward-translation-to-coordinator
forward field translation request to coordinator
2020-03-05 17:53:35 -06:00
Travis
3e4f7dd3f3 change translateFieldKeys to variadic function 2020-03-05 15:38:34 -06:00
Travis
d06ffd207f forward field translation request to coordinator 2020-03-05 14:54:23 -06:00
seebs
bbeacbe3c3
Merge pull request #147 from seebs/emptylog
don't fill up empty space with non-functional ops logs
2020-03-04 18:28:55 -06:00
Seebs
eb263b7666 don't fill up empty space with non-functional ops logs
Two changes:

1. Don't write batch/roaring adds or removes when N is 0, because
a write of no bits is not a meaningful write.
2. When unmarshalling roaring things, if a roaring bitmap didn't
change many bits, treat it as having changed at least 1 bit per 8 bytes,
so an 8KB hunk of roaring data counts as 1K changes, which will
nudge us towards snapshotting. This should keep us from having
Large Files show up so much.

This was particularly noticeable on the existence field, which
tends to a steady state of "completely full" very quickly in a lot
of cases.
2020-03-04 18:10:10 -06:00
Kuba Podgórski
53c486fce0
Remove not needed translationSyncer from holder. (#152) 2020-03-05 00:19:58 +01:00
Travis Turner
78327904ff
Merge pull request #145 from travisturner/translate-partition-better-fix
add translationSyncer interface
2020-03-03 19:42:50 -06:00
Travis
842c820366 add translationSyncer interface
This PR adds a translationSyncer interface; I tried to include
comments in the code explaining what's going on. This is taken
from those comments:

translationSyncer provides an interface allowing a function
to notify the server that an action has occurred which requires
the translation sync process to be reset. In general, this
includes anything which modifies schema (add/remove index, etc),
or anything that changes the cluster topology (add/remove node).
I originally considered leveraging the broadcaster since that was
already in place and provides similar event messages, but the
broadcaster is really meant for notifiying other nodes, while
this is more akin to an internal message bus. In fact, I think
a future iteration on this may be to make it more generic so
it can act as an internal message bus where one of the messages
being published is "translationSyncReset".
2020-03-03 14:21:45 -06:00
Travis Turner
92eae8e715
Merge pull request #146 from travisturner/remove-errant-print
remove errant println from test
2020-03-03 12:39:28 -06:00
Travis
7aea54936e remove errant println from test 2020-03-03 11:27:36 -06:00
Travis Turner
13e7679fd9
Merge pull request #138 from travisturner/translate-partition-quick-fix
very crude fix for the translate key read-only bug
2020-02-29 16:18:50 -06:00
Travis
717bd09e97 include the test which covers this scenario 2020-02-29 08:43:10 -06:00
Travis
fb8f612afe very crude fix for the translate key read-only bug
This PR forces the non-coordinator nodes to reset their translation
sync (and therefore their own cosideration of read-only partitions)
any time they receive a `ClusterStatus` message. So basically, as the
cluster grows during the startup process, each node will reset their
translation sync.

This is NOT a good solution log term, but it should address the
immediate problem.

Things to note:
- the coordinator sync isn't getting reset, but that's ok, because the
immediate problem is a partition marked as read-only when it shouldn't
be; i.e. it's ok to have the inverse (a partition not marked as
read-only when it should be) because that partition won't receive
requests anyway.
- the last node to start is already correct and doesn't really need to
reset its sync.
- there are many other scenarios not covered by this fix.

Based on this theory:

```
i have another theory that i’m going to try to test.
this one would only apply in the case where a multi-node cluster is restarted with an existing, keyed index.
- start node0: it thinks it’s responsible for all partitions (nothing is read-only)
- start node1: it thinks it’s responsible for ~1/2 of the partitions and marks the other 1/2 as read-only
- start node2: it thinks it’s responsible for ~1/3 of the partitions and marks the other 2/3 as read-only
now if node0 is the coordinator receiving all translation requests, that still might not explain what’s happening, because in that case it would just do all the translating. i think. but either way, i should make sure that scenario is not happening, but i think it may be.

actually, that might explain it, because what would happen when the coordinator received a translation request, is that it would handle the 1/3 that it owned (now that the cluster is 3 nodes), and it would send the other 2/3 out to the other 2 nodes. but where it sent the requests wouldn’t line up with what the nodes thought they were responsible for based on the restart order
in this example, node 1 would receive requests for the wrong partitions
```
2020-02-29 08:43:05 -06:00
Matthew Jaffee
fcbebcf1b6
Merge pull request #103 from seebs/gencrash
don't mark a source as changed before we've finished remapping
2020-02-21 17:00:19 -06:00
Seebs
d742c67317
avoid race on max count reads and writes 2020-02-21 16:38:36 -06:00
Seebs
ba7db3028b
sanity-check: check whether containers are flagged as mapped before mapping
In the old unmarshal code, the decision to mark a thing as mapped (always
yes) happens separately from setting the mapping. What if this could ever
somehow possibly go wrong? Let's sanity-check that to be extra careful.
2020-02-21 16:38:35 -06:00
Seebs
7841a660a8
make sure setArray isn't copying mapped data addresses by accident in unionInPlace 2020-02-21 16:38:35 -06:00
Seebs
99d865c2ea
ensure that we've unrequested mapping when applying empty storage 2020-02-21 16:38:35 -06:00
Seebs
337e451cc7
lint and review changes
Log an error in the probably-irrelevant case where we ended up with
a file, but Stat failed, which shouldn't ever happen we hope anyway.

Also explicitly discard the status from RemapRoaringStorage in a case
where we don't care.
2020-02-21 16:38:35 -06:00
Seebs
cb686dcad0
make mmap test experiment with different amounts of mapping
This is sort of prototype-ish, but the idea is that we use SetMaxMapCount
from syswrap, which already exists, to let us test edge cases like
"what happens if you only sometimes have mapped data".
2020-02-21 16:38:35 -06:00
Seebs
63fb2f8539
generation testing and paranoia features
We might have a problem with a stale mmap, and to try to narrow it down
a bit, we add some sanity-checking features and panic recovery to the
generation Transaction code.

This is pretty experimental.
2020-02-21 16:38:35 -06:00
Seebs
372389fd30
don't corrupt files when mmap fails
In some cases, after a snapshot, if mmap fails, we could write
a duplicate of the bitmap to the file, creating cryptic "unknown
op type: 60" messages. This doesn't fix those files, but it stops
making them.
2020-02-21 16:38:35 -06:00
Seebs
f9e7fee47d
don't mark a source as changed before we've finished remapping
Also, check the remap operation for errors, and if an error occurs,
try to remap to nil (which shouldn't be able to fail).
2020-02-21 16:38:34 -06:00
Matthew Jaffee
ebab831a43
Merge pull request #113 from molecula/minMaxFloatHandling
min and max should properly scale their output for decimal fields
2020-02-21 16:38:11 -06:00
Matthew Jaffee
8c9b717b05
fix "worhtless" typo in comment 2020-02-21 16:00:31 -06:00
Matt Jaffee
fe46c84d19
also fix Sum query, but don't convert to float until the last step
this avoids compounding floating point errors while summing up the
numbers, and means less logic needs to change. Should probably convert
min and max to use this approach as well, though they don't suffer
from the compounding error issue, it is simpler.
2020-02-21 14:11:30 -06:00
Matt Jaffee
7321f9427c
min and max should properly scale their output for decimal fields
this involved adding an optional float value to the ValCount struct
which complicated result types, necessitated grpc changes, and needed
quite a few tests at different layers.
2020-02-21 14:11:29 -06:00
Matthew Jaffee
d369e3b4bf
Merge pull request #125 from travisturner/time-panic
send nil time value to prevent downstream panic
2020-02-21 14:08:53 -06:00
Travis Turner
52d450cbaf
Merge branch 'enterprise' into time-panic 2020-02-21 10:31:24 -06:00
Travis
13a1b3a2c1 send nil time value to prevent downstream panic 2020-02-18 15:55:40 -06:00
Kuba Podgórski
f3f11f4a44
Let translate keys as empty strings (#120) 2020-02-18 12:54:24 +01:00
Kuba Podgórski
57eb741c24
Don't allow an int and decimal fields to be created with keys=true (#118) 2020-02-14 08:47:31 +01:00
Kuba Podgórski
59f5d4f7d6
Do not clear existence column (#117) 2020-02-13 07:08:45 +01:00
Travis Turner
4713ccd0c8
Merge pull request #110 from travisturner/translatestore-fixes
WIP: Thread OpenTranslateStore through Holder to Index
2020-02-12 11:56:49 -06:00
Ben Johnson
c8cefea897
Fix test performance 2020-02-12 10:25:26 -06:00
Travis
d9ef4c0986
use OpenInMemTranslateStore by default in tests 2020-02-12 10:25:25 -06:00
Travis
4dd530e956
open bolt translate store partitions asynchronously 2020-02-12 10:25:25 -06:00
Travis
49c8bf01a0
WIP: Thread OpenTranslateStore through Holder to Index 2020-02-12 10:25:25 -06:00
Cody Soyland
f9f6fce6b4
Merge pull request #111 from codysoyland/go-1.14-rc
Add Go 1.14-rc to CI
2020-02-10 07:59:48 -06:00
Cody Soyland
88c3477010 Add Go 1.14-rc to CI 2020-02-06 19:46:01 -06:00
Kuba Podgórski
e77c69d212
Update handler.go (#108) 2020-02-05 22:14:25 +01:00
tgruben
fc6fd150ba
Merge pull request #106 from tgruben/bug-105
handle missing index in join properly
2020-02-05 10:29:56 -06:00
Todd Gruben
0acac34fee travis suggetions 2020-02-04 15:21:55 -06:00
Todd Gruben
3140b2d8cb handle missing index in join properly 2020-02-04 11:55:49 -06:00
Kuba Podgórski
3bb45ea2c0
Fix Set operation for float numbers on decimal fields. (#101) 2020-02-03 19:29:15 +01:00
Kuba Podgórski
7c395ac4d1
Simplify Holder's logic for CreateIndex (#104) 2020-02-03 17:41:06 +01:00
Travis Turner
b693688677
Merge pull request #60 from molecula/translation-sharding
Translation sharding
2020-01-31 10:44:51 -06:00
Travis
9b4c7610e6 Merge branch 'enterprise' into translation-sharding 2020-01-31 10:13:44 -06:00
tgruben
eca14d8608
Merge pull request #97 from tgruben/row-difference-in-place
Difference in place at row level
2020-01-30 15:10:23 -06:00
Travis Turner
8626a2a710
Merge pull request #99 from travisturner/translation-sharding
Ensure ForeignIndex key translation happens in API.
2020-01-30 14:42:41 -06:00
tgruben
1be22f13e8
Merge pull request #2 from travisturner/row-difference-in-place
fix differenceInPlace test
2020-01-30 14:31:30 -06:00
Todd Gruben
f498a40d97 go mod tidy 2020-01-30 14:28:44 -06:00
Travis
0bdcb5ab0a fix differenceInPlace test 2020-01-30 13:38:31 -06:00
Travis
61e527251a fix some comments 2020-01-30 10:56:03 -06:00
Todd Gruben
8de32fd62a high level support for difference in place 2020-01-30 08:11:43 -06:00
Travis
e40400b130 Ensure ForeignIndex key translation happens in API.
For Fields with ForeignIndex (which have keys), the API was missing
the logic to do that translation against the translateStore of
the foreign index. This commit adds that logic, as well as some
missing translateStore-related logic in the gRPC code.
2020-01-28 22:46:12 -06:00
tgruben
32b92abd6e
Merge pull request #94 from tgruben/diff-inplace
Adding roaring in place difference support
2020-01-23 08:23:47 -06:00
tgruben
014c3a98a5
Merge pull request #1 from travisturner/diffinplace
tidy comments and remove pilosa dependency
2020-01-22 12:09:50 -06:00
Travis
bb80d1ed2d tidy comments and remove pilosa dependency 2020-01-22 11:59:32 -06:00
Todd Gruben
f40ced47fa included previous patterns for in place testing 2020-01-21 16:56:33 -06:00
Travis Turner
43b8d7827a
Merge pull request #90 from travisturner/translation-sharding
Field.ForeignIndex translation on ImportValue()
2020-01-17 17:25:14 -06:00
Travis
d41ee99052 linter fix 2020-01-17 14:46:43 -06:00
Travis
b620e37e51 move the foreign index key check into applyTranslateStore() 2020-01-17 14:41:41 -06:00
Travis
f001ad199f use translateIndexKeys instead of translateIndexKeySet in ImportValue() 2020-01-17 11:58:15 -06:00
Travis
efffa39c2c check foreign index on field open 2020-01-17 11:42:21 -06:00
Travis
90a2e116a7 update translateResult to translate foreign index keys on SignedRow results 2020-01-17 11:10:42 -06:00
Travis
0ba5b48fca Field.ForeignIndex translation on ImportValue() 2020-01-16 22:23:29 -06:00
Ben Johnson
10ccb6d523 translate foreign index 2020-01-16 13:53:12 -06:00
Ben Johnson
4020f8c73e fix cross-index translation 2020-01-15 14:28:06 -06:00
Travis
54679c12c4 post merge, needs review of TODOs 2020-01-14 22:10:12 -06:00
Travis
df51f07f96 Merge branch 'enterprise' into translation-sharding 2020-01-14 20:05:12 -06:00
Travis Turner
0459285101
Merge pull request #87 from travisturner/grpc-connection-reset
reset grpc connection after TransientFailure
2020-01-14 16:26:02 -06:00
Travis
757df0d284 reset grpc connection after TransientFailure 2020-01-14 15:18:25 -06:00
Travis
f232ec4277 Merge remote-tracking branch 'upstream/enterprise' into enterprise 2020-01-14 15:18:09 -06:00
Matthew Jaffee
12c6cd1c4e
Merge pull request #88 from jaffee/grpc-mutex-string-bug
mutex field data type should be string not []string
2020-01-12 18:27:47 -06:00
Matt Jaffee
ff9ad9a4fe
mutex field data type should be string not []string 2020-01-12 17:38:43 -06:00
tgruben
ba70bf3079
Merge pull request #89 from tgruben/bug-q2-double-delete
bit remove leaves internals corrupt on empty edge case
2020-01-12 16:25:31 -06:00
tgruben
3261ec4dc4
Merge branch 'enterprise' into bug-q2-double-delete 2020-01-12 16:09:12 -06:00
Todd Gruben
99108a1c63 bit remove leaves internals corrupt on empty edge case 2020-01-12 12:00:00 -06:00
Travis
89f6429dac Merge remote-tracking branch 'upstream/enterprise' into enterprise 2020-01-10 15:45:25 -06:00
Travis Turner
9015c00da9
Merge pull request #84 from travisturner/foreign-index
Add FieldOption.ForeignIndex
2020-01-10 15:45:02 -06:00
Travis
a6a2f84bd5 During Holder.Open, apply foreign index after all indexes open
In the case where a field with a foreign index opens before the
foreign index has opened (and is available as a reference in the
holder), push the field into a queue to have its foreign index
applied once all indexes have opened.
2020-01-10 12:28:28 -06:00
Travis
3d3286a9ca fix an issue caused by empty column list defaulting to IDs 2020-01-10 12:28:28 -06:00
Travis
f79fde43e3 exclude internal fields (i.e. _exists) from Inspect output 2020-01-10 12:28:28 -06:00
Travis
742135dc10 Get ForeignIndex string value when reading BSI field.
In the `Inspect` function in `server/grpc.go`, getting
the value of an `int` field with a foreign index to
an index with `Keys()`, we need to return the string
key value instead of the BSI int value for the field.

This commit also changes the method `Field.keys()` to be
exported as `Field.Keys()` so that it's accessible in
the server package.
2020-01-10 12:28:28 -06:00
Travis
35f9dfa374 remove write portion of extension data race 2020-01-10 12:28:28 -06:00
Travis
881d3bef06 Adjust the FieldOption logic to be in place prior to field.Open().
This commit changes the order of FieldOption application so that
it's always set before field.Open() is called.

This was required because field.Open() now uses some of the values
from FieldOptions to determine if/when to use a particular
translateStore. For example, when FieldOptions.ForeignIndex is set,
the translateStore from the foreign index is retrieved during
field.Open().
2020-01-10 12:28:28 -06:00
Matt Jaffee
4d8f307c5e handle string values in ImportValueRequest sorting 2020-01-10 12:28:28 -06:00
Matt Jaffee
132cf7cc1c add StringValues to proto ImportValueRequest, update proto versions
I ran:

brew upgrade protobuf
GO111MODULE=off go get -u github.com/gogo/protobuf/protoc-gen-gofast

I'm not sure if everything is still going to work, but I'm excited to
find out!
2020-01-10 12:28:27 -06:00
Travis
b22d0143e4 loadNewExtensions is unused, but included for completeness 2020-01-10 12:28:27 -06:00
Travis
1542cbefc0 Add FieldOption.ForeignIndex
This allows a BSI field to have an option indicating
that it is a foreign key to another index. If the foreign
index has column keys, then this field handles string values
by using the foreign index's translate store.
2020-01-10 12:28:27 -06:00
Travis
5ca37bf3f3 reset grpc connection after TransientFailure 2020-01-10 11:49:33 -06:00
Matthew Jaffee
7aef0743e1
Merge pull request #86 from jaffee/field-char-limit
allow field and index names up to 230 characters
2020-01-09 14:43:55 -06:00
Matt Jaffee
0a1de81441
allow field and index names up to 230 characters
The lowest limitation I've seen on any filesystem we care about is 255
characters. 230 leaves enough space that an index or field could be
backed up and have a timestamp and file extension appended while
still allowing for much longer index and field names.
2020-01-09 13:02:22 -06:00
Ben Johnson
cda2729935 fix bitdepth race 2020-01-08 09:47:43 -07:00
Ben Johnson
1f6910b0b8 fix group by test 2020-01-08 09:47:43 -07:00
Ben Johnson
a043490996 add multi-shard translation 2020-01-08 09:47:43 -07:00
Ben Johnson
bdfdeb1291 fix lint 2020-01-08 09:47:43 -07:00
Ben Johnson
a189477ba3 rebase & fix test const 2020-01-08 09:47:43 -07:00
Ben Johnson
1409ab5664 fix data race 2020-01-08 09:47:43 -07:00
Ben Johnson
1b068f75a8 Fix inmem read only translation bug 2020-01-08 09:47:43 -07:00
Ben Johnson
2f76283f03 fix replication errors & test races 2020-01-08 09:47:43 -07:00
Ben Johnson
9647d9b4bb fixing additional tests 2020-01-08 09:47:43 -07:00
Ben Johnson
c0a129979e fix tests 2020-01-08 09:47:43 -07:00
Ben Johnson
e3606d6615 fix id generation 2020-01-08 09:47:43 -07:00
Ben Johnson
82910911dd refactoring id partitioning 2020-01-08 09:47:43 -07:00
Ben Johnson
f31d68739e holder syncer translate implementation 2020-01-08 09:47:43 -07:00
Ben Johnson
b3e86e8394 refactoring stores back into index/field 2020-01-08 09:47:43 -07:00
Ben Johnson
7215bfd16c Implement translator store sharding 2020-01-08 09:47:43 -07:00
Travis Turner
cabfa3c456 add a test for pilosa/#2084 2020-01-08 09:47:43 -07:00
tgruben
457789effd
Merge pull request #62 from tgruben/clearvalue
add support to clear value for column
2020-01-07 13:12:21 -06:00
Todd Gruben
643884aeb3 refactored clear to fix q2;removed unused comment 2020-01-07 12:55:32 -06:00
Todd Gruben
26e3460413 removed view creation from ClearValue 2020-01-07 10:55:45 -06:00
Todd Gruben
d843959904 fixed comments; removed create fragment 2020-01-07 10:39:56 -06:00
Todd Gruben
75e017cf4f Merge remote-tracking branch 'upstream/enterprise' into clearvalue 2020-01-07 10:28:47 -06:00
Cody Soyland
29f7448b89
Merge pull request #83 from codysoyland/expvar-compatibility
Initialize expvar lazily to prevent panic if importing both Pilosa v1 and v2
2020-01-02 17:56:42 -06:00
Cody Soyland
8d32005ede Initialize expvar lazily to prevent panic if importing both Pilosa v1 and v2. 2020-01-02 15:43:34 -06:00
Travis Turner
5643afac47
Merge pull request #82 from travisturner/row-response-sorter
WIP: RowResponseSorter for sorting a list of RowResponse based on sort params
2019-12-31 13:18:05 -06:00
Travis
0fffd9a0cb RowResponseSorter for sorting a list of RowResponse based on sort paraters 2019-12-31 11:52:01 -06:00
Travis Turner
c247805d96
Merge pull request #81 from travisturner/inspect-field-output
Remove empty field check in Inspect()
2019-12-27 13:42:36 -06:00
Travis Turner
98df5672e9
Merge branch 'enterprise' into inspect-field-output 2019-12-27 13:26:38 -06:00
Travis Turner
768de9dc3a
Merge pull request #80 from travisturner/row-response-error
Add StatusError to RowResponse for better error handling.
2019-12-27 13:25:38 -06:00
Travis
3be4141382 Return the correct data type label in grpc header
Based on the pilosa field type, return the correct data type
label in the gRPC column header.
2019-12-27 12:43:45 -06:00
Travis
73090e05c8 Add StatusError to RowResponse for better error handling.
This PR adds a `StatusError` to the `pproto.RowResponse` type, which
allows a stream to pass an error on the stream (encoded into
the `RowResponse.StatusError`). This can be checked downstream
for matching `EOF` or `err != nil` and handled appropriately.

This is helpful mainly with the `RowResponse` reducers which run in
goroutines. Instead of trying to manage a separate channel of errors
from those goroutines, we just follow the grpc model and send the
error with the stream.
2019-12-27 12:43:45 -06:00
Travis Turner
94f97297eb
Merge pull request #77 from travisturner/all-shard
Allow All() to be called at the shard level
2019-12-27 12:35:41 -06:00
Travis
d34e38f134 Remove empty field check in Inspect()
The check for field existence is not necessary; since we
add the `_id` field to every response then at the very
least that field will be returned.

This check was preventin a query like `select _id from ...`
from returning any results.
2019-12-26 22:27:46 -06:00
Travis
586a13e942 Allow All() to be called at the shard level 2019-12-20 22:44:46 -06:00
Cody Soyland
7b30b91448
Merge pull request #74 from codysoyland/docker-build-vendor
Vendor modules before building docker image so private modules can be downloaded
2019-12-20 17:52:26 -06:00
Cody Soyland
d4117f3137 Vendor modules before building docker image so private modules can be downloaded 2019-12-20 16:05:18 -06:00
seebs
47316d9f2f
Merge pull request #70 from seebs/unionAA
Simplify unionArrayArray
2019-12-20 13:49:51 -06:00
seebs
d4d3d75e28
Merge branch 'enterprise' into unionAA 2019-12-20 13:28:57 -06:00
Matthew Jaffee
d86a3c3f2f
Merge pull request #55 from seebs/pluginfix
Pluginfix
2019-12-20 12:53:09 -06:00
Matt Jaffee
fe0f57651e
build with distinct by default 2019-12-20 12:21:47 -06:00
Cody Soyland
49b2029656
Run "go mod vendor" outside of Docker so authenticated modules may use system credentials 2019-12-20 12:21:47 -06:00
Seebs
7e1fd8392f
go.mod/go.sum changes for using molecula/ext
This pins us to the initial external release of molecula/ext, which
with any luck will be the only one. (Narrator: It was not to be the
only one.) We also use GOPRIVATE so we don't need a replace directive.
2019-12-20 12:21:47 -06:00
Seebs
0eba050054
stop using pkg/plugin, start using build tags
After a few experiments with pkg/plugin, I'm ready to concede that the
people warning me it was unsuitable for production use were in fact
correct.

In the brave new world, the "ext" package is moved to its own module
outside pilosa. This means that importing it doesn't imply any need to
version-check against pilosa; we can just use versioned copies of the
ext package, which can be public because it doesn't contain anything
we need to care about keeping proprietary.

Then we can, conditional on build tags, import modules from a
neighboring repo which contains the actual implementations, and if
they're imported, their init functions register them.
2019-12-20 12:21:47 -06:00
Seebs
f51c2dbc42
use extensions through build tags 2019-12-20 12:21:47 -06:00
Travis Turner
179fb910f7
Merge pull request #71 from travisturner/all-limit-offset
Add All() support to PQL, including limit and offset
2019-12-18 22:10:42 -06:00
Travis
361e51cb41 Add All() support to PQL, including limit and offset
This PR is meant to get all columns from an index
based on the TrackExistence row.

`All()` is a PQL function that can be used as a typical
row object. Optional arguments are `limit` and `offset`.
2019-12-18 18:00:15 -06:00
Seebs
83aa505673 Simplify unionArrayArray
Also short-circuit it in some cases.
2019-12-17 15:30:56 -06:00
Travis Turner
1af016df84
Merge pull request #68 from travisturner/linter-fix
Fix an impossible code path raised by the linter
2019-12-17 09:04:37 -06:00
Travis
532caa0fbf fix an impossible code path raised by the linter 2019-12-16 21:56:57 -06:00
Travis Turner
6f556fb880
Merge pull request #63 from travisturner/row-field-label
Wrap return types: RowIdentifiers, Pair, and []Pair
2019-12-16 07:42:20 -06:00
Travis
4f7f4f58b1 add field to SignedRow, and implement its grpc response 2019-12-14 15:56:06 -06:00
Travis
3b7b54094a update clustertests to use v2 (and go 1.13) 2019-12-13 18:45:43 -06:00
Travis
5cb37834a0 Wrap return types: RowIdentifiers, Pair, and []Pair
This PR adds a field name (string) to the return types
which represent the values from a specific field. For example,
a TopN query on field `x` would be `TopN(x)` and have results
like:
```
[]Pair{
  {ID: 14, Count: 10},
  {ID: 3, Count: 8},
  {ID: 7, Count: 3},
}
```
In order to know what field this result type refers to, we wrap
`[]Pair` in a new struct called `PairsField` which contains an
addition `Field` string where `x` is stored.

This is useful for informing the gRPC server how to construct
more appropriate headers for the result stream (in this case,
the column headers can now be "x" and "count").

Similar logic was applied to `RowIdentifiers` and `Pair` as well.
2019-12-13 15:36:51 -06:00
Travis Turner
c5aeed0715
Merge pull request #57 from tgruben/fix-minmax-count
return total match counts for either min or max
2019-12-13 15:28:27 -06:00
Todd Gruben
4523a4d693
removed uneeded test run 2019-12-13 15:10:28 -06:00
Todd Gruben
16171b3e65
return total match counts for either min or max 2019-12-13 15:10:28 -06:00
Todd Gruben
95f2864abe applied suggestions by @travisturner 2019-12-11 12:13:57 -06:00
Todd Gruben
7a2d90ade8 add support to clear value for column 2019-12-09 16:28:03 -06:00
Travis Turner
c4e339f72b
Merge pull request #59 from travisturner/not-found-code
Add grpc NotFound code where applicable
2019-12-03 17:44:30 -06:00
Travis
a5652a182c add grpc NotFound code where applicable 2019-12-03 11:53:20 -06:00
Matthew Jaffee
521ea603d0
Merge pull request #52 from molecula/import-col-attrs
Import col attrs
2019-12-02 01:25:08 -06:00
Matt Jaffee
87ee83f4cb
check errors in test to fix lint 2019-12-01 07:33:25 -06:00
Matt Jaffee
9e3029b969
re run generate-protoc 2019-12-01 07:33:24 -06:00
Alan Bernstein
e470b3276e
Add generated proto 2019-12-01 07:33:24 -06:00
Alan Bernstein
cf7d668b49
Support import column attrs in client 2019-12-01 07:33:24 -06:00
Alan Bernstein
c3e8284f6c
Test for presence of column attrs 2019-12-01 07:33:24 -06:00
Alan Bernstein
628def3db7
Clarify some error messages 2019-12-01 07:33:24 -06:00
Alan Bernstein
aba67364b1
Add support for importing column attrs 2019-12-01 07:33:23 -06:00
Travis Turner
76bb3985f0
Merge pull request #53 from travisturner/having-between
Add support for BETWEEN type conditions in the having clause.
2019-11-30 21:58:45 -06:00
Travis
52debbc389 Add support for BETWEEN type conditions in the having clause.
There is a TODO in the `StringWithSubj` method because the value
types really depend on the subject type (for example, `count` uses
uint64, while `sum` uses int64). I'm waiting to address this
until we decide how to handle sums of floats (Decimal), because
that will affect this logic as well.
2019-11-30 11:59:09 -06:00
Travis Turner
0247a9073c
Merge pull request #51 from travisturner/groupby-having
Add "having" support to GroupBy() queries
2019-11-29 23:01:15 -06:00
Travis
24d02c1920 Add "having" support to GroupBy() queries
This PR adds support for a `having` argument in a `GroupBy` query.
Usage looks like this:
```
GroupBy(Rows(a), having=Condition(count > 10))
GroupBy(Rows(a), aggregate=Sum(field=b), having=Condition(sum > 100))
```
2019-11-28 18:40:57 -06:00
Travis Turner
bc0018b67b
Merge pull request #50 from travisturner/datatype-fixes
Add StreamClient and StreamServer interfaces
2019-11-27 17:21:55 -06:00
Travis
3bc0dc28f0 Add StreamClient and StreamServer interfaces
In order to standardize results as streams of RowResponse,
this PR introduces two interfaces `StreamClient` and
`StreamServer`) which mirror the grpc stream interfaces.
Upstream users (sqlmapper, vdsm, etc) can implement
instances of these interfaces to ensure that results can
stream through the entire sytem in an expected way.

This PR also fixes a couple of missing data types.
2019-11-27 16:10:46 -06:00
Matthew Jaffee
210676c927
Merge pull request #39 from molecula/groupby-sum
Groupby sum
2019-11-27 16:04:42 -06:00
Matt Jaffee
114c1a9df8
remove unecessary span from executor tracing 2019-11-27 11:09:06 -06:00
Matt Jaffee
60397d3e8f
add more tracing around groupBy 2019-11-27 11:00:13 -06:00
Matt Jaffee
f2f9ea01dc
get group by aggregates working with PQL validation and grpc streaming 2019-11-27 11:00:13 -06:00
Ben Johnson
ea9914dba0
Add optional GroupBy() 'aggregate' field.
This commit adds an `aggregate` field that allows a `Sum()` call
to be executed for every returned group.
2019-11-27 11:00:13 -06:00
Matt Jaffee
81a4d32cdd
allow IDs to be passed even when keys enabled
This change allows one to query Pilosa fields and indexes directly
with integer row and column ids even when key translation is
enabled. This was previously disallowed during query
translation... I'm not sure why, but it can be quite useful for
debugging and testing to be able to use IDs directly. I have a test in
go-pilosa which uses this functionality.

I also simplified a bunch of the test code which was of the form:
```
else {
    if blah {
    }
}
```

to be:

```
else if blah {
```

which I think is pretty harmless.

I also changed a snapshot log line that has been bugging me to be
Debug level so that it isn't generating lots of useless logs for long
running Pilosa instances.
2019-11-27 08:41:40 -06:00
tgruben
16d5db97a6
Merge pull request #47 from tgruben/inspect-fix
fixed bug in slice container seek
2019-11-26 11:35:51 -06:00
Todd Gruben
ca0247e35b fixed bug in slice container seek 2019-11-26 09:21:52 -06:00
seebs
407c309640
Merge pull request #46 from seebs/distinctfix
Distinctfix
2019-11-22 17:29:24 -06:00
Seebs
d79ecbad86 recompute shards for cross-index calls
It turns out that we need to recompute the set of shards whenever
a query is cross-index. Otherwise we get partial results in unexpected
ways sometimes.
2019-11-22 16:02:47 -06:00
Seebs
36ef82d7ac Zero bitmap storage when reusing it for container-as-bitmap
If you don't do this, it works fine the first time you use a given
storage, but after that you start seeing spurious bits.
2019-11-22 16:02:42 -06:00
Seebs
397d93e84b provide an empty filter when a filter was empty 2019-11-22 16:02:31 -06:00
Seebs
26326ac74c recompute shards for cross-index queries
When computing results on another index, recompute list of
shards for that index.
2019-11-22 16:02:26 -06:00
Seebs
6ad39a376e handle precalls and cross-index queries better
There's two actual changes here, but they're closely related.

First, handle named parameters for precalls, not just indexed parameters.
Second, when doing translation for a call, check whether it specifies an
index, and if it does, use that index instead of the current index for
the translation.
2019-11-22 16:02:20 -06:00
seebs
16c3cfa727
Merge pull request #42 from seebs/sqdeadlock
use the right lock for Enqueue
2019-11-18 21:53:00 -06:00
seebs
01309e4fc5
Merge branch 'enterprise' into sqdeadlock 2019-11-18 20:51:40 -06:00
Cody Soyland
d3c8728821
Merge pull request #19 from codysoyland/ci-updates
Update CI to support Pilosa Enterprise (private dependencies)
2019-11-18 13:52:20 -06:00
Cody Soyland
58182ff563 Pilosa Enterprise private CI 2019-11-18 13:30:32 -06:00
Travis Turner
295adbfe67
Merge pull request #44 from travisturner/cache-threshold-deletes
Fixed ranked cache logic to support reducing cached values below the threshold
2019-11-18 12:10:46 -06:00
Travis
ed82a535e5 Fix ranked cache logic to support reducing cached values below
the threshold.

Prior to this commit, if a cache value was reduced to a value
that fell below the threshold, the operation would be ignored
and the cached value would remain at the old, higher value.

This commit also fixes logic which reduces a cached value within
the framework of uint64 values by subracting the absolute value
of the negative value (since adding a negitive doesn't work with
unsigned integers).
2019-11-18 11:39:50 -06:00
Travis Turner
32f754899e
Merge pull request #43 from travisturner/translate-race-in-test
allow for translate store race in test
2019-11-15 16:33:30 -06:00
Travis
0a69fca657 allow for translate store race in test (by using retry)
In this case, the test is reading from the translateStore
replica before the translateStore replication has had time to
deliver its log to the replica. The only way to truly address
this in the translate store would be to route all key misses
that happen on a read-only replica to the primary translate
store (or somehow know when the primary is done sending to
replicas) for actual verification that the key does not exist.
That's more involved than we want to do here; this PR just
addresses the problem in the test.
2019-11-15 07:57:47 -06:00
Seebs
f204b37760 use atomics instead of locking for stats 2019-11-14 17:40:14 -06:00
Seebs
bab077199c use the right lock for Enqueue
The request for a non-read lock blocks until all existing read
locks exit, meaning that if an Immediate operation is already
going for a fragment, an Enqueue operation will hang forever
holding the fragment's lock, while the Immediate operation has
probably relinquished the fragment's lock to wait for the
queue worker to process it. But the queue worker can't process
it, because the incoming Enqueue still holds the fragment's
lock. Solution: Don't block the Enqueue operation like that.
It shouldn't coexist with things that actually change the sq
channels, like Stop(), but it is fine for it to coexist with
other queue operations.
2019-11-14 17:00:34 -06:00
seebs
9cec40e69d
Merge pull request #41 from seebs/roaringProto
Stop using Roaring in protobuf messages until it's supported elsewhere
2019-11-14 12:45:35 -06:00
Seebs
6fc6cc4350 Stop using Roaring in protobuf messages until it's supported elsewhere
go-pilosa uses protobuf to talk to us but doesn't support the roaring
format. Conveniently, there's a kill switch.
2019-11-14 10:54:40 -06:00
Matthew Jaffee
fa9c911860
Merge pull request #37 from travisturner/rename-bool-label
Rename bool label from changed to result
2019-11-13 14:30:14 -06:00
Travis
e8cd48155a
Rename bool lable from changed to result 2019-11-13 14:12:52 -06:00
Matthew Jaffee
4dfeb89b43
Merge pull request #36 from travisturner/includescolumn-keys
Add column keys support to IncludeColumn
2019-11-13 14:09:24 -06:00
Travis
625125bac6 add column keys support to IncludeColumn 2019-11-13 11:34:21 -06:00
Matthew Jaffee
013ee21621
Merge pull request #28 from molecula/pql-float-values
Pql float values
2019-11-13 11:04:36 -06:00
Matt Jaffee
0e445db7ff
improve error message checking field type in import roaring 2019-11-13 10:07:24 -06:00
Travis
26fc621f09
Support integer predicates in Decimal field range queries. 2019-11-13 10:07:24 -06:00
Matt Jaffee
0ac778516e
check error, make linter happy 2019-11-13 10:07:24 -06:00
Matt Jaffee
14dfc9e31d
fix comment typo for BTWN_LTE_LT 2019-11-13 10:07:24 -06:00
Matt Jaffee
9c8ad727b5
allow floats in PQL queries for decimal fields
had to workaround some cruft in the parser that was trying to only
support a BETWEEN query as LTE, LTE. Now we have operations for all
combinations of LT and LTE.

unrelated - changed the port a test was binding to as it conflicted
with a port I was using locally.
2019-11-13 10:07:24 -06:00
Matt Jaffee
0fec16a141
fix integer bug on less than queries.
this was introduced recently to fix another bug. the comment above it
is correct, just the logic was off-by-one. The test shows the issue
and was confirmed to reproduce it and then fix it.
2019-11-13 10:07:23 -06:00
Travis Turner
7401fd1333
Merge pull request #33 from travisturner/grpc-logger
Fixed gRPC server logger; pass logger through from main
2019-11-13 09:56:04 -06:00
Travis Turner
afd1c004f9
Merge branch 'enterprise' into grpc-logger 2019-11-13 08:31:26 -06:00
Travis Turner
d3432478f9
Merge pull request #34 from travisturner/bool-returns
Fix makeRows in gRPC hander to handle a bool result
2019-11-13 08:24:43 -06:00
Travis
7fd5248d98 makeRows in gRPC hander now handles a bool result
This PR adds bool support to the makeRows function
in the gRPC handler.
2019-11-12 16:13:52 -06:00
seebs
1fea1ea375
Merge pull request #22 from seebs/fsckSnapshotExtension
This is a collection of changes that have been pending forever. It improves the snapshot queue performance, adds some amount of recovery for corrupt filles, reduces memory usage in the rowcache, and adds an extension interface. Yes, they should probably have happened separately over time, things happened.
2019-11-12 14:50:34 -06:00
Seebs
1e0873c70b lock BufferLogger for reads/writes
With the new addition of the holder background scan, it's possible
for an open holder to write log messages at arbitrary times. The
TestHolder_Open/ErrIndexName test checks the contents of the output
buffer, but those contents could be changing if the background task
happens to run at the right time. Use trivial locking around that
so that this shouldn't happen.
2019-11-12 12:15:13 -06:00
Seebs
03f3f424aa don't lint PEG files
I was pretty sure I'd done this, but I guess not: Skip linting
the PEG files.
2019-11-12 12:15:13 -06:00
Seebs
8cc7a176b5 license header fixups
Fix up license headers for the extension code, and add the proto
file to the list of things we don't check license headers for.
2019-11-12 12:15:13 -06:00
Seebs
c5136b14db ensmarten snapshot queue
The snapshot queue needs a bit more subtlety. In some cases,
we really do want to do a snapshot right now -- these shouldn't
have to wait for possibly a hundred or more other snapshots
to complete.

In other cases, we don't really care that much whether we do
a snapshot, and just dropping it is probably fine.

To accommodate this, we distinguish between "urgent" and
"normal" snapshots, and between "Immediate" (does an urgent
snapshot, waits for it) and "Enqueue" (might enqueue a snapshot
but *also might not* if we're already busy). There's a
corresponding "Await" to wait for a snapshot, if one is
pending, but not if one isn't.

We also have a background scan that checks the holder. It will
scan pretty actively when it's finding fragments that need
snapshots (no enqueued snapshot, opN > MaxOpN). It pauses
for a second after every hundred fragments that didn't need
snapshots, and for a minute after each holder scan that didn't
find any. So, if you don't need snapshots, it does basically
nothing, if you do, it'll be moderately aggressive about
submitting tasks -- but it always waits if there's *any*
requested snapshots in the queues.

Updates since initial draft:

Check results from Await more consistently, and in one case, use Immediate
instead and then check its error.

Fix a race condition.  The race condition comes about if:

1. You have a limited enough worker pool that this can happen.
(In testing we tend to have a worker pool of 1.)
2. A fragment is in the normal, non-urgent, queue already.
3. An immediate request comes in for that fragment. This always
happens *with the fragment lock held*.
4. A worker thread grabs that fragment from the queue.
5. The worker thread now waits on the lock. Meanwhile, the
immediate request blocks on sending the fragment to the urgent
queue.
6. The worker can't read the urgent queue, and the immediate
request can't send it, so the immediate request can't proceed.

What's supposed to happen is that the immediate request sends
the thing, and gets into Await(), which sleeps on a condition
variable using the lock, which is to say, releases the lock.

The obvious resolution is to let go of the lock, send the
message, and then reclaim the lock. But then we have the
possibility that the message sent ends up with a timestamp
right after a snapshot that happened *after* the Immediate
request was started. Oops. So we create the request, then let
go of the lock, then send the request, then reclaim the lock
and go into the Await state. All is well.

This is on top of more general use of wait groups, etcetera,
to allow us to ensure that any holder scans terminate *before*
we close the channels they might otherwise be trying to write to.
So, shutdown process is now:

* grab lock on queue (workers and scanners don't use the lock)
* mark snapshotqueue done
* wait for holder scans to complete/exit
* close and nil out all the channels
* release lock

Anything trying to submit to this needs to hold the lock, unless
it's a holder scan, so either it got the lock before we did and already
submitted the thing, or it will get the lock after this and not find
a channel to write to; it's just the holder scanner that has an
ongoing thing that might have started a write to the channel *without*
a lock held, because it's expected that it might have to wait minutes
or hours before the write will complete because it's a background task.

Also, rework the background holder scan to grab lists of
indexes/fields/views/fragments, then scan the grabbed/copied lists,
rather than iterating over maps, allowing us to grab the lock when
we're about to access a thing and let it go when done.

There might be a simpler/cleaner way to do this but opinions on how
safe it is are very mixed, so in the mean time, I'm making the range
behavior not depend at all on there being no writes to the various tiers
of holder/index/view/fragment during the background scans.
2019-11-12 12:15:13 -06:00
Seebs
3b696da34a plugins and precomputed data
So in some cases, when we do a query, the results of one
part of the query are innately shared-across-nodes; for
instance, a hypothetical Distinct query. More generally,
we allow cross-index queries; calls can have "index=foo"
in them.

This patch lets us handle that without duplicating that
query all over. Before we actually start doing the
separate calls, we run the query once from the coordinating
node, then patch the results in, and send relevant subsets
over to each client, etcetera. Also provides slightly
friendlier (and I hope faster) support for converting
bitmaps to/from sets of rows.

We also add an extension interface, and some fancy stuff
to let us define new calls, which use this. They're sort
of tied together because the first extension I wanted to
implement needed precomputed calls. The extension API
lets us create extensions using `pkg/plugin` (with all its
associated limitations, unfortunately), then query them
at load time for functionality.

This also implies some revamping of the argument
validation for PQL, like verifying that functions exist
and knowing things about their argument types.

So basically this is an overly intrusive patch, and would
be better as separate patches, but they're hard to detangle.

add trivial execution-time profiling

What if you could ?profile=true on a query and get some
numbers back? That'd be really cool.

We already have tracing/spans, but right now, those only generate
any data if you have something set up for them to trace to. Add a
fancy wrapper that lets us generate our own tracing data, and dump
it into the request response, if ?profile=true.

add a sample extension, add missing features to extension interface

Implement a naive probabilistic filter extension as an example of
what an extension looks like. In the process, discover multiple
omissions in the bitmap API. Well, I did *say* it was experimental.
2019-11-12 12:14:29 -06:00
Seebs
b25eb8f596 Sources and Generations: tracking mmapped files
This code represents an attempt at providing reliable tracking
of whether any bitmaps still in use have access to a given block
of mmapped data, allowing us to unmap the data when nothing is using
it anymore.

The basic approach is as follows: Each mmap is associated with
a new object, called a "generation". A generation reflects
a particular instance of a given file being mapped. When a
bitmap is built from an mmapped data source, the bitmap is
given a pointer to the generation as its Source. When bitmap
operations combine containers from other bitmaps, they
produce new bitmaps that are tagged with the combined set of
sources.

When we snapshot a file, or for some other reason wish to remap
it, the corresponding bitmap has all its containers updated to
use the new storage, and the bitmap's source is changed. However,
previously-handed-out containers might still have references to the
old storage. Those containers would be in bitmaps with the old
source.

After a bunch of study of trying to reference-count and track
this, I realized: We don't actually need to do that, because we
already have something suitable for determining whether anything
can reach a given object. It's the garbage collector.

So we set a finalizer on the generation object, which handles
unmapping. There's additional sanity-checks here to confirm things
like "we thought this generation should be expiring", and we
track timestamps. We could also have things check whether a
given bitmap's source was marked as obsolete "a while ago", but
that isn't implemented yet.

There's a debug version of this which tracks finalization, creation,
and ending timestamps, and has a call to provide diagnostics for
this. Identical generation IDs get separated out with random
suffixes in this case -- there's sometimes a second or third
instance of the same name due to a holder closing and reopening,
but this basically only happens in testing.

Note that generations are still used even when there's no mmapping,
but unless debugging is turned on, they shouldn't propagate much --
we don't consider a generation to be the source of a bitmap unless
the bitmap actually mapped things from that generation's mmapped
storage, or debugging is on.

There's a couple of other, possibly more subtle, changes and
bug fixes that got caught by the testing on this:
* If a fragment is partially opened and then opening some later
  part fails, we close the earlier parts before returning the
  error so we aren't leaving it partially open.
* Several operations on segments which were requesting that a
  frozen copy of a bitmap be created are now actually *replacing*
  their bitmap with the frozen bitmap, rather than discarding it.
* intersectRunRun, if it decides to create an array or bitmap,
  will yield that container instead of discarding it.

And why all of this? Why, so we can actually implement the thing
where when a fragment has a valid roaring bitmap, but the ops log
is corrupt, we can truncate the corrupt part of the ops log and
reopen it. Which I did.

When the generationdebug build tag is in use, every generation
has a finalizer all the time. When it's not, they only get finalizers
when we expect them to be done -- say, when closing a fragment.
This is because finalizers appear to be possibly-expensive.

There's some logical cleanup to openStorage here, dividing part
of its work into applyStorage and importStorage, which have a common
case for handling "there's no data in this file".
2019-11-12 12:14:29 -06:00
Seebs
6654466033 partially implement truncation of fragments for corrupt ops log
Which is to say don't actually implement it, because openStorage
is too messy right now, but this is the rest of the framework,
and now I'm going to digress into fixing openStorage.
2019-11-12 12:14:29 -06:00
Seebs
538768ea9d handle truncated/damaged .available.shards
The available shards file is just a hint to save us a bit
of time later; we don't need it to run and it can get updated
pretty easily later. If we have problems reading it, we
should just report the error, nuke the file, and continue
without it.
2019-11-12 12:14:29 -06:00
Travis
b8f665db1a pass logger through to the grpc server and handler 2019-11-12 11:08:25 -06:00
seebs
1262cd18e0
Merge pull request #30 from seebs/intfixes
Fix an error that could cause imported values to keep high-order bits from previously imported values, and another that could cause BSI fields to store extra bits they don't need.
2019-11-12 00:02:04 -06:00
seebs
b3adf2d4f6
Merge branch 'enterprise' into q2-11-7 2019-11-11 21:39:45 -06:00
Cody Soyland
5194ede82c
Merge pull request #31 from codysoyland/proto-pkg-name
Change proto package name to "pilosa" to not conflict with molecula
2019-11-11 20:51:52 -06:00
Cody Soyland
69e5e523c1
Merge branch 'enterprise' into proto-pkg-name 2019-11-11 17:26:44 -06:00
Seebs
a804a0dfb1 always treat BSI fields as having at least their depth
If you imported only small values, BSI fields could end up
not bothering to clear higher bits in existing values, which
produced strange behaviors.

We also move the computation of requiredDepth, and the change
to the field, down, combining it with the other checks of the
values for min/max being in range.

Without this, a data set with a ludicrously large value in it
could break a BSI field's depth even though the import would then
reject it.
2019-11-11 16:55:26 -06:00
Travis Turner
1a44f02e3c reset fragment.rowCache after importValue 2019-11-11 16:54:51 -06:00
Travis Turner
10514f7ced
Merge pull request #25 from travisturner/includes-column
Add an IncludesColumn() function to PQL
2019-11-11 12:55:23 -06:00
Cody Soyland
b9335c9f5c Change proto package name to "pilosa" to not conflict with molecula. Upgrade protoc to 3.10.1 2019-11-11 12:24:38 -06:00
Travis
ed37ef5dcf Add an IncludesColumn() function to PQL
Usage:
`IncludesColumn(Intersect(Row(a=1), Row(b=2)), column=10)`

The above query will return a `bool` indicating whether the
intersection of rows a-1 and b-2 contains column 10. Because
a single column is specified, this executes on a single shard
(shard=0 in this example).
2019-11-11 08:17:28 -06:00
Travis Turner
198626e657
Merge pull request #29 from travisturner/linter-fixes
fix golangci-lint complaints
2019-11-11 08:06:35 -06:00
Travis
87b8edc4c5 fix golangci-lint complaints 2019-11-10 17:58:46 -06:00
Travis Turner
2a5d79ad83
Merge pull request #26 from travisturner/proto-licence-exception
add proto/pilosa.pb.go to license.exceptions list
2019-11-10 16:31:00 -06:00
Travis
3129b1c841 add proto/pilosa.pb.go to license.exceptions list 2019-11-10 11:33:29 -06:00
Travis Turner
6632821617
Merge pull request #24 from travisturner/cache-size-none
fix cacheSize when cacheType is none (and cacheSize is 0)
2019-11-08 22:30:17 -06:00
Travis
a842dd521c fix cacheSize when cacheType is none (and cacheSize is 0)
There was an edge case where setting cacheType to none
wouldn't zero out its cacheSize. This fixes that edge case.
2019-11-08 15:58:49 -06:00
Matthew Jaffee
d6f2196bf1
Merge pull request #16 from pilosa/tls-grpc
use TLS settings when setting up GRPC server or client
2019-10-30 19:35:56 -05:00
Matt Jaffee
6f21887259
use TLS settings when setting up GRPC server or client 2019-10-30 17:38:48 -05:00
Matthew Jaffee
468cf98811
Merge pull request #15 from pilosa/decimal-to-grpc
add decimal field support to Inspect
2019-10-30 13:33:55 -05:00
Matt Jaffee
a414cada4f
add decimal field support to Inspect
I tested this manually with BloomRPC and curl, but need to write real
tests. Also need to get floats for decimal fields coming out of QueryPQL.
2019-10-30 11:13:48 -05:00
Matthew Jaffee
8f64a4f585
Merge pull request #11 from pilosa/decimal-support
support for decimal fields
2019-10-29 16:49:20 -05:00
Matt Jaffee
a9a4d244ef
fix a bug in the "less than" logic 2019-10-29 16:36:15 -05:00
Matt Jaffee
5dcabfcc7f
support for decimal fields
This commit adds a Decimal field type which is implemented mostly with
the Int field. It adds an optional "Scale" value to the Int field
which means that the values stored in that field are actually meant to
be divided by 10^Scale before being interpreted.

In order to make use of this functionality, we extend the importValue
request to allow a slice of floats rather than just int64. If the
slice of floats is present, each float in the slice is multiplied by
10^Scale and converted to an int64 before being imported. If a slice
of int64 is imported to a Decimal field, it is treated normally, and
scale is ignored. This allows the conversion to be handled at the
client side if desired.

Currently there are Field level methods for querying Float values out
of a decimal field, but no support in PQL or the executor for getting
float values. Going to wait until I can use the generic result type
before doing that, so for now, any values queried will be the scaled
integer values.

needed to add client support for importing float values, and did this
by adding a more general and simplified client method for value
imports.

rewrote api.ImportValue to use the new method which should be more
performant and efficient.

allow floats to be "pilosa import"ed into decimal fields
2019-10-29 16:36:14 -05:00
seebs
4ef7f7e26b
Merge pull request #12 from seebs/profile
Profiling and a couple of minor fixes
2019-10-29 15:24:51 -05:00
Seebs
616ed39771 Skip longest tests when running -short
The cluster timeout/down tests are way more than half the total
time for "go test", and are very unlikely to be of interest in regular
usage, although they matter for CI. Skip them when doing short
tests.
2019-10-29 15:24:09 -05:00
Seebs
7a381f7eaf allow years other than 2017 in licenses
Also clean up the license hash checking a bit. We trim vendor early
in find so we don't have to walk the whole vendor tree only to grep
the files out, and we don't check the license hashes of the exceptions,
and the exceptions are now a plain text file of non-regex strings
we match exactly. Also the license hash code is only written once.

This will help us a lot if development on Pilosa continues through
2018 or later.
2019-10-29 15:24:09 -05:00
Seebs
820c5ce220 add trivial execution-time profiling
What if you could ?profile=true on a query and get some
numbers back? That'd be really cool.

We already have tracing/spans, but right now, those only generate
any data if you have something set up for them to trace to. Add a
fancy wrapper that lets us generate our own tracing data, and dump
it into the request response, if ?profile=true.

We track wall-clock execution time, plus possible arbitrary K/V
pairs. Memory stats are not included, because obtaining them is
surprisingly expensive.
2019-10-29 15:23:37 -05:00
Travis Turner
9a2f5b3b4c
Merge pull request #10 from travisturner/grpc
initial gRPC server implementation
2019-10-29 14:39:16 -05:00
Travis
a7bb90fcd0 initial gRPC server implementation
add makeRows() tests
register the gRPC server
use api.Index() instead of api.Schema()

support most field types in Inspect() query

currently, there's no support for `time` fields.
those will be dependent upon the output format
and the ability to materialize the timestamp from
the time views.

this commit also changes the response type of the
`Inspect()` query to be a tabular `RowResponse`.
2019-10-29 14:27:07 -05:00
Travis
77a81eb2e1 fix bug preventing a Rows() query on a bool field 2019-10-29 14:27:07 -05:00
907 changed files with 23815 additions and 41467 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
lattice/.git
lattice/node_modules
lattice/build
statik/statik.go
build
testenv
bin

16
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
For bugs, please provide the following:
### What's going wrong?
### What was expected?
### Steps to reproduce the behavior
### Information about your environment (OS/architecture, CPU, RAM, cluster/solo, configuration, etc.)
For feature requests, please provide the following:
### Description
### Success criteria (What criteria will consider this ticket closeable?)

24
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,24 @@
## Overview
[Describe what this pull request addresses.]
Fixes #
## Pull request checklist
- [ ] I have updated the [documentation](https://github.com/molecula/docs).
- [ ] I have resolved any merge conflicts.
- [ ] I have included tests that cover my changes.
- [ ] All new and existing tests pass.
- [ ] Add appropriate changelog label to PR (if applicable).
## Code review checklist
This is the checklist that the reviewer will follow while reviewing your pull request. You do not need to do anything with this checklist, but be aware of what the reviewer will be looking for.
- [ ] Ensure that any changes to external docs have been included in this pull request.
- [ ] If the changes require that minor/major versions need to be updated, tag the PR appropriately.
- [ ] Ensure the new code is [properly commented](https://github.com/golang/go/wiki/CodeReviewComments#doc-comments) and follows [Idiomatic Go](https://dmitri.shuralyov.com/idiomatic-go).
- [ ] Check that tests have been written and that they cover the new functionality.
- [ ] Run tests and ensure they pass.
- [ ] Build and run the code, performing any applicable integration testing.
- [ ] Make sure PR is tagged with appropriate changelog label.

View file

@ -1,77 +0,0 @@
name: CD
on:
push:
branches: ["master"]
workflow_dispatch:
jobs:
validate:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.19.1"
- run: go version
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
- name: go vet
run: go vet ./...
- name: test
run: go test ./...
release:
needs: validate
runs-on: ubuntu-latest
outputs:
version: ${{ steps.semrel.outputs.version }}
steps:
- name: go-semantic-release
id: semrel
uses: go-semantic-release/action@v1.17.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
goos:
- "darwin"
- "linux"
- "windows"
goarch:
- "amd64"
- "arm64"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.19.1"
- name: build
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./build/${{ matrix.goos }}-${{ matrix.goarch }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./build/${{ matrix.goos }}-${{ matrix.goarch }}
asset_name: ${{ matrix.goos }}-${{ matrix.goarch }}
tag: ${{ github.ref }}

View file

@ -1,57 +0,0 @@
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
pull_request:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
validate-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: go-semantic-release/action@v1
id: semrel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
dry: true
# golangci-lint must be run separately from "validate" as there are go mod issues if you run it after the vet
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
# version: v1.29
args: --timeout=8m
validate:
name: Code Checks
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.19.1"
- run: go version
- name: go vet
run: go vet ./...

View file

@ -1,25 +0,0 @@
name: Release
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos:
- "darwin"
- "linux"
goarch:
- "amd64"
- "arm64"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "^1.19.1"
- name: build
run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./build/${{ matrix.goos }}-${{ matrix.goarch }}

2
.gitignore vendored
View file

@ -83,5 +83,3 @@ staticcheck.conf
dax/dax-data
coverage-from-docker
*.client_id.txt

View file

@ -12,34 +12,15 @@ include:
- template: Security/License-Scanning.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
default:
retry:
max: 2 # This is confusing but this means "3 runs at max".
when:
- unknown_failure
- api_failure
- runner_system_failure
- job_execution_timeout
- stuck_or_timeout_failure
variables:
GOVERSION: "1.19.3"
GOFUTURE: "latest"
CI_IMAGE: "${CI_REGISTRY_IMAGE}/ci-builder:0.0.1"
CI_PRE_CLONE_SCRIPT: |
set -x
stages:
- ci_image_build
- lint
- test
- build
- post build
- integration
- gauntlet
- performance
- nonblocking
- cleanup_build
.idk_changed:
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
changes:
compare_to: refs/heads/master
paths:
- idk/**
- client/**
- batch/**
gosec-sast:
allow_failure: false
@ -61,6 +42,51 @@ gosec-sast:
- go install 'gitlab.com/gitlab-org/security-products/analyzers/gosec@v1.4.0'
- gosec convert gosec.json > gl-sast-report.json
variables:
GOVERSION: "1.19.3"
GOFUTURE: "latest"
stages:
- lint
- test
- build
- post build
- integration
- gauntlet
- performance
- nonblocking
- cleanup_build
.setup_ssh:
before_script:
- export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
- export GOPRIVATE=github.com/molecula/*
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
## Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
- echo "$FB_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
## Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- git config --global --get url."ssh://git@github.com/".insteadOf || git config --global --add url."ssh://git@github.com/".insteadOf "https://github.com/" || true
## Set up known_hosts so we don't get prompted when there's no
## human to answer the prompt (resulting in cryptic failures).
## ssh-keygen -F checks whether github.com is in known_hosts and
## handles HashKnownHosts appropriately.
- ssh-keygen -F github.com || echo "$SSH_KNOWN_HOSTS_HASHED" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
.go-cache:
variables:
GOPATH: $CI_PROJECT_DIR/.go
@ -68,6 +94,7 @@ gosec-sast:
- mkdir -p .go
cache:
# this caching strategy makes it so each branch uses the same cache
# which I think is the best default strategy
key: "$CI_COMMIT_REF_SLUG"
paths:
- .go/pkg/mod/
@ -87,7 +114,7 @@ golangci-lint:
image: golangci/golangci-lint:v1.46.2
extends: .go-cache
stage: lint
allow_failure: true
allow_failure: false
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
script:
@ -169,52 +196,19 @@ build featurebase:
- go install github.com/rakyll/statik@v0.1.7
- $GOPATH/bin/statik -src=lattice
- export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
- |
for goos in "darwin" "linux"; do
for goarch in "amd64" "arm64"; do
GOOS="${goos}" GOARCH="${goarch}" make build FLAGS="-o featurebase_${goos}_${goarch}"
done
done
- GOOS="linux" GOARCH="amd64" make build FLAGS="-o featurebase_linux_amd64"
- GOOS="linux" GOARCH="arm64" make build FLAGS="-o featurebase_linux_arm64"
- GOOS="darwin" GOARCH="amd64" make build FLAGS="-o featurebase_darwin_amd64"
- GOOS="darwin" GOARCH="arm64" make build FLAGS="-o featurebase_darwin_arm64"
artifacts:
paths:
- featurebase_*
- featurebase_linux_amd64
- featurebase_linux_arm64
- featurebase_darwin_amd64
- featurebase_darwin_arm64
needs:
- job: build lattice
build fbsql amd64:
stage: test
variables:
BUILD_NAME: build_${CI_COMMIT_SHA}_${CI_CONCURRENT_ID}
tags:
- shell
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
script:
- export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
- date
- GOOS="linux" GOARCH="amd64" make docker-build-fbsql BUILD_CGO=1
- GOOS="darwin" GOARCH="amd64" make docker-build-fbsql
artifacts:
paths:
- ./build/fbsql_*
build fbsql arm64:
stage: test
variables:
BUILD_NAME: build_${CI_COMMIT_SHA}_${CI_CONCURRENT_ID}
tags:
- shell-arm64
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
script:
- export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
- date
- GOOS="linux" GOARCH="arm64" make docker-build-fbsql BUILD_CGO=1
- GOOS="darwin" GOARCH="arm64" make docker-build-fbsql
artifacts:
paths:
- ./build/fbsql_*
build amd container fb:
stage: test
tags:
@ -255,27 +249,13 @@ run go tests race:
stage: nonblocking # don't let this job block any other jobs because it takes much longer than the other tests.
image: golang:$GOVERSION
extends: .go-cache
variables:
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_DATABASE: run_go_tests_race
POSTGRES_DB: run_go_tests_race
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_USER: postgres
POSTGRES_USER: postgres
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_HOST: postgres
services:
- postgres:14.7
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
needs: ["smoke build"] # we do block on smoke build though bc it's pretty dumb to test stuff if it doesn't build
script:
- echo "Running featurebase race tests..."
- PKG_LIST=$(go list ./... | grep -Ev 'internal/clustertests|simulacraData|batch|idk|v3/dax/test/dax' | paste -s -d, -)
- export TMPDIR=/mnt/ramdisk/test-$CI_JOB_ID
- mkdir -p $TMPDIR
- go test -race -v -timeout=10m ${PKG_LIST//,/ }
after_script:
- rm -rf /mnt/ramdisk/test-$CI_JOB_ID
- RAMDISK=/mnt/ramdisk go test -race -v -timeout=10m ${PKG_LIST//,/ }
tags:
- docker
@ -286,26 +266,12 @@ run go tests:
stage: test
image: golang:$GOVERSION
extends: .go-cache
variables:
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_DATABASE: run_go_tests
POSTGRES_DB: run_go_tests
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_USER: postgres
POSTGRES_USER: postgres
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_HOST: postgres
services:
- postgres:14.7
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
script:
- echo "Running featurebase unit tests..."
- PKG_LIST=$(go list ./... | grep -Ev 'internal/clustertests|simulacraData|batch|idk|v3/dax/test/dax' | paste -s -d, -)
- export TMPDIR=/mnt/ramdisk/test-$CI_JOB_ID
- mkdir -p $TMPDIR
- go test -tags=shardwidth22 -timeout=10m -coverprofile=coverage.out -covermode=atomic -coverpkg=${PKG_LIST} ${PKG_LIST//,/ }
after_script:
- rm -rf /mnt/ramdisk/test-$CI_JOB_ID
- RAMDISK=/mnt/ramdisk go test -tags=shardwidth22 -timeout=10m -coverprofile=coverage.out -covermode=atomic -coverpkg=${PKG_LIST} ${PKG_LIST//,/ }
artifacts:
paths:
- coverage.out
@ -315,29 +281,14 @@ run go tests:
run go tests dax/test/dax:
stage: test
image: golang:$GOVERSION
extends: .go-cache
tags:
- docker
variables:
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_DATABASE: run_go_tests_dax
POSTGRES_DB: run_go_tests_dax
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_USER: postgres
POSTGRES_USER: postgres
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
FEATUREBASE_CONTROLLER_CONFIG_SQLDB_HOST: postgres
services:
- postgres:14.7
- aws
rules:
- if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"'
script:
- echo "Building FB and Datagen docker images for DAX tests"
- PKG_LIST=$(go list ./... | grep -Ev 'internal/clustertests|simulacraData' | paste -s -d, -)
- export TMPDIR=/mnt/ramdisk/test-$CI_JOB_ID
- mkdir -p $TMPDIR
- go test -coverprofile=coverage-dax-integration.out -covermode=atomic -coverpkg=${PKG_LIST} -timeout=20m ./dax/test/dax
after_script:
- rm -rf /mnt/ramdisk/test-$CI_JOB_ID
artifacts:
paths:
- coverage-dax-integration.out
@ -348,12 +299,14 @@ run go tests idk race:
PROJECT: race_${CI_CONCURRENT_ID}
stage: nonblocking
retry: 1
rules:
- !reference [.idk_changed, rules]
script:
- echo "Running test-all-race"
- cd ./idk/
- echo $PROJECT
- echo $CI_COMMIT_REF_SLUG
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all-race
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} make test-all-race
after_script:
- cd ./idk/
- make save-pilosa-logs
@ -373,12 +326,14 @@ run go tests idk shard transactional:
PROJECT: shardttrans_${CI_CONCURRENT_ID}
stage: nonblocking
retry: 1
rules:
- !reference [.idk_changed, rules]
script:
- echo "Running shard transactional tests"
- cd ./idk/
- echo $PROJECT
- echo $CI_COMMIT_REF_SLUG
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} make test-all
after_script:
- cd ./idk/
- make save-pilosa-logs
@ -404,11 +359,13 @@ run go tests idk 533:
- cd ./idk/
- echo $PROJECT
- echo $CI_COMMIT_REF_SLUG
- CONFLUENT_VERSION=5.3.3 BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all
- CONFLUENT_VERSION=5.3.3 BRANCH_NAME=${CI_COMMIT_REF_SLUG} make test-all
after_script:
- cd ./idk/
- make save-pilosa-logs
- make shutdown
rules:
- !reference [.idk_changed, rules]
tags:
- shell
- aws
@ -428,11 +385,13 @@ run go tests idk sasl:
- cd ./idk/
- echo $PROJECT
- echo $CI_COMMIT_REF_SLUG
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} IDK_FEATUREBASE_TAG=${CI_COMMIT_TAG} IDK_FEATUREBASE_HASH=${CI_COMMIT_SHA} make test-all-kafka-sasl
- BRANCH_NAME=${CI_COMMIT_REF_SLUG} make test-all-kafka-sasl
after_script:
- cd ./idk/
- make save-pilosa-logs
- make shutdown
rules:
- !reference [.idk_changed, rules]
tags:
- shell
- aws
@ -492,8 +451,7 @@ upload_artifacts_to_nexus:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- curl -v --user "$NEXUS_YUM_CREDS" --upload-file *.arm64.rpm https://nexus.molecula.com/repository/molecula-yum/release/
- curl -v --user "$NEXUS_YUM_CREDS" --upload-file *.amd64.rpm https://nexus.molecula.com/repository/molecula-yum/release/
- find . -maxdepth 1 -name '*.rpm' -exec curl -v --user "$NEXUS_YUM_CREDS" --upload-file {} https://nexus.molecula.com/repository/molecula-yum/release/ \;
dependencies:
- package for linux amd64
- package for linux arm64
@ -548,6 +506,8 @@ idk build_amd64:
stage: build
variables:
BUILD_NAME: build_${CI_COMMIT_SHA}_${CI_CONCURRENT_ID}
extends:
- .setup_ssh
tags:
- shell
rules:
@ -569,6 +529,8 @@ idk build_amd64:
idk build_arm64:
stage: build
extends:
- .setup_ssh
tags:
- shell-arm64
rules:
@ -592,6 +554,8 @@ idk build_arm64:
# only do containers on default branch
idk package_docker_all:
stage: build
extends:
- .setup_ssh
tags:
- shell
rules:
@ -607,6 +571,8 @@ idk package_docker_all:
idk s3 dump:
stage: post build
extends:
- .setup_ssh
allow_failure: false
variables:
PROFILE: "service-fb-ci"
@ -630,6 +596,8 @@ idk s3 dump:
idk s3 dump tag:
stage: post build
extends:
- .setup_ssh
variables:
PROFILE: "service-fb-ci"
AWS_SSH_PRIVATE_KEY: $AWS_FBCI_SSH_KEY
@ -679,6 +647,66 @@ external lookup tests:
- apt-get install -y postgresql-client
- go test . -run "^TestExternalLookup" -externalLookupDSN postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres/$POSTGRES_DB?sslmode=disable
smoke test:
stage: integration
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
variables:
PROFILE: "service-terraform"
AWS_SSH_PRIVATE_KEY: $AWS_FBCI_SSH_KEY
AWS_ACCESS_KEY_ID: $AWS_FBCI_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_FBCI_SECRET_ACCESS_KEY
TF_VAR_cluster_prefix: ""
tags:
- aws
- docker
- fbsmoke
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
before_script:
- apt-get update && apt-get install -y gnupg software-properties-common curl git
- curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
- apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
- apt-get update && apt-get install terraform
- aws configure set aws_access_key_id $AWS_FBCI_ACCESS_KEY_ID --profile $PROFILE
- aws configure set aws_secret_access_key $AWS_FBCI_SECRET_ACCESS_KEY --profile $PROFILE
- aws configure set region "us-east-2" --profile $PROFILE
- aws configure set aws_profile $PROFILE
- echo $AWS_FBCI_SSH_KEY > gitlab-featurebase-ci.pem
- chmod 400 gitlab-featurebase-ci.pem
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo $AWS_FBCI_SSH_KEY > /root/.ssh/gitlab-featurebase-ci.pem
- chmod 400 /root/.ssh/gitlab-featurebase-ci.pem
- echo "$AWS_FBCI_SSH_KEY" | ssh-add -
- chmod 700 /root/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- apt update && apt -y install jq wget git libnss3-tools
- wget -q https://go.dev/dl/go$GOVERSION.linux-amd64.tar.gz
- tar -C /usr/local -xzf go$GOVERSION.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- TF_VAR_cluster_prefix="pipeline-$CI_PIPELINE_ID-smoke-$CI_JOB_ID"
- echo "Cluster Prefix --> $TF_VAR_cluster_prefix"
# download datagen for FB-1270 repro test.
- aws s3 cp s3://molecula-artifact-storage/idk/${CI_COMMIT_BRANCH}/_latest/idk-linux-arm64/datagen ./datagen_linux_arm64
- aws s3 cp s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_linux_arm64 ./
- chmod +x ./datagen_linux_arm64 ./featurebase_linux_arm64
script:
- ./qa/scripts/setupSmokeTest.sh $CI_COMMIT_BRANCH
- ./qa/scripts/testSmokeTest.sh
- ./qa/scripts/bug_repro_tests.sh
after_script:
- ./qa/scripts/teardownSmokeTest.sh
needs:
- job: s3 dump
- job: idk s3 dump
artifacts:
when: always
paths:
- report.xml
reports:
junit: report.xml
s3 dump:
stage: post build
variables:
@ -695,19 +723,16 @@ s3 dump:
- aws configure set aws_secret_access_key $AWS_FBCI_SECRET_ACCESS_KEY
- aws configure set region "us-east-2"
- aws configure set aws_profile $PROFILE
- |
for goos in "darwin" "linux"; do
for goarch in "amd64" "arm64"; do
aws s3 cp featurebase_${goos}_${goarch} s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHORT_SHA}/featurebase_${goos}_${goarch}
aws s3 cp featurebase_${goos}_${goarch} s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_${goos}_${goarch}
aws s3 cp ./build/fbsql_${goos}_${goarch} s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHORT_SHA}/fbsql_${goos}_${goarch}
aws s3 cp ./build/fbsql_${goos}_${goarch} s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/fbsql_${goos}_${goarch}
done
done
- aws s3 cp featurebase_linux_amd64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHORT_SHA}/featurebase_linux_amd64
- aws s3 cp featurebase_linux_amd64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_linux_amd64
- aws s3 cp featurebase_linux_arm64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHORT_SHA}/featurebase_linux_arm64
- aws s3 cp featurebase_linux_arm64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_linux_arm64
- aws s3 cp featurebase_darwin_amd64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHORT_SHA}/featurebase_darwin_amd64
- aws s3 cp featurebase_darwin_amd64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_darwin_amd64
- aws s3 cp featurebase_darwin_arm64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHORT_SHA}/featurebase_darwin_arm64
- aws s3 cp featurebase_darwin_arm64 s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_darwin_arm64
needs:
- job: build featurebase
- job: build fbsql amd64
- job: build fbsql arm64
s3 dump tag:
stage: post build
@ -733,7 +758,6 @@ s3 dump tag:
echo "Directory ${dir}"
mkdir $dir
mv featurebase_${goos}_${goarch} ${dir}/featurebase
mv ./build/fbsql_${goos}_${goarch} ${dir}/fbsql
cp NOTICE install/featurebase.conf install/featurebase.*.service ${dir}/
tar cvzf ${dir}.tar.gz ${dir}
aws s3 cp ${dir} s3://${LOCATION}/${CI_COMMIT_TAG}/${dir}/ --recursive
@ -743,5 +767,24 @@ s3 dump tag:
needs:
- job: build featurebase
- job: build fbsql amd64
- job: build fbsql arm64
cleanup_build_job:
stage: cleanup_build
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
variables:
FBCI_PROFILE: "service-terraform"
AWS_ACCESS_KEY_ID: $AWS_FBCI_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_FBCI_SECRET_ACCESS_KEY
tags:
- aws
- docker
- fbsmoke
script:
- aws configure set aws_access_key_id $AWS_FBCI_ACCESS_KEY_ID --profile $FBCI_PROFILE
- aws configure set aws_secret_access_key $AWS_FBCI_SECRET_ACCESS_KEY --profile $FBCI_PROFILE
- aws configure set region "us-east-2" --profile $FBCI_PROFILE
- aws configure set aws_profile $FBCI_PROFILE
- ./qa/scripts/gitlabCleanupBuild.sh
when: always
needs:
- job: smoke test

View file

@ -0,0 +1,64 @@
variables:
GOVERSION: "1.19"
stages:
- performance
perf_able:
stage: performance
timeout: 2h
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
variables:
PROFILE: "service-terraform"
INFRA_PROFILE: "service-gitlab"
AWS_SSH_PRIVATE_KEY: $AWS_FBCI_SSH_KEY
AWS_ACCESS_KEY_ID: $AWS_FBCI_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_FBCI_SECRET_ACCESS_KEY
ASG_NAME: "gitlab-runners"
TF_VAR_cluster_prefix: ""
tags:
- aws
- docker
- fbsmoke
before_script:
- apt-get update && apt-get install -y gnupg software-properties-common curl git
- curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
- apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
- apt-get update && apt-get install terraform
- aws configure set aws_access_key_id $AWS_FBCI_ACCESS_KEY_ID --profile $PROFILE
- aws configure set aws_secret_access_key $AWS_FBCI_SECRET_ACCESS_KEY --profile $PROFILE
- aws configure set region "us-east-2" --profile $PROFILE
- aws configure set aws_profile $PROFILE
- aws configure set aws_access_key_id $AWS_INFRA_ACCESS_KEY_ID --profile $INFRA_PROFILE
- aws configure set aws_secret_access_key $AWS_INFRA_SECRET_ACCESS_KEY --profile $INFRA_PROFILE
- aws configure set region "us-east-2" --profile $INFRA_PROFILE
- echo $AWS_FBCI_SSH_KEY > gitlab-featurebase-ci.pem
- chmod 400 gitlab-featurebase-ci.pem
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo $AWS_FBCI_SSH_KEY > /root/.ssh/gitlab-featurebase-ci.pem
- chmod 400 /root/.ssh/gitlab-featurebase-ci.pem
- echo "$AWS_FBCI_SSH_KEY" | ssh-add -
- chmod 700 /root/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- apt update && apt -y install jq wget
- wget -q https://go.dev/dl/go$GOVERSION.linux-amd64.tar.gz
- tar -C /usr/local -xzf go$GOVERSION.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- TF_VAR_cluster_prefix="able-$(openssl rand -base64 12 | tr -d /=+ | cut -c -16)"
- echo "Cluster Prefix --> $TF_VAR_cluster_prefix"
- export INSTANCE_ID=$(curl --silent --fail "http://169.254.169.254/latest/meta-data/instance-id" | tee instance_id)
- aws autoscaling set-instance-protection --instance-ids "$INSTANCE_ID" --auto-scaling-group-name $ASG_NAME --protected-from-scale-in --profile $INFRA_PROFILE
- aws s3 cp s3://molecula-artifact-storage/featurebase/${CI_COMMIT_BRANCH}/_latest/featurebase_linux_arm64 ./
- chmod +x ./featurebase_linux_arm64
script:
- ./qa/scripts/perf/able/ableSetup.sh $CI_COMMIT_BRANCH
- ./qa/scripts/perf/able/ableTest.sh
after_script:
- ./qa/scripts/perf/able/ableTeardown.sh || true
- export INSTANCE_ID=$(cat instance_id)
- aws autoscaling set-instance-protection --instance-ids "$INSTANCE_ID" --auto-scaling-group-name $ASG_NAME --no-protected-from-scale-in --profile $INFRA_PROFILE
needs:
- pipeline: $PARENT_PIPELINE_ID
job: build featurebase

View file

@ -1,8 +1,8 @@
run:
#skip the protobuf generated files
deadline: 5m
timeout: 5m
skip-dirs-use-default: true
#skip the protobuf generated files
skip-dirs:
- pb
- proto
@ -10,26 +10,9 @@ run:
- pql/pql.peg.go
linters:
enable:
# Recommended to be enabled by default (https://golangci-lint.run).
# - errcheck (lots to fix)
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
# - unused (about 20 to fix)
# Additional linters we choose to enable.
# - bodyclose (lots to fix, but we should)
- errchkjson
- errname
- gofmt
# - misspell (lots to fix, but we should)
- prealloc
# - predeclared (20 to fix)
# - stylecheck (quite a lot to fix, but we should definitely work on this)
- stylecheck
# - unconvert (not at all critical, but makes for cleaner code)
- staticcheck
enable-all: false
disable-all: true
@ -67,12 +50,6 @@ linters-settings:
- shadow
disable-all: false
stylecheck:
# ST1000: at least one file in a package should have a package comment
# ST1003: golang naming standards
# ST1016: methods on the same type should have the same receiver name
# ST1020: comment on exported function
checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020"]
issues:
exclude-use-default: false
@ -81,3 +58,4 @@ issues:
exclude:
- 'declaration of "(err|ctx)" shadows declaration at'
- 'Error return value of .(.*\.Help|.*\.MarkFlagRequired|(os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked'

View file

@ -5,7 +5,7 @@ FROM golang:1.19
LABEL maintainer "dev@pilosa.com"
COPY . /go/src/github.com/featurebasedb/featurebase/
COPY . /go/src/github.com/molecula/featurebase/
# download pumba for fault injection
@ -20,12 +20,12 @@ RUN apt install -y docker.io
ADD https://github.com/docker/compose/releases/latest/download/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose
WORKDIR /go/src/github.com/featurebasedb/featurebase/cmd/featurebase
WORKDIR /go/src/github.com/molecula/featurebase/cmd/featurebase
# generate an instrumented binary to allow for calculating code coverage for clustertests
# the entrypoint for the binary is TestRunMain, which is wrapper for main
RUN go test -covermode=atomic -coverpkg=../../... -c -tags testrunmain -o featurebase
RUN cp /go/src/github.com/featurebasedb/featurebase/cmd/featurebase/featurebase /featurebase
RUN cp /go/src/github.com/molecula/featurebase/cmd/featurebase/featurebase /featurebase
COPY NOTICE /NOTICE

View file

@ -5,7 +5,7 @@ FROM golang:1.19
LABEL maintainer "dev@pilosa.com"
COPY . /go/src/github.com/featurebasedb/featurebase/
COPY . /go/src/github.com/molecula/featurebase/
# download pumba for fault injection
ADD https://github.com/alexei-led/pumba/releases/download/0.6.0/pumba_linux_amd64 /pumba
@ -19,19 +19,19 @@ RUN apt install -y docker.io
ADD https://github.com/docker/compose/releases/latest/download/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
RUN chmod +x /usr/local/bin/docker-compose
WORKDIR /go/src/github.com/featurebasedb/featurebase/cmd/featurebase
WORKDIR /go/src/github.com/molecula/featurebase/cmd/featurebase
RUN go test -covermode=atomic -coverpkg=../../... -c -tags testrunmain -o featurebase
RUN cp /go/src/github.com/featurebasedb/featurebase/cmd/featurebase/featurebase /featurebase
RUN cp /go/src/github.com/molecula/featurebase/cmd/featurebase/featurebase /featurebase
COPY NOTICE /NOTICE
COPY ./internal/clustertests /go/src/github.com/featurebasedb/featurebase/internal/clustertests
COPY ./internal/clustertests /go/src/github.com/molecula/featurebase/internal/clustertests
EXPOSE 10101
VOLUME /data
WORKDIR /go/src/github.com/featurebasedb/featurebase
WORKDIR /go/src/github.com/molecula/featurebase
CMD ["/featurebase", "-test.run=TestRunMain", "-test.coverprofile=/results/coverage.out", "server", "--data-dir", "/data", "--bind", "http://0.0.0.0:10101"]

View file

@ -16,7 +16,7 @@ RUN make build FLAGS="-o build/featurebase" ${MAKE_FLAGS}
### FeatureBase runner ###
##########################
FROM golang:alpine as runner
FROM alpine:3.13.2 as runner
LABEL maintainer "dev@featurebase.com"

View file

@ -1,48 +0,0 @@
ARG GO_VERSION=1.19
FROM golang:1.19-buster as builder
WORKDIR /
RUN apt-get update -y -qq && apt-get install -y -qq \
build-essential \
git \
musl-tools \
netcat \
unixodbc \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*
RUN ["git", "clone", "https://github.com/edenhill/librdkafka.git"]
WORKDIR /librdkafka
RUN ./configure --prefix /usr && \
make && \
make install
WORKDIR /featurebase
COPY . .
ARG MAKE_FLAGS
ARG GO_BUILD_FLAGS
ARG SOURCE_DATE_EPOCH
WORKDIR /featurebase/
ENV SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}
RUN make build-fbsql GO_BUILD_FLAGS="-mod=vendor ${GO_BUILD_FLAGS}" ${MAKE_FLAGS}
FROM ubuntu:20.04 as runner
RUN apt-get update -y -qq && apt-get install -y -qq \
ca-certificates \
musl-tools \
netcat \
unixodbc-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /featurebase/fbsql /usr/local/bin/
# Verify that the linker can find everything.
FROM runner as linkcheck
RUN if [ -e /usr/local/bin/fbsql ] ; then ldd /usr/local/bin/fbsql; fi
FROM runner

201
LICENSE
View file

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Molecula Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

114
Makefile
View file

@ -1,4 +1,4 @@
.PHONY: build clean build-lattice cover cover-viz default docker docker-build docker-build-fbsql docker-tag-push generate generate-protoc generate-pql generate-statik generate-stringer install install-protoc-gen-gofast install-protoc install-statik install-peg test docker-login
.PHONY: build clean build-lattice cover cover-viz default docker docker-build docker-tag-push generate generate-protoc generate-pql generate-statik generate-stringer install install-protoc-gen-gofast install-protoc install-statik install-peg test docker-login
SHELL := /bin/bash
VERSION := $(shell git describe --tags 2> /dev/null || echo unknown)
@ -17,17 +17,12 @@ else
endif
SHARD_WIDTH = 20
COMMIT := $(shell git describe --exact-match >/dev/null 2>&1 || git rev-parse --short HEAD)
LDFLAGS="-X github.com/featurebasedb/featurebase/v3.Version=$(VERSION) -X github.com/featurebasedb/featurebase/v3.BuildTime=$(BUILD_TIME) -X github.com/featurebasedb/featurebase/v3.Variant=$(VARIANT) -X github.com/featurebasedb/featurebase/v3.Commit=$(COMMIT) -X github.com/featurebasedb/featurebase/v3.TrialDeadline=$(TRIAL_DEADLINE)"
LDFLAGS="-X github.com/molecula/featurebase/v3.Version=$(VERSION) -X github.com/molecula/featurebase/v3.BuildTime=$(BUILD_TIME) -X github.com/molecula/featurebase/v3.Variant=$(VARIANT) -X github.com/molecula/featurebase/v3.Commit=$(COMMIT) -X github.com/molecula/featurebase/v3.TrialDeadline=$(TRIAL_DEADLINE)"
GO_VERSION=1.19
GO_BUILD_FLAGS=
DOCKER_BUILD= # set to 1 to use `docker-build` instead of `build` when creating a release
BUILD_TAGS +=
BUILD_TAGS += shardwidth$(SHARD_WIDTH)
TEST_TAGS = roaringparanoia
TEST_TIMEOUT=10m
RACE_TEST_TIMEOUT=10m
# size in GB to use for ramdisk, ?= so you can override it with env
# 4GB is not enough for `make test`, 8GB usually is.
RAMDISK_SIZE ?= 8
export GO111MODULE=on
export GOPRIVATE=github.com/molecula
@ -51,11 +46,11 @@ version:
# We build a list of packages that omits the IDK and batch packages because
# those packages require fancy environment setup.
GOPACKAGES := $(shell $(GO) list ./... | grep -v "/v3/idk" | grep -v "/v3/batch")
GOPACKAGES := $(shell $(GO) list ./... | grep -v "/idk" | grep -v "/batch")
# Run test suite
test:
$(GO) test $(GOPACKAGES) -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout $(TEST_TIMEOUT) -count=1
$(GO) test $(GOPACKAGES) -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout $(TEST_TIMEOUT)
# Run test suite with race flag
test-race:
@ -72,7 +67,7 @@ testv-race: testvsub-race
#
testvsub:
@set -e; for pkg in $(GOPACKAGES); do \
if [ $${pkg:0:38} == "github.com/featurebasedb/featurebase/v3/idk" ]; then \
if [ $${pkg:0:38} == "github.com/molecula/featurebase/v3/idk" ]; then \
echo; echo "___ skipping subpkg $$pkg"; \
continue; \
fi; \
@ -81,18 +76,13 @@ testvsub:
echo; echo "999 done testing subpkg $$pkg"; \
done
# make a $(RAMDISK_SIZE)GB RAMDisk. Speed up tests by running
# them with TMPDIR=/mnt/ramdisk.
# make a 2GB RAMDisk. Speed up tests by running them with RAMDISK=/mnt/ramdisk
ramdisk-linux:
mount -o size=$(RAMDISK__SIZE)G -t tmpfs none /mnt/ramdisk
mount -o size=2G -t tmpfs none /mnt/ramdisk
# make a $(RAMDISK_SIZE)GB RAMDisk. Speed up tests by running
# them with TMPDIR=/Volumes/RAMDisk. This is more important on
# OS X than it is on Linux, because there's performance issues
# with fsync on OS X that can make the SSD slow down to moving-platters
# drive speeds. Oops.
# make a 2GB RAMDisk. Speed up tests by running them with RAMDISK=/Volumes/RAMDisk
ramdisk-osx:
diskutil erasevolume HFS+ 'RAMDisk' $$(hdiutil attach -nobrowse -nomount ram://$$(expr 2097152 \* $(RAMDISK_SIZE)))
diskutil erasevolume HFS+ 'RAMDisk' `hdiutil attach -nobrowse -nomount ram://4194304`
detach-ramdisk-osx:
hdiutil detach /Volumes/RAMDisk
@ -117,13 +107,12 @@ cover:
cover-viz: cover
$(GO) tool cover -html=build/coverage.out
# Build featurebase
# Compile Pilosa
build:
$(GO) build -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/featurebase
package:
GOOS=$(GOOS) GOARCH=$(GOARCH) $(MAKE) build
GOOS=$(GOOS) GOARCH=$(GOARCH) $(MAKE) build-fbsql
GOOS=$(GOOS) GOARCH=$(GOARCH) FLAGS="-o featurebase" $(MAKE) build
GOARCH=$(GOARCH) VERSION=$(VERSION) nfpm package --packager deb --target featurebase.$(VERSION).$(GOARCH).deb
GOARCH=$(GOARCH) VERSION=$(VERSION) nfpm package --packager rpm --target featurebase.$(VERSION).$(GOARCH).rpm
@ -145,7 +134,7 @@ clustertests: vendor
$(DOCKER_COMPOSE) -f internal/clustertests/docker-compose.yml down
# Run the cluster tests with authentication enabled
AUTH_ARGS="-c /go/src/github.com/featurebasedb/featurebase/internal/clustertests/testdata/featurebase.conf"
AUTH_ARGS="-c /go/src/github.com/molecula/featurebase/internal/clustertests/testdata/featurebase.conf"
authclustertests: vendor
CLUSTERTESTS_FB_ARGS=$(AUTH_ARGS) $(DOCKER_COMPOSE) -f internal/clustertests/docker-compose.yml down
CLUSTERTESTS_FB_ARGS=$(AUTH_ARGS) $(DOCKER_COMPOSE) -f internal/clustertests/docker-compose.yml build
@ -154,7 +143,7 @@ authclustertests: vendor
CLUSTERTESTS_FB_ARGS=$(AUTH_ARGS) $(DOCKER_COMPOSE) -f internal/clustertests/docker-compose.yml down
# Install FeatureBase and IDK
install: install-featurebase install-idk install-fbsql
install: install-featurebase install-idk
install-featurebase:
$(GO) install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/featurebase
@ -162,9 +151,6 @@ install-featurebase:
install-idk:
$(MAKE) -C ./idk install
install-fbsql:
CGO_ENABLED=1 $(GO) install ./cmd/fbsql
# Build the lattice assets
build-lattice:
docker build -t lattice:build ./lattice
@ -172,20 +158,16 @@ build-lattice:
# `go generate` protocol buffers
generate-protoc: require-protoc require-protoc-gen-gofast
$(GO) generate github.com/featurebasedb/featurebase/v3/pb
$(GO) generate github.com/molecula/featurebase/v3/pb
# `go generate` statik assets (lattice UI)
generate-statik: build-lattice require-statik
$(GO) generate github.com/featurebasedb/featurebase/v3/statik
$(GO) generate github.com/molecula/featurebase/v3/statik
# `go generate` statik assets (lattice UI) in Docker
generate-statik-docker: build-lattice
docker run --rm -t -v $(PWD):/pilosa golang:1.15.8 sh -c "go get github.com/rakyll/statik && /go/bin/statik -src=/pilosa/lattice/build -dest=/pilosa -f"
# `go generate` stringers
generate-stringer:
$(GO) generate github.com/featurebasedb/featurebase/v3
generate-pql: require-peg
cd pql && peg -inline pql.peg && cd ..
@ -233,13 +215,6 @@ docker-image-featurebase: vendor
--file Dockerfile-dax \
--tag dax/featurebase .
docker-image-featurebase-linux-amd64: vendor
docker build \
--build-arg GO_VERSION=$(GO_VERSION) \
--platform linux/amd64 \
--file Dockerfile-dax \
--tag dax/featurebase .
docker-image-featurebase-test: vendor
docker build \
--build-arg GO_VERSION=$(GO_VERSION) \
@ -266,12 +241,7 @@ docker-image-featurebase-quick: build-for-quick
docker-image-datagen: vendor
docker build --tag dax/datagen --file Dockerfile-datagen .
get-account-id:
$(eval AWS_ACCOUNTID := $(shell aws sts get-caller-identity --output=json | jq -r .Account))
ecr-push-featurebase: docker-login
echo "Pushing to account $(AWS_ACCOUNTID), profile $(AWS_PROFILE)"
docker tag dax/featurebase:latest $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/featurebase:latest
docker push $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/featurebase:latest
@ -279,7 +249,7 @@ ecr-push-datagen: docker-login
docker tag dax/datagen:latest $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/datagen:latest
docker push $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com/dax/datagen:latest
docker-login: get-account-id
docker-login:
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin $(AWS_ACCOUNTID).dkr.ecr.us-east-2.amazonaws.com
# Create docker image (alias)
@ -353,53 +323,3 @@ test-external-lookup:
bnf:
ebnf2railroad --no-overview-diagram --no-optimizations ./sql3/sql3.ebnf
#################################
# fbsql builds in docker
#################################
# This allows multiple concurrent builds to happen in CI without
# creating container name conflicts and such. (different BUILD_NAMEs
# are passed in from gitlab-ci.yml)
BUILD_NAME ?= fbsql-build
LDFLAGS_STATIC="-linkmode external -extldflags \"-static\" -X 'github.com/featurebasedb/featurebase/v3/fbsql.Version=$(VERSION)' -X 'github.com/featurebasedb/featurebase/v3/fbsql.BuildTime=$(BUILD_TIME)' "
UNAME_P := $(shell uname -p)
BUILD_CGO ?= 0
# Build fbsql
build-fbsql:
@echo GOOS=$(GOOS) GOARCH=$(GOARCH) uname -p=$(UNAME_P) build_cgo=$(BUILD_CGO)
ifeq ($(BUILD_CGO), 0)
make build-fbsql-non-cgo
endif
ifeq ($(BUILD_CGO), 1)
make build-fbsql-cgo
endif
build-fbsql-non-cgo:
CGO_ENABLED=0 $(GO) build -ldflags $(LDFLAGS) $(GO_BUILD_FLAGS) -o fbsql ./cmd/fbsql
build-fbsql-cgo:
ifeq ($(GOARCH), arm64)
CGO_ENABLED=1 $(GO) build -tags dynamic $(GO_BUILD_FLAGS) -o fbsql ./cmd/fbsql
endif
ifeq ($(GOARCH), amd64)
CC=/usr/bin/musl-gcc CGO_ENABLED=1 $(GO) build -tags "musl static" -ldflags $(LDFLAGS_STATIC) $(GO_BUILD_FLAGS) -o fbsql ./cmd/fbsql
endif
docker-build-fbsql: vendor
DOCKER_BUILDKIT=0 docker build \
--file Dockerfile-fbsql \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg MAKE_FLAGS="GOOS=$(GOOS) GOARCH=$(GOARCH) BUILD_CGO=$(BUILD_CGO)" \
--build-arg GO_BUILD_FLAGS=$(GO_BUILD_FLAGS) \
--build-arg SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) \
--target builder \
--tag fbsql:$(BUILD_NAME) .
mkdir -p build
docker create --name $(BUILD_NAME) fbsql:$(BUILD_NAME)
docker cp $(BUILD_NAME):/featurebase/fbsql ./build/fbsql_$(GOOS)_$(GOARCH)
docker rm $(BUILD_NAME)

View file

@ -1,45 +0,0 @@
## User Contribution Guidelines for FeatureBase
Thank you for your interest in contributing to FeatureBase! We appreciate your support in making this open-source project even better. Here are some guidelines to help you get started with contributing to FeatureBase:
1. Familiarize Yourself with the Project:
- Visit the FeatureBase website at www.featurebase.com to understand the project's goals, capabilities, and features.
- Read the documentation available on the website, including the installation guide, configuration options, and data modeling concepts.
- Explore the codebase by cloning the repository and reviewing the source code.
2. Join the Community:
- Visit the FeatureBase community page at https://www.featurebase.com/community to learn more about the project's community and how to get involved.
- Join the Discord server at https://discord.gg/FBn2vEp7Na to chat with other contributors and users, ask questions, and share your ideas.
3. Set Up Your Development Environment:
- Ensure you have Go installed on your machine. Make sure your shell's search path includes the go/bin directory.
- Clone the FeatureBase repository or download it as a zip file from the repository's page.
- Follow the "Build FeatureBase Server from source" instructions in the README file to compile the server binary and the ingester binaries.
4. Choose a Contribution Area:
- Identify the area you'd like to contribute to, such as bug fixes, new features, performance improvements, documentation updates, or community support.
- Check the issue tracker on the repository or the FeatureBase community for open issues or feature requests that align with your interests and skills. Alternatively, propose your own idea by creating a new issue.
5. Create a New Branch:
- Before making any changes, create a new branch in the repository's Git repository. This branch will contain your contributions.
- Give your branch a descriptive name that reflects the nature of your contribution.
6. Make Your Changes:
- Follow the coding style and conventions used in the existing codebase.
- Write clear and concise commit messages for each logical change.
- If you're introducing new features or modifying existing behavior, make sure to update the documentation to reflect the changes.
7. Test Your Changes:
- Run the existing test suite to ensure that your modifications do not introduce any regressions.
- If applicable, write additional tests to cover the changes you made.
- Document any new testing procedures required for your contribution.
8. Submitting Your Contribution:
- Push your branch to the main repository or create a fork and submit a pull request to the main repository.
- Provide a detailed description of your changes, including the problem you solved and the approach you took.
- Be responsive to any feedback or suggestions provided by the project maintainers or other contributors.
- Once your contribution is approved, it will be reviewed and merged into the main codebase.
Please note that by contributing to FeatureBase, you agree that your contributions will be licensed under the Apache 2.0 license, which governs the project.
Thank you for considering contributing to FeatureBase! Your contributions are valuable and help improve the project for everyone.

View file

@ -1,72 +1,11 @@
# FeatureBase Community
# FeatureBase, a distributed bitmap index
FeatureBase Community is now archived and no longer maintained.
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=molecula_featurebase&metric=coverage&token=8e09e593b40570b544ed7defb47018add4eb9e7b)](https://sonarcloud.io/summary/new_code?id=molecula_featurebase)
[![SecurityRating](https://sonarcloud.io/api/project_badges/measure?project=molecula_featurebase&metric=security_rating&token=8e09e593b40570b544ed7defb47018add4eb9e7b)](https://sonarcloud.io/summary/new_code?id=molecula_featurebase)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=molecula_featurebase&metric=alert_status&token=8e09e593b40570b544ed7defb47018add4eb9e7b)](https://sonarcloud.io/summary/new_code?id=molecula_featurebase)
* [FeatureBase Community Help](https://github.com/FeatureBaseDB/FB-community-help)
See our [internal documentation](https://internal-docs.molecula.cloud), which includes all [external documentation](https://docs.molecula.cloud), plus many internal-only pages, listed under the "Internal" heading in the main navigation bar.
Follow along with the [Sample Project](https://internal-docs.molecula.cloud/tutorials/getting-started) to get a better understanding of FeatureBase's capabilities.
## Pilosa is now FeatureBase
As of September 7, 2022, the Pilosa project is now FeatureBase. The core of the project remains the same: FeatureBase is the first real-time distributed database built entirely on bitmaps. (More information about updated capabilities and improvements below.)
FeatureBase delivers low-latency query results, regardless of throughput or query volumes, on fresh data with extreme efficiency. It works because bitmaps are faster, simpler, and far more I/O efficient than traditional column-oriented data formats. With FeatureBase, you can ingest data from batch data sources (e.g. S3, CSV, Snowflake, BigQuery, etc.) and/or streaming data sources (e.g. Kafka/Confluent, Kinesis, Pulsar).
For more information about FeatureBase, please visit [www.featurebase.com][HomePage].
## Getting Started
* [Learn how to install FeatureBase Community](https://github.com/FeatureBaseDB/FB-community-help/blob/main/docs/community/com-getstart/com-getstart-home.md)
### Build FeatureBase Server from source
0. Install go. Ensure that your shell's search path includes the go/bin directory.
1. Clone the FeatureBase repository (or download as zip).
2. In the featurebase directory, run `make install` to compile the FeatureBase server binary. By default, it will be installed in the go/bin directory.
3. In the idk directory, run `make install` to compile the ingester binaries. By default, they will be installed in the go/bin directory.
4. Run `featurebase server --handler.allowed-origins=http://localhost:3000` to run FeatureBase server with default settings (learn more about configuring FeatureBase at the link below). The `--handler.allowed-origins` parameter allows the standalone web UI to talk to the server; this can be omitted if the web UI is not needed.
5. Run `curl localhost:10101/status` to verify the server is running and accessible.
### Data Model
Because FeatureBase is built on bitmaps, there is bit of a learning curve to grasp how your data is represented.
* [Learn about Data Modeling](https://github.com/FeatureBaseDB/FB-community-help/blob/main/docs/concepts/concepts-home.md)
### Ingest Data and Query
* [Learn how to ingest data from multiple data sources](https://github.com/FeatureBaseDB/FB-community-help/blob/main/docs/community/com-ingest/com-ingest-manage.md)
## Community
You can email us at community@featurebase.com and [learn more about contributing](https://github.com/FeatureBaseDB/featurebase/blob/master/OPENSOURCE.md).
Chat with us: [https://discord.gg/FBn2vEp7Na][Discord]
## What's Changed Since the Pilosa Days?
A lot has changed since the days of Pilosa. This list highlights some new capabilites included in FeatureBase. We have also made signficant improvements to the performance, scalability, and stability of the FeatureBase product.
* Query Languages: FeatureBase supports Pilosa Query Language (PQL), as well as SQL
* Stream and Batch Ingest: Combine real-time data streams with batch historical data and act on it within milliseconds.
* Mutable: Perform inserts, updates, and deletes at scale, in real time and on-the-fly. This is key for meeting data compliance requirements, and for reflecting the constantly-changing nature of high-volume data.
* Multi-Valued Set Fields: Store multiple comma-delimited values within a single field while *increasing* query performance of counts, TopKs, etc.
* Time Quantums: Setting a time quantum on a field creates extra views which allow ranged Row queries down to the time interval specified. For example, if the time quantum is set to YMD, ranged Row queries down to the granularity of a day are supported.
* RBF storage backend: this is a new compressed bitmap format which improves performance in a number of ways: ACID support on a per shard basis, prevents issues with the number of open files, reduces memory allocation and lock contention for reads, provides more consistent garbage collection, and allows backups to run concurrently with writes. However, because of this change, Pilosa backup files cannot be restored into FeatureBase.
## License
FeatureBase is licensed under the [Apache License, Version 2.0][License]
[Community]: https://github.com/FeatureBaseDB/FB-community-help/tree/main
[Install]:https://github.com/FeatureBaseDB/FB-community-help/blob/main/docs/community/com-getstart/com-getstart-home.md
[Config]: https://github.com/FeatureBaseDB/FB-community-help/tree/main/docs/community/com-config
[DataModel]: https://github.com/FeatureBaseDB/FB-community-help/blob/main/docs/concepts/concepts-home.md
[Discord]: https://discord.gg/FBn2vEp7Na
[HomePage]: http://featurebase.com?utm_campaign=Open%20Source&utm_source=GitHub
[Ingest]: https://github.com/FeatureBaseDB/FB-community-help/blob/main/docs/community/com-ingest/com-ingest-manage.md
[License]: http://www.apache.org/licenses/LICENSE-2.0
[PQL]: https://docs.featurebase.com/docs/pql-guide/pql-home/?utm_campaign=Open%20Source&utm_source=GitHub
[SQL]: https://docs.featurebase.com/docs/sql-guide/sql-guide-home/?utm_campaign=Open%20Source&utm_source=GitHub

166
api.go
View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
//go:generate stringer -type=apiMethod
package pilosa
@ -22,20 +21,20 @@ import (
"sync"
"time"
fbcontext "github.com/featurebasedb/featurebase/v3/context"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/featurebasedb/featurebase/v3/dax/computer"
"github.com/featurebasedb/featurebase/v3/dax/storage"
"github.com/featurebasedb/featurebase/v3/disco"
"github.com/featurebasedb/featurebase/v3/logger"
"github.com/featurebasedb/featurebase/v3/rbf"
fbcontext "github.com/molecula/featurebase/v3/context"
"github.com/molecula/featurebase/v3/dax"
"github.com/molecula/featurebase/v3/dax/computer"
"github.com/molecula/featurebase/v3/dax/storage"
"github.com/molecula/featurebase/v3/disco"
"github.com/molecula/featurebase/v3/logger"
"github.com/molecula/featurebase/v3/rbf"
"github.com/prometheus/client_golang/prometheus"
//"github.com/featurebasedb/featurebase/v3/pg"
"github.com/featurebasedb/featurebase/v3/pql"
"github.com/featurebasedb/featurebase/v3/roaring"
planner_types "github.com/featurebasedb/featurebase/v3/sql3/planner/types"
"github.com/featurebasedb/featurebase/v3/tracing"
//"github.com/molecula/featurebase/v3/pg"
"github.com/molecula/featurebase/v3/pql"
"github.com/molecula/featurebase/v3/roaring"
planner_types "github.com/molecula/featurebase/v3/sql3/planner/types"
"github.com/molecula/featurebase/v3/tracing"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
@ -338,14 +337,6 @@ func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
if err != nil {
return errors.Wrap(err, "deleting index")
}
// Remove from writelogger/snapshotter if serverless.
if api.isComputeNode {
if err := api.serverlessStorage.RemoveTable(dax.TableKey(indexName).QualifiedTableID()); err != nil {
return errors.Wrapf(err, "removing table from serverless storage: %s", indexName)
}
}
// Send the delete index message to all nodes.
err = api.server.SendSync(
&DeleteIndexMessage{
@ -367,8 +358,8 @@ func (api *API) DeleteIndex(ctx context.Context, indexName string) error {
}
// CreateField makes the named field in the named index with the given options.
//
// The resulting field will always have TrackExistence set.
// This method currently only takes a single functional option, but that may be
// changed in the future to support multiple options.
func (api *API) CreateField(ctx context.Context, indexName string, fieldName string, opts ...FieldOption) (*Field, error) {
span, _ := tracing.StartSpanFromContext(ctx, "API.CreateField")
defer span.Finish()
@ -381,11 +372,6 @@ func (api *API) CreateField(ctx context.Context, indexName string, fieldName str
// authN/Z info
requestUserID, _ := fbcontext.UserID(ctx) // requestUserID is "" if not in ctx
// newFieldOptions is also used in the path through the index creating
// a field from an update from DAX, so it can't assume it can always
// override this. But we're the call path for creating new fields, and
// new fields should always have TrackExistence on.
opts = append(opts, OptFieldTrackExistence())
// Apply and validate functional options.
fo, err := newFieldOptions(opts...)
if err != nil {
@ -499,9 +485,16 @@ func importWorker(importWork chan importJob) {
for j := range importWork {
err := func() (err0 error) {
for viewName, viewData := range j.req.Views {
viewName, err0 = j.field.cleanupViewName(viewName)
if err0 != nil {
return err0
// The logic here corresponds to the logic in fragment.cleanViewName().
// Unfortunately, the logic in that method is not completely exclusive
// (i.e. an "other" view named with format YYYYMMDD would be handled
// incorrectly). One way to address this would be to change the logic
// overall so there weren't conflicts. For now, we just
// rely on the field type to inform the intended view name.
if viewName == "" {
viewName = viewStandard
} else if j.field.Type() == FieldTypeTime {
viewName = fmt.Sprintf("%s_%s", viewStandard, viewName)
}
if len(viewData) == 0 {
return fmt.Errorf("no data to import for view: %s", viewName)
@ -1314,6 +1307,7 @@ type ImportOptions struct {
Clear bool
IgnoreKeyCheck bool
Presorted bool
fullySorted bool // format-aware sorting, internal use only please.
suppressLog bool
// test Tx atomicity if > 0
@ -1520,6 +1514,7 @@ func (api *API) ImportWithTx(ctx context.Context, qcx *Qcx, req *ImportRequest,
return errors.Wrap(err, "validating api method")
}
api.server.logger.Debugf("ImportWithTx: %v %v %v", req.Index, req.Field, req.Shard)
idx, field, err := api.indexField(req.Index, req.Field, req.Shard)
if err != nil {
return errors.Wrap(err, "getting index and field")
@ -1638,12 +1633,6 @@ func (api *API) ImportWithTx(ctx context.Context, qcx *Qcx, req *ImportRequest,
// across many fields in a single shard. It can both set and clear
// bits and updates caches/bitDepth as appropriate, although only the
// bitmap parts happen truly transactionally.
//
// This function does not attempt to do existence tracking, because
// it can't; there's no way to distinguish empty sets from not setting
// bits. As a result, users of this endpoint are responsible for
// providing corrected existence views for fields with existence
// tracking. Our batch API does that.
func (api *API) ImportRoaringShard(ctx context.Context, indexName string, shard uint64, req *ImportRoaringShardRequest) error {
index, err := api.Index(ctx, indexName)
if err != nil {
@ -1674,7 +1663,7 @@ func (api *API) ImportRoaringShard(ctx context.Context, indexName string, shard
}
fieldType := field.Options().Type
if viewUpdate.View, err1 = field.cleanupViewName(viewUpdate.View); err1 != nil {
if err1 = cleanupView(fieldType, &viewUpdate); err1 != nil {
return err1
}
@ -1766,6 +1755,27 @@ func (api *API) ImportRoaringShard(ctx context.Context, indexName string, shard
return nil
}
func cleanupView(fieldType string, viewUpdate *RoaringUpdate) error {
// TODO wouldn't hurt to have consolidated logic somewhere for validating view names.
switch fieldType {
case FieldTypeSet, FieldTypeTime:
if viewUpdate.View == "" {
viewUpdate.View = "standard"
}
// add 'standard_' if we just have a time... this is how IDK works by default
if fieldType == FieldTypeTime && !strings.HasPrefix(viewUpdate.View, viewStandard) {
viewUpdate.View = fmt.Sprintf("%s_%s", viewStandard, viewUpdate.View)
}
case FieldTypeInt, FieldTypeDecimal, FieldTypeTimestamp:
if viewUpdate.View == "" {
viewUpdate.View = "bsig_" + viewUpdate.Field
} else if viewUpdate.View != "bsig_"+viewUpdate.Field {
return NewBadRequestError(errors.Errorf("invalid view name (%s) for field %s of type %s", viewUpdate.View, viewUpdate.Field, fieldType))
}
}
return nil
}
// ImportValue is a wrapper around the common code in ImportValueWithTx, which
// currently just translates req.Clear into a clear ImportOption.
func (api *API) ImportValue(ctx context.Context, qcx *Qcx, req *ImportValueRequest, opts ...ImportOption) error {
@ -2019,20 +2029,21 @@ func (api *API) ImportValueWithTx(ctx context.Context, qcx *Qcx, req *ImportValu
return nil
}
func importExistenceColumns(qcx *Qcx, index *Index, columnIDs []uint64, shard uint64) (err0 error) {
func importExistenceColumns(qcx *Qcx, index *Index, columnIDs []uint64, shard uint64) error {
ef := index.existenceField()
if ef == nil {
return nil
}
tx, finisher, err := qcx.GetTx(Txo{Write: true, Index: index, Shard: shard})
if err != nil {
return err
}
defer finisher(&err0)
// markExistingInView is simpler/faster than Import, but unusually, we use the
// standard view of the existence field, instead of the existence view of
// a specific field, when doing the index-wide update.
return ef.markExistingInView(tx, columnIDs, viewStandard, shard)
existenceRowIDs := make([]uint64, len(columnIDs))
// If we don't gratuitously hand-duplicate things in field.Import,
// the fact that fragment.bulkImport rewrites its row and column
// lists can burn us if we don't make a copy before doing the
// existence field write.
columnCopy := make([]uint64, len(columnIDs))
copy(columnCopy, columnIDs)
options := ImportOptions{}
return ef.Import(qcx, existenceRowIDs, columnCopy, nil, shard, &options)
}
// ShardDistribution returns an object representing the distribution of shards
@ -3050,9 +3061,9 @@ func (api *API) Directive(ctx context.Context, d *dax.Directive) error {
}
// DirectiveApplied returns true if the computer's current Directive has been
// applied and is ready to be queried. This is temporary (primarily for tests)
// and needs to be refactored as we improve the logic around
// controller-to-computer communication.
// applied and is ready to be queried. This it temporary (primarily for tests)
// and needs to be refactored as we improve the logic around mds-to-computer
// communication.
func (api *API) DirectiveApplied(ctx context.Context) (bool, error) {
return api.holder.DirectiveApplied(), nil
}
@ -3065,7 +3076,7 @@ func (api *API) SnapshotShardData(ctx context.Context, req *dax.SnapshotShardDat
}
// TODO(jaffee) confirm this node is actually responsible for the given
// shard? Not sure we need to given that this request comes from
// the Controller, but might be a belt&suspenders situation.
// MDS, but might be a belt&suspenders situation.
qtid := req.TableKey.QualifiedTableID()
@ -3296,14 +3307,6 @@ func shardInShards(i dax.ShardNum, s dax.ShardNums) bool {
}
type SchemaAPI interface {
CreateDatabase(context.Context, *dax.Database) error
DropDatabase(context.Context, dax.DatabaseID) error
DatabaseByName(ctx context.Context, dbname dax.DatabaseName) (*dax.Database, error)
DatabaseByID(ctx context.Context, dbid dax.DatabaseID) (*dax.Database, error)
SetDatabaseOption(ctx context.Context, dbid dax.DatabaseID, option string, value string) error
Databases(context.Context, ...dax.DatabaseID) ([]*dax.Database, error)
TableByName(ctx context.Context, tname dax.TableName) (*dax.Table, error)
TableByID(ctx context.Context, tid dax.TableID) (*dax.Table, error)
Tables(ctx context.Context) ([]*dax.Table, error)
@ -3315,49 +3318,8 @@ type SchemaAPI interface {
DeleteField(ctx context.Context, tname dax.TableName, fname dax.FieldName) error
}
// Ensure type implements interface.
var _ SchemaAPI = (*NopSchemaAPI)(nil)
// NopSchemaAPI is a no-op implementation of the SchemaAPI.
type NopSchemaAPI struct{}
func (n *NopSchemaAPI) ClusterName() string {
return ""
}
func (n *NopSchemaAPI) CreateDatabase(context.Context, *dax.Database) error { return nil }
func (n *NopSchemaAPI) DropDatabase(context.Context, dax.DatabaseID) error { return nil }
func (n *NopSchemaAPI) DatabaseByName(ctx context.Context, dbname dax.DatabaseName) (*dax.Database, error) {
return nil, nil
}
func (n *NopSchemaAPI) DatabaseByID(ctx context.Context, dbid dax.DatabaseID) (*dax.Database, error) {
return nil, nil
}
func (n *NopSchemaAPI) SetDatabaseOption(ctx context.Context, dbid dax.DatabaseID, option string, value string) error {
return nil
}
func (n *NopSchemaAPI) Databases(context.Context, ...dax.DatabaseID) ([]*dax.Database, error) {
return nil, nil
}
func (n *NopSchemaAPI) TableByName(ctx context.Context, tname dax.TableName) (*dax.Table, error) {
return nil, nil
}
func (n *NopSchemaAPI) TableByID(ctx context.Context, tid dax.TableID) (*dax.Table, error) {
return nil, nil
}
func (n *NopSchemaAPI) Tables(ctx context.Context) ([]*dax.Table, error) { return nil, nil }
func (n *NopSchemaAPI) CreateTable(ctx context.Context, tbl *dax.Table) error { return nil }
func (n *NopSchemaAPI) CreateField(ctx context.Context, tname dax.TableName, fld *dax.Field) error {
return nil
}
func (n *NopSchemaAPI) DeleteTable(ctx context.Context, tname dax.TableName) error { return nil }
func (n *NopSchemaAPI) DeleteField(ctx context.Context, tname dax.TableName, fname dax.FieldName) error {
return nil
}
type ClusterNode struct {
ID string
Type string
State string
URI string
GRPCURI string

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package client
import (
@ -7,8 +6,8 @@ import (
"crypto/tls"
"sync"
"github.com/featurebasedb/featurebase/v3/logger"
pb "github.com/featurebasedb/featurebase/v3/proto"
"github.com/molecula/featurebase/v3/logger"
pb "github.com/molecula/featurebase/v3/proto"
"github.com/pkg/errors"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"

View file

@ -7,10 +7,10 @@ import (
"log"
"sync"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/featurebasedb/featurebase/v3/dax/computer"
"github.com/featurebasedb/featurebase/v3/dax/storage"
"github.com/featurebasedb/featurebase/v3/disco"
"github.com/molecula/featurebase/v3/dax"
"github.com/molecula/featurebase/v3/dax/computer"
"github.com/molecula/featurebase/v3/dax/storage"
"github.com/molecula/featurebase/v3/disco"
"github.com/pkg/errors"
)
@ -35,22 +35,6 @@ func (api *API) ApplyDirective(ctx context.Context, d *dax.Directive) error {
// Handle the operations based on the directive method.
switch d.Method {
case dax.DirectiveMethodDiff:
// In order to prevent adding too much code specific to handling a diff
// directive (e.g. adding something like an `enactDirectiveDiff()`
// method), we are instead going to build a full Directive based on the
// diff, and then proceed normally as if we had received a full
// Directive. We do that by copying the previous Directive and then
// applying the diffs to the copy.
newD := previousDirective.Copy()
// Apply the diffs from the incoming Directive to the new, copied
// Directive.
newD.ApplyDiff(d)
// Now proceed with the new diff as if we had received it as a full diff.
d = newD
case dax.DirectiveMethodFull:
// pass: normal operation
case dax.DirectiveMethodReset:
@ -58,6 +42,10 @@ func (api *API) ApplyDirective(ctx context.Context, d *dax.Directive) error {
if err := api.deleteAllIndexes(ctx); err != nil {
return errors.Wrap(err, "deleting all indexes")
}
if err := api.serverlessStorage.RemoveAll(); err != nil {
return errors.Wrap(err, "removing all managers")
}
// Set previousDirective to empty so the diff handles everything as new.
previousDirective = dax.Directive{}
@ -76,7 +64,7 @@ func (api *API) ApplyDirective(ctx context.Context, d *dax.Directive) error {
// the "enactDirective" stage of ApplyDirective which validates against this
// cached Directive, so it's important that it be set before calling
// enactDirective(). An example: when loading partition data from the
// Writelogger, there are validations to ensure that the partition being
// WriteLogger, there are validations to ensure that the partition being
// loaded is meant to be handled by this node; that validation is done
// against the cached Directive.
// TODO(tlt): despite what this comment says, this logic is not sound; we
@ -262,7 +250,7 @@ func (api *API) enactTables(ctx context.Context, fromD, toD *dax.Directive) erro
// Remove all indexes that are no longer part of the directive.
for _, tkey := range sc.removed() {
idx := string(tkey)
if err := api.DeleteIndex(ctx, idx); err != nil {
if err := api.holder.deleteIndex(idx); err != nil {
return errors.Wrapf(err, "deleting index: %s", tkey)
}
}
@ -340,18 +328,7 @@ func (api *API) pushJobsTableKeys(ctx context.Context, jobs chan<- directiveJobT
// Get the diff between from/to directive.partitions.
partComp := newPartitionsComparer(fromD.TranslatePartitionsMap(), toPartitionsMap)
// Remove any partitions which are no longer assigned to this worker.
// TODO(tlt): currently, this is just removing the file lock on the
// resource; it's not actually removing the resource from the local
// computer. We should do that.
for tkey, partitions := range partComp.removed() {
qtid := tkey.QualifiedTableID()
for _, partition := range partitions {
api.serverlessStorage.RemoveTableKeyResource(qtid, partition)
}
}
// Loop over the partition map and load from Writelogger.
// Loop over the partition map and load from WriteLogger.
for tkey, partitions := range partComp.added() {
// Get index in order to find the translate stores (by partition) for
// the table.
@ -438,18 +415,7 @@ func (api *API) pushJobsFieldKeys(ctx context.Context, jobs chan<- directiveJobT
// Get the diff between from/to directive.fields.
fieldComp := newFieldsComparer(fromD.TranslateFieldsMap(), toD.TranslateFieldsMap())
// Remove any field keys which are no longer assigned to this worker.
// TODO(tlt): currently, this is just removing the file lock on the
// resource; it's not actually removing the resource from the local
// computer. We should do that.
for tkey, fields := range fieldComp.removed() {
qtid := tkey.QualifiedTableID()
for _, field := range fields {
api.serverlessStorage.RemoveFieldKeyResource(qtid, field)
}
}
// Loop over the field map and load from Writelogger.
// Loop over the field map and load from WriteLogger.
for tkey, fields := range fieldComp.added() {
for _, field := range fields {
jobs <- directiveJobFieldKeys{
@ -533,19 +499,7 @@ func (api *API) pushJobsShards(ctx context.Context, jobs chan<- directiveJobType
// Get the diff between from/to directive shards.
shardComp := newShardsComparer(fromD.ComputeShardsMap(), shardMap)
// Remove any shards which are no longer assigned to this worker.
// TODO(tlt): currently, this is just removing the file lock on the
// resource; it's not actually removing the resource from the local
// computer. We should do that.
for tkey, shards := range shardComp.removed() {
qtid := tkey.QualifiedTableID()
for _, shard := range shards {
partition := dax.PartitionNum(disco.ShardToShardPartition(string(tkey), uint64(shard), disco.DefaultPartitionN))
api.serverlessStorage.RemoveShardResource(qtid, partition, shard)
}
}
// Loop over the shard map and load from Writelogger.
// Loop over the shard map and load from WriteLogger.
for tkey, shards := range shardComp.added() {
for _, shard := range shards {
jobs <- directiveJobShards{
@ -980,7 +934,7 @@ func createField(idx *Index, fld *dax.Field) error {
return errors.Wrapf(err, "creating field options from field: %s", fld.Name)
}
if _, err := idx.createNullableField(string(fld.Name), "", opts...); err != nil {
if _, err := idx.CreateField(string(fld.Name), "", opts...); err != nil {
return errors.Wrapf(err, "creating field on index: %s", fld.Name)
}
return nil

View file

@ -4,10 +4,10 @@ import (
"context"
"testing"
pilosa "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/dax"
daxtest "github.com/featurebasedb/featurebase/v3/dax/test"
"github.com/featurebasedb/featurebase/v3/test"
pilosa "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/dax"
daxtest "github.com/molecula/featurebase/v3/dax/test"
"github.com/molecula/featurebase/v3/test"
"github.com/stretchr/testify/assert"
)
@ -30,7 +30,7 @@ func TestAPI_Directive(t *testing.T) {
// Empty directive (and empty holder).
{
d := &dax.Directive{
Method: dax.DirectiveMethodFull,
Method: dax.DirectiveMethodDiff,
Version: 1,
}
err := api.ApplyDirective(ctx, d)
@ -41,7 +41,7 @@ func TestAPI_Directive(t *testing.T) {
// Add a new table.
{
d := &dax.Directive{
Method: dax.DirectiveMethodFull,
Method: dax.DirectiveMethodDiff,
Tables: []*dax.QualifiedTable{
tbl1,
},
@ -55,7 +55,7 @@ func TestAPI_Directive(t *testing.T) {
// Add a new table, and keep the existing table.
{
d := &dax.Directive{
Method: dax.DirectiveMethodFull,
Method: dax.DirectiveMethodDiff,
Tables: []*dax.QualifiedTable{
tbl1,
tbl2,
@ -70,7 +70,7 @@ func TestAPI_Directive(t *testing.T) {
// Add a new table and remove one of the existing tables.
{
d := &dax.Directive{
Method: dax.DirectiveMethodFull,
Method: dax.DirectiveMethodDiff,
Tables: []*dax.QualifiedTable{
tbl2,
tbl3,

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa_test
import (
@ -22,14 +21,14 @@ import (
"testing"
"time"
pilosa "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/authn"
"github.com/featurebasedb/featurebase/v3/roaring"
"github.com/featurebasedb/featurebase/v3/server"
"github.com/featurebasedb/featurebase/v3/shardwidth"
"github.com/featurebasedb/featurebase/v3/test"
. "github.com/featurebasedb/featurebase/v3/vprint" // nolint:staticcheck
"github.com/golang-jwt/jwt"
pilosa "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/authn"
"github.com/molecula/featurebase/v3/roaring"
"github.com/molecula/featurebase/v3/server"
"github.com/molecula/featurebase/v3/shardwidth"
"github.com/molecula/featurebase/v3/test"
. "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck
"golang.org/x/sync/errgroup"
)
@ -837,7 +836,7 @@ func TestAPI_IDAlloc(t *testing.T) {
t.Fatalf("obtaining random bytes: %v", err)
}
ids3, err := primary.ReserveIDs(key, session, 0, 2)
var esync pilosa.IDOffsetDesyncError
var esync pilosa.ErrIDOffsetDesync
if errors.As(err, &esync) {
if esync.Requested != 0 {
t.Errorf("incorrect requested offset in error: provided %d but got %d", 0, esync.Requested)

View file

@ -14,10 +14,10 @@ import (
"github.com/apache/arrow/go/v10/arrow"
"github.com/apache/arrow/go/v10/arrow/array"
"github.com/apache/arrow/go/v10/arrow/memory"
"github.com/featurebasedb/featurebase/v3/pql"
"github.com/featurebasedb/featurebase/v3/tracing"
"github.com/featurebasedb/featurebase/v3/vprint"
"github.com/gomem/gomem/pkg/dataframe"
"github.com/molecula/featurebase/v3/pql"
"github.com/molecula/featurebase/v3/tracing"
"github.com/molecula/featurebase/v3/vprint"
"github.com/pkg/errors"
ivy "robpike.io/ivy/arrow"
@ -95,7 +95,7 @@ func IvyReduce(reduceCode string, opCode string, opt *ExecOptions) (func(ctx con
col := value.ToArrowColumn(accumulator, pool)
return dataframe.NewDataFrameFromColumns(pool, []arrow.Column{*col})
}
// only actually reduce on the initiating node i hate the network
// only acutally reduce on the initiating node i hate the network
// over head but oh well
ctxIvy.AssignGlobal("_", accumulator)
ok, err := runIvyString(ctxIvy, reduceCode)
@ -541,7 +541,7 @@ func (sf *ShardFile) Save(name string) error {
if sf.table != nil {
// we append if there was existing file
column := sf.table.Column(col)
// if primitive type
// if primative type
switch column.DataType() {
case arrow.BinaryTypes.String:
chunks = sf.buildFromStrings(col, mem)

View file

@ -17,9 +17,9 @@ import (
"github.com/apache/arrow/go/v10/parquet"
"github.com/apache/arrow/go/v10/parquet/file"
"github.com/apache/arrow/go/v10/parquet/pqarrow"
"github.com/featurebasedb/featurebase/v3/pql"
"github.com/featurebasedb/featurebase/v3/tracing"
"github.com/gomem/gomem/pkg/dataframe"
"github.com/molecula/featurebase/v3/pql"
"github.com/molecula/featurebase/v3/tracing"
"github.com/pkg/errors"
)
@ -60,7 +60,7 @@ func (e *executor) executeArrow(ctx context.Context, qcx *Qcx, index string, c *
mu.Unlock()
return e.executeArrowShard(ctx, qcx, index, c, shard, pool, columnFilter)
}
tables := make([]*BasicTable, 0)
tables := make([]*basicTable, 0)
reduceFn := func(ctx context.Context, prev, v interface{}) interface{} {
mu.Lock()
@ -70,7 +70,7 @@ func (e *executor) executeArrow(ctx context.Context, qcx *Qcx, index string, c *
return prev
}
switch t := v.(type) {
case *BasicTable:
case *basicTable:
if t.resolver != nil {
mu.Lock()
@ -93,108 +93,104 @@ func (e *executor) executeArrow(ctx context.Context, qcx *Qcx, index string, c *
return nil, err
}
if len(tables) == 0 {
return &BasicTable{name: "empty"}, nil
return &basicTable{name: "empty"}, nil
}
tbl := Concat(tables[0].Schema(), tables, pool)
r := dataframe.NewChunkResolver(tbl.Column(0))
return &BasicTable{resolver: &r, table: tbl}, nil
return &basicTable{resolver: &r, table: tbl}, nil
}
type BasicTable struct {
type basicTable struct {
resolver dataframe.Resolver
table arrow.Table
filtered bool
name string
}
func (st *BasicTable) Name() string {
func (st *basicTable) Name() string {
return st.name
}
func (st *BasicTable) Schema() *arrow.Schema {
func (st *basicTable) Schema() *arrow.Schema {
if st.table != nil {
return st.table.Schema()
}
return &arrow.Schema{}
}
func (st *BasicTable) IsFiltered() bool {
func (st *basicTable) IsFiltered() bool {
return st.filtered
}
func (st *BasicTable) NumRows() int64 {
func (st *basicTable) NumRows() int64 {
if st.resolver == nil {
return 0
}
return int64(st.resolver.NumRows())
}
func (st *BasicTable) NumCols() int64 {
func (st *basicTable) NumCols() int64 {
if st.table != nil {
return st.table.NumCols()
}
return 0
}
func (st *BasicTable) Column(i int) *arrow.Column {
func (st *basicTable) Column(i int) *arrow.Column {
if st.table != nil {
return st.table.Column(i)
}
return nil
}
func (st *BasicTable) Retain() {
func (st *basicTable) Retain() {
if st.table != nil {
st.table.Retain()
}
}
func (st *BasicTable) Release() {
func (st *basicTable) Release() {
if st.table != nil {
st.table.Retain()
}
}
func (st *BasicTable) Get(column, row int) interface{} {
func (st *basicTable) Get(column, row int) interface{} {
field := st.Schema().Field(column)
c, i := st.resolver.Resolve(row)
nullable := field.Nullable
chunk := st.Column(column).Data().Chunk(c)
// TODO(twg) 2023/01/26 potential NULL support?
if nullable && chunk.IsNull(i) {
return nil
}
switch field.Type.(type) {
case *arrow.BooleanType:
return chunk.(*array.Boolean).Value(i)
// case *arrow.BooleanType:
// v := chunk.(*array.Boolean).BooleanValues()
// return v[i]
case *arrow.Int8Type:
v := chunk.(*array.Int8).Int8Values()
return int64(v[i])
return v[i]
case *arrow.Int16Type:
v := chunk.(*array.Int16).Int16Values()
return int64(v[i])
return v[i]
case *arrow.Int32Type:
v := chunk.(*array.Int32).Int32Values()
return int64(v[i])
return v[i]
case *arrow.Int64Type:
v := chunk.(*array.Int64).Int64Values()
return int64(v[i])
return v[i]
case *arrow.Uint8Type:
v := chunk.(*array.Uint8).Uint8Values()
return uint64(v[i])
return v[i]
case *arrow.Uint16Type:
v := chunk.(*array.Uint16).Uint16Values()
return uint64(v[i])
return v[i]
case *arrow.Uint32Type:
v := chunk.(*array.Uint32).Uint32Values()
return uint64(v[i])
return v[i]
case *arrow.Uint64Type:
v := chunk.(*array.Uint64).Uint64Values()
return v[i]
case *arrow.Float32Type:
v := chunk.(*array.Float32).Float32Values()
return float64(v[i])
return v[i]
case *arrow.Float64Type:
v := chunk.(*array.Float64).Float64Values()
return v[i]
@ -269,7 +265,7 @@ func appendData(bldr array.Builder, v interface{}) {
}
}
func Concat(schema *arrow.Schema, tables []*BasicTable, mem memory.Allocator) arrow.Table {
func Concat(schema *arrow.Schema, tables []*basicTable, mem memory.Allocator) arrow.Table {
if len(tables) == 1 {
if !tables[0].IsFiltered() {
return tables[0]
@ -311,7 +307,7 @@ func Concat(schema *arrow.Schema, tables []*BasicTable, mem memory.Allocator) ar
return array.NewTable(schema, cols, -1)
}
func (st *BasicTable) MarshalJSON() ([]byte, error) {
func (st *basicTable) MarshalJSON() ([]byte, error) {
results := make(map[string]interface{})
n := 0
if st.table != nil {
@ -330,10 +326,10 @@ func (st *BasicTable) MarshalJSON() ([]byte, error) {
return json.Marshal(results)
}
func BasicTableFromArrow(table arrow.Table, mem memory.Allocator) *BasicTable {
func BasicTableFromArrow(table arrow.Table, mem memory.Allocator) *basicTable {
col := table.Column(0)
r := dataframe.NewChunkResolver(col)
return &BasicTable{resolver: &r, table: table}
return &basicTable{resolver: &r, table: table}
}
func filterColumns(filters []string, table arrow.Table) arrow.Table {
@ -363,7 +359,7 @@ func filterColumns(filters []string, table arrow.Table) arrow.Table {
return array.NewTable(filterdSchema, cols, table.NumRows())
}
func (e *executor) executeArrowShard(ctx context.Context, qcx *Qcx, index string, c *pql.Call, shard uint64, pool memory.Allocator, columnFilter []string) (*BasicTable, error) {
func (e *executor) executeArrowShard(ctx context.Context, qcx *Qcx, index string, c *pql.Call, shard uint64, pool memory.Allocator, columnFilter []string) (*basicTable, error) {
name := fmt.Sprintf("a. %v", shard)
span, _ := tracing.StartSpanFromContext(ctx, "Executor.executeArrowShard")
defer span.Finish()
@ -377,7 +373,7 @@ func (e *executor) executeArrowShard(ctx context.Context, qcx *Qcx, index string
filter = row
if !filter.Any() {
// no need to actuall run the query for its not operating against any values
return &BasicTable{name: name}, nil
return &basicTable{name: name}, nil
}
}
//
@ -391,7 +387,7 @@ func (e *executor) executeArrowShard(ctx context.Context, qcx *Qcx, index string
fname := idx.GetDataFramePath(shard)
if !e.dataFrameExists(fname) {
return &BasicTable{name: name}, nil
return &basicTable{name: name}, nil
}
table, err := e.getDataTable(ctx, fname, pool)
@ -411,7 +407,7 @@ func (e *executor) executeArrowShard(ctx context.Context, qcx *Qcx, index string
resolver = &p
if filter != nil {
if len(ids) == 0 {
return &BasicTable{name: name}, nil
return &basicTable{name: name}, nil
}
resolver, err = filterDataframe(resolver, pool, ids)
if err != nil {
@ -419,7 +415,7 @@ func (e *executor) executeArrowShard(ctx context.Context, qcx *Qcx, index string
}
}
table.Retain()
return &BasicTable{resolver: resolver, table: table, filtered: filter != nil, name: name}, nil
return &basicTable{resolver: resolver, table: table, filtered: filter != nil, name: name}, nil
}
func (e *executor) dataFrameExists(fname string) bool {
@ -478,7 +474,7 @@ func readTableArrow(filename string, mem memory.Allocator) (arrow.Table, error)
return nil, err
}
defer rr.Close()
records := make([]arrow.Record, rr.NumRecords())
records := make([]arrow.Record, rr.NumRecords(), rr.NumRecords())
i := 0
for {
rec, err := rr.Read()

View file

@ -1,9 +1,8 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
"github.com/featurebasedb/featurebase/v3/testhook"
"github.com/molecula/featurebase/v3/testhook"
)
var NewAuditor func() testhook.Auditor = NewNopAuditor

View file

@ -1,12 +1,11 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
"fmt"
"reflect"
"github.com/featurebasedb/featurebase/v3/testhook"
"github.com/molecula/featurebase/v3/testhook"
)
// These audit hooks are desireable during testing, but not in

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa_test
import (
@ -7,8 +6,8 @@ import (
"os"
"reflect"
"github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/testhook"
"github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/testhook"
)
// AuditLeaksOn is a global switch to turn on resource

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
// Package authn handles authentication
package authn
@ -20,14 +19,11 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"github.com/featurebasedb/featurebase/v3/logger"
"github.com/molecula/featurebase/v3/logger"
"github.com/pkg/errors"
"golang.org/x/oauth2"
)
// AuthContextKey is a unique type to prevent collisions when using context.WithValue()
type AuthContextKey string
const (
// AccessCookieName is the name of the cookie that holds the access token.
AccessCookieName = "molecula-chip"
@ -37,12 +33,6 @@ const (
// RefreshHeaderName is the name of the header that holds the refresh token.
RefreshHeaderName = "X-Molecula-Refresh-Token"
// ContextValueAccessToken is the key used to set AccessTokens in a ctx.
ContextValueAccessToken = AuthContextKey("Access")
// ContextValueRefreshToken is the key used to set RefreshTokens in a ctx.
ContextValueRefreshToken = AuthContextKey("Refresh")
)
// cachedGroups is used to hold groups and when they were last cached
@ -173,7 +163,7 @@ func (a *Auth) refreshToken(access, refresh string) (string, string, error) {
// it is caller's responsibility to inform the user that the access token has been refreshed
func (a *Auth) Authenticate(access, refresh string) (*UserInfo, error) {
// clean up the cache every 30 minutes or so
if time.Since(a.lastCacheClean) >= 30*time.Minute {
if time.Now().Sub(a.lastCacheClean) >= 30*time.Minute {
a.cleanCache()
}
@ -239,7 +229,7 @@ func (a *Auth) Authenticate(access, refresh string) (*UserInfo, error) {
func (a *Auth) cleanCache() {
for access, tkn := range a.groupsCache {
// if it's been more than 24 hours since the groups were cached
if time.Since(tkn.cacheTime) >= 24*time.Hour {
if time.Now().Sub(tkn.cacheTime) >= 24*time.Hour {
// remove it from our cache
delete(a.groupsCache, access)
}
@ -302,7 +292,7 @@ func (a *Auth) getGroups(token string) ([]Group, error) {
var groups Groups
gc, ok := a.groupsCache[token]
if ok && (time.Since(gc.cacheTime) < a.cacheTTL) && len(gc.groups) > 0 {
if ok && (time.Now().Sub(gc.cacheTime) < a.cacheTTL) && len(gc.groups) > 0 {
return gc.groups, nil
}

View file

@ -16,8 +16,8 @@ import (
"testing"
"time"
"github.com/featurebasedb/featurebase/v3/logger"
"github.com/golang-jwt/jwt"
"github.com/molecula/featurebase/v3/logger"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
@ -67,7 +67,7 @@ func TestSetGRPCMetadata(t *testing.T) {
"otherCookies": {"cookie": []string{a.accessCookieName + "=something", "blah=blah"}},
} {
t.Run(name, func(t *testing.T) {
ogCookies := md["cookie"]
ogCookies, _ := md["cookie"]
ctx := grpc.NewContextWithServerTransportStream(
metadata.NewIncomingContext(context.TODO(),
md,
@ -280,7 +280,8 @@ func TestAuthenticate(t *testing.T) {
a.groupsCache[token] = cachedGroups{time.Now(), test.groups}
}
if test.refresh {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var srv *httptest.Server
srv = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
t.Fatalf("unexpected error: %v", err)
}

View file

@ -1,5 +1,16 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package authz
@ -7,7 +18,7 @@ import (
"fmt"
"io"
"github.com/featurebasedb/featurebase/v3/authn"
"github.com/molecula/featurebase/v3/authn"
"gopkg.in/yaml.v2"
)

View file

@ -1,5 +1,16 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2017 Pilosa Corp.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package authz_test
import (
@ -9,8 +20,8 @@ import (
"strings"
"testing"
"github.com/featurebasedb/featurebase/v3/authn"
"github.com/featurebasedb/featurebase/v3/authz"
"github.com/molecula/featurebase/v3/authn"
"github.com/molecula/featurebase/v3/authz"
)
func TestAuth_ReadPermissionsFile(t *testing.T) {

View file

@ -2,10 +2,10 @@ ARG GO_VERSION=1.19
FROM golang:${GO_VERSION}
WORKDIR /go/src/github.com/featurebasedb/featurebase/
WORKDIR /go/src/github.com/molecula/featurebase/
COPY . .
WORKDIR /go/src/github.com/featurebasedb/featurebase/batch/
WORKDIR /go/src/github.com/molecula/featurebase/batch/
CMD ["go","test","-v","-mod=vendor","-tags=odbc,dynamic","./..."]

View file

@ -10,12 +10,12 @@ import (
"sync"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/batch/egpool"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/featurebasedb/featurebase/v3/logger"
"github.com/featurebasedb/featurebase/v3/pql"
"github.com/featurebasedb/featurebase/v3/roaring"
featurebase "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/batch/egpool"
"github.com/molecula/featurebase/v3/dax"
"github.com/molecula/featurebase/v3/logger"
"github.com/molecula/featurebase/v3/pql"
"github.com/molecula/featurebase/v3/roaring"
"github.com/pkg/errors"
)
@ -23,7 +23,6 @@ import (
const (
DefaultKeyTranslateBatchSize = 100000
existenceFieldName = "_exists"
existenceViewName = "existence" // this should match top level featurebase viewExistence
)
// TODO if using column translation, column ids might get way out of
@ -574,11 +573,7 @@ func (b *Batch) Add(rec Row) error {
case int64:
b.values[field.Name] = append(b.values[field.Name], val)
case []string:
// note that a length of 0 can be valid, and represents an
// empty set. an empty set counts as a non-NULL value for
// SQL purposes -- it means the existence view bit should
// get set.
if val == nil {
if len(val) == 0 {
continue
}
rowIDSets, ok := b.rowIDSets[field.Name]
@ -613,11 +608,7 @@ func (b *Batch) Add(rec Row) error {
}
b.rowIDSets[field.Name] = append(rowIDSets, rowIDs)
case []uint64:
// note that a length of 0 can be valid, and represents an
// empty set. an empty set counts as a non-NULL value for
// SQL purposes -- it means the existence view bit should
// get set.
if val == nil {
if len(val) == 0 {
continue
}
rowIDSets, ok := b.rowIDSets[field.Name]
@ -672,9 +663,6 @@ func (b *Batch) Add(rec Row) error {
for i, uval := range rec.Clears {
field := b.header[i]
if field.Options.Type == featurebase.FieldTypeMutex && uval != nil {
return errors.Errorf("individual-bit clears not allowed on mutex fields; use nil to clear a mutex")
}
if _, ok := b.clearRowIDs[i]; !ok {
b.clearRowIDs[i] = make(map[int]uint64)
}
@ -730,7 +718,7 @@ func (b *Batch) Add(rec Row) error {
return nil
}
// ErrBatchNowFull — similar to io.EOF — is a marker error to notify the user of
// ErrBatchNowFull — similar to io.EOF — is a marker error to notify the user of
// a batch that it is time to call Import.
var ErrBatchNowFull = errors.New("batch is now full - you cannot add any more records (though the one you just added was accepted)")
@ -1257,7 +1245,7 @@ func (b *Batch) doImport(frags, clearFrags fragments) error {
}
ferr := b.importer.ImportRoaringBitmap(ctx, b.tbl.ID, fld, shard, viewMap, false)
b.log.Debugf("imp-roar field: %s, shard:%d, views:%d %v", field, shard, len(viewMap), time.Since(starty))
b.log.Debugf("imp-roar field: %s, shard:%d, views:%d %v", field, shard, len(clearViewMap), time.Since(starty))
return errors.Wrapf(ferr, "importing data for %s", field)
})
}
@ -1355,7 +1343,6 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments
curShard := ^uint64(0) // impossible sentinel value for shard.
var curBM *roaring.Bitmap
var clearBM *roaring.Bitmap
var existCurBM *roaring.Bitmap
for j := range b.ids {
col := b.ids[j]
row := nilSentinel
@ -1368,12 +1355,8 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments
if col/shardWidth != curShard {
curShard = col / shardWidth
// the API treats "" as standard
curBM = frags.GetOrCreate(curShard, field.Name, "")
clearBM = clearFrags.GetOrCreate(curShard, field.Name, "")
if opts.ActuallyTrackingExistence() {
existCurBM = frags.GetOrCreate(curShard, field.Name, existenceViewName)
}
}
if row != nilSentinel {
// TODO this is super ugly, but we want to avoid setting
@ -1383,9 +1366,6 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments
// the NoStandardView case would be great.
if !(opts.Type == featurebase.FieldTypeTime && opts.NoStandardView) {
curBM.DirectAdd(row*shardWidth + (col % shardWidth))
if opts.ActuallyTrackingExistence() {
existCurBM.DirectAdd(col % shardWidth)
}
}
if opts.Type == featurebase.FieldTypeTime {
views, err := b.times[j].views(opts.TimeQuantum)
@ -1406,16 +1386,6 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments
// we want to make sure that at this point, the "set"
// fragments don't contain the bit that we're clearing
curBM.DirectRemoveN(clearRow*shardWidth + (col % shardWidth))
// Because this is RowIDs, not RowIDSets, there's only one
// bit. We should not be setting the existence bit based on
// this value, if we're actually clearing it. This doesn't
// mean we will clear an existing existence bit, though.
// The case where we would clear an existence bit is the
// case where someone specified row[mutexField].Clears = nil,
// which is far from here.
if opts.ActuallyTrackingExistence() {
existCurBM.DirectRemoveN(col % shardWidth)
}
}
}
}
@ -1434,23 +1404,14 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments
opts := field.Options
curShard := ^uint64(0) // impossible sentinel value for shard.
var curBM *roaring.Bitmap
var existCurBM *roaring.Bitmap
for j := range b.ids {
col, rowIDs := b.ids[j], rowIDSets[j]
if len(rowIDs) == 0 {
continue
}
if col/shardWidth != curShard {
curShard = col / shardWidth
curBM = frags.GetOrCreate(curShard, fname, "")
if opts.ActuallyTrackingExistence() {
existCurBM = frags.GetOrCreate(curShard, fname, existenceViewName)
}
}
if len(rowIDs) == 0 {
// you can validly specify an empty set, which is not the same as a null,
// but which still ought to set the existence bit if we're tracking that.
if opts.ActuallyTrackingExistence() && rowIDs != nil {
existCurBM.DirectAdd(col % shardWidth)
}
continue
}
// TODO this is super ugly, but we want to avoid setting
// bits on the standard view in the specific case when
@ -1461,9 +1422,6 @@ func (b *Batch) makeFragments(frags, clearFrags fragments) (fragments, fragments
for _, row := range rowIDs {
curBM.DirectAdd(row*shardWidth + (col % shardWidth))
}
if opts.ActuallyTrackingExistence() {
existCurBM.DirectAdd(col % shardWidth)
}
}
if opts.Type == featurebase.FieldTypeTime {
views, err := b.times[j].views(opts.TimeQuantum)
@ -1591,11 +1549,6 @@ func (b *Batch) makeSingleValFragments(frags, clearFrags fragments) (fragments,
shard := ids[0] / shardWidth
bitmap := frags.GetOrCreate(shard, field.Name, "standard")
clearBM := clearFrags.GetOrCreate(shard, field.Name, "standard")
var existBM, existClearBM *roaring.Bitmap
if field.Options.ActuallyTrackingExistence() {
existBM = frags.GetOrCreate(shard, field.Name, existenceViewName)
existClearBM = clearFrags.GetOrCreate(shard, field.Name, existenceViewName)
}
for i, id := range ids {
if i+1 < len(ids) {
// we only want the last value set for each id
@ -1608,10 +1561,6 @@ func (b *Batch) makeSingleValFragments(frags, clearFrags fragments) (fragments,
shard = id / shardWidth
bitmap = frags.GetOrCreate(shard, field.Name, "standard")
clearBM = clearFrags.GetOrCreate(shard, field.Name, "standard")
if field.Options.ActuallyTrackingExistence() {
existBM = frags.GetOrCreate(shard, field.Name, existenceViewName)
existClearBM = clearFrags.GetOrCreate(shard, field.Name, existenceViewName)
}
}
fragmentColumn := id % shardWidth
clearBM.Add(fragmentColumn) // Will use this to clear columns.
@ -1619,11 +1568,6 @@ func (b *Batch) makeSingleValFragments(frags, clearFrags fragments) (fragments,
// clearSentinel is used for deletion
// so this value should only be added if its not clearSentinel
bitmap.Add(row*shardWidth + fragmentColumn)
if field.Options.ActuallyTrackingExistence() {
existBM.Add(fragmentColumn)
}
} else if field.Options.ActuallyTrackingExistence() {
existClearBM.Add(fragmentColumn)
}
}
}
@ -1652,11 +1596,6 @@ func (b *Batch) makeSingleValFragments(frags, clearFrags fragments) (fragments,
fragmentColumn := recID % shardWidth
clearBM.Add(fragmentColumn)
if field.Options.ActuallyTrackingExistence() {
existClearBM := clearFrags.GetOrCreate(shard, field.Name, existenceViewName)
existClearBM.Add(fragmentColumn)
}
}
}
@ -1679,10 +1618,6 @@ func (b *Batch) makeSingleValFragments(frags, clearFrags fragments) (fragments,
fragmentColumn := recID % shardWidth
clearBM.Add(fragmentColumn)
if field.Options.ActuallyTrackingExistence() {
exist := frags.GetOrCreate(shard, field.Name, existenceViewName)
exist.Add(fragmentColumn)
}
if boolVal {
bitmap.Add(trueRowOffset + fragmentColumn)

View file

@ -12,9 +12,9 @@ import (
"testing"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/client"
"github.com/featurebasedb/featurebase/v3/pql"
featurebase "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/client"
"github.com/molecula/featurebase/v3/pql"
"github.com/stretchr/testify/assert"
"github.com/pkg/errors"
@ -103,12 +103,6 @@ func testStringSliceCombos(t *testing.T, importer featurebase.Importer, sapi fea
Index: idx.Name,
Query: "TopN(a1, n=10)",
})
if resp.Err != nil {
t.Fatalf("unexpected error from TopN query: %v", resp.Err)
}
if len(resp.Results) < 1 {
t.Fatalf("expected non-empty result set, got empty results")
}
pairsField, ok := resp.Results[0].(*featurebase.PairsField)
assert.True(t, ok, "wrong return type: %T", resp.Results[0])
@ -514,11 +508,10 @@ func testStringSliceEmptyAndNil(t *testing.T, importer featurebase.Importer, sap
{
Name: "strslice",
Options: featurebase.FieldOptions{
Type: featurebase.FieldTypeSet,
Keys: true,
CacheType: featurebase.CacheTypeRanked,
CacheSize: 100,
TrackExistence: true,
Type: featurebase.FieldTypeSet,
Keys: true,
CacheType: featurebase.CacheTypeRanked,
CacheSize: 100,
},
},
},
@ -618,14 +611,6 @@ func testStringSliceEmptyAndNil(t *testing.T, importer featurebase.Importer, sap
pql: "Row(strslice='z')",
exp: []uint64{2},
},
{
pql: "Row(strslice==null)",
exp: []uint64{1},
},
{
pql: "Row(strslice!=null)",
exp: []uint64{0, 2, 3, 4},
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
@ -2060,7 +2045,7 @@ func mutexClearRegression(t *testing.T, importer featurebase.Importer, sapi feat
}
col := uint64(0)
row := uint64(0)
row := uint64(1)
for i := uint64(0); i <= 21; i++ {
col = (i%2+1)*featurebase.ShardWidth + i%5
row = i % 3
@ -2141,7 +2126,7 @@ func mutexNilClearID(t *testing.T, importer featurebase.Importer, sapi featureba
}
col := uint64(0)
row := uint64(0)
row := uint64(1)
// populate mutex with some data
for i := uint64(0); i < 11; i++ {
col = (i%2+1)*featurebase.ShardWidth + i%5
@ -2356,58 +2341,3 @@ func testImportBatchBools(t *testing.T, importer featurebase.Importer, sapi feat
assert.True(t, ok, "wrong return type: %T", resp.Results[0])
assert.Equal(t, uint64(2), count)
}
func TestConvert(t *testing.T) {
t.Run("timestampToInt", func(t *testing.T) {
tests := []struct {
unit TimeUnit
ts string
exp int64
}{
{unit: "s", ts: "2022-01-01T00:00:00Z", exp: 1640995200},
{unit: "ms", ts: "2022-01-01T00:00:00Z", exp: 1640995200000},
{unit: "us", ts: "2022-01-01T00:00:00Z", exp: 1640995200000000},
{unit: "ns", ts: "2022-01-01T00:00:00Z", exp: 1640995200000000000},
{unit: "x", ts: "2022-01-01T00:00:00Z", exp: 0},
}
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
ts, err := time.Parse(time.RFC3339, test.ts)
assert.NoError(t, err)
v := timestampToInt(test.unit, ts)
assert.Equal(t, test.exp, v)
})
}
})
t.Run("Int64ToTimestamp", func(t *testing.T) {
tests := []struct {
unit TimeUnit
epoch string
val int64
exp time.Time
}{
{
unit: "ms",
epoch: "2022-01-01T00:00:00Z",
val: 0,
exp: time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC),
},
{
unit: "s",
epoch: "2022-01-01T00:00:00Z",
val: 86400,
exp: time.Date(2022, 1, 2, 0, 0, 0, 0, time.UTC),
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
epoch, err := time.Parse(time.RFC3339, test.epoch)
assert.NoError(t, err)
ts, err := Int64ToTimestamp(test.unit, epoch, test.val)
assert.NoError(t, err)
assert.Equal(t, test.exp, ts)
})
}
})
}

View file

@ -1,20 +0,0 @@
package batch
import (
"time"
"github.com/featurebasedb/featurebase/v3/dax"
)
// Batcher is an interface implemented by anything which can allocate new
// batches.
type Batcher interface {
NewBatch(cfg Config, tbl *dax.Table, fields []*dax.Field) (RecordBatch, error)
}
// Config is the configuration options passed to NewBatch for any implementation
// of the Batcher interface.
type Config struct {
Size int
MaxStaleness time.Duration
}

View file

@ -3,8 +3,8 @@ package batch
import (
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/errors"
featurebase "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/errors"
)
var (

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package egpool
import (
@ -58,11 +57,11 @@ func (eg *Group) err(err error) {
eg.errs = append(eg.errs, err)
}
type PanicError struct {
type ErrPanic struct {
Value interface{}
}
func (p PanicError) Error() string {
func (p ErrPanic) Error() string {
return fmt.Sprintf("panic: %v", p.Value)
}
@ -77,7 +76,7 @@ func (eg *Group) processJobs() {
defer func() {
if !finished {
if p := recover(); p != nil {
eg.err(PanicError{p})
eg.err(ErrPanic{p})
} else {
eg.err(ErrGoexit)
}

View file

@ -1,12 +1,11 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package egpool_test
import (
"errors"
"testing"
"github.com/featurebasedb/featurebase/v3/batch/egpool"
"github.com/molecula/featurebase/v3/batch/egpool"
)
func TestEGPool(t *testing.T) {

View file

@ -1,3 +1 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
package batch

View file

@ -1,11 +1,10 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
"fmt"
"github.com/featurebasedb/featurebase/v3/disco"
"github.com/molecula/featurebase/v3/disco"
"github.com/pkg/errors"
)

5
bsi.go
View file

@ -1,11 +1,10 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
"math/bits"
"github.com/featurebasedb/featurebase/v3/roaring"
"github.com/molecula/featurebase/v3/roaring"
)
// BSIData contains BSI-structured data.

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (

View file

@ -1,110 +0,0 @@
package buffer
import (
"bytes"
"io"
"io/ioutil"
"os"
"sync"
)
// NewFileBuffer returns a file buffer which will use an in-memory buffer, until `max` bytes have been written, at which point it will write the contents of memory to a file, and continue writing future data to the file.
// The file will be written to `temp` directory. The buffer fulfills the io.Reader and io.Writer interface
func NewFileBuffer(max int, temp string) *FileBuffer {
return &FileBuffer{max: max, tempDir: temp}
}
type FileBuffer struct {
max int
buf bytes.Buffer
file *os.File
tempDir string
reading bool
files []*os.File
mu sync.Mutex
}
func (fb *FileBuffer) Write(p []byte) (n int, err error) {
if fb.reading {
panic("cannot write after read")
}
if fb.file != nil {
return fb.file.Write(p)
}
n, err = fb.buf.Write(p)
if err != nil {
return
}
if fb.buf.Len() > fb.max {
fb.file, err = ioutil.TempFile(fb.tempDir, "filebuffer-")
if err != nil {
return
}
_, err = io.Copy(fb.file, &fb.buf)
fb.buf.Reset()
}
return
}
func (fb *FileBuffer) Len() (int64, error) {
if fb.file == nil {
return int64(fb.buf.Len()), nil
}
fi, err := fb.file.Stat()
if err != nil {
return 0, err
}
return fi.Size(), nil
}
func (fb *FileBuffer) Read(p []byte) (n int, err error) {
if fb.file != nil {
if !fb.reading {
fb.reading = true
_, err = fb.file.Seek(0, 0)
if err != nil {
return
}
}
return fb.file.Read(p)
}
fb.reading = true
return fb.buf.Read(p)
}
func (fb *FileBuffer) Close() error {
if fb.file != nil {
name := fb.file.Name()
if err := fb.file.Close(); err != nil {
return err
}
for _, f := range fb.files {
f.Close()
}
fb.files = fb.files[:0]
fb.file = nil
return os.Remove(name)
}
return nil
}
func (fb *FileBuffer) Reset() error {
fb.mu.Lock()
defer fb.mu.Unlock()
fb.reading = false
fb.buf.Reset()
return fb.Close()
}
func (fb *FileBuffer) NewReader() (io.Reader, error) {
fb.mu.Lock()
defer fb.mu.Unlock()
fb.reading = true
if fb.file == nil {
return bytes.NewReader(fb.buf.Bytes()), nil
}
f, err := os.OpenFile(fb.file.Name(), os.O_RDONLY, 0)
fb.files = append(fb.files, f)
return f, err
}

View file

@ -53,10 +53,10 @@ const PAGE_PREV_POINTER_OFFSET = 12 // offset 12, length 4, end 16
const PAGE_NEXT_POINTER_OFFSET = 16 // offset 16, length 4, end 20
const PAGE_SLOTS_START_OFFSET = 20 // offset 20
// PAGE_SLOT_LENGTH is the size of the page slot key/value.
// page slots
//
// key offset int16 //offset 0, length 2, end 2
// value offset int16 //offset 2, length 2, end 4
// key offset int16 //offset 0, length 2, end 2
// value offset int16 //offset 2, length 2, end 4
const PAGE_SLOT_LENGTH = 4
// Page represents a page on disk

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
@ -11,8 +10,8 @@ import (
"sync"
"time"
"github.com/featurebasedb/featurebase/v3/lru"
pb "github.com/featurebasedb/featurebase/v3/proto"
"github.com/molecula/featurebase/v3/lru"
pb "github.com/molecula/featurebase/v3/proto"
"github.com/pkg/errors"
)

View file

@ -1,12 +1,11 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa_test
import (
"reflect"
"testing"
pilosa "github.com/featurebasedb/featurebase/v3"
"github.com/molecula/featurebase/v3"
)
// Ensure cache stays constrained to its configured size.
@ -62,7 +61,7 @@ func TestCache_Rank_Dirty(t *testing.T) {
cache.Add(v.ID, v.Count)
}
var got []pair //nolint:prealloc
var got []pair
for _, p := range cache.Top() {
got = append(got, pair(p))
}

View file

@ -1,11 +1,10 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package pilosa
import (
"github.com/featurebasedb/featurebase/v3/roaring"
txkey "github.com/featurebasedb/featurebase/v3/short_txkey"
"github.com/featurebasedb/featurebase/v3/vprint"
"github.com/molecula/featurebase/v3/roaring"
txkey "github.com/molecula/featurebase/v3/short_txkey"
"github.com/molecula/featurebase/v3/vprint"
)
// catcher is useful to report error locations with a
@ -124,17 +123,6 @@ func (c *catcherTx) Remove(index, field, view string, shard uint64, a ...uint64)
return c.b.Remove(index, field, view, shard, a...)
}
func (c *catcherTx) Removed(index, field, view string, shard uint64, a ...uint64) (changed []uint64, err error) {
defer func() {
if r := recover(); r != nil {
vprint.AlwaysPrintf("see Removed() PanicOn '%v' at '%v'", r, vprint.Stack())
vprint.PanicOn(r)
}
}()
return c.b.Removed(index, field, view, shard, a...)
}
func (c *catcherTx) Contains(index, field, view string, shard uint64, key uint64) (exists bool, err error) {
defer func() {

View file

@ -1,15 +0,0 @@
.PHONY: test testv test-integration testv-integration
GO=go
test:
$(GO) test ./... -short
testv:
$(GO) test -v ./... -short
test-integration:
$(GO) test . -count 1 -timeout 20m -run TestCLIIntegration/$(RUN)
testv-integration:
$(GO) test -v . -count 1 -timeout 20m -run TestCLIIntegration/$(RUN)

View file

@ -1,8 +0,0 @@
package batch
// Inserter can be implemented by anything which can handle a SQL statement
// representing a write operation. An example is `BULK INSERT`. The Insert()
// method on this interface does not return any results other than an error.
type Inserter interface {
Insert(sql string) error
}

View file

@ -1,215 +0,0 @@
package batch
import (
"encoding/json"
"fmt"
"strings"
"time"
fbbatch "github.com/featurebasedb/featurebase/v3/batch"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/featurebasedb/featurebase/v3/errors"
"github.com/featurebasedb/featurebase/v3/pql"
)
// Ensure type implements interface.
var _ fbbatch.Batcher = (*sqlBatcher)(nil)
type sqlBatcher struct {
inserter Inserter
fields []*dax.Field
}
func NewSQLBatcher(i Inserter, flds []*dax.Field) *sqlBatcher {
return &sqlBatcher{
inserter: i,
fields: flds,
}
}
func (b *sqlBatcher) NewBatch(cfg fbbatch.Config, tbl *dax.Table, flds []*dax.Field) (fbbatch.RecordBatch, error) {
fields := flds
if b.fields != nil {
fields = b.fields
}
return &sqlBatch{
table: tbl,
fields: fields,
size: cfg.Size,
maxStaleness: cfg.MaxStaleness,
ids: make([]interface{}, 0, cfg.Size),
rows: make([][]interface{}, 0, cfg.Size),
inserter: b.inserter,
}, nil
}
// Ensure type implements interface.
var _ fbbatch.RecordBatch = (*sqlBatch)(nil)
type sqlBatch struct {
table *dax.Table
fields []*dax.Field
size int
ids []interface{}
rows [][]interface{}
// staleTime tracks the time the first record of the batch was inserted
// plus the maxStaleness, in order to raise ErrBatchNowStale if the
// maxStaleness has elapsed
staleTime time.Time
maxStaleness time.Duration
// inserter handles SQL INSERT statements generated for each batch.
inserter Inserter
}
func (b *sqlBatch) Add(rec fbbatch.Row) error {
// Clear rec.Values and rec.Clears upon return.
defer func() {
for i := range rec.Values {
rec.Values[i] = nil
}
for k := range rec.Clears {
delete(rec.Clears, k)
}
}()
if len(b.ids) == cap(b.ids) {
return fbbatch.ErrBatchAlreadyFull
}
if len(rec.Values) != len(b.fields) {
return errors.Errorf("record needs to match up with batch fields, got %d fields and %d record", len(b.fields), len(rec.Values))
}
// Append the ID to b.ids.
b.ids = append(b.ids, rec.ID)
// Convert decimal fields (which come in as int64, along with the scale in
// field) to pql.Decimal.
for i, fld := range b.fields {
switch b.fields[i].Type {
case dax.BaseTypeDecimal:
if val, ok := rec.Values[i].(int64); ok {
rec.Values[i] = pql.NewDecimal(val, fld.Options.Scale)
}
case dax.BaseTypeTimestamp:
if val, ok := rec.Values[i].(int64); ok {
ts := time.Unix(val, 0)
rec.Values[i] = ts.Format(time.RFC3339)
}
}
}
// Append the record to b.rows.
vals := make([]interface{}, 0, len(rec.Values))
vals = append(vals, rec.Values...)
b.rows = append(b.rows, vals)
// Check for batch full or stale.
if len(b.ids) == cap(b.ids) {
return fbbatch.ErrBatchNowFull
}
if b.maxStaleness != time.Duration(0) { // set maxStaleness to 0 to disable staleness checking
if len(b.ids) == 1 {
b.staleTime = time.Now().Add(b.maxStaleness)
} else if time.Now().After(b.staleTime) {
return fbbatch.ErrBatchNowStale
}
}
return nil
}
func (b *sqlBatch) Import() error {
if len(b.rows) == 0 {
return nil
}
// Construct the BULK INSERT statement based on the table and fields.
sql, err := buildBulkInsert(b.table, b.fields, b.ids, b.rows)
if err != nil {
return errors.Wrap(err, "building bulk insert statement")
}
// Reset batch data.
b.reset()
// Submit the SQL statement.
return b.inserter.Insert(sql)
}
func (b *sqlBatch) reset() {
b.ids = b.ids[:0]
b.rows = b.rows[:0]
}
func (b *sqlBatch) Len() int {
return len(b.rows)
}
func (b *sqlBatch) Flush() error {
return nil
}
func buildBulkInsert(tbl *dax.Table, fields []*dax.Field, ids []interface{}, rows [][]interface{}) (string, error) {
// Validation.
if tbl.Name == "" {
return "", errors.New(errors.ErrUncoded, "table name is required")
} else if len(fields) == 0 {
return "", errors.New(errors.ErrUncoded, "at least one field is required")
}
var sb strings.Builder
sb.WriteString(`BULK INSERT INTO `)
sb.WriteString(string(tbl.Name))
sb.WriteString(` (_id,`)
flds := make([]string, 0, len(fields))
maps := make([]string, 0, len(fields))
for i := range fields {
flds = append(flds, string(fields[i].Name))
maps = append(maps, fmt.Sprintf("'$.col_%d' %s", i, fields[i].FullType()))
}
// Fields
sb.WriteString(strings.Join(flds, ","))
// MAP
keyType := dax.BaseTypeID
if tbl.StringKeys() {
keyType = dax.BaseTypeString
}
sb.WriteString(`) MAP ('$._id' `)
sb.WriteString(keyType)
sb.WriteString(`,`)
sb.WriteString(strings.Join(maps, ","))
sb.WriteString(`) FROM x'`)
// Row values.
// m is a map representing a single row to be marshalled and added to the
// bulk insert as one line in the NDJSON payload. We re-use the map for each
// row.
m := make(map[string]interface{})
for i := range rows {
// Write the ID value.
m[string(dax.PrimaryKeyFieldName)] = ids[i]
// Write the rest of the data values.
for col := range rows[i] {
m[fmt.Sprintf("col_%d", col)] = rows[i][col]
}
// Marshal the map to json and add to the sql statement.
if j, err := json.Marshal(m); err != nil {
return "", errors.Wrap(err, "marshalling row to json")
} else {
sb.Write(j)
sb.WriteString("\n")
}
}
// WITH
sb.WriteString(fmt.Sprintf(`' WITH BATCHSIZE %d FORMAT 'NDJSON' INPUT 'STREAM'`, len(rows)))
return sb.String(), nil
}

View file

@ -1,47 +0,0 @@
package batch
import (
"testing"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/stretchr/testify/assert"
)
func TestBatchSQL(t *testing.T) {
tbl := &dax.Table{
Name: "foo",
}
fields := []*dax.Field{
{
Name: "name",
Type: dax.BaseTypeString,
},
{
Name: "age",
Type: dax.BaseTypeInt,
},
}
ids := []interface{}{
0, 1, 2,
}
rows := [][]interface{}{
{
[]interface{}{"Alice", int64(11)},
},
{
[]interface{}{"Bob", int64(22)},
},
{
[]interface{}{"Carl,Comma", int64(33)},
},
}
s, err := buildBulkInsert(tbl, fields, ids, rows)
assert.NoError(t, err)
exp := `BULK INSERT INTO foo (_id,name,age) MAP ('$._id' id,'$.col_0' string,'$.col_1' int) FROM x'{"_id":0,"col_0":["Alice",11]}
{"_id":1,"col_0":["Bob",22]}
{"_id":2,"col_0":["Carl,Comma",33]}
' WITH BATCHSIZE 3 FORMAT 'NDJSON' INPUT 'STREAM'`
assert.Equal(t, exp, s)
}

View file

@ -1,91 +0,0 @@
package cli
import (
"io"
"strings"
"github.com/featurebasedb/featurebase/v3/errors"
)
// buffer is a query buffer for SQL statements. Note that this is not a query
// buffer as you would find on a database server (buffering query results).
// Rather, this buffers the working SQL statement. The buffer has two
// components: the buffer of query parts making up the working, incomplete SQL
// statement, and the last completed SQL statement submitted to the Queryer.
type buffer struct {
parts []queryPart
lastQuery query
hasBatchFile bool
}
func newBuffer() *buffer {
return &buffer{}
}
// addPart adds the given queryPart to the buffer. If the part is of type
// `partTerminator` (which is generally singified in the CLI by a ";"), the
// buffer will finalize the query and return it. In all other cases, the
// returned query is nil.
func (b *buffer) addPart(part queryPart) (query, error) {
// Check for part type compatibility. For example, multiple batchFile parts
// are not allowed in the same query.
switch part.(type) {
case *partBatchFile:
if b.hasBatchFile {
return nil, errors.Errorf("multiple batch files in one query is not supported")
}
b.hasBatchFile = true
case *partTerminator:
return b.finalize(), nil
}
b.parts = append(b.parts, part)
return nil, nil
}
// finalize copies the contents (queryParts) of buffer to lastQuery and then
// resets the buffer. It returns the query that was finalized.
func (b *buffer) finalize() query {
q := make(query, len(b.parts))
copy(q, b.parts)
b.lastQuery = q
b.reset()
return q
}
// print returns the contents of the buffer as a string. This is generally used
// to visually inspect the state of the buffer (for example, when a user issues
// a `\p` meta-command in the CLI).
func (b *buffer) print() string {
if len(b.parts) > 0 {
return query(b.parts).String()
} else if b.lastQuery != nil {
return b.lastQuery.String() + ";"
}
return "Query buffer is empty."
}
// reset clears the buffer. It returns a message which may optionally be used to
// display to a user.
func (b *buffer) reset() string {
b.parts = b.parts[:0]
b.hasBatchFile = false
return "Query buffer reset (cleared)."
}
func (b *buffer) Reader() io.Reader {
if len(b.parts) > 0 {
return query(b.parts).Reader()
} else if b.lastQuery != nil {
r := b.lastQuery.Reader()
// TODO(tlt): terminating the query here results in a line feed just
// before the semi-colon (for example, when you print out the query
// buffer using `\w [FILE]`). The removal and re-introduction of line
// feeds is kind of a mess.
term := strings.NewReader(";")
return io.MultiReader(r, term)
}
return strings.NewReader("")
}

1074
cli/cli.go

File diff suppressed because it is too large Load diff

View file

@ -1,257 +0,0 @@
package cli_test
import (
"bufio"
"context"
"fmt"
"os"
"strings"
"testing"
"time"
"github.com/featurebasedb/featurebase/v3/cli"
"github.com/featurebasedb/featurebase/v3/dax/server/test"
"github.com/featurebasedb/featurebase/v3/logger"
"github.com/stretchr/testify/require"
)
func TestCLIIntegration(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
ctx := context.Background()
t.Run("Stubbed Framework", func(t *testing.T) {
mc := test.MustRunManagedCommand(t)
defer mc.Close()
addr := mc.Address()
capture := newCapture(t)
comparer := newComparer(t)
comparer.run()
fbsql := cli.NewCommand(logger.StderrLogger)
fbsql.SetStdin(capture)
fbsql.SetStdout(comparer)
fbsql.SetStderr(comparer)
fbsql.Config = &cli.Config{
Host: addr.Host(),
Port: fmt.Sprintf("%d", addr.Port()),
}
// Run fbsql in a goroutine so we can continue to send it commands
// below.
didQuit := make(chan struct{})
go func() {
require.NoError(t, fbsql.Run(ctx))
close(didQuit)
}()
// testFiles reference files located in the cli/testdata directory. All
// tests should be placed there; other than adding another test file to
// this list, you probably shouldn't be editing this file unless you are
// trying to modify the way the test framework itself works.
testFiles := []string{
"setup",
"database",
"table",
// the tests below may be dependent on the previous tests, which do
// setup and some shared database and table creation.
"query_buffer",
// meta commands
"meta_bang",
"meta_cd",
"meta_echo",
"meta_describe",
"meta_file",
"meta_pset_border",
"meta_pset_expanded",
"meta_pset_format_csv",
"meta_pset_tuples_only",
"meta_include",
"meta_output",
"meta_set",
"meta_timing",
"meta_write",
}
for _, testFile := range testFiles {
t.Run(testFile, func(t *testing.T) {
f, err := os.Open("testdata/" + testFile)
require.NoError(t, err)
scanner := bufio.NewScanner(f)
var lineNo int
for scanner.Scan() {
line := scanner.Text()
lineNo++
// Empty lines and comments (//) are ignored.
if line == "" {
continue
} else if strings.HasPrefix(line, "//") {
continue
}
parts := strings.SplitN(line, ":", 2)
switch parts[0] {
case "SEND":
v := ""
if len(parts) == 2 {
v = parts[1]
}
capture.sendLine(v)
case "EXPECT":
v := ""
if len(parts) == 2 {
v = parts[1]
}
comparer.expectLine(v, testFile, lineNo)
case "EXPECTCOMP":
if len(parts) == 2 {
comps := strings.SplitN(parts[1], ":", 2)
v := ""
if len(comps) == 2 {
v = comps[1]
}
comparer.expectLineComp(comparator(comps[0]), v, testFile, lineNo)
} else {
t.Errorf("unexpected line: %s[%d]:%s", testFile, lineNo, line)
}
default:
t.Errorf("unexpected line: %s[%d]:%s", testFile, lineNo, line)
}
}
require.NoError(t, scanner.Err())
})
}
// End with quit to ensure that fbsql closes without error.
capture.sendLine(`\q`)
// Ensure fbsql quits cleanly.
select {
case <-didQuit:
case <-time.After(time.Second):
t.Fatalf("expected fbsql to quit")
}
})
}
// compare is used to compare fbsql output written to its Stdout with expected
// lines.
type comparer struct {
t *testing.T
out chan byte
outline chan []byte
exp chan []byte
}
func newComparer(t *testing.T) *comparer {
return &comparer{
t: t,
out: make(chan byte, 1024),
outline: make(chan []byte, 128),
exp: make(chan []byte, 1024),
}
}
func (c *comparer) run() {
// Read bytes off output, and for every line (designated by a line feed "\n"),
// push the line onto the outline channel.
go func() {
var line []byte
for {
b := <-c.out
if b == byte('\n') {
c.outline <- line
line = []byte{}
continue
}
line = append(line, b)
}
}()
}
type comparator string
const (
compEquals = "Equals"
compHasPrefix = "HasPrefix"
compWithFormat = "WithFormat"
)
// expectLine is a convenience method which calls expectLineComp with the compEq
// comparator and the given line.
func (c *comparer) expectLine(line string, fileName string, lineNo int) {
c.expectLineComp(compEquals, line, fileName, lineNo)
}
// expectLineComp reads the next line from the outline channel and compares it
// with the given `line`. A comparator can be provided to inform how the lines
// should be compared (for example, the compHasPrefix comparator will just
// compare the beginning part of the outline).
func (c *comparer) expectLineComp(comp comparator, line string, fileName string, lineNo int) {
var outline []byte
select {
case outline = <-c.outline:
case <-time.After(10 * time.Second):
// TODO(tlt): this is 10 seconds to account for the fb_views creation on
// a local mac. This should really be something like 2 seconds. Put this
// back to 2 once fb_views issue is addressed.
c.t.Fatalf("expected output line %s[%d]: >%s<", fileName, lineNo, line)
}
// msg is included in any require which fails.
msg := []interface{}{"exp: %s[%d], got: >%s<", fileName, lineNo, outline}
switch comp {
case compEquals:
require.Equal(c.t, []byte(line), outline, msg...)
case compHasPrefix:
require.True(c.t, strings.HasPrefix(string(outline), line), msg...)
case compWithFormat:
require.True(c.t, compareByteSlices(outline, []byte(line)), msg...)
default:
c.t.Fatalf("invalid comparator: %s", comp)
}
}
func (c *comparer) Write(b []byte) (n int, err error) {
for i := range b {
c.out <- b[i]
}
return len(b), err
}
// compareByteSlices compares a byte slice s with another byte slice format and
// returns true if they are the same. It will accept underscore as a
// single-character wildcard anywhere in slice format.
func compareByteSlices(s, format []byte) bool {
// Replace some helpers in format before comparing.
f := string(format)
f = strings.ReplaceAll(f, `{uuid}`, `________-____-____-____-____________`)
f = strings.ReplaceAll(f, `{timestamp}`, `____-__-__T__:__:__Z`)
format = []byte(f)
if len(s) != len(format) {
return false
}
for i := range s {
if format[i] == '_' {
continue
}
if s[i] != format[i] {
// log.Printf("DEBUG: characters differ: (%d): '%v' != '%v'", i, s[i], format[i])
return false
}
}
return true
}

View file

@ -8,9 +8,9 @@ import (
"testing"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/cli"
"github.com/featurebasedb/featurebase/v3/logger"
featurebase "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/cli"
"github.com/molecula/featurebase/v3/logger"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
@ -21,9 +21,9 @@ func TestCLI(t *testing.T) {
capture := newCapture(t)
cli := cli.NewCommand(logger.StderrLogger)
cli.SetStdin(capture)
cli.SetStdout(capture)
cli := cli.NewCLICommand(logger.StderrLogger)
cli.Stdin = capture
cli.Stdout = capture
cli.Queryer = capture
go func() {
@ -33,32 +33,38 @@ func TestCLI(t *testing.T) {
none := []string{}
// One statement, one line.
capture.Assert("one;", []string{"one\n"})
capture.Assert("one;", []string{`one`})
// One statement, multiple lines.
capture.Assert("one", none)
capture.Assert(" two ", none)
capture.Assert("three;", []string{"one\ntwo\nthree\n"})
capture.Assert("three;", []string{`one
two
three`})
// Multiple statements, one line.
capture.Assert("foo; bar;", []string{"foo\n", "bar\n"})
capture.Assert("foo; bar;", []string{`foo`, `bar`})
// Multiple statements, multiple lines.
capture.Assert("a1", none)
capture.Assert("a2; b1", []string{"a1\na2\n"})
capture.Assert("b2;", []string{"b1\nb2\n"})
capture.Assert("a2; b1", []string{`a1
a2`})
capture.Assert("b2;", []string{`b1
b2`})
// Blank lines.
capture.Assert("one", none)
capture.Assert("", none)
capture.Assert("three;", []string{"one\nthree\n"})
capture.Assert("three;", []string{`one
three`})
// Just a semi-colon.
capture.Assert(";", []string{""})
capture.Assert(";", none)
// Multi-line with just a semi-colon.
capture.Assert("one", none)
capture.Assert(";", []string{"one\n"})
capture.Assert(";", []string{`one`})
// Ensure a clean exit with no errors.
assert.NoError(t, capture.Exit())
@ -74,7 +80,7 @@ var _ cli.Queryer = (*capture)(nil)
// capture implements the various CLI interfaces in order to capture test input
// and submit it as though that input were being read from the command line. It
// also captures calls made to the Queryer.Query method and ensures the sql they
// also captures calls made to the Queryer.Query method and ensures the sql the
// contain is expected.
type capture struct {
t *testing.T
@ -105,7 +111,7 @@ func newCapture(t *testing.T) *capture {
}
func (c *capture) Exit() error {
c.sendLine(`\q`)
c.sendLine("exit")
c.mu.RLock()
defer c.mu.RUnlock()
return c.err
@ -177,15 +183,9 @@ func (c *capture) Write(b []byte) (n int, err error) {
// Query is called by the CLI command once a full SQL statement is received
// (signified by the terminator: `;`).
func (c *capture) Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error) {
tmpBuf := new(strings.Builder)
_, err := io.Copy(tmpBuf, sql)
if err != nil {
return nil, err
}
func (c *capture) Query(org, db, sql string) (*featurebase.WireQueryResponse, error) {
c.mu.Lock()
c.sqls = append(c.sqls, tmpBuf.String())
c.sqls = append(c.sqls, sql)
c.mu.Unlock()
select {

View file

@ -1,31 +0,0 @@
package cli
// Config represents the configuration for the command.
type Config struct {
Host string `json:"host"`
Port string `json:"port"`
OrganizationID string `json:"org-id"`
Database string `json:"db"`
// CloudAuth
CloudAuth CloudAuthConfig `json:"cloud-auth"`
// Kafka
KafkaConfig string `json:"kafka-config"`
HistoryPath string `json:"history-path"`
// CSV (Comma-Separated Values) table output mode.
CSV bool `json:"csv"`
// PSet takes one or more pset arguments of the form: `--pset=VAR[=ARG]`.
PSets []string `json:"pset"`
}
type CloudAuthConfig struct {
ClientID string `json:"client-id"`
Region string `json:"region"`
Email string `json:"email"`
Password string `json:"password"`
}

View file

@ -1,16 +0,0 @@
package cli
import (
"github.com/featurebasedb/featurebase/v3/errors"
)
const (
ErrOrganizationRequired errors.Code = "OrganizationRequired"
)
func NewErrOrganizationRequired() error {
return errors.New(
ErrOrganizationRequired,
"organization required",
)
}

View file

@ -1,6 +1,7 @@
package fbcloud
import (
"bytes"
"encoding/json"
"fmt"
"io"
@ -8,7 +9,7 @@ import (
"strings"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
featurebase "github.com/molecula/featurebase/v3"
"github.com/pkg/errors"
)
@ -39,26 +40,37 @@ func (cq *Queryer) tokenRefresh() error {
return nil
}
type tokenizedSQL struct {
Language string `json:"language"`
Statement string `json:"statement"`
}
// Query issues a SQL query formatted for the FeatureBase cloud query endpoint.
func (cq *Queryer) Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error) {
func (cq *Queryer) Query(org, db, sql string) (*featurebase.WireQueryResponse, error) {
if time.Since(cq.lastRefresh) > TokenRefreshTimeout {
if err := cq.tokenRefresh(); err != nil {
return nil, errors.Wrap(err, "refreshing token")
}
}
url := fmt.Sprintf("%s/databases/%s/sql", cq.Host, db)
if db == "" {
url = fmt.Sprintf("%s/sql", cq.Host)
url := fmt.Sprintf("%s/v2/databases/%s/query/sql", cq.Host, db)
sqlReq := &tokenizedSQL{
Language: "sql",
Statement: sql,
}
var buf bytes.Buffer
if err := json.NewEncoder(&buf).Encode(sqlReq); err != nil {
return nil, errors.Wrapf(err, "encoding sql request: %s", sql)
}
client := &http.Client{
Timeout: time.Second * 30,
}
req, err := http.NewRequest(http.MethodPost, url, sql)
req, err := http.NewRequest(http.MethodPost, url, &buf)
if err != nil {
return nil, errors.Wrap(err, "creating new post request")
}
req.Header.Add("Content-Type", "text/plain")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", cq.token)
var resp *http.Response
@ -129,3 +141,7 @@ func (cq *Queryer) HTTPRequest(method, path, body string, v interface{}) ([]byte
return bodbytes, nil
}
type cloudResponse struct {
Results featurebase.WireQueryResponse `json:"results"`
}

View file

@ -1,70 +0,0 @@
package cli
import (
"fmt"
"github.com/featurebasedb/featurebase/v3/cli/batch"
"github.com/featurebasedb/featurebase/v3/cli/kafka"
"github.com/featurebasedb/featurebase/v3/errors"
"github.com/spf13/viper"
)
func (cmd *Command) newKafkaRunner(cfgFile string) (*kafka.Runner, error) {
// Read the kafka config file.
v := viper.New()
v.SetConfigFile(cfgFile)
v.SetConfigType("toml")
err := v.ReadInConfig()
if err != nil {
return nil, fmt.Errorf("error reading configuration file '%s': %v", cfgFile, err)
}
cfg := kafka.Config{}
if err := v.Unmarshal(&cfg); err != nil {
return nil, errors.Wrap(err, "unmarshalling config")
}
if err := kafka.ValidateConfig(cfg); err != nil {
return nil, errors.Wrap(err, "validating config")
}
// Create a new config with defaults.
// Look up fields based on table provided in the config.
wqr, err := cmd.executeQuery(newRawQuery("SHOW COLUMNS FROM " + cfg.Table))
if err != nil {
return nil, errors.Wrap(err, "executing query")
}
scr, err := wqr.ShowColumnsResponse()
if err != nil {
return nil, errors.Wrap(err, "getting show columns from wire query response")
}
// If no fields were provided in the config, use the fields defined on the
// table and assume a 1-to-1 mapping of source to destination.
if len(cfg.Fields) == 0 {
cfg.Fields = kafka.FieldsToConfig(scr.Fields)
} else {
cfg.Fields, err = kafka.CheckFieldCompatibility(cfg.Fields, scr)
if err != nil {
return nil, errors.Wrap(err, "validating config fields")
}
}
idkCfg, err := kafka.ConvertConfig(cfg)
if err != nil {
return nil, errors.Wrap(err, "cleaning config")
}
flds, err := kafka.ConfigToFields(cfg)
if err != nil {
return nil, errors.Wrap(err, "getting fields from config")
}
return kafka.NewRunner(
idkCfg,
batch.NewSQLBatcher(cmd, flds),
cmd.stderr,
), nil
}

View file

@ -1,251 +0,0 @@
package kafka
import (
"fmt"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/featurebasedb/featurebase/v3/idk"
"github.com/pkg/errors"
)
// Config is the user-facing configuration for kafka support in the CLI. This is
// unmarshalled from the the toml config file supplied by the user.
type Config struct {
Hosts []string `mapstructure:"hosts" help:"Kafka hosts."`
Group string `mapstructure:"group" help:"Kafka group."`
Topics []string `mapstructure:"topics" help:"Kafka topics to read from."`
BatchSize int `mapstructure:"batch-size" help:"Batch size."`
BatchMaxStaleness time.Duration `mapstructure:"batch-max-staleness" help:"Maximum length of time that the oldest record in a batch can exist before flushing the batch. Note that this can potentially stack with timeouts waiting for the source."`
Timeout time.Duration `mapstructure:"timeout" help:"Time to wait for more records from Kafka before flushing a batch. 0 to disable."`
Table string `mapstructure:"table" help:"Destination table name."`
Fields []Field `mapstructure:"fields"`
}
// Field is a user-facing configuration field.
type Field struct {
Name string `mapstructure:"name"`
SourceType string `mapstructure:"source-type"`
SourcePath []string `mapstructure:"source-path"`
PrimaryKey bool `mapstructure:"primary-key"`
}
// ConfigForIDK represents Config converted to values suitable for IDK. In
// particular, the idk.RawField is used in parsing the schema in IDK.
type ConfigForIDK struct {
Hosts []string
Group string
Topics []string
BatchSize int
BatchMaxStaleness time.Duration
Timeout time.Duration
Table string
IDField string
Fields []idk.RawField
}
// ValidateConfig validates the config is usable.
func ValidateConfig(c Config) error {
if c.Table == "" {
return errors.Errorf("table is required")
} else if len(c.Topics) == 0 {
return errors.Errorf("at least one topic is required")
} else if len(c.Fields) > 0 {
// We only need to do these checks if any fields are specified at all.
// If no fields are specified, that's ok because then we default to
// using fields based off the existing table.
if len(c.Fields) < 2 {
return errors.Errorf("at least two fields are required (one should be a primary key)")
} else {
var found int
for i := range c.Fields {
if c.Fields[i].PrimaryKey {
found++
}
if c.Fields[i].Name == "" {
return errors.Errorf("a name attribute (which isn't equal to \"\") should exist for all fields")
}
}
if found != 1 {
return errors.Errorf("exactly one primary key field is required")
}
}
}
return nil
}
// ConvertConfig converts a Config to one that suitable for IDK.
func ConvertConfig(c Config) (ConfigForIDK, error) {
// Set a default kafka host in case one isn't provided.
hosts := []string{"localhost:9092"}
if len(c.Hosts) > 0 {
hosts = c.Hosts
}
// Copy all the shared members from Config to ConfigForIDK.
out := ConfigForIDK{
Hosts: hosts,
Group: c.Group,
Topics: c.Topics,
BatchSize: c.BatchSize,
BatchMaxStaleness: c.BatchMaxStaleness,
Timeout: c.Timeout,
Table: c.Table,
}
if len(c.Fields) == 0 {
return out, errors.New("fields cannot be empty")
}
// rawFields wil be the same as c.Fields, but possibly enhanced.
rawFields := make([]idk.RawField, 0, len(c.Fields))
var foundPK bool
for _, fld := range c.Fields {
if fld.PrimaryKey {
out.IDField = fld.Name
foundPK = true
}
typ, quals, err := dax.SplitFieldType(fld.SourceType)
if err != nil {
return out, errors.Wrap(err, "getting base type")
}
rawFld := idk.RawField{
Name: fld.Name,
Type: string(typ),
Path: fld.SourcePath,
}
// If a SourcePath wasn't provided, default to using the field name.
if len(rawFld.Path) == 0 {
rawFld.Path = []string{fld.Name}
}
switch typ {
case dax.BaseTypeInt:
// We don't have to handle min/max because we don't create the table.
case dax.BaseTypeDecimal:
if len(quals) != 1 {
return out, errors.Errorf("expected decimal scale")
}
rawFld.Config = []byte(fmt.Sprintf(`{"scale":%d}`, quals[0]))
case dax.BaseTypeID:
rawFld.Config = []byte("{\"mutex\":true}")
case dax.BaseTypeIDSet:
rawFld.Type = "ids"
case dax.BaseTypeString:
rawFld.Config = []byte("{\"mutex\":true}")
case dax.BaseTypeStringSet:
rawFld.Type = "strings"
case dax.BaseTypeTimestamp:
// No timestamp options are handled for now.
}
rawFields = append(rawFields, rawFld)
}
if !foundPK {
return out, errors.New("primary-key not found in fields")
}
out.Fields = rawFields
return out, nil
}
// ConfigToFields returns a list of *dax.Field based on the IDField and Fields
// in the Config.
func ConfigToFields(c Config) ([]*dax.Field, error) {
// We don't know if a primary key will be found, so we can't set the
// capacity to `len(c.Fields)-1`.
out := make([]*dax.Field, 0, len(c.Fields))
for _, fld := range c.Fields {
if fld.PrimaryKey {
continue
}
typ, quals, err := dax.SplitFieldType(fld.SourceType)
if err != nil {
return nil, errors.Wrap(err, "splitting field type")
}
dfld := &dax.Field{
Name: dax.FieldName(fld.Name),
Type: typ,
}
switch typ {
case dax.BaseTypeDecimal:
if len(quals) != 1 {
return nil, errors.Errorf("expected decimal scale")
}
scale, ok := quals[0].(int64)
if !ok {
return nil, errors.Errorf("invalid decimal scale: %v", quals[0])
}
dfld.Options.Scale = scale
}
out = append(out, dfld)
}
return out, nil
}
// FieldsToConfig returns a Config.Fields based on a list of *dax.Field.
func FieldsToConfig(flds []*dax.Field) []Field {
out := make([]Field, 0, len(flds))
for _, fld := range flds {
out = append(out, Field{
Name: string(fld.Name),
SourceType: fld.FullType(),
PrimaryKey: fld.IsPrimaryKey(),
})
}
return out
}
// CheckFieldCompatibility ensures that the fields provided in the kafka config
// are compatible with the fields in the existing table. It returns a copy of
// the kafka config fields with empty values defaulted to the table field
// configuration.
func CheckFieldCompatibility(cflds []Field, scr *featurebase.ShowColumnsResponse) ([]Field, error) {
out := make([]Field, len(cflds))
for i, cfld := range cflds {
out[i] = cfld
cfldName := dax.FieldName(cfld.Name)
// Primary key field.
if cfld.PrimaryKey {
f := scr.Field(dax.PrimaryKeyFieldName)
if f == nil {
return nil, dax.NewErrFieldDoesNotExist(dax.PrimaryKeyFieldName) // It should be impossible to hit this.
}
if out[i].SourceType == "" {
if f.StringKeys() {
out[i].SourceType = dax.BaseTypeString
} else {
out[i].SourceType = dax.BaseTypeID
}
}
continue
}
// Non primary key fields.
if cfldName == dax.PrimaryKeyFieldName {
return nil, errors.Errorf("field named '%s' must be a primary key", dax.PrimaryKeyFieldName)
}
f := scr.Field(cfldName)
if f == nil {
return nil, dax.NewErrFieldDoesNotExist(cfldName)
}
if out[i].SourceType == "" {
out[i].SourceType = f.FullType()
}
}
return out, nil
}

View file

@ -1,67 +0,0 @@
package kafka
import (
"io"
"time"
fbbatch "github.com/featurebasedb/featurebase/v3/batch"
"github.com/featurebasedb/featurebase/v3/errors"
"github.com/featurebasedb/featurebase/v3/idk"
"github.com/featurebasedb/featurebase/v3/idk/kafka_static"
"github.com/featurebasedb/featurebase/v3/logger"
)
// Runner is a CLI-specific kafka consumer. It's similar to
// idk.kafka_static.Main in that it embeds idk.Main and contains additional
// functionality specific to its use case.
type Runner struct {
idk.Main `flag:"!embed"`
KafkaHosts []string `help:"Comma separated list of host:port pairs for Kafka."`
Group string `help:"Kafka group."`
Topics []string `help:"Kafka topics to read from."`
Timeout time.Duration `help:"Time to wait for more records from Kafka before flushing a batch. 0 to disable."`
Header []idk.RawField `help:"Header configuration."`
}
func NewRunner(cfg ConfigForIDK, batcher fbbatch.Batcher, logWriter io.Writer) *Runner {
idkMain := idk.NewMain()
idkMain.IDField = cfg.IDField
idkMain.Index = cfg.Table
idkMain.Batcher = batcher
idkMain.BatchSize = cfg.BatchSize
idkMain.BatchMaxStaleness = cfg.BatchMaxStaleness
idkMain.SetBasic()
idkMain.SetLog(logger.NewStandardLogger(logWriter))
kr := &Runner{
Main: *idkMain,
KafkaHosts: cfg.Hosts,
Group: cfg.Group,
Topics: cfg.Topics,
Header: cfg.Fields,
Timeout: cfg.Timeout,
}
kr.OffsetMode = true
kr.Main.Namespace = "cli_kafka_runner"
kr.Main.Pprof = "" // don't initialize pprof until we actually use it in tests
kr.NewSource = func() (idk.Source, error) {
source := kafka_static.NewSource()
source.Hosts = kr.KafkaHosts
source.Group = kr.Group
source.Topics = kr.Topics
source.Log = kr.Main.Log()
// source.TLS = m.KafkaTLS
source.Timeout = kr.Timeout
// source.SkipOld = m.SkipOld
source.HeaderFields = kr.Header
// source.S3Region = m.S3Region
// source.AllowMissingFields = m.AllowMissingFields
err := source.Open()
if err != nil {
return nil, errors.Wrap(err, "opening source")
}
return source, nil
}
return kr
}

File diff suppressed because it is too large Load diff

View file

@ -1,136 +0,0 @@
package cli
import (
"fmt"
"io"
"os"
"strings"
)
// query is a collection of queryParts which, when applied together, make up an
// executable SQL query.
type query []queryPart
func (q query) String() string {
var sb strings.Builder
for i := range q {
sb.WriteString(q[i].String())
if i < len(q)-1 {
sb.WriteRune('\n')
}
}
return sb.String()
}
// Reader returns the query as an io.Reader so that it can be passed to, for
// example, http.Post().
func (q query) Reader() io.Reader {
readers := make([]io.Reader, 0, len(q))
for i := range q {
readers = append(readers, q[i].Reader())
}
return io.MultiReader(readers...)
}
// queryPart is an interface representing anything which can use to build up a
// query.
type queryPart interface {
fmt.Stringer
Reader() io.Reader
}
func newRawQuery(s string) query {
return []queryPart{
newPartRaw(s),
}
}
// ////////////////////////////////////////////////////////////////////////////
// raw
// ////////////////////////////////////////////////////////////////////////////
// Ensure type implements interface.
var _ queryPart = (*partRaw)(nil)
type partRaw struct {
raw string
}
func newPartRaw(s string) *partRaw {
return &partRaw{
raw: s,
}
}
func (p *partRaw) Reader() io.Reader {
return strings.NewReader(p.raw + "\n")
}
func (p *partRaw) String() string {
return p.raw
}
// ////////////////////////////////////////////////////////////////////////////
// file
// ////////////////////////////////////////////////////////////////////////////
// Ensure type implements interface.
var _ queryPart = (*partFile)(nil)
type partFile struct {
file *os.File
}
func newPartFile(f *os.File) *partFile {
return &partFile{
file: f,
}
}
func (p *partFile) Reader() io.Reader {
return p.file
}
func (p *partFile) String() string {
return fmt.Sprintf("[file: %s]", p.file.Name())
}
// ////////////////////////////////////////////////////////////////////////////
// batch file
// ////////////////////////////////////////////////////////////////////////////
// Ensure type implements interface.
var _ queryPart = (*partBatchFile)(nil)
type partBatchFile struct {
file *os.File
}
func (p *partBatchFile) Reader() io.Reader {
return p.file
}
func (p *partBatchFile) String() string {
return p.file.Name()
}
// ////////////////////////////////////////////////////////////////////////////
// terminator (i.e. ";")
// ////////////////////////////////////////////////////////////////////////////
// Ensure type implements interface.
var _ queryPart = (*partTerminator)(nil)
type partTerminator struct{}
func newPartTerminator() *partTerminator {
return &partTerminator{}
}
func (p *partTerminator) Reader() io.Reader {
return nil
}
func (p *partTerminator) String() string {
return terminationChar
}

View file

@ -1,26 +1,20 @@
package cli
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
featurebase "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/dax"
queryerhttp "github.com/molecula/featurebase/v3/dax/queryer/http"
"github.com/pkg/errors"
)
type Queryer interface {
Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error)
}
// Ensure type implements interface.
var _ Queryer = (*nopQueryer)(nil)
type nopQueryer struct{}
func (qryr *nopQueryer) Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error) {
return nil, errors.Errorf("no-op queryer")
Query(org, db, sql string) (*featurebase.WireQueryResponse, error)
}
// Ensure type implements interface.
@ -33,10 +27,13 @@ type standardQueryer struct {
Port string
}
func (qryr *standardQueryer) Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error) {
func (qryr *standardQueryer) Query(org, db, sql string) (*featurebase.WireQueryResponse, error) {
buf := bytes.Buffer{}
url := fmt.Sprintf("%s/sql", hostPort(qryr.Host, qryr.Port))
resp, err := http.Post(url, "application/json", sql)
buf.Write([]byte(sql))
resp, err := http.Post(url, "application/json", &buf)
if err != nil {
return nil, errors.Wrapf(err, "posting query")
}
@ -45,10 +42,8 @@ func (qryr *standardQueryer) Query(org string, db string, sql io.Reader) (*featu
if err != nil {
return nil, errors.Wrap(err, "reading response")
}
sqlResponse := &featurebase.WireQueryResponse{}
// TODO(tlt): switch this back once all responses are typed
// TODO(twg) 2023/03/01 using json.Number to decode large ints so care must be made
// if err := json.Unmarshal(fullbod, sqlResponse); err != nil {
if err := sqlResponse.UnmarshalJSONTyped(fullbod, true); err != nil {
return nil, errors.Wrapf(err, "unmarshaling query response, body:\n'%s'\n", fullbod)
@ -58,39 +53,32 @@ func (qryr *standardQueryer) Query(org string, db string, sql io.Reader) (*featu
}
// Ensure type implements interface.
var _ Queryer = (*serverlessQueryer)(nil)
var _ Queryer = (*daxQueryer)(nil)
// serverlessQueryer is similar to the standardQueryer except that it hits a
// different endpoint, and its payload is database-aware.
type serverlessQueryer struct {
// daxQueryer is similar to the standardQueryer except that it hits a different
// endpoint, and its payload is a json object which includes, in addition to the
// sql statement, things like org and db.
type daxQueryer struct {
Host string
Port string
}
func (qryr *serverlessQueryer) Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error) {
if org == "" {
return nil, NewErrOrganizationRequired()
func (qryr *daxQueryer) Query(org, db, sql string) (*featurebase.WireQueryResponse, error) {
buf := bytes.Buffer{}
url := fmt.Sprintf("%s/queryer/sql", hostPort(qryr.Host, qryr.Port))
sqlReq := &queryerhttp.SQLRequest{
OrganizationID: dax.OrganizationID(org),
DatabaseID: dax.DatabaseID(db),
SQL: sql,
}
if err := json.NewEncoder(&buf).Encode(sqlReq); err != nil {
return nil, errors.Wrapf(err, "encoding sql request: %s", sql)
}
url := fmt.Sprintf("%s/queryer/databases/%s/sql", hostPort(qryr.Host, qryr.Port), db)
if db == "" {
url = fmt.Sprintf("%s/queryer/sql", hostPort(qryr.Host, qryr.Port))
}
client := &http.Client{
Timeout: time.Second * 30,
}
req, err := http.NewRequest(http.MethodPost, url, sql)
resp, err := http.Post(url, "application/json", &buf)
if err != nil {
return nil, errors.Wrap(err, "creating new post request")
}
req.Header.Add("Content-Type", "text/plain")
req.Header.Add("OrganizationID", org)
var resp *http.Response
if resp, err = client.Do(req); err != nil {
return nil, errors.Wrap(err, "executing post request")
return nil, errors.Wrapf(err, "posting query")
}
fullbod, err := io.ReadAll(resp.Body)

View file

@ -1,109 +0,0 @@
package cli
import (
"strings"
"github.com/benhoyt/goawk/lexer"
)
// replacer can replace parts of a string based on some rules and the provided
// map[string]string. For example, the Command can replace strings with values
// in its `variables` map.
type replacer struct {
m map[string]string
}
func newReplacer(m map[string]string) *replacer {
return &replacer{
m: m,
}
}
// replace replaces all instances of the string pattern `:key` with the value at
// m[key]. For example we want something like this:
//
// GIVEN: `start :one,:'two', :"three" ::four ::`
//
// with map
//
// map[string]string{
// "one": "repl1",
// "three": "repl3",
// }
//
// WANT: `start repl1,:'two', "repl3" ::four ::`
func (r *replacer) replace(s string) string {
// If no variables have been added to the map, there's no need to parse the
// string for variable replacement.
if len(r.m) == 0 {
return s
}
line := []byte(s)
lex := lexer.NewLexer(line)
// finger contains the index into line at the start of non-variable text
// that we want to include, as-is in the output.
var finger int
// sb builds the string which will be the final output.
var sb strings.Builder
for {
pos, tok, _ := lex.Scan()
switch tok {
case lexer.COLON:
// last is the last normal character position before the colon.
last := pos.Column - 1
// Get the next byte to see if the colon value is quoted, and if so,
// whether its has single or double quotes.
b := lex.PeekByte()
// padding is the amount of padding we have to consider around the
// variable name. If the variable is not quoted, it doesn't require
// any padding. But if it has quotes, it needs 2 characters of
// paddings to accomodate the quotes.
padding := 0
// quote holds the character to use to quote the final, replaced
// output value. Because the lexer doesn't tell us how a certain
// `string` token was quoted, we need to keep track of that here so
// we can put them back.
quote := ""
switch b {
case byte('\''): // single quote
quote = `'`
padding = 2
case byte('"'): // double quote
quote = `"`
padding = 2
}
pos, tok, key := lex.Scan()
switch tok {
case lexer.NAME, lexer.STRING:
// Write the normal text up to the variable replacement
// position.
sb.Write(line[finger:last])
if v, ok := r.m[key]; ok {
// Write replaced variable with the quotes it had.
sb.WriteString(quote + v + quote)
} else {
// Since the variable was not found in the map, just write
// back what was already there.
sb.WriteString(":" + quote + key + quote)
}
// Reset finger to point to the next position after the
// variable.
finger = pos.Column + len(key) + padding - 1
}
case lexer.EOF:
// Write the remainder of the string and return.
sb.Write(line[finger:])
return sb.String()
}
}
}

View file

@ -1,109 +0,0 @@
package cli
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReplacer(t *testing.T) {
t.Run("general replace function", func(t *testing.T) {
m := map[string]string{
"v1": "newVone",
"v2": "newVtwo",
}
tests := []struct {
s string
m map[string]string
exp string
}{
{
// no variables present
s: "foo",
m: m,
exp: "foo",
},
{
// variable prefix, but not in map
s: ":foo",
m: m,
exp: ":foo",
},
{
// variable name match, but missing prefix
s: "v1",
m: m,
exp: "v1",
},
{
// variable name match
s: ":v1",
m: m,
exp: "newVone",
},
{
// two variables, the same, no space
s: ":v1:v1",
m: m,
exp: "newVonenewVone",
},
{
// two variables, different, no space
s: ":v1:v2",
m: m,
exp: "newVonenewVtwo",
},
{
// two variables, different, spaces
s: ":v1 :v2",
m: m,
exp: "newVone newVtwo",
},
{
// one variable, one non-variable, no space
s: ":v1:foo",
m: m,
exp: "newVone:foo",
},
{
// one non-variable, one variable, no space
s: "foo:v1",
m: m,
exp: "foonewVone",
},
{
// two variables, different, comma
s: ":v1, :v2",
m: m,
exp: "newVone, newVtwo",
},
{
// single quotes
s: ":'v1'",
m: m,
exp: "'newVone'",
},
{
// double quotes
s: `:"v2"`,
m: m,
exp: `"newVtwo"`,
},
{
// more quotes
s: `start :v1,:'two', :"v2" ::four :: `,
m: m,
exp: `start newVone,:'two', "newVtwo" ::four :: `,
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
replacer := newReplacer(test.m)
assert.Equal(t, test.exp, replacer.replace(test.s))
})
}
})
}

View file

@ -1,133 +0,0 @@
package cli
import (
"strings"
"github.com/pkg/errors"
)
// splitter is a line splitter which splits a line into queryParts and
// metaCommands. It may not be necessary to have this be a separate struct since
// it contains no members and just has the one `split()` method, but here we
// are.
type splitter struct {
replacer *replacer
}
func newSplitter(r *replacer) *splitter {
return &splitter{
replacer: r,
}
}
// split splits the given line into queryParts and metaCommands.
// If a metaCommand is found, everything after that is considered either arguments to that
// metaCommand, or additional metaCommands. In other words, queryParts can not follow
// metaCommands in the same line.
//
// A line can contain any of the following patterns:
// 1- [queryParts...]: "select * from tbl; select"
// 2- [metaCommands...]: "\! pwd \q"
// 3- [queryParts...][metaCommands...]: "select * from \i file.sql"
func (s *splitter) split(line string) ([]queryPart, []metaCommand, error) {
// Look for a comment line.
if strings.HasPrefix(line, "--") {
return nil, nil, nil
}
// Look for a meta command.
parts := strings.SplitN(line, `\`, 2)
switch len(parts) {
case 1:
// slice of queryParts (pattern 1)
if qps, err := s.splitQueryParts(strings.TrimSpace(parts[0])); err != nil {
return nil, nil, errors.Wrap(err, "splitting query parts")
} else {
return qps, nil, nil
}
case 2:
// slice of parts + slice of meta commands (pattern 3)
// or
// slice of meta commands (pattern 2)
qps, err := s.splitQueryParts(strings.TrimSpace(parts[0]))
if err != nil {
return nil, nil, errors.Wrap(err, "splitting query parts")
}
mcs, err := s.splitMetaCommands(strings.TrimSpace(parts[1]))
if err != nil {
return nil, nil, errors.Wrap(err, "splitting meta commands")
}
return qps, mcs, nil
}
return nil, nil, nil
}
func (s *splitter) splitQueryParts(line string) ([]queryPart, error) {
if line == "" {
return nil, nil
}
// Look for a termination character;
parts := strings.Split(line, terminationChar)
// Do variable replacement.
for i := range parts {
parts[i] = s.replacer.replace(parts[i])
}
if len(parts) == 1 {
part0 := strings.TrimSpace(parts[0])
return []queryPart{
newPartRaw(part0),
}, nil
}
qps := make([]queryPart, 0)
for i := range parts {
part := strings.TrimSpace(parts[i])
if part == "" {
// If the line starts with a ";", treat it as a terminator for a
// previous line.
if i == 0 {
qps = append(qps, &partTerminator{})
}
continue
}
qps = append(qps, newPartRaw(part))
if i < len(parts)-1 {
qps = append(qps, &partTerminator{})
}
}
return qps, nil
}
func (s *splitter) splitMetaCommands(in string) ([]metaCommand, error) {
parts := strings.Split(in, `\`)
if len(parts) == 1 {
mc, err := splitMetaCommand(parts[0], s.replacer)
if err != nil {
return nil, errors.Wrapf(err, "splitting meta command: %s", parts[0])
}
return []metaCommand{mc}, nil
}
mcs := make([]metaCommand, 0)
for i := range parts {
part := strings.TrimSpace(parts[i])
if part == "" {
continue
}
mc, err := splitMetaCommand(part, s.replacer)
if err != nil {
return nil, errors.Wrapf(err, "splitting meta command: %s", part)
}
mcs = append(mcs, mc)
}
return mcs, nil
}

View file

@ -1,146 +0,0 @@
package cli
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSplitter(t *testing.T) {
s := newSplitter(newReplacer(nil))
t.Run("Split", func(t *testing.T) {
tests := []struct {
line string
expQueryParts []queryPart
expMetaCommands []metaCommand
expError string
}{
{
line: `foo`,
expQueryParts: []queryPart{
newPartRaw("foo"),
},
},
{
line: `foo;`,
expQueryParts: []queryPart{
newPartRaw("foo"),
newPartTerminator(),
},
},
{
line: `foo; `,
expQueryParts: []queryPart{
newPartRaw("foo"),
newPartTerminator(),
},
},
{
line: `foo; ; `,
expQueryParts: []queryPart{
newPartRaw("foo"),
newPartTerminator(),
},
},
{
line: `foo; bar`,
expQueryParts: []queryPart{
newPartRaw("foo"),
newPartTerminator(),
newPartRaw("bar"),
},
},
{
line: `foo; bar;`,
expQueryParts: []queryPart{
newPartRaw("foo"),
newPartTerminator(),
newPartRaw("bar"),
newPartTerminator(),
},
},
{
line: `\q`,
expMetaCommands: []metaCommand{
&metaQuit{},
},
},
{
line: ` \p`,
expMetaCommands: []metaCommand{
&metaPrint{},
},
},
{
line: `\q \p`,
expMetaCommands: []metaCommand{
&metaQuit{},
&metaPrint{},
},
},
{
line: `\q \p arg1 arg2`,
expMetaCommands: []metaCommand{
&metaQuit{},
&metaPrint{},
},
},
{
line: `\set`,
expMetaCommands: []metaCommand{
&metaSet{
args: []string{},
},
},
},
{
line: `\set arg1 arg2`,
expMetaCommands: []metaCommand{
&metaSet{
args: []string{"arg1", "arg2"},
},
},
},
{
line: `\set 'arg1' 'arg2'`,
expMetaCommands: []metaCommand{
&metaSet{
args: []string{"arg1", "arg2"},
},
},
},
{
line: `\set 'arg1' '"arg2"'`,
expMetaCommands: []metaCommand{
&metaSet{
args: []string{"arg1", "\"arg2\""},
},
},
},
{
line: `\`,
expError: "unsupported meta-command:",
},
{
line: `\xyzxyz`,
expError: "unsupported meta-command:",
},
}
for i, tt := range tests {
t.Run(fmt.Sprintf("test-%d-%s", i, tt.line), func(t *testing.T) {
qps, mcs, err := s.split(tt.line)
if tt.expError != "" {
if assert.Error(t, err) {
assert.Contains(t, err.Error(), tt.expError)
}
return
}
assert.NoError(t, err)
assert.ElementsMatch(t, tt.expQueryParts, qps)
assert.ElementsMatch(t, tt.expMetaCommands, mcs)
})
}
})
}

53
cli/testdata/database vendored
View file

@ -1,53 +0,0 @@
// Show databases now that we have set org.
SEND:SHOW DATABASES;
EXPECT:+-----+------+-------+------------+------------+------------+-------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | units | description |
EXPECT:+-----+------+-------+------------+------------+------------+-------+-------------+
EXPECT:+-----+------+-------+------------+------------+------------+-------+-------------+
EXPECT:
// Create db1.
SEND:CREATE DATABASE db1 WITH UNITS 1;
EXPECT:
// List databases via SHOW DATABASES.
SEND:SHOW DATABASES;
EXPECT:+--------------------------------------+------+-------+------------+----------------------+----------------------+-------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | units | description |
EXPECT:+--------------------------------------+------+-------+------------+----------------------+----------------------+-------+-------------+
EXPECTCOMP:WithFormat:| {uuid} | db1 | | | {timestamp} | {timestamp} | 1 | |
EXPECT:+--------------------------------------+------+-------+------------+----------------------+----------------------+-------+-------------+
EXPECT:
// List databases via SHOW DATABASES.
SEND:\l
EXPECT:+--------------------------------------+------+-------+------------+----------------------+----------------------+-------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | units | description |
EXPECT:+--------------------------------------+------+-------+------------+----------------------+----------------------+-------+-------------+
EXPECTCOMP:WithFormat:| {uuid} | db1 | | | {timestamp} | {timestamp} | 1 | |
EXPECT:+--------------------------------------+------+-------+------------+----------------------+----------------------+-------+-------------+
EXPECT:
// Check database connection.
SEND:\c
EXPECT:You are not connected to a database.
// Try connecting to an invalid database.
SEND:\c invalid
EXPECT:executing meta command: invalid database: invalid
// Try connecting with too many arguments.
SEND:\c db1 extra
EXPECT:executing meta command: meta command 'connect' takes zero or one argument
// Connect to a database.
SEND:\c db1
EXPECTCOMP:WithFormat:You are now connected to database "db1" ({uuid}).
// Disconnect from the current database.
SEND:\c -
EXPECT:You are not connected to a database.
// Connect to a database again.
SEND:\c db1
EXPECTCOMP:WithFormat:You are now connected to database "db1" ({uuid}).

View file

@ -1,10 +0,0 @@
"Id", "Name", "Short description", "Gender", "Country", "Occupation", "Birth year", "Death year", "Manner of death", "Age of death"
1, "George Washington", "1st president of the United States (17321799)", "Male", "United States of America; Kingdom of Great Britain", "Politician", "1732", "1799", "natural causes", "67"
2, "Douglas Adams", "English writer and humorist", "Male", "United Kingdom", "Artist", "1952", "2001", "natural causes", "49"
3, "Abraham Lincoln", "16th president of the United States (1809-1865)", "Male", "United States of America", "Politician", "1809", "1865", "homicide", "56"
4, "Wolfgang Amadeus Mozart", "Austrian composer of the Classical period", "Male", "Archduchy of Austria; Archbishopric of Salzburg", "Artist", "1756", "1791", "0", "35"
5, "Ludwig van Beethoven", "German classical and romantic composer", "Male", "Holy Roman Empire; Austrian Empire", "Artist", "1770", "1827", "0", "57"
6, "Jean-François Champollion", "French classical scholar", "Male", "Kingdom of France; First French Empire", "Egyptologist", "1790", "1832", "natural causes", "42"
7, "Paul Morand", "French writer", "Male", "France", "Artist", "1888", "1976", "0", "88"
8, "Claude Monet", "French impressionist painter (1840-1926)", "Male", "France", "Artist", "1840", "1926", "natural causes", "86"
1 Id Name Short description Gender Country Occupation Birth year Death year Manner of death Age of death
2 1 George Washington 1st president of the United States (1732–1799) Male United States of America; Kingdom of Great Britain Politician 1732 1799 natural causes 67
3 2 Douglas Adams English writer and humorist Male United Kingdom Artist 1952 2001 natural causes 49
4 3 Abraham Lincoln 16th president of the United States (1809-1865) Male United States of America Politician 1809 1865 homicide 56
5 4 Wolfgang Amadeus Mozart Austrian composer of the Classical period Male Archduchy of Austria; Archbishopric of Salzburg Artist 1756 1791 0 35
6 5 Ludwig van Beethoven German classical and romantic composer Male Holy Roman Empire; Austrian Empire Artist 1770 1827 0 57
7 6 Jean-François Champollion French classical scholar Male Kingdom of France; First French Empire Egyptologist 1790 1832 natural causes 42
8 7 Paul Morand French writer Male France Artist 1888 1976 0 88
9 8 Claude Monet French impressionist painter (1840-1926) Male France Artist 1840 1926 natural causes 86

View file

@ -1,8 +0,0 @@
SEND:\! echo 'foo'
EXPECT:foo
SEND:\! echo "foo"
EXPECT:"foo"
SEND:\!
EXPECT:executing meta command: meta command '!' requires at least one argument

17
cli/testdata/meta_cd vendored
View file

@ -1,17 +0,0 @@
// Make a directory so we can test \cd'ing into it.
SEND:\! mkdir cli-test-dir
SEND:\cd cli-test-dir
SEND:\cd ..
SEND:\! rmdir cli-test-dir
// TODO(tlt): before we do this, we should implement the ability to execute
// commands in a \set like:
// \set homedir `pwd`
// then we can store what directory we're in so we can move back to it
// at the end of the test
// Switch to home directory.
// SEND:\cd
// Expect error on extra argument to \cd.
SEND:\cd dir extra
EXPECT:executing meta command: meta command 'cd' takes zero or one argument

View file

@ -1,33 +0,0 @@
// TODO(tlt): we can't run this test until we get the system tables under control (i.e. sorted). Currently, fb_views is in a map with users, so the following can fail 50% of the time.
// Show tables for database by calling describe with no args.
// SEND:\d
// EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+------------------------+
// EXPECT:| _id | name | owner | updated_by | created_at | updated_at | keys | space_used | description |
// EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+------------------------+
// EXPECTCOMP:WithFormat:| fb_veiws | fb_views | | | {timestamp} | {timestamp} | true | 0 | system table for views |
// EXPECTCOMP:WithFormat:| users | users | | | {timestamp} | {timestamp} | false | 0 | |
// EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
// EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
// EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
// EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
// EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
// EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+------------------------+
// EXPECT:
// Show columns for table.
SEND:\d users
EXPECT:+------+------+--------+----------------------+-------+------------+------------+-------+----------------------+---------------------+----------+-------+-------------+-----+
EXPECT:| _id | name | type | created_at | keys | cache_type | cache_size | scale | min | max | timeunit | epoch | timequantum | ttl |
EXPECT:+------+------+--------+----------------------+-------+------------+------------+-------+----------------------+---------------------+----------+-------+-------------+-----+
EXPECTCOMP:WithFormat:| _id | _id | id | {timestamp} | false | | 0 | 0 | 0 | 0 | | 0 | | 0s |
EXPECTCOMP:WithFormat:| name | name | string | {timestamp} | true | ranked | 50000 | 0 | 0 | 0 | | 0 | | 0s |
EXPECTCOMP:WithFormat:| age | age | int | {timestamp} | false | | 0 | 0 | -9223372036854775808 | 9223372036854775807 | | 0 | | 0s |
EXPECT:+------+------+--------+----------------------+-------+------------+------------+-------+----------------------+---------------------+----------+-------+-------------+-----+
EXPECT:
// Show columns for an invalid table.
SEND:\d invalid
EXPECT:Error: compiling plan: [1:19] table 'invalid' not found
SEND:\d users extra
EXPECT:executing meta command: meta command 'describe' takes zero or one argument

View file

@ -1,6 +0,0 @@
SEND:\echo
EXPECT:
// Simple \echo.
SEND:\echo foo bar
EXPECT:foo bar

View file

@ -1,70 +0,0 @@
// Create a table.
SEND:CREATE TABLE famous (
SEND: _id ID,
SEND: name STRING,
SEND: description STRING,
SEND: gender STRING,
SEND: country STRING,
SEND: occupation STRING,
SEND: birth_year INT min -32767 max 32767,
SEND: death_year INT min -32767 max 32767,
SEND: death_manner STRING,
SEND: birth_age INT min -32767 max 32767
SEND:);
EXPECT:
// Open bulk insert.
SEND:BULK INSERT
SEND:INTO famous (_id, name, description, gender, country, occupation,
SEND: birth_year, death_year, death_manner, birth_age )
SEND:MAP(0 INT,
SEND:1 STRING,
SEND:2 STRING,
SEND:3 STRING,
SEND:4 STRING,
SEND:5 STRING,
SEND:6 INT,
SEND:7 INT,
SEND:8 STRING,
SEND:9 INT )
SEND:FROM
SEND: x'
// Call \file
SEND:\file testdata/famous.csv
// Close bulk insert.
SEND:'
SEND:WITH
SEND: BATCHSIZE 100000
SEND: FORMAT 'CSV'
SEND: INPUT 'STREAM'
SEND: HEADER_ROW;
EXPECT:
// Query table to ensure we have data.
SEND:SELECT * FROM famous;
EXPECT:+-----+---------------------------+-------------------------------------------------+--------+----------------------------------------------------+--------------+------------+------------+----------------+-----------+
EXPECT:| _id | name | description | gender | country | occupation | birth_year | death_year | death_manner | birth_age |
EXPECT:+-----+---------------------------+-------------------------------------------------+--------+----------------------------------------------------+--------------+------------+------------+----------------+-----------+
EXPECT:| 1 | George Washington | 1st president of the United States (17321799) | Male | United States of America; Kingdom of Great Britain | Politician | 1732 | 1799 | natural causes | 67 |
EXPECT:| 2 | Douglas Adams | English writer and humorist | Male | United Kingdom | Artist | 1952 | 2001 | natural causes | 49 |
EXPECT:| 3 | Abraham Lincoln | 16th president of the United States (1809-1865) | Male | United States of America | Politician | 1809 | 1865 | homicide | 56 |
EXPECT:| 4 | Wolfgang Amadeus Mozart | Austrian composer of the Classical period | Male | Archduchy of Austria; Archbishopric of Salzburg | Artist | 1756 | 1791 | 0 | 35 |
EXPECT:| 5 | Ludwig van Beethoven | German classical and romantic composer | Male | Holy Roman Empire; Austrian Empire | Artist | 1770 | 1827 | 0 | 57 |
EXPECT:| 6 | Jean-François Champollion | French classical scholar | Male | Kingdom of France; First French Empire | Egyptologist | 1790 | 1832 | natural causes | 42 |
EXPECT:| 7 | Paul Morand | French writer | Male | France | Artist | 1888 | 1976 | 0 | 88 |
EXPECT:| 8 | Claude Monet | French impressionist painter (1840-1926) | Male | France | Artist | 1840 | 1926 | natural causes | 86 |
EXPECT:+-----+---------------------------+-------------------------------------------------+--------+----------------------------------------------------+--------------+------------+------------+----------------+-----------+
EXPECT:
// TODO(tlt): dropping the table seems to cause problems.
// Drop the table.
//SEND:DROP TABLE famous;
// Ensure that invalid aruments (none or too many) return an error.
SEND:\file
EXPECT:executing meta command: meta command 'file' requires exactly one argument
SEND:\file filename extra
EXPECT:executing meta command: meta command 'file' requires exactly one argument

View file

@ -1,24 +0,0 @@
// Include with no argument should error.
SEND:\i
EXPECT:executing meta command: meta command 'include' requires exactly one argument
// Include with too many arguments should error.
SEND:\include testdata/people.sql extra
EXPECT:executing meta command: meta command 'include' requires exactly one argument
// Invalid file should error.
SEND:\include invalid.file
EXPECT:executing meta command: opening file: invalid.file: open invalid.file: no such file or directory
SEND:\include testdata/people.sql
EXPECT:
EXPECT:
EXPECT:+-----+------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+------+-----+
EXPECT:| 1 | Amy | 42 |
EXPECT:| 2 | Bob | 27 |
EXPECT:| 3 | Carl | 33 |
EXPECT:+-----+------+-----+
EXPECT:
EXPECT:mix in a meta command

View file

@ -1,67 +0,0 @@
SEND:SELECT * FROM users;
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:
// Redirect output to a file.
SEND:\o test-output-file
SEND:SELECT * FROM users;
// Ensure the output went to the file.
SEND:\! cat test-output-file
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:
// Let's test some qecho stuff here while we're at it.
SEND:\qecho string with "double quotes"
SEND:\qecho -n one
SEND:\qecho -n two
SEND:\qecho three
SEND:\qecho four
SEND:\! cat test-output-file
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:
EXPECT:string with "double quotes"
EXPECT:onetwothree
EXPECT:four
// And \warn messages should still go to stderr, not the file.
SEND:\warn a warning string
EXPECT:a warning string
// Remove the file.
SEND:\! rm test-output-file
// Set the output back to stdout.
SEND:\o
SEND:SELECT * FROM users;
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:
// Ensure extra arguments to \output causes an error.
SEND:\o filename extra
EXPECT:executing meta command: meta command 'output' takes zero or one argument

View file

@ -1,52 +0,0 @@
SEND:\pset border 2
EXPECT:Border style is 2.
SEND:SELECT 1 as foo, 'baz' as bar;
EXPECT:+-----+-----+
EXPECT:| foo | bar |
EXPECT:+-----+-----+
EXPECT:| 1 | baz |
EXPECT:+-----+-----+
EXPECT:
SEND:\pset border
EXPECT:Border style is 2.
SEND:\pset border 999
EXPECT:Border style is 0.
SEND:\pset border 1
EXPECT:Border style is 1.
SEND:SELECT 1 as foo, 'baz' as bar;
EXPECT: foo | bar
EXPECT:-----+-----
EXPECT: 1 | baz
EXPECT:
SEND:\pset border 2
EXPECT:Border style is 2.
SEND:SELECT 1 as foo, 'baz' as bar;
EXPECT:+-----+-----+
EXPECT:| foo | bar |
EXPECT:+-----+-----+
EXPECT:| 1 | baz |
EXPECT:+-----+-----+
EXPECT:
SEND:\pset border 0
EXPECT:Border style is 0.
SEND:SELECT 1 as foo, 'baz' as bar;
EXPECT:foo bar
EXPECT:--- ---
EXPECT: 1 baz
EXPECT:
SEND:\pset border 1 extra
EXPECT:executing meta command: meta command 'pset' takes zero, one, or two arguments
// Set border back to the testing default.
SEND:\pset border 2
EXPECT:Border style is 2.

View file

@ -1,35 +0,0 @@
// Set to off.
SEND:\pset expanded off
EXPECT:Expanded display is off.
// Set to on.
SEND:\pset expanded on
EXPECT:Expanded display is on.
// Toggle to off.
SEND:\pset expanded
EXPECT:Expanded display is off.
// Toggle to on.
SEND:\pset expanded
EXPECT:Expanded display is on.
// Set to something invalid.
SEND:\pset expanded invalid
EXPECT:executing meta command: unrecognized value "invalid" for "expanded": Boolean expected
// Ensure expanded shows results vertically.
SEND:SELECT 1 as foo, 'baz' as bar;
EXPECT:+-----+-----+
EXPECT:| foo | 1 |
EXPECT:| bar | baz |
EXPECT:+-----+-----+
EXPECT:
// Set back to off as we started.
SEND:\pset expanded off
EXPECT:Expanded display is off.
// make sure the \x meta-command returns expected errors
SEND:\x on extra
EXPECT:executing meta command: meta command 'expanded' takes zero or one argument

View file

@ -1,47 +0,0 @@
SEND:\pset format csv
EXPECT:Output format is csv.
SEND:SELECT * FROM users;
EXPECT:_id,name,age
EXPECT:1,Anne,38
EXPECT:2,Bill,23
EXPECT:3,Cindy,64
// Exclude headers.
SEND:\t on
EXPECT:Tuples only is on.
SEND:SELECT * FROM users;
EXPECT:1,Anne,38
EXPECT:2,Bill,23
EXPECT:3,Cindy,64
// Reset headers.
SEND:\t off
EXPECT:Tuples only is off.
// Set expanded to on.
SEND:\x on
EXPECT:Expanded display is on.
SEND:SELECT * FROM users;
EXPECT:_id,1
EXPECT:name,Anne
EXPECT:age,38
EXPECT:_id,2
EXPECT:name,Bill
EXPECT:age,23
EXPECT:_id,3
EXPECT:name,Cindy
EXPECT:age,64
// Set expanded back to off.
SEND:\x off
EXPECT:Expanded display is off.
// Set format back to aligned as we started.
SEND:\pset format aligned
EXPECT:Output format is aligned.
SEND:\pset format invalid
EXPECT:executing meta command: \pset: allowed formats are aligned, csv

View file

@ -1,34 +0,0 @@
// Set to off.
SEND:\pset tuples_only off
EXPECT:Tuples only is off.
// Set to on.
SEND:\pset tuples_only on
EXPECT:Tuples only is on.
// Toggle to off.
SEND:\pset tuples_only
EXPECT:Tuples only is off.
// Toggle to on.
SEND:\pset tuples_only
EXPECT:Tuples only is on.
// Set to something invalid.
SEND:\pset tuples_only invalid
EXPECT:executing meta command: unrecognized value "invalid" for "tuples_only": Boolean expected
// Ensure tuples_only shows only tuples.
SEND:SELECT 1 as foo, 'baz' as bar;
EXPECT:+---+-----+
EXPECT:| 1 | baz |
EXPECT:+---+-----+
EXPECT:
// Set back to off as we started.
SEND:\pset tuples_only off
EXPECT:Tuples only is off.
// make sure the \t meta-command returns expected errors
SEND:\t off extra
EXPECT:executing meta command: meta command 'tuples_only' takes zero or one argument

31
cli/testdata/meta_set vendored
View file

@ -1,31 +0,0 @@
SEND:\set
SEND:\set var1 foo
SEND:\set
EXPECT:var1 = 'foo'
SEND:\set var2 bar
SEND:\set
EXPECT:var1 = 'foo'
EXPECT:var2 = 'bar'
SEND:\set var3 zoo
SEND:\set
EXPECT:var1 = 'foo'
EXPECT:var2 = 'bar'
EXPECT:var3 = 'zoo'
SEND:\unset
EXPECT:\unset: missing required argument
SEND:\unset non-existent-key
SEND:\unset var1
SEND:\set
EXPECT:var2 = 'bar'
EXPECT:var3 = 'zoo'
SEND:\unset var2 extra
EXPECT:\unset: extra argument "extra" ignored
SEND:\set
EXPECT:var3 = 'zoo'

View file

@ -1,50 +0,0 @@
// Start by ensuring timing is off.
SEND:\timing off
EXPECT:Timing is off.
// Set timing on.
SEND:\timing on
EXPECT:Timing is on.
// Toggle timing.
SEND:\timing
EXPECT:Timing is off.
// Toggle timing again.
SEND:\timing
EXPECT:Timing is on.
// Send extra argument to \timing.
SEND:\timing on extra
EXPECT:executing meta command: meta command 'timing' takes zero or one argument
SEND:SELECT * FROM users;
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:
EXPECTCOMP:HasPrefix:Execution time:
// Turn timing back off.
SEND:\timing off
EXPECT:Timing is off.
// Ensure we don't get timing.
SEND:SELECT * FROM users;
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:
// Ensure an invalid timing value returns an error.
SEND:\timing invalid
EXPECT:executing meta command: unrecognized value "invalid" for "\timing": Boolean expected

View file

@ -1,24 +0,0 @@
// Make sure there's something in the query buffer.
// This is left unterminated because we don't need to execute the query;
// we just need there to be something in the buffer.
SEND:SELECT * FROM invalid-table
SEND:\write query-buffer-contents
// Reset the buffer.
SEND:\r
EXPECT:Query buffer reset (cleared).
// Read from the file.
SEND:\! cat query-buffer-contents
EXPECT:SELECT * FROM invalid-table
// Remove the file.
SEND:\! rm query-buffer-contents
// Send \write with no arguments.
SEND:\write
EXPECT:\w: missing required argument
// Send \write with extra arguments.
SEND:\write filename extra
EXPECT:executing meta command: meta command 'w' exactly one argument

View file

@ -1,12 +0,0 @@
-- Create a table.
create table people (_id id, name string, age int);
-- Insert some values.
insert into people values (1, 'Amy', 42), (2, 'Bob', 27), (3, 'Carl', 33);
-- Get all rows from the table.
select * from people;
-- Mix in a meta-command to show that both are supported
-- in the include file.
\echo mix in a meta command

View file

@ -1,40 +0,0 @@
SEND:select 1 as foo;
EXPECT:+-----+
EXPECT:| foo |
EXPECT:+-----+
EXPECT:| 1 |
EXPECT:+-----+
EXPECT:
SEND:\p
EXPECT:select 1 as foo;
SEND:select 2
SEND:\p
EXPECT:select 2
SEND:\r
EXPECT:Query buffer reset (cleared).
SEND:\p
EXPECT:select 1 as foo;
SEND:select 3
SEND:\p
EXPECT:select 3
SEND:as foo
SEND:\p
EXPECT:select 3
EXPECT:as foo
SEND:;
EXPECT:+-----+
EXPECT:| foo |
EXPECT:+-----+
EXPECT:| 3 |
EXPECT:+-----+
EXPECT:
SEND:\p
EXPECT:select 3
EXPECT:as foo;

51
cli/testdata/setup vendored
View file

@ -1,51 +0,0 @@
// Startup splash.
EXPECT:FeatureBase CLI ()
EXPECT:Type "\q" to quit.
EXPECT:Detected on-prem, serverless deployment.
EXPECTCOMP:HasPrefix:Host: http://localhost:
EXPECT:You are not connected to a database.
// Show databases.
SEND:SHOW DATABASES;
EXPECT:Organization required. Use \org to set an organization.
// Get current org.
SEND:\org
EXPECT:You have not set an organization.
// Set org.
SEND:\org acme
EXPECT:You have set organization "acme".
// Try to set org with too many arguments.
SEND:\org acme extra
EXPECT:executing meta command: meta command 'org' takes zero or one argument
// Set location to UTC so that expected timestamp size is consistent.
// Without this, a test running locally in may have a timestamp that
// ends in a timezone offset such as `-06:00`, while one running as UTC
// will have `Z`. Since these string lengths differ, our generic
// {timestamp} comparison will fail.
SEND:\pset location UTC
EXPECT:Location is UTC.
// Set an invalid location.
SEND:\pset location invalid
EXPECT:executing meta command: loading location: invalid: unknown time zone invalid
// Try to set location with too many arguments.
SEND:\pset location UTC extra
EXPECT:executing meta command: meta command 'pset' takes zero, one, or two arguments
// Set border to 2 for testing because it makes it easier to visually see
// what the tests are expecting (because lines don't end in spaces).
SEND:\pset border 2
EXPECT:Border style is 2.
// Check the state of pset.
SEND:\pset
EXPECT:border 2
EXPECT:expanded off
EXPECT:format aligned
EXPECT:location UTC
EXPECT:tuples_only off

72
cli/testdata/table vendored
View file

@ -1,72 +0,0 @@
// Show tables for database using SHOW TABLES WITH SYSTEM.
SEND:SHOW TABLES WITH SYSTEM;
EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | keys | space_used | description |
EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECT:
// Show tables for database using \d.
SEND:\d
EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | keys | space_used | description |
EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECTCOMP:WithFormat:| fb_____________________ | fb_____________________ | | | {timestamp} | {timestamp} | false | 0 | |
EXPECT:+-------------------------+-------------------------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECT:
// Show tables for database using SHOW TABLES.
SEND:SHOW TABLES;
EXPECT:+-----+------+-------+------------+------------+------------+------+------------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | keys | space_used | description |
EXPECT:+-----+------+-------+------------+------------+------------+------+------------+-------------+
EXPECT:+-----+------+-------+------------+------------+------------+------+------------+-------------+
EXPECT:
// Show tables for database using \dt.
SEND:\dt
EXPECT:+-----+------+-------+------------+------------+------------+------+------------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | keys | space_used | description |
EXPECT:+-----+------+-------+------------+------------+------------+------+------------+-------------+
EXPECT:+-----+------+-------+------------+------------+------------+------+------------+-------------+
EXPECT:
// Create a table. That can be used for general testing.
SEND:CREATE TABLE users (_id id, name string, age int);
EXPECT:
SEND:INSERT INTO users VALUES (1, 'Anne', 38), (2, 'Bill', 23), (3, 'Cindy', 64);
EXPECT:
// Show tables for database to get the newly created table.
SEND:\dt
EXPECT:+-------+-------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECT:| _id | name | owner | updated_by | created_at | updated_at | keys | space_used | description |
EXPECT:+-------+-------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECTCOMP:WithFormat:| users | users | | | {timestamp} | {timestamp} | false | 0 | |
EXPECT:+-------+-------+-------+------------+----------------------+----------------------+-------+------------+-------------+
EXPECT:
// We don't select from users until AFTER we check SHOW TABLES above because
// running this creates the fb_views sytem table which has a description.
// And it's annoying to mask out all of the description fields because we
// don't know which row fb_views will fall into.
SEND:SELECT * FROM users;
EXPECT:+-----+-------+-----+
EXPECT:| _id | name | age |
EXPECT:+-----+-------+-----+
EXPECT:| 1 | Anne | 38 |
EXPECT:| 2 | Bill | 23 |
EXPECT:| 3 | Cindy | 64 |
EXPECT:+-----+-------+-----+
EXPECT:

View file

@ -1,21 +0,0 @@
package cli
import (
"os"
)
// workingDir was originally set up with the intention of using it to maintain a
// reference to the current working directory. But it turns out we haven't
// really needed that so far. The `cd()` method is unsed in one of the meta
// commands, but we could probably just call `os.Chdir()` directly there. With
// that said, I'm leaving it here for now until we're abosolutely sure we don't
// need to use this for other directory/file handling functionality.
type workingDir struct{}
func newWorkingDir() *workingDir {
return &workingDir{}
}
func (wd *workingDir) cd(dir string) error {
return os.Chdir(dir)
}

View file

@ -1,294 +0,0 @@
package cli
import (
"encoding/csv"
"fmt"
"io"
"log"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/jedib0t/go-pretty/table"
"github.com/jedib0t/go-pretty/text"
"github.com/pkg/errors"
)
// writeOptions contains user configuration options which describe how to write
// the query output.
type writeOptions struct {
border int
expanded bool
format string
location *time.Location
timing bool
tuplesOnly bool
}
const (
formatAligned = "aligned"
formatCSV = "csv"
)
func defaultWriteOptions() *writeOptions {
return &writeOptions{
border: 1,
expanded: false,
format: formatAligned,
location: time.Local,
timing: false,
tuplesOnly: false,
}
}
// writeOutput writes the query response, taking the format into consideration.
// It sends query output to qOut, non-error informational output (such as query
// timing) to wOut, and errors to wErr.
func writeOutput(r *featurebase.WireQueryResponse, opts *writeOptions, qOut io.Writer, wOut io.Writer, wErr io.Writer) error {
if r == nil {
return errors.New("attempt to write out nil response")
}
if r.Error != "" {
if _, err := wErr.Write([]byte("Error: " + r.Error + "\n")); err != nil {
return errors.Wrapf(err, "writing error: %s", r.Error)
}
return writeWarnings(r, wErr)
}
switch opts.format {
case formatAligned:
if err := writeTable(r, opts, qOut); err != nil {
return errors.Wrap(err, "writing table")
}
// Add some white space after query results.
qOut.Write([]byte("\n"))
case formatCSV:
if err := writeCSV(r, opts, qOut); err != nil {
return errors.Wrap(err, "writing csv")
}
default:
return errors.Errorf("invalid format: %s", opts.format)
}
if err := writeWarnings(r, wErr); err != nil {
return err
}
// Timing.
if opts.timing {
if _, err := wOut.Write([]byte(fmt.Sprintf("Execution time: %dμs\n", r.ExecutionTime))); err != nil {
return errors.Wrapf(err, "writing execution time: %s", r.Error)
}
}
return nil
}
// writeCSV writes the WireQueryResponse to qOut as csv.
func writeCSV(r *featurebase.WireQueryResponse, opts *writeOptions, qOut io.Writer) error {
w := csv.NewWriter(qOut)
if opts.expanded {
// Expanded csv
// rec is used to write the row as a slice of strings. It is reused to
// avoid unnecessary memory allocation.
rec := make([]string, 2)
for _, row := range r.Data {
cleanRow(row, opts)
for i, col := range r.Schema.Fields {
rec[0] = string(col.Name)
rec[1] = fmt.Sprintf("%v", row[i])
// Write the record.
if err := w.Write(rec); err != nil {
log.Fatalln("error writing expanded record to csv:", err)
}
}
}
} else {
// Normal csv (i.e. NOT expanded)
// Write the schema.
if !opts.tuplesOnly {
header := make([]string, 0, len(r.Schema.Fields))
for i := range r.Schema.Fields {
header = append(header, string(r.Schema.Fields[i].Name))
}
if err := w.Write(header); err != nil {
return errors.Wrapf(err, "error writing header to csv")
}
}
// Write the records.
// rec is used to write the row as a slice of strings. It is reused to
// avoid unnecessary memory allocation.
rec := make([]string, len(r.Schema.Fields))
for _, row := range r.Data {
cleanRow(row, opts)
for i := range row {
rec[i] = fmt.Sprintf("%v", row[i])
}
if err := w.Write(rec); err != nil {
log.Fatalln("error writing record to csv:", err)
}
}
}
// Write any buffered data to the underlying writer (standard output).
w.Flush()
return w.Error()
}
// writeTable writes the WireQueryResponse to qOut in a tabular format.
func writeTable(r *featurebase.WireQueryResponse, opts *writeOptions, qOut io.Writer) error {
t := table.NewWriter()
t.SetOutputMirror(qOut)
switch opts.border {
case 0:
t.SetStyle(styleBorder0)
case 1:
t.SetStyle(styleBorder1)
default:
t.SetStyle(styleBorder2)
// In expanded mode with a border, we need borders between each record.
if opts.expanded {
t.Style().Options.SeparateRows = true
}
}
// Don't uppercase the header values.
t.Style().Format.Header = text.FormatDefault
if opts.expanded {
// Expanded table
for _, row := range r.Data {
cleanRow(row, opts)
colRow := make([]interface{}, 2)
scolRow := make([]string, 2)
div := "\n"
for i, col := range r.Schema.Fields {
if i == len(r.Schema.Fields)-1 {
div = ""
}
scolRow[0] += fmt.Sprintf("%s%s", col.Name, div)
scolRow[1] += fmt.Sprintf("%v%s", row[i], div)
}
colRow[0] = scolRow[0]
colRow[1] = scolRow[1]
t.AppendRow(table.Row(colRow[:]))
}
} else {
// Normal table (i.e. NOT expanded)
if !opts.tuplesOnly {
t.AppendHeader(schemaToRow(r.Schema))
}
for _, row := range r.Data {
cleanRow(row, opts)
t.AppendRow(table.Row(row))
}
}
t.Render()
return nil
}
// cleanRow loops through all the columns of row and modifies its value based on
// type.
//
// If the value is nil, replace it with a null string; go-pretty doesn't expect
// nil pointers in the data values.
//
// If the value is a time.Time, we want to print it using RFC3339Nano to be
// consistent with everything else.
func cleanRow(row []interface{}, opts *writeOptions) {
for i := range row {
switch v := row[i].(type) {
case nil:
row[i] = nullValue
case time.Time:
row[i] = v.In(opts.location).Format(time.RFC3339Nano)
}
}
}
func schemaToRow(schema featurebase.WireQuerySchema) []interface{} {
ret := make([]interface{}, len(schema.Fields))
for i, field := range schema.Fields {
ret[i] = field.Name
}
return ret
}
func writeWarnings(r *featurebase.WireQueryResponse, w io.Writer) error {
if len(r.Warnings) == 0 {
return nil
}
if _, err := w.Write([]byte("\n")); err != nil {
return errors.Wrapf(err, "writing line feed")
}
for _, warning := range r.Warnings {
if _, err := w.Write([]byte("Warning: " + warning + "\n")); err != nil {
return errors.Wrapf(err, "writing warning: %s", warning)
}
}
return nil
}
var styleBorder2 table.Style = table.StyleDefault
var styleBorder1 table.Style = table.Style{
Name: "StyleBorder1",
Box: table.StyleBoxDefault,
Color: table.ColorOptionsDefault,
Format: table.FormatOptionsDefault,
Options: table.Options{
DrawBorder: false,
SeparateColumns: true,
SeparateFooter: true,
SeparateHeader: true,
SeparateRows: false,
},
Title: table.TitleOptionsDefault,
}
var styleBorder0 table.Style = table.Style{
Name: "StyleBorder0",
Box: table.BoxStyle{
BottomLeft: "+",
BottomRight: "+",
BottomSeparator: "+",
Left: "|",
LeftSeparator: "+",
MiddleHorizontal: "-",
MiddleSeparator: " ",
MiddleVertical: " ",
PaddingLeft: "",
PaddingRight: "",
PageSeparator: "\n",
Right: "|",
RightSeparator: "+",
TopLeft: "+",
TopRight: "+",
TopSeparator: "+",
UnfinishedRow: " ~",
},
Color: table.ColorOptionsDefault,
Format: table.FormatOptionsDefault,
Options: table.Options{
DrawBorder: false,
SeparateColumns: true,
SeparateFooter: true,
SeparateHeader: true,
SeparateRows: false,
},
Title: table.TitleOptionsDefault,
}

View file

@ -1,188 +0,0 @@
package cli
import (
"bytes"
"fmt"
"strings"
"testing"
featurebase "github.com/featurebasedb/featurebase/v3"
dax "github.com/featurebasedb/featurebase/v3/dax"
"github.com/stretchr/testify/assert"
)
func TestWriter(t *testing.T) {
t.Run("writeTable", func(t *testing.T) {
wqr := &featurebase.WireQueryResponse{
Schema: featurebase.WireQuerySchema{
Fields: []*featurebase.WireQueryField{
{Name: "_id", Type: dax.BaseTypeID},
{Name: "name", Type: dax.BaseTypeString},
{Name: "age", Type: dax.BaseTypeInt},
},
},
Data: [][]interface{}{
{1, "Amy", 44},
{2, "Bob", 32},
{3, "Cindy", 28},
},
}
// TODO(tlt): used for debugging
// format := defaultWriteOptions()
// assert.NoError(t, writeTable(wqr, format, os.Stdout, os.Stdout, os.Stdout))
// return
tests := []struct {
format *writeOptions
expQOut string
expOut string
expErr string
}{
{
// default format
format: defaultWriteOptions(),
expQOut: stringOfLines(
" _id | name | age ",
"-----+-------+-----",
" 1 | Amy | 44 ",
" 2 | Bob | 32 ",
" 3 | Cindy | 28 ",
"",
),
expOut: "",
expErr: "",
},
{
// timing on
format: &writeOptions{
border: 1,
expanded: false,
format: formatAligned,
timing: true,
tuplesOnly: false,
},
expQOut: stringOfLines(
" _id | name | age ",
"-----+-------+-----",
" 1 | Amy | 44 ",
" 2 | Bob | 32 ",
" 3 | Cindy | 28 ",
"",
),
expOut: "Execution time: 0μs\n",
expErr: "",
},
{
// format.border = 2 (or higher)
format: &writeOptions{
border: 2,
expanded: false,
format: formatAligned,
timing: false,
tuplesOnly: false,
},
expQOut: stringOfLines(
"+-----+-------+-----+",
"| _id | name | age |",
"+-----+-------+-----+",
"| 1 | Amy | 44 |",
"| 2 | Bob | 32 |",
"| 3 | Cindy | 28 |",
"+-----+-------+-----+",
"",
),
expOut: "",
expErr: "",
},
{
// format.border = 0
format: &writeOptions{
border: 0,
expanded: false,
format: formatAligned,
timing: false,
tuplesOnly: false,
},
expQOut: stringOfLines(
"_id name age",
"--- ----- ---",
" 1 Amy 44",
" 2 Bob 32",
" 3 Cindy 28",
"",
),
expOut: "",
expErr: "",
},
{
// format.tuplesOnly = true
format: &writeOptions{
border: 1,
expanded: false,
format: formatAligned,
timing: false,
tuplesOnly: true,
},
expQOut: stringOfLines(
" 1 | Amy | 44 ",
" 2 | Bob | 32 ",
" 3 | Cindy | 28 ",
"",
),
expOut: "",
expErr: "",
},
{
// format.border = 2, expanded
format: &writeOptions{
border: 2,
expanded: true,
format: formatAligned,
timing: false,
tuplesOnly: false,
},
expQOut: stringOfLines(
"+------+-------+",
"| _id | 1 |",
"| name | Amy |",
"| age | 44 |",
"+------+-------+",
"| _id | 2 |",
"| name | Bob |",
"| age | 32 |",
"+------+-------+",
"| _id | 3 |",
"| name | Cindy |",
"| age | 28 |",
"+------+-------+",
"",
),
expOut: "",
expErr: "",
},
}
for i, test := range tests {
t.Run(fmt.Sprintf("test-%d", i), func(t *testing.T) {
// Set up buffers to capture the output.
qOut := bytes.NewBuffer(make([]byte, 0, 100000))
wOut := bytes.NewBuffer(make([]byte, 0, 100000))
wErr := bytes.NewBuffer(make([]byte, 0, 100000))
assert.NoError(t, writeOutput(wqr, test.format, qOut, wOut, wErr))
assert.Equal(t, test.expQOut, qOut.String())
assert.Equal(t, test.expOut, wOut.String())
assert.Equal(t, test.expErr, wErr.String())
})
}
})
}
func stringOfLines(lines ...string) string {
var sb strings.Builder
for _, line := range lines {
sb.WriteString(line + "\n")
}
return sb.String()
}

View file

@ -3,10 +3,10 @@ package client
import (
"context"
featurebase "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/client/types"
"github.com/featurebasedb/featurebase/v3/dax"
"github.com/featurebasedb/featurebase/v3/errors"
featurebase "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/client/types"
"github.com/molecula/featurebase/v3/dax"
"github.com/molecula/featurebase/v3/errors"
)
var _ featurebase.SchemaAPI = &schemaAPI{}
@ -26,26 +26,6 @@ func NewSchemaAPI(c *Client) *schemaAPI {
}
}
func (s *schemaAPI) CreateDatabase(context.Context, *dax.Database) error {
return errors.Errorf("unimplemented: schemaAPI.CreateDatabase()")
}
func (s *schemaAPI) DropDatabase(context.Context, dax.DatabaseID) error {
return errors.Errorf("unimplemented: schemaAPI.DropDatabase()")
}
func (s *schemaAPI) DatabaseByName(ctx context.Context, dbname dax.DatabaseName) (*dax.Database, error) {
return nil, errors.Errorf("unimplemented: schemaAPI.DatabaseByName()")
}
func (s *schemaAPI) DatabaseByID(ctx context.Context, dbid dax.DatabaseID) (*dax.Database, error) {
return nil, errors.Errorf("unimplemented: schemaAPI.DatabaseByID()")
}
func (s *schemaAPI) SetDatabaseOption(ctx context.Context, dbid dax.DatabaseID, option string, value string) error {
return nil
}
func (s *schemaAPI) Databases(context.Context, ...dax.DatabaseID) ([]*dax.Database, error) {
return nil, errors.Errorf("unimplemented: schemaAPI.Databases()")
}
func (s *schemaAPI) TableByName(ctx context.Context, tname dax.TableName) (*dax.Table, error) {
return nil, errors.New(errors.ErrUncoded, "schemaAPI.TableByName not implemented")
}

View file

@ -20,16 +20,16 @@ import (
"sync"
"time"
pilosa "github.com/featurebasedb/featurebase/v3"
"github.com/featurebasedb/featurebase/v3/client/types"
fbproto "github.com/featurebasedb/featurebase/v3/encoding/proto" // TODO use this everywhere and get rid of proto import
"github.com/featurebasedb/featurebase/v3/logger"
pnet "github.com/featurebasedb/featurebase/v3/net"
"github.com/featurebasedb/featurebase/v3/pb"
"github.com/featurebasedb/featurebase/v3/pql"
"github.com/featurebasedb/featurebase/v3/roaring"
"github.com/featurebasedb/featurebase/v3/vprint"
"github.com/golang/protobuf/proto" //nolint:staticcheck
pilosa "github.com/molecula/featurebase/v3"
"github.com/molecula/featurebase/v3/client/types"
fbproto "github.com/molecula/featurebase/v3/encoding/proto" // TODO use this everywhere and get rid of proto import
"github.com/molecula/featurebase/v3/logger"
pnet "github.com/molecula/featurebase/v3/net"
"github.com/molecula/featurebase/v3/pb"
"github.com/molecula/featurebase/v3/pql"
"github.com/molecula/featurebase/v3/roaring"
"github.com/molecula/featurebase/v3/vprint"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package client
import (
@ -9,13 +8,13 @@ import (
"testing"
"time"
featurebase "github.com/featurebasedb/featurebase/v3"
client_types "github.com/featurebasedb/featurebase/v3/client/types"
"github.com/featurebasedb/featurebase/v3/disco"
pnet "github.com/featurebasedb/featurebase/v3/net"
"github.com/featurebasedb/featurebase/v3/roaring"
"github.com/featurebasedb/featurebase/v3/shardwidth"
"github.com/featurebasedb/featurebase/v3/test"
featurebase "github.com/molecula/featurebase/v3"
client_types "github.com/molecula/featurebase/v3/client/types"
"github.com/molecula/featurebase/v3/disco"
pnet "github.com/molecula/featurebase/v3/net"
"github.com/molecula/featurebase/v3/roaring"
"github.com/molecula/featurebase/v3/shardwidth"
"github.com/molecula/featurebase/v3/test"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"
)
@ -228,7 +227,7 @@ func TestClientAgainstCluster(t *testing.T) {
_, err = cli.Query(qry)
require.NoErrorf(t, err, "BatchQuery")
// XXX: The following is required to make this test pass. See: https://github.com/featurebasedb/featurebase/issues/625
// XXX: The following is required to make this test pass. See: https://github.com/molecula/featurebase/issues/625
_, _, err = cli.HTTPRequest("POST", "/recalculate-caches", nil, nil)
require.NoErrorf(t, err, "POST /recalculate-caches")

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
// package ctl contains all pilosa subcommands other than 'server'. These are
// generally administration, testing, and debugging tools.
@ -11,7 +10,7 @@ import (
"reflect"
"testing"
pnet "github.com/featurebasedb/featurebase/v3/net"
pnet "github.com/molecula/featurebase/v3/net"
)
func TestQueryWithError(t *testing.T) {

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
// package ctl contains all pilosa subcommands other than 'server'. These are
// generally administration, testing, and debugging tools.
@ -8,7 +7,7 @@ package client
import (
"sync"
pnet "github.com/featurebasedb/featurebase/v3/net"
pnet "github.com/molecula/featurebase/v3/net"
)
// Cluster contains hosts in a Pilosa cluster.

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
// package ctl contains all pilosa subcommands other than 'server'. These are
// generally administration, testing, and debugging tools.
@ -8,7 +7,7 @@ package client
import (
"testing"
pnet "github.com/featurebasedb/featurebase/v3/net"
pnet "github.com/molecula/featurebase/v3/net"
)
func TestNewClusterWithHost(t *testing.T) {

View file

@ -1,5 +1,4 @@
// Copyright 2022 Molecula Corp. (DBA FeatureBase).
// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Molecula Corp. All rights reserved.
package csv
import (
@ -11,7 +10,7 @@ import (
"strings"
"time"
"github.com/featurebasedb/featurebase/v3/client"
"github.com/molecula/featurebase/v3/client"
)
// Format is the format of the data in the CSV file.

Some files were not shown because too many files have changed in this diff Show more