From 68c6bffa2c5f9311408dc7315dfa6fe5653247fd Mon Sep 17 00:00:00 2001 From: reesporte Date: Fri, 14 Jan 2022 13:02:01 -0600 Subject: [PATCH 01/29] clear localstorage on sign out --- lattice/src/App/AuthFlow/SignOutButton.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/lattice/src/App/AuthFlow/SignOutButton.tsx b/lattice/src/App/AuthFlow/SignOutButton.tsx index 3e76c22db..ff6b5e6ba 100644 --- a/lattice/src/App/AuthFlow/SignOutButton.tsx +++ b/lattice/src/App/AuthFlow/SignOutButton.tsx @@ -7,6 +7,7 @@ interface Props { const SignOutButton: React.FC = ({ children }) => { const signoutOnClick = (e) => { + localStorage.clear(); window.location.href = '/logout'; }; From 70b1ef906f3f18581bd7085243d8b7b08bc0ddf0 Mon Sep 17 00:00:00 2001 From: Samir Patel <48686912+54mir@users.noreply.github.com> Date: Mon, 17 Jan 2022 20:41:57 -0600 Subject: [PATCH 02/29] switch on req type --- server/grpc.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/grpc.go b/server/grpc.go index f24823915..5468ab84a 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -1655,7 +1655,16 @@ func Valid(ctx context.Context, method string, auth *authn.Auth, req interface{} if !ok { ua = []string{""} } - logger.Infof("GRPC: %v, %v, %v, %v, %v, %v", ip, ua, method, uinfo.UserID, uinfo.UserName, req) + + switch r := req.(type) { + case *pb.QueryPQLRequest: + logger.Infof("GRPC: %v, %v, %v, %v, %v, %+v", ip, ua, method, uinfo.UserID, uinfo.UserName, r) + case *pb.QuerySQLRequest: + logger.Infof("GRPC: %v, %v, %v, %v, %v, %+v", ip, ua, method, uinfo.UserID, uinfo.UserName, r) + default: + logger.Infof("GRPC: %v, %v, %v, %v, %v, %v", ip, ua, method, uinfo.UserID, uinfo.UserName) + + } return context.WithValue(ctx, "userinfo", uinfo), nil } From 695321e6c098125db8a1280bf1249e948f66a181 Mon Sep 17 00:00:00 2001 From: Samir Patel <48686912+54mir@users.noreply.github.com> Date: Mon, 17 Jan 2022 20:47:27 -0600 Subject: [PATCH 03/29] print attr --- server/grpc.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/server/grpc.go b/server/grpc.go index 5468ab84a..ee6875a42 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -1658,12 +1658,11 @@ func Valid(ctx context.Context, method string, auth *authn.Auth, req interface{} switch r := req.(type) { case *pb.QueryPQLRequest: - logger.Infof("GRPC: %v, %v, %v, %v, %v, %+v", ip, ua, method, uinfo.UserID, uinfo.UserName, r) + logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Pql) case *pb.QuerySQLRequest: - logger.Infof("GRPC: %v, %v, %v, %v, %v, %+v", ip, ua, method, uinfo.UserID, uinfo.UserName, r) + logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Sql) default: - logger.Infof("GRPC: %v, %v, %v, %v, %v, %v", ip, ua, method, uinfo.UserID, uinfo.UserName) - + logger.Infof("GRPC: %v, %v, %v, %v, %v", ip, ua, method, uinfo.UserID, uinfo.UserName) } return context.WithValue(ctx, "userinfo", uinfo), nil From c969a8370e1f6d043786b2a30961e7fce72b1976 Mon Sep 17 00:00:00 2001 From: Hoang Pham Date: Tue, 18 Jan 2022 17:57:40 -0600 Subject: [PATCH 04/29] UI - added fix for Query Builder page showing up as blank when there are no tables associated with current user --- lattice/src/App/QueryBuilder/QueryBuilderContainer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lattice/src/App/QueryBuilder/QueryBuilderContainer.tsx b/lattice/src/App/QueryBuilder/QueryBuilderContainer.tsx index da27904de..3f7afb292 100644 --- a/lattice/src/App/QueryBuilder/QueryBuilderContainer.tsx +++ b/lattice/src/App/QueryBuilder/QueryBuilderContainer.tsx @@ -196,7 +196,8 @@ export const QueryBuilderContainer = () => { return ( - {tables.length > 0 ? ( + {/* check if tables is not null AND tables.length > 0 */} + {(tables && tables.length > 0) ? ( Date: Wed, 19 Jan 2022 10:11:19 -0600 Subject: [PATCH 05/29] update keygen subcommand this updates the subcommand to output a single secret key instead of two reflecting changes made to AuthN/authZ --- cmd/keygen.go | 6 +++--- ctl/keygen.go | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/keygen.go b/cmd/keygen.go index 9a4faa940..527a7ca3d 100644 --- a/cmd/keygen.go +++ b/cmd/keygen.go @@ -13,9 +13,9 @@ func newKeygenCommand(stdin io.Reader, stdout io.Writer, stderr io.Writer) *cobr cmd := ctl.NewKeygenCommand(stdin, stdout, stderr) ccmd := &cobra.Command{ Use: "keygen", - Short: "Generate keys for authentication.", + Short: "Generate secret key for authentication.", Long: ` -Generate hash and block keys to configure FeatureBase for Authentication. +Generate secret key to configure FeatureBase for Authentication. `, RunE: func(c *cobra.Command, args []string) error { return cmd.Run(context.Background()) @@ -23,6 +23,6 @@ Generate hash and block keys to configure FeatureBase for Authentication. } flags := ccmd.Flags() - flags.IntVarP(&cmd.KeyLength, "length", "l", 32, "length of keys to produce") + flags.IntVarP(&cmd.KeyLength, "length", "l", 32, "length of the key to produce") return ccmd } diff --git a/ctl/keygen.go b/ctl/keygen.go index 06cc797ad..dc0d4aa36 100644 --- a/ctl/keygen.go +++ b/ctl/keygen.go @@ -10,7 +10,7 @@ import ( pilosa "github.com/molecula/featurebase/v2" ) -// Keygen represents a command for generating crytographic keys. +// Keygen represents a command for generating a crytographic key. type KeygenCommand struct { CmdIO *pilosa.CmdIO KeyLength int @@ -23,9 +23,8 @@ func NewKeygenCommand(stdin io.Reader, stdout, stderr io.Writer) *KeygenCommand } } -// Run keys to use for authentication . +// Run keygen to obtain key to use for authentication . func (kg *KeygenCommand) Run(_ context.Context) error { - fmt.Printf("hash-key = \"%+x\"\n", securecookie.GenerateRandomKey(kg.KeyLength)) - fmt.Printf("block-key = \"%+x\"\n", securecookie.GenerateRandomKey(kg.KeyLength)) + fmt.Printf("secret-key = \"%+x\"\n", securecookie.GenerateRandomKey(kg.KeyLength)) return nil } From e1d7389893ecc5f1213282b84c15086fd7690514 Mon Sep 17 00:00:00 2001 From: Samir Patel <48686912+54mir@users.noreply.github.com> Date: Wed, 19 Jan 2022 11:23:02 -0500 Subject: [PATCH 06/29] Update ctl/keygen.go Co-authored-by: reese <45641995+reesporte@users.noreply.github.com> --- ctl/keygen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctl/keygen.go b/ctl/keygen.go index dc0d4aa36..001cad9f9 100644 --- a/ctl/keygen.go +++ b/ctl/keygen.go @@ -10,7 +10,7 @@ import ( pilosa "github.com/molecula/featurebase/v2" ) -// Keygen represents a command for generating a crytographic key. +// Keygen represents a command for generating a cryptographic key. type KeygenCommand struct { CmdIO *pilosa.CmdIO KeyLength int From e7552a76a7aa32762e0ce1f6af4f6c70b3e45d06 Mon Sep 17 00:00:00 2001 From: reesporte Date: Wed, 19 Jan 2022 12:08:05 -0600 Subject: [PATCH 07/29] fix bug where drop table wasn't being authorized also fixes bug in GetAuthorizedIndexList where perms weren't being properly compared --- authz/authorization.go | 4 ++-- server/grpc.go | 33 +++++++++++++++++++++++--- server/grpc_test.go | 53 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/authz/authorization.go b/authz/authorization.go index a2127f33d..1cd0d3dc1 100644 --- a/authz/authorization.go +++ b/authz/authorization.go @@ -120,7 +120,7 @@ func (p *GroupPermissions) IsAdmin(groups []authn.Group) bool { func (p *GroupPermissions) GetAuthorizedIndexList(groups []authn.Group, desiredPermission Permission) (indexList []string) { // if user is admin, find all indexes in permissions file and return them - if admin := p.IsAdmin(groups); admin { + if p.IsAdmin(groups) { for groupId := range p.Permissions { for index := range p.Permissions[groupId] { indexList = append(indexList, index) @@ -132,7 +132,7 @@ func (p *GroupPermissions) GetAuthorizedIndexList(groups []authn.Group, desiredP for _, group := range groups { if _, ok := p.Permissions[group.GroupID]; ok { for index, permission := range p.Permissions[group.GroupID] { - if permission >= desiredPermission { + if permission.Satisfies(desiredPermission) { indexList = append(indexList, index) } } diff --git a/server/grpc.go b/server/grpc.go index f24823915..c57374020 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -30,6 +30,7 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/reflection" "google.golang.org/grpc/status" + "vitess.io/vitess/go/vt/sqlparser" ) // GRPCHandler contains methods which handle the various gRPC requests. @@ -174,7 +175,13 @@ func (h *GRPCHandler) QuerySQL(req *pb.QuerySQLRequest, stream pb.Pilosa_QuerySQ return errors.Wrap(err, "parsing SQL") } - allowed := h.perms.GetAuthorizedIndexList(uinfo.(*authn.UserInfo).Groups, authz.Read) + perm := authz.Read + switch parsed.Statement.(type) { + case *sqlparser.DDL: // currently only used for DropTable + perm = authz.Admin + } + + allowed := h.perms.GetAuthorizedIndexList(uinfo.(*authn.UserInfo).Groups, perm) if !h.perms.IsAdmin(uinfo.(*authn.UserInfo).Groups) { if !isAllowed(parsed.Tables, allowed) { return status.Error(codes.PermissionDenied, "insufficient permissions to access requested tables") @@ -219,9 +226,29 @@ func (h *GRPCHandler) QuerySQL(req *pb.QuerySQLRequest, stream pb.Pilosa_QuerySQ func (h *GRPCHandler) QuerySQLUnary(ctx context.Context, req *pb.QuerySQLRequest) (*pb.TableResponse, error) { start := time.Now() uinfo := ctx.Value("userinfo") - if uinfo != nil && !h.perms.IsAdmin(uinfo.(*authn.UserInfo).Groups) { - ctx = context.WithValue(ctx, "indices", h.perms.GetAuthorizedIndexList(uinfo.(*authn.UserInfo).Groups, authz.Read)) + if uinfo != nil { + // authz + m := sql.NewMapper() + parsed, err := m.MapSQL(req.Sql) + if err != nil { + return nil, errors.Wrap(err, "parsing SQL") + } + + perm := authz.Read + switch parsed.Statement.(type) { + case *sqlparser.DDL: // currently only used for DropTable + perm = authz.Admin + } + + allowed := h.perms.GetAuthorizedIndexList(uinfo.(*authn.UserInfo).Groups, perm) + if !h.perms.IsAdmin(uinfo.(*authn.UserInfo).Groups) { + if !isAllowed(parsed.Tables, allowed) { + return nil, status.Error(codes.PermissionDenied, "insufficient permissions to access requested tables") + } + ctx = context.WithValue(ctx, "indices", allowed) + } } + results, err := h.execSQL(ctx, req.Sql) if err != nil { return nil, err diff --git a/server/grpc_test.go b/server/grpc_test.go index c2b993a96..acfa48943 100644 --- a/server/grpc_test.go +++ b/server/grpc_test.go @@ -1162,6 +1162,7 @@ admin: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe"` t.Fatal(err) } }) + t.Run("test-show-tables-unary-admin", func(t *testing.T) { response, err := gh.QuerySQLUnary(adminCtx, &pb.QuerySQLRequest{ Sql: "show tables", @@ -1190,6 +1191,55 @@ admin: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe"` t.Fatal(err) } }) + + t.Run("test-drop-table-unary-read", func(t *testing.T) { + _, err := gh.QuerySQLUnary(readCtx, &pb.QuerySQLRequest{ + Sql: "drop table deletable_index", + }) + if err == nil { + t.Fatal("expected error but got nil") + } + }) + + t.Run("test-drop-table-unary-write", func(t *testing.T) { + _, err := gh.QuerySQLUnary(writeCtx, &pb.QuerySQLRequest{ + Sql: "drop table deletable_index", + }) + if err == nil { + t.Fatal("expected error but got nil") + } + }) + + t.Run("test-drop-table-unary-admin", func(t *testing.T) { + _, err := gh.QuerySQLUnary(adminCtx, &pb.QuerySQLRequest{ + Sql: "drop table deletable_index", + }) + if err != nil { + t.Fatalf("expected nil error but got %v", err) + } + }) + + t.Run("test-drop-table-stream-read", func(t *testing.T) { + mock := &mockPilosa_QuerySQLServer{ctx: readCtx} + err := gh.QuerySQL(&pb.QuerySQLRequest{Sql: "drop table another_one"}, mock) + if err == nil { + t.Fatal("expected error but got nil") + } + }) + t.Run("test-drop-table-stream-write", func(t *testing.T) { + mock := &mockPilosa_QuerySQLServer{ctx: writeCtx} + err := gh.QuerySQL(&pb.QuerySQLRequest{Sql: "drop table another_one"}, mock) + if err == nil { + t.Fatal("expected error but got nil") + } + }) + t.Run("test-drop-table-stream-admin", func(t *testing.T) { + mock := &mockPilosa_QuerySQLServer{ctx: adminCtx} + err := gh.QuerySQL(&pb.QuerySQLRequest{Sql: "drop table another_one"}, mock) + if err != nil { + t.Fatalf("expected nil error but got %v", err) + } + }) } func TestCRUDIndexes(t *testing.T) { @@ -1506,6 +1556,9 @@ func setUpTestQuerySQLUnary(ctx context.Context, t *testing.T) (gh *server.GRPCH // delete_me m.MustCreateIndex(t, "delete_me", pilosa.IndexOptions{TrackExistence: true}) + m.MustCreateIndex(t, "another_one", pilosa.IndexOptions{TrackExistence: true}) + m.MustCreateIndex(t, "deletable_index", pilosa.IndexOptions{TrackExistence: true}) + return gh, func() { if err := m.API.DeleteIndex(ctx, joiner.Name()); err != nil { panic(err) From 61ef1aee4e694316810238236c84d01e714ede20 Mon Sep 17 00:00:00 2001 From: reesporte Date: Wed, 19 Jan 2022 12:55:07 -0600 Subject: [PATCH 08/29] fix older tests --- server/grpc_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/grpc_test.go b/server/grpc_test.go index acfa48943..3508d03ab 100644 --- a/server/grpc_test.go +++ b/server/grpc_test.go @@ -843,6 +843,8 @@ func TestQuerySQL(t *testing.T) { {"Table", "string"}, }, rows: []row{ + {[]columnResponse{"another_one"}}, + {[]columnResponse{"deletable_index"}}, {[]columnResponse{"delete_me"}}, {[]columnResponse{"grouper"}}, {[]columnResponse{"joiner"}}, @@ -881,6 +883,9 @@ func TestQuerySQL(t *testing.T) { {"Table", "string"}, }, rows: []row{ + {[]columnResponse{"another_one"}}, + {[]columnResponse{"deletable_index"}}, + {[]columnResponse{"grouper"}}, {[]columnResponse{"joiner"}}, }, From a162322fc9d12eb3bbd8376f037d877da90ee8b5 Mon Sep 17 00:00:00 2001 From: reesporte Date: Wed, 19 Jan 2022 14:43:54 -0600 Subject: [PATCH 09/29] fix bug with nil elements in protobuf indexes we were allocating space we weren't using smh my head --- server/grpc.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/server/grpc.go b/server/grpc.go index c57374020..f046c7f97 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -456,10 +456,10 @@ func (h *GRPCHandler) GetIndex(ctx context.Context, req *pb.GetIndexRequest) (*p // GetIndexes returns a list of all Indexes func (h *GRPCHandler) GetIndexes(ctx context.Context, req *pb.GetIndexesRequest) (*pb.GetIndexesResponse, error) { uinfo := ctx.Value("userinfo") - var pp *authn.UserInfo + var userInfo *authn.UserInfo if uinfo != nil { var ok bool - pp, ok = uinfo.(*authn.UserInfo) + userInfo, ok = uinfo.(*authn.UserInfo) if !ok { return nil, status.Error(codes.InvalidArgument, "malformed auth header") } @@ -469,17 +469,14 @@ func (h *GRPCHandler) GetIndexes(ctx context.Context, req *pb.GetIndexesRequest) return nil, errToStatusError(err) } - indexes := make([]*pb.Index, len(schema)) - i := 0 + indexes := make([]*pb.Index, 0) for _, index := range schema { - if pp != nil { - if p, err := h.perms.GetPermissions(pp, index.Name); err == nil && p.Satisfies(authz.Read) { - indexes[i] = &pb.Index{Name: index.Name} - i += 1 + if userInfo != nil { + if p, err := h.perms.GetPermissions(userInfo, index.Name); err == nil && p.Satisfies(authz.Read) { + indexes = append(indexes, &pb.Index{Name: index.Name}) } } else { - indexes[i] = &pb.Index{Name: index.Name} - i += 1 + indexes = append(indexes, &pb.Index{Name: index.Name}) } } return &pb.GetIndexesResponse{Indexes: indexes}, nil From adcd5adb0293a46b307a564c10cd7de93f2a31af Mon Sep 17 00:00:00 2001 From: Seebs Date: Mon, 10 Jan 2022 10:33:01 -0600 Subject: [PATCH 10/29] 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. --- rbf/cursor.go | 6 +++--- rbf/db.go | 29 +++++++++++++++++------------ rbf/tx.go | 13 ++++++++++--- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/rbf/cursor.go b/rbf/cursor.go index 2419bc5f8..22d4427e6 100644 --- a/rbf/cursor.go +++ b/rbf/cursor.go @@ -526,7 +526,7 @@ func (c *Cursor) putLeafCellFast(in leafCell, isInsert bool) (err error) { } // Write page header. - dst := allocPage() // make([]byte, PageSize) + dst := allocPage() writePageNo(dst, readPageNo(src)) writeFlags(dst, PageTypeLeaf) writeCellN(dst, dstCellN) @@ -616,7 +616,7 @@ func (c *Cursor) deleteLeafCell(key uint64) (err error) { cells = cells[:len(cells)-1] // Write cells to page. - buf := make([]byte, PageSize) + buf := allocPage() writePageNo(buf[:], elem.pgno) writeFlags(buf[:], PageTypeLeaf) writeCellN(buf[:], len(cells)) @@ -800,7 +800,7 @@ func (c *Cursor) deleteBranchCell(stackIndex int, key uint64) (err error) { return err } - buf := make([]byte, PageSize) + buf := allocPage() copy(buf, target) writePageNo(buf[:], elem.pgno) diff --git a/rbf/db.go b/rbf/db.go index 97de950e6..1d693fac6 100644 --- a/rbf/db.go +++ b/rbf/db.go @@ -11,6 +11,7 @@ import ( "sort" "sync" "syscall" + "unsafe" "github.com/benbjohnson/immutable" "github.com/molecula/featurebase/v2/logger" @@ -560,7 +561,7 @@ func (db *DB) init() error { // initMetaPage initializes the meta page. func (db *DB) initMetaPage() error { - page := make([]byte, PageSize) + page := allocPage() writeMetaMagic(page) writeMetaPageN(page, 3) writeMetaRootRecordPageNo(page, 1) @@ -572,7 +573,7 @@ func (db *DB) initMetaPage() error { // initRootRecordPage initializes the initial root record page. func (db *DB) initRootRecordPage() error { - page := make([]byte, PageSize) + page := allocPage() writePageNo(page, 1) writeFlags(page, PageTypeRootRecord) _, err := db.file.WriteAt(page, 1*PageSize) @@ -582,7 +583,7 @@ func (db *DB) initRootRecordPage() error { // initFreelistPage initializes the initial freelist btree page. func (db *DB) initFreelistPage() error { - page := make([]byte, PageSize) + page := allocPage() writePageNo(page, 2) writeFlags(page, PageTypeLeaf) _, err := db.file.WriteAt(page, 2*PageSize) @@ -829,18 +830,22 @@ type DebugInfo struct { // Shared pool for in-memory database pages. // These are used before being flushed to disk. -var pagePool = &sync.Pool{ - New: func() interface{} { - page := make([]byte, PageSize) - return &page - }, -} +var pagePool = &sync.Pool{} func allocPage() []byte { - page := pagePool.Get().(*[]byte) - return *page + existing := pagePool.Get() + if existing == nil { + return make([]byte, PageSize) + } + // zero the existing page before returning it + page := existing.(*[PageSize]byte)[:] + for i := range page { + page[i] = 0 + } + return page } func freePage(page []byte) { - pagePool.Put(&page) + data := (*[PageSize]byte)(unsafe.Pointer(&page[0])) + pagePool.Put(data) } diff --git a/rbf/tx.go b/rbf/tx.go index aef2b395c..b2a1a5185 100644 --- a/rbf/tx.go +++ b/rbf/tx.go @@ -236,7 +236,7 @@ func (tx *Tx) createBitmap(name string) error { } // Write root page. - page := make([]byte, PageSize) + page := allocPage() writePageNo(page, pgno) writeFlags(page, PageTypeLeaf) writeCellN(page, 0) @@ -449,7 +449,7 @@ func (tx *Tx) writeRootRecordPages(records *immutable.SortedMap) (err error) { // Write new root record pages. for itr := records.Iterator(); !itr.Done(); { // Initialize page & write as many records as will fit. - page := make([]byte, PageSize) + page := allocPage() writePageNo(page, pgno) writeFlags(page, PageTypeRootRecord) @@ -1800,9 +1800,16 @@ func (tx *Tx) flush() error { } // Write bitmap headers & pages to WAL. + // + // We need to write a bitmap header before each such page. We only allocate + // one header, and we reuse it, because each write is flushing it out to + // disk, and it doesn't get stored in-memory. + var hdr []byte + if len(tx.dirtyBitmapPages) > 0 { + hdr = allocPage() + } for _, pgno := range dirtyPageMapKeys(tx.dirtyBitmapPages) { // Write header page. - hdr := make([]byte, PageSize) writePageNo(hdr[:], pgno) writeFlags(hdr[:], PageTypeBitmapHeader) if _, err := tx.writeToWAL(w, hdr); err != nil { From 112abcb549e86135cf8abd55b2e756ff4b93b8dd Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 7 Jan 2022 15:59:49 -0600 Subject: [PATCH 11/29] 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. --- rbf/db.go | 23 ++++++++++++++++++ rbf/tx.go | 73 ++++++++++++++++++++++++++----------------------------- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/rbf/db.go b/rbf/db.go index 1d693fac6..f2eeceea3 100644 --- a/rbf/db.go +++ b/rbf/db.go @@ -69,6 +69,8 @@ type DB struct { // Path represents the path to the database file. Path string + + freelistCursor Cursor // cursor to reuse for freelist operations } // NewDB returns a new instance of DB. @@ -808,6 +810,11 @@ func (db *DB) readMetaPage() ([]byte, error) { return db.readDBPage(0) } +// getCursor returns a cursor which has not been zeroed. The only thing +// a caller should need to do is set c.stack's top correctly (it should be +// 0, and the [0] elem should be the root page to start on). +// +// TODO: Should this do anything about c.buffered? func (db *DB) getCursor(tx *Tx) *Cursor { c := cursorSyncPool.Get().(*Cursor) c.tx = tx @@ -828,6 +835,22 @@ type DebugInfo struct { Txs []*TxDebugInfo `json:"txs"` } +// when we want a cursor to access a free list, we are always doing this in +// a context specific to a write transaction, of which any DB can only have +// one at a time, and the operations modifying the free list don't recurse, +// because that would corrupt the list (see tx.freelistCleanup for the hairy +// details), which means that there is only ever one cursor being used for the +// free list, but also we use that cursor very often, and if we have to allocate +// it or zero it we end up with a lot of excess allocations and zeroing. +func (db *DB) getFreelistCursor(tx *Tx) *Cursor { + c := &db.freelistCursor + c.tx = tx + c.stack.elems[0] = stackElem{pgno: readMetaFreelistPageNo(tx.meta[:])} + c.stack.top = 0 + c.buffered = false + return c +} + // Shared pool for in-memory database pages. // These are used before being flushed to disk. var pagePool = &sync.Pool{} diff --git a/rbf/tx.go b/rbf/tx.go index b2a1a5185..4fa8f441e 100644 --- a/rbf/tx.go +++ b/rbf/tx.go @@ -984,6 +984,10 @@ func (tx *Tx) walkTree(pgno, parent uint32, fn func(pgno, parent, typ uint32, er // about that removing things from the free list, because the add logic // already just uses new pages rather than trying to use the free list // when it knows the free list is involved. +// +// Because this is expected to be used in a defer, instead of returning an +// error, it will set the error it got the address of to a new error if it +// encounters one and there wasn't one already. func (tx *Tx) freelistCleanup(outErr *error) { defer func() { // no matter what, we're done with this after this, but we still @@ -994,8 +998,7 @@ func (tx *Tx) freelistCleanup(outErr *error) { if len(tx.pendingFreelistAdds) == 0 { return } - c := Cursor{tx: tx} - c.stack.elems[0] = stackElem{pgno: readMetaFreelistPageNo(tx.meta[:])} + c := tx.db.getFreelistCursor(tx) for len(tx.pendingFreelistAdds) > 0 { var pass []uint32 pass, tx.pendingFreelistAdds = tx.pendingFreelistAdds, nil @@ -1006,7 +1009,7 @@ func (tx *Tx) freelistCleanup(outErr *error) { } return } else if !changed { - vprint.PanicOn(fmt.Sprintf("rbf.Tx.freePgno(): double free: %d", tx.pendingFreelistAdds)) + vprint.PanicOn(fmt.Sprintf("rbf.Tx.freelistCleanup(): double free: %d", pass)) } } } @@ -1015,44 +1018,25 @@ func (tx *Tx) freelistCleanup(outErr *error) { // allocatePgno returns a page number for a new available page. This page may be // pulled from the free list or, if no free pages are available, it will be // created by extending the file size. +// +// allocatePgno uses the freelist cursor (a shared db-wide thing), and sets +// the "modifyingFreelist" flag while it's running. If for some reason a +// modification to the freelist would require a new allocation or free, +// allocations always just create a new page, and frees are processed later +// by a separate call through a deferred tx.freelistCleanup(). func (tx *Tx) allocatePgno() (_ uint32, outErr error) { if tx.modifyingFreelist { return tx.allocateNewPgno(), nil } - // Attempt to find page in freelist. - pgno, err := tx.nextFreelistPageNo() - - if err != nil { - return 0, err - } else if pgno != 0 { - tx.modifyingFreelist = true - defer tx.freelistCleanup(&outErr) - c := Cursor{tx: tx} - c.stack.elems[0] = stackElem{pgno: readMetaFreelistPageNo(tx.meta[:])} - if changed, err := c.Remove(uint64(pgno)); err != nil { - return 0, err - } else if !changed { - vprint.PanicOn(fmt.Sprintf("tx.Tx.allocatePgno(): double alloc: %d", pgno)) - } - return pgno, nil - } - // no freelist pages, fall back - return tx.allocateNewPgno(), nil -} - -// allocateNewPgno requests a new page unconditionally, ignoring the free list. -func (tx *Tx) allocateNewPgno() uint32 { - // Increment the total page count by one and return the last page. - pgno := readMetaPageN(tx.meta[:]) - writeMetaPageN(tx.meta[:], pgno+1) - return pgno -} - -func (tx *Tx) nextFreelistPageNo() (uint32, error) { - c := Cursor{tx: tx} - c.stack.elems[0] = stackElem{pgno: readMetaFreelistPageNo(tx.meta[:])} + // this serves as a precaution against double-use of the freelist cursor + // used database-wide. we don't have actual synchronization here because + // only one write Tx should exist at once and it's not safe to use its + // write-capable ops concurrently anyway. + tx.modifyingFreelist = true + defer tx.freelistCleanup(&outErr) + c := tx.db.getFreelistCursor(tx) if err := c.First(); err == io.EOF { - return 0, nil + return tx.allocateNewPgno(), nil } else if err != nil { return 0, err } @@ -1067,17 +1051,30 @@ func (tx *Tx) nextFreelistPageNo() (uint32, error) { v := cell.firstValue(tx) pgno := uint32((cell.Key << 16) | uint64(v)) + + if changed, err := c.Remove(uint64(pgno)); err != nil { + return 0, err + } else if !changed { + vprint.PanicOn(fmt.Sprintf("tx.Tx.allocatePgno(): double alloc: %d", pgno)) + } return pgno, nil } +// allocateNewPgno requests a new page unconditionally, ignoring the free list. +func (tx *Tx) allocateNewPgno() uint32 { + // Increment the total page count by one and return the last page. + pgno := readMetaPageN(tx.meta[:]) + writeMetaPageN(tx.meta[:], pgno+1) + return pgno +} + // deallocate releases a page number to the freelist. func (tx *Tx) freePgno(pgno uint32) (outErr error) { if tx.modifyingFreelist { tx.pendingFreelistAdds = append(tx.pendingFreelistAdds, pgno) return nil } - c := Cursor{tx: tx} - c.stack.elems[0] = stackElem{pgno: readMetaFreelistPageNo(tx.meta[:])} + c := tx.db.getFreelistCursor(tx) tx.modifyingFreelist = true defer tx.freelistCleanup(&outErr) From 719a30e1289c6c089fcd42cd8025902d5bb97f91 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 19 Jan 2022 13:21:44 -0600 Subject: [PATCH 12/29] 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. --- rbf/db_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rbf/db_test.go b/rbf/db_test.go index f4238e7e1..65d84cff6 100644 --- a/rbf/db_test.go +++ b/rbf/db_test.go @@ -339,7 +339,7 @@ func TestDB_MultiTx(t *testing.T) { } // Continuously set/clear bits while readers are executing. - for i := 0; i < 1000; i++ { + for i := 0; i < 100; i++ { func() { tx, err := db.Begin(true) if err != nil { From 37507db4ac4ff1a5410aadf230b1519acfede169 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 19 Jan 2022 13:13:05 -0600 Subject: [PATCH 13/29] 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. --- rbf/tx_test.go | 79 +++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/rbf/tx_test.go b/rbf/tx_test.go index 7a726c2ed..14626ce00 100644 --- a/rbf/tx_test.go +++ b/rbf/tx_test.go @@ -248,6 +248,27 @@ func TestTx_DeallocateTree(t *testing.T) { } } +func arraySizedChunk() []uint16 { + v := make([]uint16, rbf.ArrayMaxSize) + for i := range v { + v[i] = uint16(i) + } + return v +} + +var convenientPrepopulatedArray = arraySizedChunk() + +// populateBitmapWithArrays +func populateBitmapWithArrays(tb testing.TB, tx *rbf.Tx, n int, name string) { + c := roaring.NewContainerArray(convenientPrepopulatedArray) + for i := 0; i < n; i++ { + err := tx.PutContainer(name, uint64(i), c) + if err != nil { + tb.Fatal(err) + } + } +} + func TestTx_RecreateBitmap(t *testing.T) { db := MustOpenDB(t) defer MustCloseDB(t, db) @@ -258,14 +279,8 @@ func TestTx_RecreateBitmap(t *testing.T) { if err := tx.CreateBitmap("x"); err != nil { t.Fatal(err) } - const N = 825000 - slots := make([]uint64, N) - for i := range slots { - slots[i] = uint64(i) << 20 - } - if _, err := tx.Add("x", slots...); err != nil { - t.Fatal(err) - } + const N = 825 + populateBitmapWithArrays(t, tx, N, "x") err := tx.Commit() if err != nil { t.Fatal(err) @@ -291,9 +306,7 @@ func TestTx_RecreateBitmap(t *testing.T) { if err := tx.CreateBitmap("x"); err != nil { t.Fatal(err) } - if _, err := tx.Add("x", slots...); err != nil { - t.Fatal(err) - } + populateBitmapWithArrays(t, tx, N, "x") err = tx.Commit() if err != nil { t.Fatal(err) @@ -374,20 +387,14 @@ func TestTx_DeallocateToFreeList(t *testing.T) { if err = tx.CreateBitmap("y"); err != nil { t.Fatal(err) } - const N = 12274831 - slots := make([]uint64, N) - for i := range slots { - slots[i] = uint64(i) << 10 - } - bm := roaring.NewBitmap(slots...) - if _, err = tx.AddRoaring("x", bm); err != nil { - t.Fatal(err) - } + // Insert large array values. + populateBitmapWithArrays(t, tx, 4080, "x") + if err = tx.Check(); err != nil { t.Fatal(err) } for i := 0; i < 500; i++ { - if _, err := tx.Add("y", uint64(i)<<16); err != nil { + if _, err := tx.Add("y", uint64(i)<<16+32768); err != nil { t.Fatal(err) } } @@ -426,9 +433,8 @@ func TestTx_DeallocateToFreeList(t *testing.T) { if err := tx.CreateBitmap("x"); err != nil { t.Fatal(err) } - if _, err := tx.AddRoaring("x", bm); err != nil { - t.Fatal(err) - } + populateBitmapWithArrays(t, tx, 4080, "x") + if err = tx.Check(); err != nil { t.Fatal(err) } @@ -451,17 +457,7 @@ func TestTx_Remove(t *testing.T) { } // Insert large array values. - var values []uint64 - for i := 0; i < 1000; i++ { - for j := 0; j < rbf.ArrayMaxSize; j++ { - v := uint64((i << 16) + j) - values = append(values, v) - - if _, err := tx.Add("x", v); err != nil { - t.Fatalf("Add(%d) err=%q", v, err) - } - } - } + populateBitmapWithArrays(t, tx, 500, "x") if err := tx.Commit(); err != nil { t.Fatal(err) @@ -471,12 +467,17 @@ func TestTx_Remove(t *testing.T) { defer tx.Rollback() // Remove all array values. - for _, i := range rand.Perm(len(values)) { - v := values[i] - if _, err := tx.Remove("x", v); err != nil { - t.Fatalf("Remove(%d) err=%q", v, err) + for i := 0; i < 500; i++ { + err := tx.RemoveContainer("x", uint64(i)) + if err != nil { + t.Fatal(err) } } + // This triggered a different panic without the relevant patch. + err := tx.RemoveContainer("x", 500) + if err != nil { + t.Fatal(err) + } if err := tx.Commit(); err != nil { t.Fatal(err) From 2dce518a243c4006c75ae7210e2e33e0283ec794 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 19 Jan 2022 14:44:47 -0600 Subject: [PATCH 14/29] retry other etcd ErrTimeout variants etcd can return more detailed ErrTimeout variants in rare cases, and we want to retry on those too. --- etcd/embed.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etcd/embed.go b/etcd/embed.go index db3bc34ea..a7f1ba073 100644 --- a/etcd/embed.go +++ b/etcd/embed.go @@ -210,7 +210,7 @@ func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) { e.cli = cli e.cliMu.Unlock() break - case etcdserver.ErrTimeout: + case etcdserver.ErrTimeout, etcdserver.ErrTimeoutDueToLeaderFail, etcdserver.ErrTimeoutDueToConnectionLost, etcdserver.ErrTimeoutLeaderTransfer: // sporadic timeouts are concerning but not necessarily fatal // and can usually be retried. elapsed := time.Since(start) From 749dcd69703351179a2341c2872f53a9374ec347 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 19 Jan 2022 16:57:47 -0600 Subject: [PATCH 15/29] retry on etcd timeout errors --- etcd/embed.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/etcd/embed.go b/etcd/embed.go index a7f1ba073..a74ae1c7d 100644 --- a/etcd/embed.go +++ b/etcd/embed.go @@ -210,6 +210,13 @@ func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) { e.cli = cli e.cliMu.Unlock() break + default: + msg := err.Error() + if !strings.HasPrefix(msg, "etcdserver: request timed out") { + // not a known error, also not a wrapped timeout + return errors.Wrap(err, "non-retryable error") + } + fallthrough // treat this as being like a timeout error case etcdserver.ErrTimeout, etcdserver.ErrTimeoutDueToLeaderFail, etcdserver.ErrTimeoutDueToConnectionLost, etcdserver.ErrTimeoutLeaderTransfer: // sporadic timeouts are concerning but not necessarily fatal // and can usually be retried. @@ -225,9 +232,6 @@ func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) { // from spamming these. time.Sleep(100 * time.Millisecond) break - default: - // nil, or an error we don't know about - return errors.Wrap(err, "non-retryable error") } } // if we got here, we got a total of three of some combination of From fb118959856f192118afa8fa0115abdaa60c1e99 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 19 Jan 2022 17:09:57 -0600 Subject: [PATCH 16/29] oops handle nil --- etcd/embed.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etcd/embed.go b/etcd/embed.go index a74ae1c7d..0167f6b42 100644 --- a/etcd/embed.go +++ b/etcd/embed.go @@ -210,6 +210,8 @@ func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) { e.cli = cli e.cliMu.Unlock() break + case nil: + return nil default: msg := err.Error() if !strings.HasPrefix(msg, "etcdserver: request timed out") { From 592fcbb05b72cb8fb2b3ab7eb1ad90be6d96f583 Mon Sep 17 00:00:00 2001 From: reesporte Date: Wed, 19 Jan 2022 21:20:08 -0600 Subject: [PATCH 17/29] one logger to rule them all unify logging method, actually log query for streaming and unary requests --- server/grpc.go | 61 +++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/server/grpc.go b/server/grpc.go index ee6875a42..3a0e67fe2 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -165,8 +165,8 @@ func isAllowed(requested []string, allowed []string) bool { // QuerySQL handles the SQL request and sends RowResponses to the stream. func (h *GRPCHandler) QuerySQL(req *pb.QuerySQLRequest, stream pb.Pilosa_QuerySQLServer) error { ctx := stream.Context() - uinfo := ctx.Value("userinfo") - if uinfo != nil { + uinfo, ok := ctx.Value("userinfo").(*authn.UserInfo) + if ok && uinfo != nil { // authz m := sql.NewMapper() parsed, err := m.MapSQL(req.Sql) @@ -174,13 +174,14 @@ func (h *GRPCHandler) QuerySQL(req *pb.QuerySQLRequest, stream pb.Pilosa_QuerySQ return errors.Wrap(err, "parsing SQL") } - allowed := h.perms.GetAuthorizedIndexList(uinfo.(*authn.UserInfo).Groups, authz.Read) - if !h.perms.IsAdmin(uinfo.(*authn.UserInfo).Groups) { + allowed := h.perms.GetAuthorizedIndexList(uinfo.Groups, authz.Read) + if !h.perms.IsAdmin(uinfo.Groups) { if !isAllowed(parsed.Tables, allowed) { return status.Error(codes.PermissionDenied, "insufficient permissions to access requested tables") } ctx = context.WithValue(ctx, "indices", allowed) } + LogQuery(ctx, "QuerySQL", req, h.queryLogger) } start := time.Now() @@ -272,6 +273,7 @@ func (h *GRPCHandler) QueryPQL(req *pb.QueryPQLRequest, stream pb.Pilosa_QueryPQ return status.Error(codes.PermissionDenied, "insufficient permissions to access requested indexes") } } + LogQuery(ctx, "QueryPQL", req, h.queryLogger) } t := time.Now() resp, err := h.api.Query(stream.Context(), &query) @@ -693,6 +695,8 @@ func (h *GRPCHandler) Inspect(req *pb.InspectRequest, stream pb.Pilosa_InspectSe h.logger.Infof("DEPRECATED: Inspect is deprecated, please use Extract() instead.") }) + LogQuery(stream.Context(), "Inspect", req, h.queryLogger) + index, err := h.api.Index(stream.Context(), req.Index) if err != nil { return errToStatusError(err) @@ -1561,16 +1565,17 @@ func NewGRPCServer(opts ...grpcServerOption) (*grpcServer, error) { if server.auth != nil { gopts = append(gopts, grpc.UnaryInterceptor( func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - ctx, err := Valid(ctx, info.FullMethod, server.auth, req, server.queryLogger) + ctx, err := Valid(ctx, server.auth) if err != nil { return nil, err } + LogQuery(ctx, info.FullMethod, req, server.logger) return handler(ctx, req) }, )) gopts = append(gopts, grpc.StreamInterceptor( func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - ctx, err := Valid(ss.Context(), info.FullMethod, server.auth, srv, server.queryLogger) + ctx, err := Valid(ss.Context(), server.auth) if err != nil { return err } @@ -1597,6 +1602,29 @@ func NewGRPCServer(opts ...grpcServerOption) (*grpcServer, error) { return server, nil } +// LogQuery logs requests +func LogQuery(ctx context.Context, method string, req interface{}, logger logger.Logger) { + uinfo, ok := ctx.Value("userinfo").(*authn.UserInfo) + md, _ := metadata.FromIncomingContext(ctx) + p, ok := peer.FromContext(ctx) + ip := "" + if ok { + ip = p.Addr.String() + } + ua, ok := md["user-agent"] + if !ok { + ua = []string{""} + } + switch r := req.(type) { + case *pb.QueryPQLRequest: + logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Pql) + case *pb.QuerySQLRequest: + logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Sql) + default: + logger.Infof("GRPC: %v, %v, %v, %v, %v", ip, ua, method, uinfo.UserID, uinfo.UserName) + } +} + // wrappedStream wraps around the embedded grpc.ServerStream, and intercepts the RecvMsg and // SendMsg method call. type wrappedStream struct { @@ -1616,7 +1644,7 @@ func (w *wrappedStream) SendMsg(m interface{}) error { return w.ServerStream.SendMsg(m) } -func Valid(ctx context.Context, method string, auth *authn.Auth, req interface{}, logger logger.Logger) (context.Context, error) { +func Valid(ctx context.Context, auth *authn.Auth) (context.Context, error) { md, ok := metadata.FromIncomingContext(ctx) if !ok { return ctx, status.Errorf(codes.InvalidArgument, "missing metadata") @@ -1646,24 +1674,5 @@ func Valid(ctx context.Context, method string, auth *authn.Auth, req interface{} return ctx, status.Errorf(codes.Unauthenticated, err.Error()) } - p, ok := peer.FromContext(ctx) - ip := "" - if ok { - ip = p.Addr.String() - } - ua, ok := md["user-agent"] - if !ok { - ua = []string{""} - } - - switch r := req.(type) { - case *pb.QueryPQLRequest: - logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Pql) - case *pb.QuerySQLRequest: - logger.Infof("GRPC: %v, %v, %v, %v, %v, %s", ip, ua, method, uinfo.UserID, uinfo.UserName, r.Sql) - default: - logger.Infof("GRPC: %v, %v, %v, %v, %v", ip, ua, method, uinfo.UserID, uinfo.UserName) - } - return context.WithValue(ctx, "userinfo", uinfo), nil } From 87bbca938ce0b247d25cdbd5fcb03f236ba4e442 Mon Sep 17 00:00:00 2001 From: reesporte Date: Thu, 20 Jan 2022 11:14:04 -0600 Subject: [PATCH 18/29] 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 --- api_test.go | 1 + ctl/server.go | 1 + install/featurebase.conf | 1 + server/config.go | 2 ++ server/config_internal_test.go | 7 +++++++ server/server.go | 2 +- 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/api_test.go b/api_test.go index f57bba824..98a6ba42b 100644 --- a/api_test.go +++ b/api_test.go @@ -1491,6 +1491,7 @@ admin: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe"` AuthorizeURL: "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/authorize", TokenURL: "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/token", GroupEndpointURL: "https://graph.microsoft.com/v1.0/me/transitiveMemberOf/microsoft.graph.group?$count=true", + RedirectBaseURL: "https://localhost:10101", LogoutURL: "https://login.microsoftonline.com/common/oauth2/v2.0/logout", Scopes: []string{"https://graph.microsoft.com/.default", "offline_access"}, SecretKey: "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", diff --git a/ctl/server.go b/ctl/server.go index 74f5ad888..db5300e83 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -111,6 +111,7 @@ func BuildServerFlags(cmd *cobra.Command, srv *server.Command) { flags.StringVar(&srv.Config.Auth.ClientId, "auth.client-id", srv.Config.Auth.ClientId, "Identity Provider's Application/Client ID.") flags.StringVar(&srv.Config.Auth.ClientSecret, "auth.client-secret", srv.Config.Auth.ClientSecret, "Identity Provider's Client Secret.") flags.StringVar(&srv.Config.Auth.AuthorizeURL, "auth.authorize-url", srv.Config.Auth.AuthorizeURL, "Identity Provider's Authorize URL.") + flags.StringVar(&srv.Config.Auth.RedirectBaseURL, "auth.redirect-base-url", srv.Config.Auth.RedirectBaseURL, "Base URL of the featurebase instance used to redirect IDP.") flags.StringVar(&srv.Config.Auth.TokenURL, "auth.token-url", srv.Config.Auth.TokenURL, "Identity Provider's Token URL.") flags.StringVar(&srv.Config.Auth.GroupEndpointURL, "auth.group-endpoint-url", srv.Config.Auth.GroupEndpointURL, "Identity Provider's Group endpoint URL.") flags.StringVar(&srv.Config.Auth.LogoutURL, "auth.logout-url", srv.Config.Auth.LogoutURL, "Identity Provider's Logout URL.") diff --git a/install/featurebase.conf b/install/featurebase.conf index 3389ff90d..a8894e8f9 100644 --- a/install/featurebase.conf +++ b/install/featurebase.conf @@ -381,6 +381,7 @@ log-path = "/var/log/molecula/featurebase.log" # authorize-url = "" # token-url = "" # group-endpoint-url = "" +# redirect-base-url = "" # logout-url = "" # scopes = ["", ""] # secret-key = "" diff --git a/server/config.go b/server/config.go index e3fe21fe3..fd319aa6a 100644 --- a/server/config.go +++ b/server/config.go @@ -240,6 +240,7 @@ type Auth struct { AuthorizeURL string `toml:"authorize-url"` TokenURL string `toml:"token-url"` GroupEndpointURL string `toml:"group-endpoint-url"` + RedirectBaseURL string `toml:"redirect-base-url"` LogoutURL string `toml:"logout-url"` Scopes []string `toml:"scopes"` SecretKey string `toml:"secret-key"` @@ -622,6 +623,7 @@ func (c *Config) ValidateAuth() (errors []error) { {name: "AuthorizeURL", val: c.Auth.AuthorizeURL}, {name: "TokenURL", val: c.Auth.TokenURL}, {name: "GroupEndpointURL", val: c.Auth.GroupEndpointURL}, + {name: "RedirectBaseURL", val: c.Auth.RedirectBaseURL}, {name: "LogoutURL", val: c.Auth.LogoutURL}, {name: "SecretKey", val: c.Auth.SecretKey}, {name: "QueryLogPath", val: c.Auth.QueryLogPath}, diff --git a/server/config_internal_test.go b/server/config_internal_test.go index 0dcf3ffb4..b12b58bff 100644 --- a/server/config_internal_test.go +++ b/server/config_internal_test.go @@ -309,12 +309,14 @@ func TestConfig_validateAuth(t *testing.T) { errorMesgEmpty, errorMesgEmpty, errorMesgEmpty, + errorMesgEmpty, }, Auth{ Enable: enable, ClientId: emptyString, ClientSecret: emptyString, AuthorizeURL: emptyString, + RedirectBaseURL: emptyString, TokenURL: emptyString, GroupEndpointURL: emptyString, LogoutURL: emptyString, @@ -334,6 +336,7 @@ func TestConfig_validateAuth(t *testing.T) { ClientSecret: validClientSecret, AuthorizeURL: validTestURL, TokenURL: validTestURL, + RedirectBaseURL: validTestURL, GroupEndpointURL: validTestURL, LogoutURL: validTestURL, Scopes: validStringSlice, @@ -354,6 +357,7 @@ func TestConfig_validateAuth(t *testing.T) { AuthorizeURL: validTestURL, TokenURL: invalidURL, GroupEndpointURL: invalidURL, + RedirectBaseURL: validTestURL, LogoutURL: invalidURL, Scopes: validStringSlice, SecretKey: validKey, @@ -372,6 +376,7 @@ func TestConfig_validateAuth(t *testing.T) { AuthorizeURL: validTestURL, TokenURL: validTestURL, GroupEndpointURL: validTestURL, + RedirectBaseURL: validTestURL, LogoutURL: validTestURL, Scopes: emptySlice, SecretKey: validKey, @@ -387,6 +392,7 @@ func TestConfig_validateAuth(t *testing.T) { ClientSecret: validClientSecret, AuthorizeURL: validTestURL, TokenURL: validTestURL, + RedirectBaseURL: validTestURL, GroupEndpointURL: validTestURL, LogoutURL: validTestURL, Scopes: validStringSlice, @@ -402,6 +408,7 @@ func TestConfig_validateAuth(t *testing.T) { ClientId: emptyString, ClientSecret: validString, AuthorizeURL: emptyString, + RedirectBaseURL: validTestURL, TokenURL: emptyString, GroupEndpointURL: invalidURL, LogoutURL: validTestURL, diff --git a/server/server.go b/server/server.go index 781a1a216..0d38c8c78 100644 --- a/server/server.go +++ b/server/server.go @@ -538,7 +538,7 @@ func (m *Command) SetupServer() error { } ac := m.Config.Auth - m.auth, err = authn.NewAuth(m.logger, m.listenURI.String(), ac.Scopes, ac.AuthorizeURL, ac.TokenURL, ac.GroupEndpointURL, ac.LogoutURL, ac.ClientId, ac.ClientSecret, ac.SecretKey) + m.auth, err = authn.NewAuth(m.logger, ac.RedirectBaseURL, ac.Scopes, ac.AuthorizeURL, ac.TokenURL, ac.GroupEndpointURL, ac.LogoutURL, ac.ClientId, ac.ClientSecret, ac.SecretKey) if err != nil { return errors.Wrap(err, "instantiating authN object") } From 399a11223fa9bb1735c2dcb55105e7d4090c138e Mon Sep 17 00:00:00 2001 From: reesporte Date: Thu, 20 Jan 2022 13:58:18 -0600 Subject: [PATCH 19/29] use aws to run these jobs --- .gitlab/.gitlab-ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index 6dbd26dc8..84705c4c6 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -77,6 +77,8 @@ run go tests: script: - echo "Running featurebase unit tests..." - go test ./... + tags: + - aws run go tests race: stage: test @@ -87,6 +89,8 @@ run go tests race: script: - echo "Running featurebase race tests..." - go test -race -timeout=30m ./... + tags: + - aws run go tests shardwidth22: stage: test @@ -97,7 +101,9 @@ run go tests shardwidth22: script: - echo "Running featurebase race tests..." - go test -tags=shardwidth22 ./... - + tags: + - aws + # we do coverage reporting from the future tests because the json # output is very difficult to human-read. The alternative would be to # run the regular tests twice and also run the future tests. @@ -115,6 +121,8 @@ run go tests future: paths: - coverage.out - test-report.out + tags: + - aws upload to sonarcloud: stage: test From 81fcd9c22860f0458e3c8cf7df2954f34a2469bd Mon Sep 17 00:00:00 2001 From: reesporte Date: Thu, 20 Jan 2022 14:14:25 -0600 Subject: [PATCH 20/29] fix merge conflicts --- server/grpc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/grpc.go b/server/grpc.go index fa0623ec3..4fc8fd3bd 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -182,7 +182,7 @@ func (h *GRPCHandler) QuerySQL(req *pb.QuerySQLRequest, stream pb.Pilosa_QuerySQ } allowed := h.perms.GetAuthorizedIndexList(uinfo.Groups, perm) - if !h.perms.IsAdmin(uinfo.(*authn.UserInfo).Groups) { + if !h.perms.IsAdmin(uinfo.Groups) { if !isAllowed(parsed.Tables, allowed) { return status.Error(codes.PermissionDenied, "insufficient permissions to access requested tables") } From a93c3f2f713ca1dce5b60285b75b7b31a4f070de Mon Sep 17 00:00:00 2001 From: "garrison.davis@molecula.com" Date: Fri, 21 Jan 2022 09:55:23 -0700 Subject: [PATCH 21/29] Remove go caching This will likely return when it's done in S3. --- .gitlab/.gitlab-ci.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index 84705c4c6..793e70aae 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -3,14 +3,6 @@ include: - template: Security/License-Scanning.gitlab-ci.yml - template: Security/Dependency-Scanning.gitlab-ci.yml -.go-cache: - variables: - GOPATH: $CI_PROJECT_DIR/.go - cache: - - key: $CI_COMMIT_REF_SLUG - paths: - - .go/pkg/mod/ - variables: GOVERSION: "1.16.13" @@ -24,7 +16,6 @@ stages: golangci-lint: image: golangci/golangci-lint:v1.39.0 stage: lint - extends: .go-cache allow_failure: false rules: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' @@ -71,7 +62,6 @@ run jest tests: run go tests: stage: test image: golang:$GOVERSION - extends: .go-cache rules: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: @@ -83,7 +73,6 @@ run go tests: run go tests race: stage: test image: golang:$GOVERSION - extends: .go-cache rules: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: @@ -95,7 +84,6 @@ run go tests race: run go tests shardwidth22: stage: test image: golang:$GOVERSION - extends: .go-cache rules: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: @@ -110,7 +98,6 @@ run go tests shardwidth22: run go tests future: stage: test image: golang:1.17.6 - extends: .go-cache rules: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: From b5fb9aad8434eed5e4e5383b9093129caf523a2c Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 20 Jan 2022 13:10:15 -0600 Subject: [PATCH 22/29] 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. --- .gitlab/.gitlab-ci.yml | 10 +++++----- Makefile | 16 +++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index 793e70aae..09987cadd 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -66,7 +66,7 @@ run go tests: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: - echo "Running featurebase unit tests..." - - go test ./... + - go test -timeout=30m ./... tags: - aws @@ -77,7 +77,7 @@ run go tests race: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: - echo "Running featurebase race tests..." - - go test -race -timeout=30m ./... + - go test -race -timeout=90m ./... tags: - aws @@ -88,10 +88,10 @@ run go tests shardwidth22: - if: '$CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web"' script: - echo "Running featurebase race tests..." - - go test -tags=shardwidth22 ./... + - go test -timeout=30m -tags=shardwidth22 ./... tags: - aws - + # we do coverage reporting from the future tests because the json # output is very difficult to human-read. The alternative would be to # run the regular tests twice and also run the future tests. @@ -103,7 +103,7 @@ run go tests future: script: - echo "Running featurebase unit tests..." - PKG_LIST=$(go list ./... | grep -v internal/clustertests | paste -s -d, -) - - go test -json -coverprofile=coverage.out -covermode=atomic -coverpkg=${PKG_LIST} ./... | tee test-report.out + - go test -timeout=30m -json -coverprofile=coverage.out -covermode=atomic -coverpkg=${PKG_LIST} ./... | tee test-report.out artifacts: paths: - coverage.out diff --git a/Makefile b/Makefile index 8545c0cb8..540c1f9b7 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ DOCKER_BUILD= # set to 1 to use `docker-build` instead of `build` when creating BUILD_TAGS += shardwidth$(SHARD_WIDTH) TEST_TAGS = roaringparanoia UNAME := $(shell uname -s) +TEST_TIMEOUT=30m +RACE_TEST_TIMEOUT=90m ifeq ($(UNAME), Darwin) IS_MACOS:=1 else @@ -45,11 +47,11 @@ version: # Run test suite test: - $(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v + $(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout $(TEST_TIMEOUT) # Run test suite with race flag test-race: - CGO_ENABLED=1 $(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -race -timeout 60m -v + CGO_ENABLED=1 $(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -race -timeout $(RACE_TEST_TIMEOUT) -v testv: topt testvsub @@ -64,7 +66,7 @@ testvsub: set -e; for i in boltdb client ctl http pg pql rbf roaring server sql txkey; do \ echo; echo "___ testing subpkg $$i"; \ cd $$i; pwd; \ - $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout 60m || break; \ + $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout $(RACE_TEST_TIMEOUT) || break; \ echo; echo "999 done testing subpkg $$i"; \ cd ..; \ done @@ -73,7 +75,7 @@ testvsub-race: set -e; for i in boltdb client ctl http pg pql rbf roaring server sql txkey; do \ echo; echo "___ testing subpkg $$i -race"; \ cd $$i; pwd; \ - CGO_ENABLED=1 $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -race -timeout 60m || break; \ + CGO_ENABLED=1 $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -race -timeout $(RACE_TEST_TIMEOUT) || break; \ echo; echo "999 done testing subpkg $$i -race"; \ cd ..; \ done @@ -248,20 +250,20 @@ pilosa-fsck: # Run Pilosa tests inside Docker container docker-test: - docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) golang:$(GO_VERSION) go test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) ./... + docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) golang:$(GO_VERSION) go test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -timeout $(TEST_TIMEOUT) ./... # Must use bash in order to -o pipefail; otherwise the tee will hide red tests. # run top tests, not subdirs. print summary red/green after. # The \-\-\- FAIL avoids counting the extra two FAIL strings at then bottom of log.topt. topt: mv log.topt.roar log.topt.roar.prev || true - $(eval SHELL:=/bin/bash) set -o pipefail; $(GO) test -v -timeout 60m -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.roar + $(eval SHELL:=/bin/bash) set -o pipefail; $(GO) test -v -timeout $(RACE_TEST_TIMEOUT) -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.roar @echo " log.topt.roar green: \c"; cat log.topt.roar | grep PASS |wc -l @echo " log.topt.roar red: \c"; cat log.topt.roar | grep '\-\-\- FAIL' | wc -l topt-race: mv log.topt.race log.topt.race.prev || true - $(eval SHELL:=/bin/bash) set -o pipefail; CGO_ENABLED=1 $(GO) test -race -timeout 60m -v -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.race + $(eval SHELL:=/bin/bash) set -o pipefail; CGO_ENABLED=1 $(GO) test -race -timeout $(RACE_TEST_TIMEOUT) -v -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.race @echo " log.topt.race green: \c"; cat log.topt.race | grep PASS |wc -l @echo " log.topt.race red: \c"; cat log.topt.race | grep '\-\-\- FAIL' | wc -l From b40c86c278ed3fa94740500636357be452b81832 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 20 Jan 2022 14:46:17 -0600 Subject: [PATCH 23/29] 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. --- etcd/embed.go | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/etcd/embed.go b/etcd/embed.go index 0167f6b42..696c85df2 100644 --- a/etcd/embed.go +++ b/etcd/embed.go @@ -187,6 +187,22 @@ func (e *Etcd) Close() error { // New feature: retryClient can also retry on errTimeout. const etcdRetryTimes = 3 +// newClient requests a new client which is different from the one +// passed in. if we've already changed our client (say, because someone +// else already did that) we just return that new one. +func (e *Etcd) newClient(cli *clientv3.Client) *clientv3.Client { + e.cliMu.Lock() + defer e.cliMu.Unlock() + if cli != e.cli { + cli = e.cli + // someone else already reopened. retry. + return cli + } + _ = cli.Close() + e.cli = v3client.New(e.e.Server) + return e.cli +} + func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) { e.cliMu.Lock() cli := e.cli @@ -196,29 +212,24 @@ func (e *Etcd) retryClient(fn func(cli *clientv3.Client) error) (err error) { err = fn(cli) switch err { case etcdserver.ErrLeaderChanged: - // we can't do much with an error from closing e.cli at this point, so - // we try again. - e.cliMu.Lock() - if cli != e.cli { - cli = e.cli - e.cliMu.Unlock() - // someone else already reopened. retry. - continue - } - _ = cli.Close() - cli = v3client.New(e.e.Server) - e.cli = cli - e.cliMu.Unlock() + cli = e.newClient(cli) break case nil: return nil default: msg := err.Error() - if !strings.HasPrefix(msg, "etcdserver: request timed out") { + // this shouldn't be necessary, but empirically, we sometimes + // get an error message which has this text, but the error itself + // isn't actually etcdserver.ErrLeaderChanged. + if strings.Contains(msg, "etcdserver: leader changed") { + cli = e.newClient(cli) + break + } + if !strings.Contains(msg, "etcdserver: request timed out") { // not a known error, also not a wrapped timeout return errors.Wrap(err, "non-retryable error") } - fallthrough // treat this as being like a timeout error + fallthrough // treat this as being one of the ErrTimeout derivatives, possibly wrapped. case etcdserver.ErrTimeout, etcdserver.ErrTimeoutDueToLeaderFail, etcdserver.ErrTimeoutDueToConnectionLost, etcdserver.ErrTimeoutLeaderTransfer: // sporadic timeouts are concerning but not necessarily fatal // and can usually be retried. From d50065a16f29901281d41e59ab03e4bd0ede4365 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 20 Jan 2022 14:50:45 -0600 Subject: [PATCH 24/29] 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. --- rbf/tx_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rbf/tx_test.go b/rbf/tx_test.go index 14626ce00..6f98a0fb0 100644 --- a/rbf/tx_test.go +++ b/rbf/tx_test.go @@ -140,14 +140,14 @@ func TestTx_CommitRollback(t *testing.T) { select { case <-ch1: t.Fatal("second tx started while first tx active") - case <-time.After(10 * time.Millisecond): + case <-time.After(50 * time.Millisecond): } // Finish first transaction. close(ch0) select { case <-ch1: - case <-time.After(10 * time.Millisecond): + case <-time.After(10 * time.Second): t.Fatal("second tx should have started after first tx closed") } }) From 375aaf8fbc896797478d35de29985a1a27c6f603 Mon Sep 17 00:00:00 2001 From: Seebs Date: Thu, 20 Jan 2022 16:49:20 -0600 Subject: [PATCH 25/29] 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. --- ctl/backup.go | 2 +- ctl/restore.go | 2 +- ctl/util.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ctl/backup.go b/ctl/backup.go index 302041dfe..519a604fd 100644 --- a/ctl/backup.go +++ b/ctl/backup.go @@ -60,7 +60,7 @@ func NewBackupCommand(stdin io.Reader, stdout, stderr io.Writer) *BackupCommand CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), Concurrency: 1, RetryPeriod: time.Minute, - Pprof: "localhost:43809", + Pprof: "localhost:0", } } diff --git a/ctl/restore.go b/ctl/restore.go index 9c12434f8..6cbf700b0 100644 --- a/ctl/restore.go +++ b/ctl/restore.go @@ -56,7 +56,7 @@ func NewRestoreCommand(stdin io.Reader, stdout, stderr io.Writer) *RestoreComman CmdIO: pilosa.NewCmdIO(stdin, stdout, stderr), RetryPeriod: time.Second * 30, Concurrency: 1, - Pprof: "localhost:43809", + Pprof: "localhost:0", } } diff --git a/ctl/util.go b/ctl/util.go index 60ac082c9..2a5611df6 100644 --- a/ctl/util.go +++ b/ctl/util.go @@ -40,7 +40,7 @@ func startProfilingServer(addr string, logger logger.Logger) (close func() error return nil, err } go func() { - logger.Printf("Listening for /debug/pprof/ and /debug/fgprof on '%s'", addr) + logger.Printf("Listening for /debug/pprof/ and /debug/fgprof on '%s'", ln.Addr().String()) logger.Printf("%v", s.Serve(ln)) }() From 096c44884acddfed561b3f949e25b1d0e4e6d825 Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 21 Jan 2022 10:38:51 -0600 Subject: [PATCH 26/29] fix typo in doc comment --- test/disco.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/disco.go b/test/disco.go index 847d78258..7609fea9f 100644 --- a/test/disco.go +++ b/test/disco.go @@ -38,7 +38,7 @@ func (ports *Ports) Close() error { return err3 } -// listenerPortURL builds a TCP listener and corresponding http://localhost:%d +// listenerWithURL builds a TCP listener and corresponding http://localhost:%d // URL, and returns those. func listenerWithURL() (listener *net.TCPListener, url string, err error) { l, err := net.Listen("tcp", ":0") From 03a18e9beb76d6f6fb23c94784c9fe7b3fc0fe3e Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 21 Jan 2022 10:38:56 -0600 Subject: [PATCH 27/29] 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. --- etcd/leasedkv_test.go | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/etcd/leasedkv_test.go b/etcd/leasedkv_test.go index 5d8a9444f..0366d7dd2 100644 --- a/etcd/leasedkv_test.go +++ b/etcd/leasedkv_test.go @@ -3,7 +3,8 @@ package etcd import ( "context" - "errors" + "fmt" + "net" "os" "testing" "time" @@ -11,16 +12,48 @@ import ( "github.com/molecula/featurebase/v2/disco" "github.com/molecula/featurebase/v2/logger" "github.com/molecula/featurebase/v2/testhook" + "github.com/pkg/errors" "go.etcd.io/etcd/embed" "go.etcd.io/etcd/etcdserver/api/v3client" + "go.etcd.io/etcd/pkg/types" ) const initVal = "test" const newVal = "newValue" +// listenerWithURL builds a TCP listener and corresponding http://localhost:%d +// URL, and returns those. Identical to the copy in /test, except we can't +// import that because it imports us. +func listenerWithURL() (listener *net.TCPListener, url string, err error) { + l, err := net.Listen("tcp", ":0") + if err != nil { + return listener, url, err + } + listener = l.(*net.TCPListener) + port := listener.Addr().(*net.TCPAddr).Port + url = fmt.Sprintf("http://localhost:%d", port) + return listener, url, err +} + func TestLeasedKv(t *testing.T) { cfg := embed.NewConfig() + clientListener, clientURL, err := listenerWithURL() + if err != nil { + t.Fatal(errors.Wrap(err, "creating client listener")) + } + peerListener, peerURL, err := listenerWithURL() + if err != nil { + t.Fatal(errors.Wrap(err, "creating peer listener")) + } + cfg.LPUrls = types.MustNewURLs([]string{peerURL}) + cfg.LPeerSocket = []*net.TCPListener{peerListener} + cfg.APUrls = types.MustNewURLs([]string{peerURL}) + cfg.LCUrls = types.MustNewURLs([]string{clientURL}) + cfg.LClientSocket = []*net.TCPListener{clientListener} + cfg.ACUrls = types.MustNewURLs([]string{clientURL}) + cfg.InitialCluster = cfg.Name + "=" + peerURL + dir, err := testhook.TempDir(t, "leasedkv-*") if err != nil { t.Fatal(err) From 9ebf0e21197e9edc7779a95161c47eb9f5001115 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Fri, 21 Jan 2022 09:41:17 -0700 Subject: [PATCH 28/29] Upgrade go.mod to featurebase/v3 --- Makefile | 11 ++++---- api.go | 18 ++++++------- api/client/grpc.go | 4 +-- api_test.go | 16 +++++------ audit.go | 2 +- audit_internal_test.go | 2 +- audit_test.go | 4 +-- authn/authenticate.go | 2 +- authn/authenticate_internal_test.go | 2 +- authz/authorization.go | 2 +- authz/authorization_test.go | 4 +-- boltdb/translate.go | 2 +- boltdb/translate_test.go | 8 +++--- broadcast.go | 2 +- bsi.go | 2 +- cache.go | 6 ++--- cache_test.go | 2 +- catcher.go | 6 ++--- client.go | 8 +++--- client/batch.go | 6 ++--- client/batch_test.go | 2 +- client/client.go | 14 +++++----- client/client_it_test.go | 8 +++--- client/client_test.go | 2 +- client/cluster.go | 2 +- client/cluster_test.go | 2 +- client/csv/csv.go | 2 +- client/csv/csv_it_test.go | 4 +-- client/csv/csv_test.go | 6 ++--- client/doc.go | 2 +- client/egpool/egpool_test.go | 2 +- client/ingest_api_batch.go | 2 +- client/ingest_api_batch_test.go | 4 +-- client/orm.go | 2 +- client/orm_test.go | 4 +-- client/record_test.go | 2 +- client/response.go | 2 +- client/response_test.go | 2 +- client/shardnodes.go | 2 +- cluster.go | 12 ++++----- cluster_internal_test.go | 10 +++---- cmd.go | 2 +- cmd/backup.go | 2 +- cmd/badloader/badloader.go | 8 +++--- cmd/check.go | 2 +- cmd/chksum.go | 2 +- cmd/config.go | 4 +-- cmd/convert.go | 2 +- cmd/export.go | 2 +- cmd/export_test.go | 2 +- cmd/featurebase-parse-sql/main.go | 2 +- cmd/featurebase/main.go | 2 +- cmd/generate_config.go | 2 +- cmd/import.go | 4 +-- cmd/import_test.go | 6 ++--- cmd/keygen.go | 2 +- cmd/pilosa-bench/main.go | 4 +-- cmd/random-query/main.go | 12 ++++----- cmd/random-query/main_test.go | 12 ++++----- cmd/rbf.go | 2 +- cmd/restore.go | 2 +- cmd/roaring-migrate/main.go | 10 +++---- cmd/root.go | 2 +- cmd/root_test.go | 4 +-- cmd/server.go | 8 +++--- cmd/server_test.go | 8 +++--- cmd/slurp/slurp.go | 8 +++--- ctl/backup.go | 8 +++--- ctl/check.go | 4 +-- ctl/check_test.go | 2 +- ctl/chksum.go | 4 +-- ctl/common.go | 6 ++--- ctl/config.go | 4 +-- ctl/config_test.go | 2 +- ctl/export.go | 4 +-- ctl/export_test.go | 4 +-- ctl/generate_config.go | 4 +-- ctl/import.go | 6 ++--- ctl/import_test.go | 6 ++--- ctl/inspect.go | 6 ++--- ctl/inspect_test.go | 2 +- ctl/keygen.go | 2 +- ctl/main_test.go | 2 +- ctl/rbf_check.go | 4 +-- ctl/rbf_dump.go | 4 +-- ctl/rbf_page.go | 4 +-- ctl/rbf_pages.go | 6 ++--- ctl/restore.go | 10 +++---- ctl/server.go | 4 +-- ctl/server_test.go | 2 +- ctl/util.go | 2 +- dbshard.go | 8 +++--- dbshard_internal_test.go | 10 +++---- dbshard_test.go | 12 ++++----- delete_test.go | 4 +-- diagnostics.go | 2 +- diagnostics_internal_test.go | 2 +- encoding/proto/proto.go | 16 +++++------ encoding/proto/proto_test.go | 6 ++--- etcd/embed.go | 6 ++--- etcd/leasedkv.go | 2 +- etcd/leasedkv_test.go | 6 ++--- event.go | 2 +- executor.go | 16 +++++------ executor_internal_test.go | 4 +-- executor_test.go | 24 ++++++++--------- field.go | 12 ++++----- field_internal_test.go | 10 +++---- field_test.go | 8 +++--- fragment.go | 22 +++++++-------- fragment_internal_test.go | 10 +++---- gcnotify/gcnotify.go | 2 +- gendebug_test.go | 2 +- generation.go | 6 ++--- go.mod | 3 +-- gopsutil/systeminfo.go | 2 +- gopsutil/systeminfo_test.go | 4 +-- hack.go | 4 +-- handler.go | 4 +-- hash/blake3_test.go | 2 +- holder.go | 18 ++++++------- holder_internal_test.go | 4 +-- holder_test.go | 8 +++--- http/client.go | 16 +++++------ http/client_test.go | 12 ++++----- http/handler.go | 20 +++++++------- http/handler_internal_test.go | 10 +++---- http/handler_test.go | 8 +++--- http/translator.go | 4 +-- http/translator_test.go | 6 ++--- idalloc_test.go | 2 +- index.go | 8 +++--- index_internal_test.go | 2 +- index_test.go | 10 +++---- ingest/codec_test.go | 2 +- ingest/op.go | 2 +- ingest/op_test.go | 2 +- ingest/update.go | 2 +- ingest_test.go | 6 ++--- internal/clustertests/cluster_test.go | 6 ++--- internal/clustertests/docker-compose.yml | 2 +- internal/clustertests/pause_node_test.go | 12 ++++----- internal/test/querygenerator.go | 2 +- internal/test/querygenerator_test.go | 2 +- iterator.go | 2 +- logger/filewriter_test.go | 2 +- main_test.go | 2 +- mmap_test.go | 4 +-- mock/translator.go | 2 +- pg/pgtest/handler.go | 2 +- pg/pgtest/server.go | 2 +- pg/pgtest/tls.go | 2 +- pg/protocol.go | 4 +-- pg/query.go | 2 +- pg/server.go | 2 +- pg/server_test.go | 6 ++--- pg/type.go | 2 +- pilosa.go | 6 ++--- pilosa_internal_test.go | 4 +-- pilosa_test.go | 4 +-- planner.go | 4 +-- planner_test.go | 4 +-- pprof.go | 4 +-- pql/ast_test.go | 2 +- pql/decimal_test.go | 2 +- pql/parser_test.go | 4 +-- prometheus/prometheus.go | 4 +-- prometheus/prometheus_test.go | 2 +- proto/vdsm/vdsm.pb.go | 2 +- rbf.go | 12 ++++----- rbf/array.go | 2 +- rbf/cfg/cfg.go | 2 +- rbf/cursor.go | 2 +- rbf/cursor_internal_test.go | 4 +-- rbf/cursor_test.go | 4 +-- rbf/cursorx.go | 2 +- rbf/db.go | 6 ++--- rbf/db_test.go | 4 +-- rbf/ingest_test.go | 10 +++---- rbf/rbf.go | 6 ++--- rbf/rbf_test.go | 8 +++--- rbf/tx.go | 6 ++--- rbf/tx_test.go | 4 +-- rbf/util.go | 4 +-- rbf/util_test.go | 6 ++--- roaring/benchpretty/main.go | 2 +- roaring/filter.go | 2 +- roaring/filter_internal_test.go | 2 +- roaring/printutil.go | 2 +- roaring/printutil_test.go | 2 +- roaring/roaring_internal_test.go | 2 +- roaring/roaring_stats.go | 2 +- roaring/roaring_test.go | 8 +++--- row.go | 4 +-- row_test.go | 2 +- rrtx.go | 8 +++--- rrtx_internal_test.go | 2 +- server.go | 18 ++++++------- server/cluster_test.go | 8 +++--- server/config.go | 10 +++---- server/config_test.go | 4 +-- server/grpc.go | 18 ++++++------- server/grpc_test.go | 18 ++++++------- server/handler_test.go | 14 +++++----- server/pg.go | 14 +++++----- server/pg_internal_test.go | 4 +-- server/pg_test.go | 12 ++++----- server/server.go | 34 ++++++++++++------------ server/server_test.go | 16 +++++------ server/sql.go | 8 +++--- server/tlsconfig.go | 2 +- server/trial.go | 2 +- server_internal_test.go | 4 +-- shardwidth/helper_test.go | 2 +- snapshotqueue.go | 4 +-- sql/ddl.go | 4 +-- sql/extract.go | 4 +-- sql/handler_test.go | 4 +-- sql/mapper.go | 2 +- sql/model.go | 2 +- sql/reduce.go | 6 ++--- sql/reduce_test.go | 2 +- sql/select.go | 6 ++--- sql/show.go | 4 +-- sql2/ast_test.go | 2 +- sql2/parser_test.go | 2 +- sql2/scanner_test.go | 2 +- sql2/token_test.go | 2 +- statik/filesystem.go | 2 +- stats/stats.go | 2 +- stats/stats_test.go | 10 +++---- statsd/statsd.go | 4 +-- statsd/statsd_test.go | 4 +-- stattx.go | 8 +++--- test/cluster.go | 14 +++++----- test/disco.go | 6 ++--- test/field.go | 2 +- test/holder.go | 8 +++--- test/index.go | 4 +-- test/pilosa.go | 12 ++++----- test/pilosa_test.go | 4 +-- test/transaction.go | 2 +- testhook/auditor_test.go | 2 +- topology/node.go | 4 +-- topology/snapshot.go | 4 +-- tracing/opentracing/opentracing.go | 4 +-- transaction.go | 2 +- transaction_test.go | 6 ++--- translate.go | 4 +-- translator_test.go | 14 +++++----- tx.go | 6 ++--- tx_internal_test.go | 2 +- tx_test.go | 12 ++++----- txfactory.go | 4 +-- util.go | 2 +- utils_internal_test.go | 6 ++--- version.go | 2 +- view.go | 10 +++---- view_internal_test.go | 4 +-- 259 files changed, 695 insertions(+), 697 deletions(-) diff --git a/Makefile b/Makefile index 540c1f9b7..b98e3c803 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ .PHONY: build check-clean clean build-lattice cover cover-viz default docker docker-build docker-test docker-tag-push generate generate-protoc generate-pql generate-statik gometalinter install install-build-deps install-golangci-lint install-gometalinter install-protoc install-protoc-gen-gofast install-peg install-statik release release-build test testv testv-race testvsub testvsub-race test-txstore-rbf CLONE_URL=github.com/pilosa/pilosa -MOD_VERSION=v2 VERSION := $(shell git describe --tags 2> /dev/null || echo unknown) VARIANT = Molecula GO=go @@ -13,7 +12,7 @@ BRANCH_ID := $(BRANCH)-$(GOOS)-$(GOARCH) BUILD_TIME := $(shell date -u +%FT%T%z) SHARD_WIDTH = 20 COMMIT := $(shell git describe --exact-match >/dev/null 2>&1 || git rev-parse --short HEAD) -LDFLAGS="-X github.com/molecula/featurebase/v2.Version=$(VERSION) -X github.com/molecula/featurebase/v2.BuildTime=$(BUILD_TIME) -X github.com/molecula/featurebase/v2.Variant=$(VARIANT) -X github.com/molecula/featurebase/v2.Commit=$(COMMIT) -X github.com/molecula/featurebase/v2.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.16.10 DOCKER_BUILD= # set to 1 to use `docker-build` instead of `build` when creating a release BUILD_TAGS += shardwidth$(SHARD_WIDTH) @@ -170,11 +169,11 @@ build-lattice: # `go generate` protocol buffers generate-protoc: require-protoc require-protoc-gen-gofast - $(GO) generate github.com/molecula/featurebase/v2/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/molecula/featurebase/v2/statik + $(GO) generate github.com/molecula/featurebase/v3/statik # `go generate` statik assets (lattice UI) in Docker generate-statik-docker: build-lattice @@ -182,7 +181,7 @@ generate-statik-docker: build-lattice # `go generate` stringers generate-stringer: - $(GO) generate github.com/molecula/featurebase/v2 + $(GO) generate github.com/molecula/featurebase/v3 generate-pql: require-peg cd pql && peg -inline pql.peg && cd .. @@ -193,7 +192,7 @@ generate-proto-grpc: require-protoc require-protoc-gen-go # TODO: Modify above commands and remove the below mv if possible. # See https://go-review.googlesource.com/c/protobuf/+/219298/ for info on --go-opt # I couldn't get it to work during development - Cody - cp -r proto/github.com/molecula/featurebase/v2/proto/ proto/ + cp -r proto/github.com/molecula/featurebase/v3/proto/ proto/ rm -rf proto/github.com # `go generate` all needed packages diff --git a/api.go b/api.go index fdee2f8f7..a373b0a1b 100644 --- a/api.go +++ b/api.go @@ -21,16 +21,16 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/rbf" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/rbf" - //"github.com/molecula/featurebase/v2/pg" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/tracing" + //"github.com/molecula/featurebase/v3/pg" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/api/client/grpc.go b/api/client/grpc.go index bb1479612..2bad9f413 100644 --- a/api/client/grpc.go +++ b/api/client/grpc.go @@ -6,8 +6,8 @@ import ( "crypto/tls" "sync" - "github.com/molecula/featurebase/v2/logger" - pb "github.com/molecula/featurebase/v2/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" diff --git a/api_test.go b/api_test.go index 98a6ba42b..0c7c63287 100644 --- a/api_test.go +++ b/api_test.go @@ -19,14 +19,14 @@ import ( "time" "github.com/golang-jwt/jwt" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/shardwidth" - "github.com/molecula/featurebase/v2/test" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/http" + "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 ) func TestAPI_Import(t *testing.T) { diff --git a/audit.go b/audit.go index c86e56b74..6ffd28eb9 100644 --- a/audit.go +++ b/audit.go @@ -2,7 +2,7 @@ package pilosa import ( - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) var NewAuditor func() testhook.Auditor = NewNopAuditor diff --git a/audit_internal_test.go b/audit_internal_test.go index 6382d9588..70cce7d2d 100644 --- a/audit_internal_test.go +++ b/audit_internal_test.go @@ -5,7 +5,7 @@ import ( "fmt" "reflect" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) // These audit hooks are desireable during testing, but not in diff --git a/audit_test.go b/audit_test.go index c887a2398..112f8bbfd 100644 --- a/audit_test.go +++ b/audit_test.go @@ -6,8 +6,8 @@ import ( "os" "reflect" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/testhook" ) // AuditLeaksOn is a global switch to turn on resource diff --git a/authn/authenticate.go b/authn/authenticate.go index 73b325055..037d30d14 100644 --- a/authn/authenticate.go +++ b/authn/authenticate.go @@ -15,7 +15,7 @@ import ( "time" "github.com/golang-jwt/jwt" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" "golang.org/x/oauth2" ) diff --git a/authn/authenticate_internal_test.go b/authn/authenticate_internal_test.go index f937510d5..3eed3878c 100644 --- a/authn/authenticate_internal_test.go +++ b/authn/authenticate_internal_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" ) func TestAuth(t *testing.T) { diff --git a/authz/authorization.go b/authz/authorization.go index 1cd0d3dc1..bd57ff521 100644 --- a/authz/authorization.go +++ b/authz/authorization.go @@ -19,7 +19,7 @@ import ( "io" "io/ioutil" - "github.com/molecula/featurebase/v2/authn" + "github.com/molecula/featurebase/v3/authn" "gopkg.in/yaml.v2" ) diff --git a/authz/authorization_test.go b/authz/authorization_test.go index 0b0f9dbbe..5bc0602dc 100644 --- a/authz/authorization_test.go +++ b/authz/authorization_test.go @@ -20,8 +20,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/authz" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/authz" ) func TestAuth_ReadPermissionsFile(t *testing.T) { diff --git a/boltdb/translate.go b/boltdb/translate.go index 939be909c..8ff56f7e4 100644 --- a/boltdb/translate.go +++ b/boltdb/translate.go @@ -12,7 +12,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" "github.com/pkg/errors" bolt "go.etcd.io/bbolt" diff --git a/boltdb/translate_test.go b/boltdb/translate_test.go index c1640d62e..201971644 100644 --- a/boltdb/translate_test.go +++ b/boltdb/translate_test.go @@ -10,10 +10,10 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/topology" ) //var vv = pilosa.VV diff --git a/broadcast.go b/broadcast.go index 022508855..663044497 100644 --- a/broadcast.go +++ b/broadcast.go @@ -4,7 +4,7 @@ package pilosa import ( "fmt" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" ) diff --git a/bsi.go b/bsi.go index 7e776d64b..719404897 100644 --- a/bsi.go +++ b/bsi.go @@ -4,7 +4,7 @@ package pilosa import ( "math/bits" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" ) // bsiData contains BSI-structured data. diff --git a/cache.go b/cache.go index 11a9e58ac..4dd5d5e4c 100644 --- a/cache.go +++ b/cache.go @@ -10,9 +10,9 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/lru" - pb "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/stats" + "github.com/molecula/featurebase/v3/lru" + pb "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/stats" "github.com/pkg/errors" ) diff --git a/cache_test.go b/cache_test.go index d3691e5b4..1ff8d0fff 100644 --- a/cache_test.go +++ b/cache_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) // Ensure cache stays constrained to its configured size. diff --git a/catcher.go b/catcher.go index e1c5fd4d9..a1f128d65 100644 --- a/catcher.go +++ b/catcher.go @@ -2,9 +2,9 @@ package pilosa import ( - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/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 diff --git a/client.go b/client.go index 75741fcd3..35e3230de 100644 --- a/client.go +++ b/client.go @@ -6,9 +6,9 @@ import ( "io" "time" - "github.com/molecula/featurebase/v2/ingest" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3/ingest" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/topology" ) // Bit represents the intersection of a row and a column. It can be specified by @@ -36,7 +36,7 @@ type FieldValue struct { // While I understand that putting the entire Client behind an interface might require this many methods, // I don't want to let it go unquestioned. // Another note from Travis: I think we eventually want to unify `InternalClient` with -// the `github.com/molecula/featurebase/v2/client` client. +// the `github.com/molecula/featurebase/v3/client` client. // Doing that may obviate the need to refactor this. type InternalClient interface { InternalQueryClient diff --git a/client/batch.go b/client/batch.go index 182d4e476..87a8952ee 100644 --- a/client/batch.go +++ b/client/batch.go @@ -6,9 +6,9 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/client/egpool" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/client/egpool" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/client/batch_test.go b/client/batch_test.go index cc8ab891f..8823a5099 100644 --- a/client/batch_test.go +++ b/client/batch_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/test" "github.com/pkg/errors" ) diff --git a/client/client.go b/client/client.go index 082a56634..bc5740514 100644 --- a/client/client.go +++ b/client/client.go @@ -20,13 +20,13 @@ import ( "time" "github.com/golang/protobuf/proto" //nolint:staticcheck - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/logger" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/pb" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/stats" + pilosa "github.com/molecula/featurebase/v3" + "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/stats" "github.com/opentracing/opentracing-go" "github.com/pkg/errors" "golang.org/x/sync/errgroup" diff --git a/client/client_it_test.go b/client/client_it_test.go index ef79f105c..ff8614d78 100644 --- a/client/client_it_test.go +++ b/client/client_it_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/disco" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/shardwidth" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/disco" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/shardwidth" + "github.com/molecula/featurebase/v3/test" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" ) diff --git a/client/client_test.go b/client/client_test.go index ea073eaac..170cf5093 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -10,7 +10,7 @@ import ( "reflect" "testing" - pnet "github.com/molecula/featurebase/v2/net" + pnet "github.com/molecula/featurebase/v3/net" ) func TestQueryWithError(t *testing.T) { diff --git a/client/cluster.go b/client/cluster.go index dfc407ddb..0f1230583 100644 --- a/client/cluster.go +++ b/client/cluster.go @@ -7,7 +7,7 @@ package client import ( "sync" - pnet "github.com/molecula/featurebase/v2/net" + pnet "github.com/molecula/featurebase/v3/net" ) // Cluster contains hosts in a Pilosa cluster. diff --git a/client/cluster_test.go b/client/cluster_test.go index 797427371..36790b7f8 100644 --- a/client/cluster_test.go +++ b/client/cluster_test.go @@ -7,7 +7,7 @@ package client import ( "testing" - pnet "github.com/molecula/featurebase/v2/net" + pnet "github.com/molecula/featurebase/v3/net" ) func TestNewClusterWithHost(t *testing.T) { diff --git a/client/csv/csv.go b/client/csv/csv.go index e2dd8f6a2..a0797c52d 100644 --- a/client/csv/csv.go +++ b/client/csv/csv.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/molecula/featurebase/v2/client" + "github.com/molecula/featurebase/v3/client" ) // Format is the format of the data in the CSV file. diff --git a/client/csv/csv_it_test.go b/client/csv/csv_it_test.go index de901816c..c530b3147 100644 --- a/client/csv/csv_it_test.go +++ b/client/csv/csv_it_test.go @@ -10,8 +10,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/client" - "github.com/molecula/featurebase/v2/client/csv" + "github.com/molecula/featurebase/v3/client" + "github.com/molecula/featurebase/v3/client/csv" ) func TestCSVIterate(t *testing.T) { diff --git a/client/csv/csv_test.go b/client/csv/csv_test.go index 870237fb3..3be57f12d 100644 --- a/client/csv/csv_test.go +++ b/client/csv/csv_test.go @@ -8,9 +8,9 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/client" - "github.com/molecula/featurebase/v2/client/csv" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/client" + "github.com/molecula/featurebase/v3/client/csv" ) func TestCSVColumnIterator(t *testing.T) { diff --git a/client/doc.go b/client/doc.go index afd6cc244..5c519c819 100644 --- a/client/doc.go +++ b/client/doc.go @@ -11,7 +11,7 @@ Usage: import ( "fmt" - "github.com/molecula/featurebase/v2/client" + "github.com/molecula/featurebase/v3/client" ) // Create a Client instance diff --git a/client/egpool/egpool_test.go b/client/egpool/egpool_test.go index 4413b813b..af5132e50 100644 --- a/client/egpool/egpool_test.go +++ b/client/egpool/egpool_test.go @@ -5,7 +5,7 @@ import ( "errors" "testing" - "github.com/molecula/featurebase/v2/client/egpool" + "github.com/molecula/featurebase/v3/client/egpool" ) func TestEGPool(t *testing.T) { diff --git a/client/ingest_api_batch.go b/client/ingest_api_batch.go index 2f6d35d5e..a1ae7a1c5 100644 --- a/client/ingest_api_batch.go +++ b/client/ingest_api_batch.go @@ -3,7 +3,7 @@ package client import ( "time" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" ) diff --git a/client/ingest_api_batch_test.go b/client/ingest_api_batch_test.go index ff5692b1b..9abfa15c6 100644 --- a/client/ingest_api_batch_test.go +++ b/client/ingest_api_batch_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/test" ) func TestIngestAPIBatchAdd(t *testing.T) { diff --git a/client/orm.go b/client/orm.go index 0c4262d63..ddb77bbd4 100644 --- a/client/orm.go +++ b/client/orm.go @@ -13,7 +13,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/pql" "github.com/pkg/errors" ) diff --git a/client/orm_test.go b/client/orm_test.go index 595710e53..650d113c3 100644 --- a/client/orm_test.go +++ b/client/orm_test.go @@ -13,8 +13,8 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pql" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pql" "github.com/pkg/errors" ) diff --git a/client/record_test.go b/client/record_test.go index b2aa892c8..7cb23b216 100644 --- a/client/record_test.go +++ b/client/record_test.go @@ -7,7 +7,7 @@ package client_test import ( "testing" - "github.com/molecula/featurebase/v2/client" + "github.com/molecula/featurebase/v3/client" ) func TestColumnShard(t *testing.T) { diff --git a/client/response.go b/client/response.go index b7ad51a84..8aa3c8c1a 100644 --- a/client/response.go +++ b/client/response.go @@ -8,7 +8,7 @@ import ( "encoding/json" "fmt" - "github.com/molecula/featurebase/v2/pb" + "github.com/molecula/featurebase/v3/pb" ) // QueryResponse types. diff --git a/client/response_test.go b/client/response_test.go index 41bd0b916..7cce0de22 100644 --- a/client/response_test.go +++ b/client/response_test.go @@ -11,7 +11,7 @@ import ( "reflect" "testing" - "github.com/molecula/featurebase/v2/pb" + "github.com/molecula/featurebase/v3/pb" ) func TestNewRowResultFromInternal(t *testing.T) { diff --git a/client/shardnodes.go b/client/shardnodes.go index 332cb818c..52161be35 100644 --- a/client/shardnodes.go +++ b/client/shardnodes.go @@ -7,7 +7,7 @@ package client import ( "sync" - pnet "github.com/molecula/featurebase/v2/net" + pnet "github.com/molecula/featurebase/v3/net" ) type shardNodes struct { diff --git a/cluster.go b/cluster.go index 6ae257352..1f45d2c15 100644 --- a/cluster.go +++ b/cluster.go @@ -10,12 +10,12 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/tracing" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/cluster_internal_test.go b/cluster_internal_test.go index fa3afd983..e2261a41f 100644 --- a/cluster_internal_test.go +++ b/cluster_internal_test.go @@ -12,11 +12,11 @@ import ( "time" "github.com/davecgh/go-spew/spew" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/topology" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/topology" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) // Ensure that fragCombos creates the correct fragment mapping. diff --git a/cmd.go b/cmd.go index 05036b941..73f54d17f 100644 --- a/cmd.go +++ b/cmd.go @@ -4,7 +4,7 @@ package pilosa import ( "io" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" ) // CmdIO holds standard unix inputs and outputs. diff --git a/cmd/backup.go b/cmd/backup.go index 28712123d..0a0d5dd28 100644 --- a/cmd/backup.go +++ b/cmd/backup.go @@ -5,7 +5,7 @@ import ( "context" "io" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" "github.com/spf13/cobra" ) diff --git a/cmd/badloader/badloader.go b/cmd/badloader/badloader.go index f95d0a649..642137575 100644 --- a/cmd/badloader/badloader.go +++ b/cmd/badloader/badloader.go @@ -12,10 +12,10 @@ import ( "io/ioutil" gohttp "net/http" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/vprint" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/vprint" "os" "strconv" diff --git a/cmd/check.go b/cmd/check.go index ac1700e07..f22dcd3a0 100644 --- a/cmd/check.go +++ b/cmd/check.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" ) var checker *ctl.CheckCommand diff --git a/cmd/chksum.go b/cmd/chksum.go index a9fa14b0c..54a8643f9 100644 --- a/cmd/chksum.go +++ b/cmd/chksum.go @@ -5,7 +5,7 @@ import ( "context" "io" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" "github.com/spf13/cobra" ) diff --git a/cmd/config.go b/cmd/config.go index 19d6bad7e..fc3e11b24 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -7,8 +7,8 @@ import ( "github.com/spf13/cobra" - "github.com/molecula/featurebase/v2/ctl" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3/ctl" + "github.com/molecula/featurebase/v3/server" ) var conf *ctl.ConfigCommand diff --git a/cmd/convert.go b/cmd/convert.go index 4b86eff60..2a9f5711a 100644 --- a/cmd/convert.go +++ b/cmd/convert.go @@ -8,7 +8,7 @@ import ( "github.com/spf13/cobra" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" ) var inspector *ctl.InspectCommand diff --git a/cmd/export.go b/cmd/export.go index 8d97b742f..aae8f13d9 100644 --- a/cmd/export.go +++ b/cmd/export.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" ) var Exporter *ctl.ExportCommand diff --git a/cmd/export_test.go b/cmd/export_test.go index 1ff43a2ab..4a97ece8c 100644 --- a/cmd/export_test.go +++ b/cmd/export_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/cmd" + "github.com/molecula/featurebase/v3/cmd" ) func TestExportHelp(t *testing.T) { diff --git a/cmd/featurebase-parse-sql/main.go b/cmd/featurebase-parse-sql/main.go index d3143e419..10dcfc3cd 100644 --- a/cmd/featurebase-parse-sql/main.go +++ b/cmd/featurebase-parse-sql/main.go @@ -9,7 +9,7 @@ import ( "os" "strings" - "github.com/molecula/featurebase/v2/sql2" + "github.com/molecula/featurebase/v3/sql2" ) func main() { diff --git a/cmd/featurebase/main.go b/cmd/featurebase/main.go index f185eac29..42f814fe0 100644 --- a/cmd/featurebase/main.go +++ b/cmd/featurebase/main.go @@ -8,7 +8,7 @@ import ( "fmt" "os" - "github.com/molecula/featurebase/v2/cmd" + "github.com/molecula/featurebase/v3/cmd" ) func main() { diff --git a/cmd/generate_config.go b/cmd/generate_config.go index 2ee184ab9..ce671f886 100644 --- a/cmd/generate_config.go +++ b/cmd/generate_config.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" ) var generateConf *ctl.GenerateConfigCommand diff --git a/cmd/import.go b/cmd/import.go index 0ad7e293c..243f440e8 100644 --- a/cmd/import.go +++ b/cmd/import.go @@ -5,8 +5,8 @@ import ( "context" "io" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/ctl" "github.com/spf13/cobra" ) diff --git a/cmd/import_test.go b/cmd/import_test.go index d3713b67a..bc640dc82 100644 --- a/cmd/import_test.go +++ b/cmd/import_test.go @@ -5,10 +5,10 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" - "github.com/molecula/featurebase/v2/cmd" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/cmd" + "github.com/molecula/featurebase/v3/pql" ) func TestImportHelp(t *testing.T) { diff --git a/cmd/keygen.go b/cmd/keygen.go index 527a7ca3d..8bf9166f0 100644 --- a/cmd/keygen.go +++ b/cmd/keygen.go @@ -5,7 +5,7 @@ import ( "context" "io" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" "github.com/spf13/cobra" ) diff --git a/cmd/pilosa-bench/main.go b/cmd/pilosa-bench/main.go index 8f1569028..15c7f4e6b 100644 --- a/cmd/pilosa-bench/main.go +++ b/cmd/pilosa-bench/main.go @@ -16,8 +16,8 @@ import ( "strings" "time" - "github.com/molecula/featurebase/v2" - phttp "github.com/molecula/featurebase/v2/http" + "github.com/molecula/featurebase/v3" + phttp "github.com/molecula/featurebase/v3/http" "golang.org/x/sync/errgroup" ) diff --git a/cmd/random-query/main.go b/cmd/random-query/main.go index ed4416a28..282e9034b 100644 --- a/cmd/random-query/main.go +++ b/cmd/random-query/main.go @@ -16,12 +16,12 @@ import ( "time" "github.com/gogo/protobuf/proto" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/client" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/pb" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/vprint" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/client" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/pb" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" vegeta "github.com/tsenart/vegeta/v12/lib" ) diff --git a/cmd/random-query/main_test.go b/cmd/random-query/main_test.go index 6f17c6518..2c847217f 100644 --- a/cmd/random-query/main_test.go +++ b/cmd/random-query/main_test.go @@ -7,12 +7,12 @@ import ( "strconv" "testing" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func Test_RandomQuery(t *testing.T) { diff --git a/cmd/rbf.go b/cmd/rbf.go index 15c9900fd..b7c1925c4 100644 --- a/cmd/rbf.go +++ b/cmd/rbf.go @@ -8,7 +8,7 @@ import ( "io" "strconv" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" "github.com/spf13/cobra" ) diff --git a/cmd/restore.go b/cmd/restore.go index bc9271d0e..071463714 100644 --- a/cmd/restore.go +++ b/cmd/restore.go @@ -5,7 +5,7 @@ import ( "context" "io" - "github.com/molecula/featurebase/v2/ctl" + "github.com/molecula/featurebase/v3/ctl" "github.com/spf13/cobra" ) diff --git a/cmd/roaring-migrate/main.go b/cmd/roaring-migrate/main.go index 4ca91bec0..72e6fa94a 100644 --- a/cmd/roaring-migrate/main.go +++ b/cmd/roaring-migrate/main.go @@ -12,11 +12,11 @@ import ( "strings" "syscall" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/rbf" - "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/rbf" + "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/roaring" + txkey "github.com/molecula/featurebase/v3/short_txkey" "github.com/spf13/cobra" ) diff --git a/cmd/root.go b/cmd/root.go index c164bed97..f32cc5875 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,7 +6,7 @@ import ( "io" "strings" - pilosa "github.com/molecula/featurebase/v2" + pilosa "github.com/molecula/featurebase/v3" "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" diff --git a/cmd/root_test.go b/cmd/root_test.go index 23a36cd8c..00f2072d8 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -12,8 +12,8 @@ import ( "time" - "github.com/molecula/featurebase/v2/cmd" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/cmd" + "github.com/molecula/featurebase/v3/testhook" "github.com/spf13/cobra" ) diff --git a/cmd/server.go b/cmd/server.go index 60a541a0f..e03266d5b 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -4,10 +4,10 @@ package cmd import ( "io" - "github.com/molecula/featurebase/v2/ctl" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/tracing" - "github.com/molecula/featurebase/v2/tracing/opentracing" + "github.com/molecula/featurebase/v3/ctl" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/tracing" + "github.com/molecula/featurebase/v3/tracing/opentracing" "github.com/pkg/errors" "github.com/spf13/cobra" jaegercfg "github.com/uber/jaeger-client-go/config" diff --git a/cmd/server_test.go b/cmd/server_test.go index 0843822b1..f2d3cf057 100644 --- a/cmd/server_test.go +++ b/cmd/server_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/cmd" - _ "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/toml" + "github.com/molecula/featurebase/v3/cmd" + _ "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/toml" "github.com/pkg/errors" ) diff --git a/cmd/slurp/slurp.go b/cmd/slurp/slurp.go index 800a5a773..8b4eaef85 100644 --- a/cmd/slurp/slurp.go +++ b/cmd/slurp/slurp.go @@ -17,10 +17,10 @@ import ( "strings" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/vprint" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/vprint" ) // slurp: slurp is a load-tester for importing bulk data. diff --git a/ctl/backup.go b/ctl/backup.go index 519a604fd..8d3aa4e1a 100644 --- a/ctl/backup.go +++ b/ctl/backup.go @@ -12,10 +12,10 @@ import ( "path/filepath" "time" - pilosa "github.com/molecula/featurebase/v2" - fb_http "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/topology" + pilosa "github.com/molecula/featurebase/v3" + fb_http "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/ctl/check.go b/ctl/check.go index da3a3412a..655394757 100644 --- a/ctl/check.go +++ b/ctl/check.go @@ -9,8 +9,8 @@ import ( "path/filepath" "syscall" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/ctl/check_test.go b/ctl/check_test.go index cad35a4c3..229fcff44 100644 --- a/ctl/check_test.go +++ b/ctl/check_test.go @@ -10,7 +10,7 @@ import ( "context" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func TestCheckCommand_RunCacheFile(t *testing.T) { diff --git a/ctl/chksum.go b/ctl/chksum.go index af2430efb..5b10d56c9 100644 --- a/ctl/chksum.go +++ b/ctl/chksum.go @@ -8,8 +8,8 @@ import ( "io" "github.com/cespare/xxhash" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/server" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/server" ) // ChkSumCommand represents a command for backing up a Pilosa node. diff --git a/ctl/common.go b/ctl/common.go index 558cdece3..028a1250a 100644 --- a/ctl/common.go +++ b/ctl/common.go @@ -7,9 +7,9 @@ import ( gohttp "net/http" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/server" "github.com/pkg/errors" "github.com/spf13/pflag" ) diff --git a/ctl/config.go b/ctl/config.go index 526997cc0..cd4331e18 100644 --- a/ctl/config.go +++ b/ctl/config.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/server" toml "github.com/pelletier/go-toml" ) diff --git a/ctl/config_test.go b/ctl/config_test.go index a251ae008..9594229ad 100644 --- a/ctl/config_test.go +++ b/ctl/config_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3/server" ) func TestConfigCommand_Run(t *testing.T) { diff --git a/ctl/export.go b/ctl/export.go index 8df67c79e..43c988693 100644 --- a/ctl/export.go +++ b/ctl/export.go @@ -6,8 +6,8 @@ import ( "io" "os" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/server" "github.com/pkg/errors" ) diff --git a/ctl/export_test.go b/ctl/export_test.go index 144ad3417..8dbdf08c3 100644 --- a/ctl/export_test.go +++ b/ctl/export_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/test" ) func TestExportCommand_Validation(t *testing.T) { diff --git a/ctl/generate_config.go b/ctl/generate_config.go index 96ae06f56..634b69ff9 100644 --- a/ctl/generate_config.go +++ b/ctl/generate_config.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/server" "github.com/pelletier/go-toml" "github.com/pkg/errors" ) diff --git a/ctl/import.go b/ctl/import.go index f6ecf148c..34689ec9c 100644 --- a/ctl/import.go +++ b/ctl/import.go @@ -11,9 +11,9 @@ import ( "strconv" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/server" "github.com/pkg/errors" ) diff --git a/ctl/import_test.go b/ctl/import_test.go index fd3a2d66b..b9327bb9b 100644 --- a/ctl/import_test.go +++ b/ctl/import_test.go @@ -14,9 +14,9 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/testhook" ) func TestImportCommand_Validation(t *testing.T) { diff --git a/ctl/inspect.go b/ctl/inspect.go index 0848c9cbf..73d197501 100644 --- a/ctl/inspect.go +++ b/ctl/inspect.go @@ -19,9 +19,9 @@ import ( "unsafe" "github.com/gogo/protobuf/proto" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pb" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pb" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/ctl/inspect_test.go b/ctl/inspect_test.go index 94ed12937..3528edbe7 100644 --- a/ctl/inspect_test.go +++ b/ctl/inspect_test.go @@ -9,7 +9,7 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func TestInspectCommand_Run(t *testing.T) { diff --git a/ctl/keygen.go b/ctl/keygen.go index 001cad9f9..19b4f8026 100644 --- a/ctl/keygen.go +++ b/ctl/keygen.go @@ -7,7 +7,7 @@ import ( "io" "github.com/gorilla/securecookie" - pilosa "github.com/molecula/featurebase/v2" + pilosa "github.com/molecula/featurebase/v3" ) // Keygen represents a command for generating a cryptographic key. diff --git a/ctl/main_test.go b/ctl/main_test.go index e4c50bb9b..cbd81d2ff 100644 --- a/ctl/main_test.go +++ b/ctl/main_test.go @@ -9,7 +9,7 @@ import ( _ "net/http/pprof" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func TestMain(m *testing.M) { diff --git a/ctl/rbf_check.go b/ctl/rbf_check.go index f3d40912d..cc6ec3465 100644 --- a/ctl/rbf_check.go +++ b/ctl/rbf_check.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/rbf" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/rbf" ) // RBFCheckCommand represents a command for running a consistency check on RBF. diff --git a/ctl/rbf_dump.go b/ctl/rbf_dump.go index 992318de6..cfaa120e1 100644 --- a/ctl/rbf_dump.go +++ b/ctl/rbf_dump.go @@ -8,8 +8,8 @@ import ( "io" "strings" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/rbf" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/rbf" ) // RBFDumpCommand represents a command for dumping raw data for an RBF page. diff --git a/ctl/rbf_page.go b/ctl/rbf_page.go index 1af1e9335..eb0a71c7f 100644 --- a/ctl/rbf_page.go +++ b/ctl/rbf_page.go @@ -6,8 +6,8 @@ import ( "fmt" "io" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/rbf" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/rbf" ) // RBFPageCommand represents a command for printing data for a single RBF page. diff --git a/ctl/rbf_pages.go b/ctl/rbf_pages.go index b774175ae..75c6ba59a 100644 --- a/ctl/rbf_pages.go +++ b/ctl/rbf_pages.go @@ -6,9 +6,9 @@ import ( "fmt" "io" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/rbf" - "github.com/molecula/featurebase/v2/txkey" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/rbf" + "github.com/molecula/featurebase/v3/txkey" ) // RBFPagesCommand represents a command for printing a list of RBF page metadata. diff --git a/ctl/restore.go b/ctl/restore.go index 6cbf700b0..b40b25b78 100644 --- a/ctl/restore.go +++ b/ctl/restore.go @@ -17,11 +17,11 @@ import ( "github.com/hashicorp/go-retryablehttp" - pilosa "github.com/molecula/featurebase/v2" - fb_http "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/topology" + pilosa "github.com/molecula/featurebase/v3" + fb_http "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/ctl/server.go b/ctl/server.go index db5300e83..98391f761 100644 --- a/ctl/server.go +++ b/ctl/server.go @@ -5,8 +5,8 @@ import ( "fmt" "time" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/storage" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/storage" "github.com/spf13/cobra" ) diff --git a/ctl/server_test.go b/ctl/server_test.go index 18d8027e2..fc17e3050 100644 --- a/ctl/server_test.go +++ b/ctl/server_test.go @@ -5,7 +5,7 @@ import ( "bytes" "testing" - "github.com/molecula/featurebase/v2/server" + "github.com/molecula/featurebase/v3/server" "github.com/spf13/cobra" ) diff --git a/ctl/util.go b/ctl/util.go index 2a5611df6..4ee0762b0 100644 --- a/ctl/util.go +++ b/ctl/util.go @@ -9,7 +9,7 @@ import ( "time" "github.com/felixge/fgprof" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" ) diff --git a/dbshard.go b/dbshard.go index df43273dd..ee738458f 100644 --- a/dbshard.go +++ b/dbshard.go @@ -10,12 +10,12 @@ import ( "strings" "sync" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/storage" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/storage" "github.com/pkg/errors" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/vprint" ) var _ = sort.Sort diff --git a/dbshard_internal_test.go b/dbshard_internal_test.go index e524ae7e7..ceb63ab89 100644 --- a/dbshard_internal_test.go +++ b/dbshard_internal_test.go @@ -8,11 +8,11 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/rbf" - "github.com/molecula/featurebase/v2/shardwidth" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/testhook" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3/rbf" + "github.com/molecula/featurebase/v3/shardwidth" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/testhook" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) // Shard per db evaluation diff --git a/dbshard_test.go b/dbshard_test.go index 62945b1fb..6f7281301 100644 --- a/dbshard_test.go +++ b/dbshard_test.go @@ -7,12 +7,12 @@ import ( "reflect" "testing" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func TestAPI_SimplerOneNode_ImportColumnKey(t *testing.T) { diff --git a/delete_test.go b/delete_test.go index e3e1a2aef..df977513b 100644 --- a/delete_test.go +++ b/delete_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/test" "github.com/stretchr/testify/require" ) diff --git a/diagnostics.go b/diagnostics.go index 3742d6d88..989fc8e4c 100644 --- a/diagnostics.go +++ b/diagnostics.go @@ -11,7 +11,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" ) diff --git a/diagnostics_internal_test.go b/diagnostics_internal_test.go index 690fba1de..0a0ccf8c9 100644 --- a/diagnostics_internal_test.go +++ b/diagnostics_internal_test.go @@ -10,7 +10,7 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" ) func TestDiagnosticsClient(t *testing.T) { diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index cb66619c3..b9f826938 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -6,14 +6,14 @@ import ( "time" "github.com/gogo/protobuf/proto" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/ingest" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/pb" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/topology" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/ingest" + 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/topology" "github.com/pkg/errors" ) diff --git a/encoding/proto/proto_test.go b/encoding/proto/proto_test.go index a011b6b41..6c2107fc5 100644 --- a/encoding/proto/proto_test.go +++ b/encoding/proto/proto_test.go @@ -6,9 +6,9 @@ import ( "reflect" "testing" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/pb" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/pb" ) func testOneRoundTrip(t *testing.T, s pilosa.Serializer, obj pilosa.Message, expectedMarshalErr error, expectedUnmarshalErr error, expectedMismatchErr error) { diff --git a/etcd/embed.go b/etcd/embed.go index 696c85df2..cff332736 100644 --- a/etcd/embed.go +++ b/etcd/embed.go @@ -14,9 +14,9 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" "go.etcd.io/etcd/clientv3" "go.etcd.io/etcd/clientv3/clientv3util" diff --git a/etcd/leasedkv.go b/etcd/leasedkv.go index 742bb51ad..20d8d40ed 100644 --- a/etcd/leasedkv.go +++ b/etcd/leasedkv.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/disco" + "github.com/molecula/featurebase/v3/disco" "github.com/pkg/errors" "go.etcd.io/etcd/clientv3" "go.etcd.io/etcd/clientv3/clientv3util" diff --git a/etcd/leasedkv_test.go b/etcd/leasedkv_test.go index 0366d7dd2..e4222764b 100644 --- a/etcd/leasedkv_test.go +++ b/etcd/leasedkv_test.go @@ -9,9 +9,9 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/testhook" "github.com/pkg/errors" "go.etcd.io/etcd/embed" "go.etcd.io/etcd/etcdserver/api/v3client" diff --git a/event.go b/event.go index 83d2c3a03..811e6c7d9 100644 --- a/event.go +++ b/event.go @@ -1,7 +1,7 @@ // Copyright 2021 Molecula Corp. All rights reserved. package pilosa -import "github.com/molecula/featurebase/v2/topology" +import "github.com/molecula/featurebase/v3/topology" // NodeEventType are the types of node events. type NodeEventType int diff --git a/executor.go b/executor.go index 692feef82..24e36af61 100644 --- a/executor.go +++ b/executor.go @@ -17,14 +17,14 @@ import ( "unsafe" "github.com/lib/pq" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/shardwidth" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/tracing" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/shardwidth" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/executor_internal_test.go b/executor_internal_test.go index 953123385..171cb2ae3 100644 --- a/executor_internal_test.go +++ b/executor_internal_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/testhook" ) func TestExecutor_TranslateRowsOnBool(t *testing.T) { diff --git a/executor_test.go b/executor_test.go index 990a569dd..a074cf90f 100644 --- a/executor_test.go +++ b/executor_test.go @@ -25,18 +25,18 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/ctl" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/testhook" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/ctl" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/testhook" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck "github.com/pkg/errors" ) diff --git a/field.go b/field.go index b78ed051c..5beb2983a 100644 --- a/field.go +++ b/field.go @@ -15,12 +15,12 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/tracing" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" ) diff --git a/field_internal_test.go b/field_internal_test.go index d9471db91..da1ba40bd 100644 --- a/field_internal_test.go +++ b/field_internal_test.go @@ -12,11 +12,11 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/shardwidth" - "github.com/molecula/featurebase/v2/testhook" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/shardwidth" + "github.com/molecula/featurebase/v3/testhook" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) // CorruptAMutex breaks a mutex in order to test the mutex-corruption stuff. diff --git a/field_test.go b/field_test.go index 739dc60a2..8eb4f8d3e 100644 --- a/field_test.go +++ b/field_test.go @@ -6,10 +6,10 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/testhook" ) // Ensure a field can set & read a bsiGroup value. diff --git a/fragment.go b/fragment.go index cf04079e0..1eceb076f 100644 --- a/fragment.go +++ b/fragment.go @@ -27,17 +27,17 @@ import ( "github.com/cespare/xxhash" "github.com/gogo/protobuf/proto" - "github.com/molecula/featurebase/v2/logger" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/pb" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/shardwidth" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/tracing" - "github.com/molecula/featurebase/v2/vprint" + "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/shardwidth" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/tracing" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" ) diff --git a/fragment_internal_test.go b/fragment_internal_test.go index 7945476c6..0ecdfb787 100644 --- a/fragment_internal_test.go +++ b/fragment_internal_test.go @@ -23,11 +23,11 @@ import ( "testing/quick" "github.com/davecgh/go-spew/spew" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/testhook" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/testhook" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/gcnotify/gcnotify.go b/gcnotify/gcnotify.go index fc9d90fa6..e6bf92eed 100644 --- a/gcnotify/gcnotify.go +++ b/gcnotify/gcnotify.go @@ -3,7 +3,7 @@ package gcnotify import ( "github.com/CAFxX/gcnotifier" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) // Ensure ActiveGCNotifier implements interface. diff --git a/gendebug_test.go b/gendebug_test.go index bc7fb488c..05094bd22 100644 --- a/gendebug_test.go +++ b/gendebug_test.go @@ -10,7 +10,7 @@ import ( "fmt" "runtime" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func examineResults() error { diff --git a/generation.go b/generation.go index 7c880c8c3..dfb8a3277 100644 --- a/generation.go +++ b/generation.go @@ -12,9 +12,9 @@ import ( "syscall" "time" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/syswrap" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/syswrap" "github.com/pkg/errors" ) diff --git a/go.mod b/go.mod index f15095796..f1d6d285b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/molecula/featurebase/v2 +module github.com/molecula/featurebase/v3 replace go.etcd.io/etcd => github.com/molecula/etcd v0.0.0-20210930172242-ad94b354f72c @@ -14,7 +14,6 @@ require ( github.com/cespare/xxhash v1.1.0 github.com/davecgh/go-spew v1.1.1 github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect - github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/dustin/go-humanize v1.0.0 // indirect github.com/felixge/fgprof v0.9.1 github.com/fsnotify/fsnotify v1.4.9 // indirect diff --git a/gopsutil/systeminfo.go b/gopsutil/systeminfo.go index f95a08e86..3430562b6 100644 --- a/gopsutil/systeminfo.go +++ b/gopsutil/systeminfo.go @@ -6,7 +6,7 @@ import ( "runtime" "strings" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" "github.com/shirou/gopsutil/v3/cpu" "github.com/shirou/gopsutil/v3/disk" "github.com/shirou/gopsutil/v3/host" diff --git a/gopsutil/systeminfo_test.go b/gopsutil/systeminfo_test.go index f285f3a69..a59cedc03 100644 --- a/gopsutil/systeminfo_test.go +++ b/gopsutil/systeminfo_test.go @@ -4,8 +4,8 @@ package gopsutil_test import ( "testing" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/gopsutil" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/gopsutil" ) func TestSystemInfo(t *testing.T) { diff --git a/hack.go b/hack.go index 2fad99df2..4f8a8a460 100644 --- a/hack.go +++ b/hack.go @@ -3,8 +3,8 @@ package pilosa import ( "github.com/gogo/protobuf/proto" - "github.com/molecula/featurebase/v2/pb" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/pb" + "github.com/molecula/featurebase/v3/pql" ) func UnmarshalIndexOptions(name string, createdAt int64, buf []byte) (*IndexOptions, error) { diff --git a/handler.go b/handler.go index ee18153ea..725225f5f 100644 --- a/handler.go +++ b/handler.go @@ -5,8 +5,8 @@ import ( "encoding/json" "time" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/tracing" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" ) diff --git a/hash/blake3_test.go b/hash/blake3_test.go index d33df7b4b..e7552f23a 100644 --- a/hash/blake3_test.go +++ b/hash/blake3_test.go @@ -9,7 +9,7 @@ import ( "path" "testing" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func TestBlake3Hasher(t *testing.T) { diff --git a/holder.go b/holder.go index ad50e497e..cf35bf998 100644 --- a/holder.go +++ b/holder.go @@ -15,15 +15,15 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/logger" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/logger" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/holder_internal_test.go b/holder_internal_test.go index e2724ac50..b1455aa5e 100644 --- a/holder_internal_test.go +++ b/holder_internal_test.go @@ -7,8 +7,8 @@ import ( "os" "testing" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/testhook" ) var _ = fmt.Printf diff --git a/holder_test.go b/holder_test.go index 01b6db39f..cff3cf7da 100644 --- a/holder_test.go +++ b/holder_test.go @@ -11,10 +11,10 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/test" "github.com/pkg/errors" ) diff --git a/http/client.go b/http/client.go index c9bf14068..183b7675d 100644 --- a/http/client.go +++ b/http/client.go @@ -20,14 +20,14 @@ import ( "time" "github.com/hashicorp/go-retryablehttp" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/encoding/proto" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/logger" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/tracing" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/encoding/proto" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/logger" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" ) diff --git a/http/client_test.go b/http/client_test.go index 0b05bc00f..74c25d7fd 100644 --- a/http/client_test.go +++ b/http/client_test.go @@ -14,12 +14,12 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" ) diff --git a/http/handler.go b/http/handler.go index 579f66385..d92f69e45 100644 --- a/http/handler.go +++ b/http/handler.go @@ -29,16 +29,16 @@ import ( "github.com/felixge/fgprof" "github.com/gorilla/handlers" "github.com/gorilla/mux" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/authz" - "github.com/molecula/featurebase/v2/encoding/proto" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/rbf" - "github.com/molecula/featurebase/v2/topology" - "github.com/molecula/featurebase/v2/tracing" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/authz" + "github.com/molecula/featurebase/v3/encoding/proto" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/rbf" + "github.com/molecula/featurebase/v3/topology" + "github.com/molecula/featurebase/v3/tracing" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus/promhttp" dto "github.com/prometheus/client_model/go" diff --git a/http/handler_internal_test.go b/http/handler_internal_test.go index 511079961..a3fcdb133 100644 --- a/http/handler_internal_test.go +++ b/http/handler_internal_test.go @@ -16,13 +16,13 @@ import ( "time" "github.com/golang-jwt/jwt" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" "golang.org/x/oauth2" - "github.com/molecula/featurebase/v2/authz" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/authz" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pql" ) // Test custom UnmarshalJSON for postIndexRequest object diff --git a/http/handler_test.go b/http/handler_test.go index 7dd2e6b00..c58a4bd3e 100644 --- a/http/handler_test.go +++ b/http/handler_test.go @@ -9,10 +9,10 @@ import ( "strings" "testing" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" ) func TestHandlerOptions(t *testing.T) { diff --git a/http/translator.go b/http/translator.go index 8bce04a67..4c161d590 100644 --- a/http/translator.go +++ b/http/translator.go @@ -12,8 +12,8 @@ import ( "reflect" "sync" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/logger" ) func GetOpenTranslateReaderFunc(client *http.Client) pilosa.OpenTranslateReaderFunc { diff --git a/http/translator_test.go b/http/translator_test.go index 2474da7f1..74a579f9c 100644 --- a/http/translator_test.go +++ b/http/translator_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/test" ) func TestTranslateStore_EntryReader(t *testing.T) { diff --git a/idalloc_test.go b/idalloc_test.go index 69d7e5e3e..1004dc229 100644 --- a/idalloc_test.go +++ b/idalloc_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" bolt "go.etcd.io/bbolt" ) diff --git a/index.go b/index.go index 3426b3b5a..864e71346 100644 --- a/index.go +++ b/index.go @@ -10,10 +10,10 @@ import ( "strconv" "sync" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/testhook" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/index_internal_test.go b/index_internal_test.go index 161e7a2d3..a36a2475a 100644 --- a/index_internal_test.go +++ b/index_internal_test.go @@ -4,7 +4,7 @@ package pilosa import ( "testing" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) // mustOpenIndex returns a new, opened index at a temporary path. Panic on error. diff --git a/index_test.go b/index_test.go index 6d2a7a0c6..67d69ecbe 100644 --- a/index_test.go +++ b/index_test.go @@ -10,11 +10,11 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/testhook" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/testhook" "github.com/pkg/errors" ) diff --git a/ingest/codec_test.go b/ingest/codec_test.go index 04d81c558..d36a0b757 100644 --- a/ingest/codec_test.go +++ b/ingest/codec_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) func TestStableTranslator(t *testing.T) { diff --git a/ingest/op.go b/ingest/op.go index df5291a39..5eb3880ca 100644 --- a/ingest/op.go +++ b/ingest/op.go @@ -7,7 +7,7 @@ import ( "math/bits" "sort" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) type OpType uint8 diff --git a/ingest/op_test.go b/ingest/op_test.go index dadf04d0f..31e1c56ff 100644 --- a/ingest/op_test.go +++ b/ingest/op_test.go @@ -5,7 +5,7 @@ import ( "math/rand" "testing" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) type opShardingTestCase struct { diff --git a/ingest/update.go b/ingest/update.go index c27448eac..f36363ba7 100644 --- a/ingest/update.go +++ b/ingest/update.go @@ -2,7 +2,7 @@ package ingest import ( - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" ) // ShardUpdate is an update request for a shard. diff --git a/ingest_test.go b/ingest_test.go index cca87e258..712b834e6 100644 --- a/ingest_test.go +++ b/ingest_test.go @@ -12,9 +12,9 @@ import ( "strings" "testing" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/test" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/test" "github.com/pkg/errors" ) diff --git a/internal/clustertests/cluster_test.go b/internal/clustertests/cluster_test.go index 79d067ad4..c6f4b0c3b 100644 --- a/internal/clustertests/cluster_test.go +++ b/internal/clustertests/cluster_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - picli "github.com/molecula/featurebase/v2/http" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + picli "github.com/molecula/featurebase/v3/http" ) func TestClusterStuff(t *testing.T) { diff --git a/internal/clustertests/docker-compose.yml b/internal/clustertests/docker-compose.yml index 46143a3f6..af74a4d30 100644 --- a/internal/clustertests/docker-compose.yml +++ b/internal/clustertests/docker-compose.yml @@ -75,6 +75,6 @@ services: volumes: - /var/run/docker.sock:/var/run/docker.sock command: - - "cd /go/src/github.com/molecula/featurebase/ && go test -mod=vendor -v -count=1 github.com/molecula/featurebase/v2/internal/clustertests" + - "cd /go/src/github.com/molecula/featurebase/ && go test -mod=vendor -v -count=1 github.com/molecula/featurebase/v3/internal/clustertests" networks: pilosanet: diff --git a/internal/clustertests/pause_node_test.go b/internal/clustertests/pause_node_test.go index 256078a90..d6c3863a8 100644 --- a/internal/clustertests/pause_node_test.go +++ b/internal/clustertests/pause_node_test.go @@ -14,12 +14,12 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - boltdb "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/topology" + pilosa "github.com/molecula/featurebase/v3" + boltdb "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" ) diff --git a/internal/test/querygenerator.go b/internal/test/querygenerator.go index f85811ed7..2be0e4874 100644 --- a/internal/test/querygenerator.go +++ b/internal/test/querygenerator.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/pql" ) type Args map[string]interface{} diff --git a/internal/test/querygenerator_test.go b/internal/test/querygenerator_test.go index 766e62a80..9b62586a3 100644 --- a/internal/test/querygenerator_test.go +++ b/internal/test/querygenerator_test.go @@ -4,7 +4,7 @@ package test import ( "testing" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/pql" ) func TestPQL_Generator(t *testing.T) { diff --git a/iterator.go b/iterator.go index b37c44062..0364ae28e 100644 --- a/iterator.go +++ b/iterator.go @@ -4,7 +4,7 @@ package pilosa import ( "fmt" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" ) // iterator is an interface for looping over row/column pairs. diff --git a/logger/filewriter_test.go b/logger/filewriter_test.go index df7501e5c..9d493cce0 100644 --- a/logger/filewriter_test.go +++ b/logger/filewriter_test.go @@ -30,7 +30,7 @@ import ( "os" "testing" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) // TestReopenAppend -- make sure we always append to an existing file diff --git a/main_test.go b/main_test.go index 983b234ee..6919a82ae 100644 --- a/main_test.go +++ b/main_test.go @@ -9,7 +9,7 @@ import ( "net/http" _ "net/http/pprof" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func TestMain(m *testing.M) { diff --git a/mmap_test.go b/mmap_test.go index 669f8caf9..ef7513b4a 100644 --- a/mmap_test.go +++ b/mmap_test.go @@ -7,8 +7,8 @@ import ( "runtime" "testing" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/syswrap" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/syswrap" ) type cv struct { diff --git a/mock/translator.go b/mock/translator.go index 74ed4c42f..fe3583272 100644 --- a/mock/translator.go +++ b/mock/translator.go @@ -5,7 +5,7 @@ import ( "context" "io" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) type TranslateStore struct { diff --git a/pg/pgtest/handler.go b/pg/pgtest/handler.go index 592485547..4ee29e505 100644 --- a/pg/pgtest/handler.go +++ b/pg/pgtest/handler.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "github.com/molecula/featurebase/v2/pg" + "github.com/molecula/featurebase/v3/pg" ) // HandlerFunc implements a postgres query handler with a function. diff --git a/pg/pgtest/server.go b/pg/pgtest/server.go index 95e11a86c..07df564bc 100644 --- a/pg/pgtest/server.go +++ b/pg/pgtest/server.go @@ -7,7 +7,7 @@ import ( "net" "testing" - "github.com/molecula/featurebase/v2/pg" + "github.com/molecula/featurebase/v3/pg" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/pg/pgtest/tls.go b/pg/pgtest/tls.go index c188c7d4d..0779e3bc7 100644 --- a/pg/pgtest/tls.go +++ b/pg/pgtest/tls.go @@ -12,7 +12,7 @@ import ( "math/big" "time" - "github.com/molecula/featurebase/v2/pg" + "github.com/molecula/featurebase/v3/pg" "github.com/pkg/errors" ) diff --git a/pg/protocol.go b/pg/protocol.go index 8a0044323..54868f65e 100644 --- a/pg/protocol.go +++ b/pg/protocol.go @@ -17,8 +17,8 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/pg/message" - "github.com/molecula/featurebase/v2/sql" + "github.com/molecula/featurebase/v3/pg/message" + "github.com/molecula/featurebase/v3/sql" "github.com/pkg/errors" "vitess.io/vitess/go/vt/sqlparser" ) diff --git a/pg/query.go b/pg/query.go index 773562929..ff4f303d7 100644 --- a/pg/query.go +++ b/pg/query.go @@ -5,7 +5,7 @@ import ( "context" "fmt" - "github.com/molecula/featurebase/v2/pg/message" + "github.com/molecula/featurebase/v3/pg/message" "github.com/pkg/errors" ) diff --git a/pg/server.go b/pg/server.go index 8e6841a32..e6bf0e658 100644 --- a/pg/server.go +++ b/pg/server.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" ) // Server is a postgres wire protocol server. diff --git a/pg/server_test.go b/pg/server_test.go index a7b719f2f..b2066bbeb 100644 --- a/pg/server_test.go +++ b/pg/server_test.go @@ -15,9 +15,9 @@ import ( "time" "github.com/lib/pq" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pg" - "github.com/molecula/featurebase/v2/pg/pgtest" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pg" + "github.com/molecula/featurebase/v3/pg/pgtest" ) // TestStartupTimeout tests that an incoming connection that does nothing times out and gets closed. diff --git a/pg/type.go b/pg/type.go index 9fa0451f8..52275a1b6 100644 --- a/pg/type.go +++ b/pg/type.go @@ -1,7 +1,7 @@ // Copyright 2021 Molecula Corp. All rights reserved. package pg -import "github.com/molecula/featurebase/v2/pg/message" +import "github.com/molecula/featurebase/v3/pg/message" // Type represents a postgres type. type Type struct { diff --git a/pilosa.go b/pilosa.go index 1757f7de3..354c435ff 100644 --- a/pilosa.go +++ b/pilosa.go @@ -6,9 +6,9 @@ import ( "regexp" "time" - "github.com/molecula/featurebase/v2/disco" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/storage" + "github.com/molecula/featurebase/v3/disco" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/storage" "github.com/pkg/errors" ) diff --git a/pilosa_internal_test.go b/pilosa_internal_test.go index d2891199e..ca68e640f 100644 --- a/pilosa_internal_test.go +++ b/pilosa_internal_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/molecula/featurebase/v2/roaring" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3/roaring" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func TestValidateName(t *testing.T) { diff --git a/pilosa_test.go b/pilosa_test.go index a9fd29826..8f057355f 100644 --- a/pilosa_test.go +++ b/pilosa_test.go @@ -5,8 +5,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2" - _ "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + _ "github.com/molecula/featurebase/v3/test" ) func TestAddressWithDefaults(t *testing.T) { diff --git a/planner.go b/planner.go index 6ecedb179..91541f20c 100644 --- a/planner.go +++ b/planner.go @@ -8,8 +8,8 @@ import ( "strconv" "strings" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/sql2" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/sql2" ) type Planner struct { diff --git a/planner_test.go b/planner_test.go index 668e8a9c5..edcbbaefc 100644 --- a/planner_test.go +++ b/planner_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/test" ) func TestPlanner_Count(t *testing.T) { diff --git a/pprof.go b/pprof.go index 9d601da6a..07f87b1b2 100644 --- a/pprof.go +++ b/pprof.go @@ -10,8 +10,8 @@ import ( _ "net/http/pprof" // Imported for its side-effect of registering pprof endpoints with the server. - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/vprint" ) // CPUProfileForDur (where "Dur" is short for "Duration"), is used for diff --git a/pql/ast_test.go b/pql/ast_test.go index 3d7153bfb..b095fe878 100644 --- a/pql/ast_test.go +++ b/pql/ast_test.go @@ -4,7 +4,7 @@ package pql_test import ( "testing" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/pql" ) // Ensure call can be converted into a string. diff --git a/pql/decimal_test.go b/pql/decimal_test.go index e5efca481..ea24685ff 100644 --- a/pql/decimal_test.go +++ b/pql/decimal_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3/pql" ) // Ensure call can be converted into a string. diff --git a/pql/parser_test.go b/pql/parser_test.go index fad097bf1..3cfa612a8 100644 --- a/pql/parser_test.go +++ b/pql/parser_test.go @@ -6,8 +6,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/pql" - _ "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/pql" + _ "github.com/molecula/featurebase/v3/test" ) // Ensure the parser can parse PQL. diff --git a/prometheus/prometheus.go b/prometheus/prometheus.go index 1bd92af8a..79703cf85 100644 --- a/prometheus/prometheus.go +++ b/prometheus/prometheus.go @@ -7,8 +7,8 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/stats" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/stats" "github.com/prometheus/client_golang/prometheus" ) diff --git a/prometheus/prometheus_test.go b/prometheus/prometheus_test.go index 07ee4c1ac..1dd64ca9d 100644 --- a/prometheus/prometheus_test.go +++ b/prometheus/prometheus_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - pilosaPrometheus "github.com/molecula/featurebase/v2/prometheus" + pilosaPrometheus "github.com/molecula/featurebase/v3/prometheus" "github.com/prometheus/client_golang/prometheus" io_prometheus_client "github.com/prometheus/client_model/go" ) diff --git a/proto/vdsm/vdsm.pb.go b/proto/vdsm/vdsm.pb.go index 62e9cc00c..6390f80dd 100644 --- a/proto/vdsm/vdsm.pb.go +++ b/proto/vdsm/vdsm.pb.go @@ -7,7 +7,7 @@ import ( context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - proto1 "github.com/molecula/featurebase/v2/proto" + proto1 "github.com/molecula/featurebase/v3/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/rbf.go b/rbf.go index 298c717d7..b79b2eb03 100644 --- a/rbf.go +++ b/rbf.go @@ -9,13 +9,13 @@ import ( "strings" "sync" - "github.com/molecula/featurebase/v2/rbf" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/storage" + "github.com/molecula/featurebase/v3/rbf" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/roaring" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/storage" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" ) diff --git a/rbf/array.go b/rbf/array.go index d8d008a32..4e2b3b7e8 100644 --- a/rbf/array.go +++ b/rbf/array.go @@ -4,7 +4,7 @@ package rbf import ( "unsafe" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" ) // toArray16 converts a byte slice into a slice of uint16 values using unsafe. diff --git a/rbf/cfg/cfg.go b/rbf/cfg/cfg.go index 671c6fe43..184775e33 100644 --- a/rbf/cfg/cfg.go +++ b/rbf/cfg/cfg.go @@ -2,7 +2,7 @@ package cfg import ( - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/spf13/pflag" ) diff --git a/rbf/cursor.go b/rbf/cursor.go index 22d4427e6..41e9e4d4f 100644 --- a/rbf/cursor.go +++ b/rbf/cursor.go @@ -8,7 +8,7 @@ import ( "sort" "unsafe" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/rbf/cursor_internal_test.go b/rbf/cursor_internal_test.go index 8f2bf6a1f..b97b80bd7 100644 --- a/rbf/cursor_internal_test.go +++ b/rbf/cursor_internal_test.go @@ -6,8 +6,8 @@ import ( "fmt" "testing" - "github.com/molecula/featurebase/v2/roaring" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3/roaring" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func getRoaringIter(bitsToSet ...uint64) roaring.RoaringIterator { diff --git a/rbf/cursor_test.go b/rbf/cursor_test.go index 940798c04..9c5603a3a 100644 --- a/rbf/cursor_test.go +++ b/rbf/cursor_test.go @@ -11,8 +11,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/rbf" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/rbf" + "github.com/molecula/featurebase/v3/roaring" ) func TestCursor_FirstNext(t *testing.T) { diff --git a/rbf/cursorx.go b/rbf/cursorx.go index 2b6226dde..fafdbf512 100644 --- a/rbf/cursorx.go +++ b/rbf/cursorx.go @@ -8,7 +8,7 @@ import ( "math" "os" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/rbf/db.go b/rbf/db.go index f2eeceea3..a6c9959bb 100644 --- a/rbf/db.go +++ b/rbf/db.go @@ -14,9 +14,9 @@ import ( "unsafe" "github.com/benbjohnson/immutable" - "github.com/molecula/featurebase/v2/logger" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/syswrap" + "github.com/molecula/featurebase/v3/logger" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/syswrap" ) var ( diff --git a/rbf/db_test.go b/rbf/db_test.go index 65d84cff6..3e6bdd1b1 100644 --- a/rbf/db_test.go +++ b/rbf/db_test.go @@ -15,8 +15,8 @@ import ( _ "net/http/pprof" "github.com/felixge/fgprof" - "github.com/molecula/featurebase/v2/rbf" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" + "github.com/molecula/featurebase/v3/rbf" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" "golang.org/x/sync/errgroup" ) diff --git a/rbf/ingest_test.go b/rbf/ingest_test.go index e4a7532af..d9b7be2e6 100644 --- a/rbf/ingest_test.go +++ b/rbf/ingest_test.go @@ -12,12 +12,12 @@ import ( //"time" - "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/testhook" - txkey "github.com/molecula/featurebase/v2/short_txkey" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + txkey "github.com/molecula/featurebase/v3/short_txkey" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func rbfName(index, field, view string, shard uint64) string { diff --git a/rbf/rbf.go b/rbf/rbf.go index 4a66ba309..ac156a2c7 100644 --- a/rbf/rbf.go +++ b/rbf/rbf.go @@ -15,9 +15,9 @@ import ( "unsafe" "github.com/benbjohnson/immutable" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/shardwidth" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/shardwidth" + "github.com/molecula/featurebase/v3/vprint" ) const ( diff --git a/rbf/rbf_test.go b/rbf/rbf_test.go index 17605a6fc..3ff80350b 100644 --- a/rbf/rbf_test.go +++ b/rbf/rbf_test.go @@ -11,10 +11,10 @@ import ( "sort" "testing" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/rbf" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/rbf" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/testhook" ) var quickCheckN *int = flag.Int("quickchecks", 10, "The number of iterations for each quickcheck") diff --git a/rbf/tx.go b/rbf/tx.go index 4fa8f441e..17647caa3 100644 --- a/rbf/tx.go +++ b/rbf/tx.go @@ -11,9 +11,9 @@ import ( "sync" "github.com/benbjohnson/immutable" - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/roaring" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/vprint" ) var _ = txkey.ToString diff --git a/rbf/tx_test.go b/rbf/tx_test.go index 6f98a0fb0..e9e493afc 100644 --- a/rbf/tx_test.go +++ b/rbf/tx_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/rbf" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/rbf" + "github.com/molecula/featurebase/v3/roaring" ) func TestTx_CommitRollback(t *testing.T) { diff --git a/rbf/util.go b/rbf/util.go index 626b97738..4b29b2a2e 100644 --- a/rbf/util.go +++ b/rbf/util.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/vprint" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/vprint" ) // we don't currently use dumpAllPages but it's tricky enough to get right diff --git a/rbf/util_test.go b/rbf/util_test.go index e13cc6acf..4a8177aff 100644 --- a/rbf/util_test.go +++ b/rbf/util_test.go @@ -7,9 +7,9 @@ import ( "os" "testing" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/testhook" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/testhook" ) // util_test adds reusable utilities for testing. diff --git a/roaring/benchpretty/main.go b/roaring/benchpretty/main.go index 20c790f6c..229eb39df 100644 --- a/roaring/benchpretty/main.go +++ b/roaring/benchpretty/main.go @@ -11,7 +11,7 @@ import ( "strconv" "strings" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" ) var pattern = regexp.MustCompile(`^BenchmarkCtOps/([^/]+)/([^/]+)/([^-]+)-([0-9]+)\s*([0-9]+)\s*([0-9.]+) ns/op`) diff --git a/roaring/filter.go b/roaring/filter.go index 600de65da..15a4a2f90 100644 --- a/roaring/filter.go +++ b/roaring/filter.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) // We want BitmapScanner to be accessible from both the pilosa package, and diff --git a/roaring/filter_internal_test.go b/roaring/filter_internal_test.go index c390741d6..1e9a5d778 100644 --- a/roaring/filter_internal_test.go +++ b/roaring/filter_internal_test.go @@ -9,7 +9,7 @@ import ( "sync" "testing" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) // For each container key i from 1 to (shard width in containers), we diff --git a/roaring/printutil.go b/roaring/printutil.go index bffd3b0b0..6cebb192d 100644 --- a/roaring/printutil.go +++ b/roaring/printutil.go @@ -5,7 +5,7 @@ import ( "fmt" "math" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) func (b *Bitmap) String() (r string) { diff --git a/roaring/printutil_test.go b/roaring/printutil_test.go index 44cbb6acc..27d2cbb58 100644 --- a/roaring/printutil_test.go +++ b/roaring/printutil_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) func TestAsContainerMatrixString(t *testing.T) { diff --git a/roaring/roaring_internal_test.go b/roaring/roaring_internal_test.go index ba59b7ce4..7fc0e5bb1 100644 --- a/roaring/roaring_internal_test.go +++ b/roaring/roaring_internal_test.go @@ -12,7 +12,7 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/generator" + "github.com/molecula/featurebase/v3/generator" "github.com/pkg/errors" ) diff --git a/roaring/roaring_stats.go b/roaring/roaring_stats.go index eac3909f1..b0218bfcc 100644 --- a/roaring/roaring_stats.go +++ b/roaring/roaring_stats.go @@ -5,7 +5,7 @@ package roaring import ( - "github.com/molecula/featurebase/v2/stats" + "github.com/molecula/featurebase/v3/stats" ) var statsEv = stats.NewExpvarStatsClient() diff --git a/roaring/roaring_test.go b/roaring/roaring_test.go index 86e9ea516..508505b38 100644 --- a/roaring/roaring_test.go +++ b/roaring/roaring_test.go @@ -11,10 +11,10 @@ import ( "testing/quick" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/generator" - "github.com/molecula/featurebase/v2/roaring" - _ "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/generator" + "github.com/molecula/featurebase/v3/roaring" + _ "github.com/molecula/featurebase/v3/test" ) func TestContainerCount(t *testing.T) { diff --git a/row.go b/row.go index 60c14566f..b310d2ad0 100644 --- a/row.go +++ b/row.go @@ -5,8 +5,8 @@ import ( "encoding/json" "sort" - pb "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/roaring" + pb "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/row_test.go b/row_test.go index c4199a452..076026313 100644 --- a/row_test.go +++ b/row_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) // Ensure a row can be merged diff --git a/rrtx.go b/rrtx.go index be55f1893..0411e9c80 100644 --- a/rrtx.go +++ b/rrtx.go @@ -11,11 +11,11 @@ import ( "sync" "sync/atomic" - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/storage" + "github.com/molecula/featurebase/v3/roaring" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/storage" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" ) diff --git a/rrtx_internal_test.go b/rrtx_internal_test.go index eb3907cd1..64c996bc4 100644 --- a/rrtx_internal_test.go +++ b/rrtx_internal_test.go @@ -4,7 +4,7 @@ package pilosa import ( "testing" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func TestRoaring_HasData(t *testing.T) { diff --git a/server.go b/server.go index 23e760e19..076142a9a 100644 --- a/server.go +++ b/server.go @@ -17,15 +17,15 @@ import ( uuid "github.com/satori/go.uuid" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/logger" - pnet "github.com/molecula/featurebase/v2/net" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/sql2" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/logger" + pnet "github.com/molecula/featurebase/v3/net" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/sql2" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" "golang.org/x/sync/errgroup" diff --git a/server/cluster_test.go b/server/cluster_test.go index 07ab7ea04..1f021bdf0 100644 --- a/server/cluster_test.go +++ b/server/cluster_test.go @@ -12,10 +12,10 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" ) // Ensure program can send/receive broadcast messages. diff --git a/server/config.go b/server/config.go index fd319aa6a..8c6d4600b 100644 --- a/server/config.go +++ b/server/config.go @@ -15,11 +15,11 @@ import ( "strings" "time" - "github.com/molecula/featurebase/v2/authz" - petcd "github.com/molecula/featurebase/v2/etcd" - rbfcfg "github.com/molecula/featurebase/v2/rbf/cfg" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/toml" + "github.com/molecula/featurebase/v3/authz" + petcd "github.com/molecula/featurebase/v3/etcd" + rbfcfg "github.com/molecula/featurebase/v3/rbf/cfg" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/toml" "github.com/pkg/errors" ) diff --git a/server/config_test.go b/server/config_test.go index ce336ba59..77490d451 100644 --- a/server/config_test.go +++ b/server/config_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/toml" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/toml" ) func Test_ValidateConfig(t *testing.T) { diff --git a/server/grpc.go b/server/grpc.go index 4fc8fd3bd..0fff11427 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -13,15 +13,15 @@ import ( "time" "github.com/improbable-eng/grpc-web/go/grpcweb" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/authz" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pql" - pb "github.com/molecula/featurebase/v2/proto" - vdsm_pb "github.com/molecula/featurebase/v2/proto/vdsm" - "github.com/molecula/featurebase/v2/sql" - "github.com/molecula/featurebase/v2/stats" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/authz" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pql" + pb "github.com/molecula/featurebase/v3/proto" + vdsm_pb "github.com/molecula/featurebase/v3/proto/vdsm" + "github.com/molecula/featurebase/v3/sql" + "github.com/molecula/featurebase/v3/stats" "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/server/grpc_test.go b/server/grpc_test.go index 3508d03ab..55c9e65c1 100644 --- a/server/grpc_test.go +++ b/server/grpc_test.go @@ -15,15 +15,15 @@ import ( "time" "github.com/golang-jwt/jwt" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/authz" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pql" - pb "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/sql" - "github.com/molecula/featurebase/v2/test" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/authz" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pql" + pb "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/sql" + "github.com/molecula/featurebase/v3/test" "github.com/pkg/errors" "google.golang.org/grpc" "google.golang.org/grpc/codes" diff --git a/server/handler_test.go b/server/handler_test.go index 1e1105ff4..48dddde78 100644 --- a/server/handler_test.go +++ b/server/handler_test.go @@ -18,13 +18,13 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/encoding/proto" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/encoding/proto" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" ) func TestHandler_PostSchemaCluster(t *testing.T) { diff --git a/server/pg.go b/server/pg.go index 42b95d987..87b1f8fa8 100644 --- a/server/pg.go +++ b/server/pg.go @@ -12,14 +12,14 @@ import ( "strings" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pg" - "github.com/molecula/featurebase/v2/sql2" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pg" + "github.com/molecula/featurebase/v3/sql2" - //"github.com/molecula/featurebase/v2/pg" - "github.com/molecula/featurebase/v2/pql" - pb "github.com/molecula/featurebase/v2/proto" + //"github.com/molecula/featurebase/v3/pg" + "github.com/molecula/featurebase/v3/pql" + pb "github.com/molecula/featurebase/v3/proto" "github.com/pkg/errors" "golang.org/x/sync/errgroup" diff --git a/server/pg_internal_test.go b/server/pg_internal_test.go index 83ed1780f..5c870b501 100644 --- a/server/pg_internal_test.go +++ b/server/pg_internal_test.go @@ -4,8 +4,8 @@ package server import ( "testing" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pg" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pg" ) // pg_internal_test.go tests unexported methods from server/pg.go diff --git a/server/pg_test.go b/server/pg_test.go index 8cfb21035..7250c6f7e 100644 --- a/server/pg_test.go +++ b/server/pg_test.go @@ -8,12 +8,12 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/pg" - "github.com/molecula/featurebase/v2/pg/pgtest" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/pg" + "github.com/molecula/featurebase/v3/pg/pgtest" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" ) func TestPostgresHandler(t *testing.T) { diff --git a/server/server.go b/server/server.go index 0d38c8c78..8212f6816 100644 --- a/server/server.go +++ b/server/server.go @@ -28,23 +28,23 @@ import ( "golang.org/x/sync/errgroup" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/authn" - "github.com/molecula/featurebase/v2/authz" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/encoding/proto" - petcd "github.com/molecula/featurebase/v2/etcd" - "github.com/molecula/featurebase/v2/gcnotify" - "github.com/molecula/featurebase/v2/gopsutil" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/logger" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/prometheus" - "github.com/molecula/featurebase/v2/statik" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/statsd" - "github.com/molecula/featurebase/v2/syswrap" - "github.com/molecula/featurebase/v2/testhook" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/authn" + "github.com/molecula/featurebase/v3/authz" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/encoding/proto" + petcd "github.com/molecula/featurebase/v3/etcd" + "github.com/molecula/featurebase/v3/gcnotify" + "github.com/molecula/featurebase/v3/gopsutil" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/logger" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/prometheus" + "github.com/molecula/featurebase/v3/statik" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/statsd" + "github.com/molecula/featurebase/v3/syswrap" + "github.com/molecula/featurebase/v3/testhook" "github.com/pelletier/go-toml" "github.com/pkg/errors" ) diff --git a/server/server_test.go b/server/server_test.go index 551781ffb..3dfd92728 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -17,14 +17,14 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/testhook" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/testhook" "github.com/pkg/errors" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" diff --git a/server/sql.go b/server/sql.go index b936f89c6..6cf0a457a 100644 --- a/server/sql.go +++ b/server/sql.go @@ -4,10 +4,10 @@ package server import ( "context" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/logger" - pb "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/sql" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/logger" + pb "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/sql" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/server/tlsconfig.go b/server/tlsconfig.go index 82bed6693..4976fa6e5 100644 --- a/server/tlsconfig.go +++ b/server/tlsconfig.go @@ -42,7 +42,7 @@ import ( "sync" "syscall" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" ) diff --git a/server/trial.go b/server/trial.go index 057a786d1..eddc20b16 100644 --- a/server/trial.go +++ b/server/trial.go @@ -12,7 +12,7 @@ import ( "time" "github.com/beevik/ntp" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) // handleTrialDeadline checks to see if this is a trial version of Molecula that expires at some point. diff --git a/server_internal_test.go b/server_internal_test.go index 763f2dc6a..9859e950d 100644 --- a/server_internal_test.go +++ b/server_internal_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/testhook" ) // Ensure the file handle count is working diff --git a/shardwidth/helper_test.go b/shardwidth/helper_test.go index 8966d5aad..458edb678 100644 --- a/shardwidth/helper_test.go +++ b/shardwidth/helper_test.go @@ -5,7 +5,7 @@ import ( "math/rand" "testing" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/shardwidth" ) type nextShardTestCase struct { diff --git a/snapshotqueue.go b/snapshotqueue.go index a33f90bce..ef0bda24c 100644 --- a/snapshotqueue.go +++ b/snapshotqueue.go @@ -11,8 +11,8 @@ import ( "sync/atomic" "time" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/testhook" "github.com/pkg/errors" ) diff --git a/sql/ddl.go b/sql/ddl.go index 9390e3c06..70d553304 100644 --- a/sql/ddl.go +++ b/sql/ddl.go @@ -5,8 +5,8 @@ import ( "context" "fmt" - "github.com/molecula/featurebase/v2" - pproto "github.com/molecula/featurebase/v2/proto" + "github.com/molecula/featurebase/v3" + pproto "github.com/molecula/featurebase/v3/proto" "github.com/pkg/errors" "vitess.io/vitess/go/vt/sqlparser" ) diff --git a/sql/extract.go b/sql/extract.go index 0165f5f40..73a7e795e 100644 --- a/sql/extract.go +++ b/sql/extract.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pql" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pql" "github.com/pkg/errors" "vitess.io/vitess/go/vt/sqlparser" ) diff --git a/sql/handler_test.go b/sql/handler_test.go index 4f2e263bb..6eaba476f 100644 --- a/sql/handler_test.go +++ b/sql/handler_test.go @@ -5,8 +5,8 @@ import ( "context" "testing" - "github.com/molecula/featurebase/v2/sql" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/sql" + "github.com/molecula/featurebase/v3/test" ) func TestHandler(t *testing.T) { diff --git a/sql/mapper.go b/sql/mapper.go index 4e271bdbe..a8cec076b 100644 --- a/sql/mapper.go +++ b/sql/mapper.go @@ -4,7 +4,7 @@ package sql import ( "strings" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" "vitess.io/vitess/go/vt/sqlparser" ) diff --git a/sql/model.go b/sql/model.go index 5d87aa47a..2019814a9 100644 --- a/sql/model.go +++ b/sql/model.go @@ -4,7 +4,7 @@ package sql import ( "fmt" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" "github.com/pkg/errors" ) diff --git a/sql/reduce.go b/sql/reduce.go index a4cf4211d..8de56c1f0 100644 --- a/sql/reduce.go +++ b/sql/reduce.go @@ -4,9 +4,9 @@ package sql import ( "sort" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pql" - pproto "github.com/molecula/featurebase/v2/proto" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pql" + pproto "github.com/molecula/featurebase/v3/proto" "github.com/pkg/errors" ) diff --git a/sql/reduce_test.go b/sql/reduce_test.go index dcddba726..4efafdfa1 100644 --- a/sql/reduce_test.go +++ b/sql/reduce_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - pproto "github.com/molecula/featurebase/v2/proto" + pproto "github.com/molecula/featurebase/v3/proto" "github.com/pkg/errors" ) diff --git a/sql/select.go b/sql/select.go index 07385d80d..3297ee0fc 100644 --- a/sql/select.go +++ b/sql/select.go @@ -6,9 +6,9 @@ import ( "fmt" "strings" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pql" - pproto "github.com/molecula/featurebase/v2/proto" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pql" + pproto "github.com/molecula/featurebase/v3/proto" "github.com/pkg/errors" "vitess.io/vitess/go/vt/sqlparser" ) diff --git a/sql/show.go b/sql/show.go index 186d51923..4ceb829e5 100644 --- a/sql/show.go +++ b/sql/show.go @@ -5,8 +5,8 @@ import ( "context" "fmt" - pilosa "github.com/molecula/featurebase/v2" - pproto "github.com/molecula/featurebase/v2/proto" + pilosa "github.com/molecula/featurebase/v3" + pproto "github.com/molecula/featurebase/v3/proto" "github.com/pkg/errors" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/sql2/ast_test.go b/sql2/ast_test.go index 7523fe77d..c625393ed 100644 --- a/sql2/ast_test.go +++ b/sql2/ast_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/go-test/deep" - sql "github.com/molecula/featurebase/v2/sql2" + sql "github.com/molecula/featurebase/v3/sql2" ) func TestExprString(t *testing.T) { diff --git a/sql2/parser_test.go b/sql2/parser_test.go index 2a7be9f90..04745c9a6 100644 --- a/sql2/parser_test.go +++ b/sql2/parser_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/go-test/deep" - sql "github.com/molecula/featurebase/v2/sql2" + sql "github.com/molecula/featurebase/v3/sql2" ) func TestParser_ParseStatement(t *testing.T) { diff --git a/sql2/scanner_test.go b/sql2/scanner_test.go index 63763195d..7b9cd5436 100644 --- a/sql2/scanner_test.go +++ b/sql2/scanner_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - sql "github.com/molecula/featurebase/v2/sql2" + sql "github.com/molecula/featurebase/v3/sql2" ) func TestScanner_Scan(t *testing.T) { diff --git a/sql2/token_test.go b/sql2/token_test.go index 03e583600..773f347b6 100644 --- a/sql2/token_test.go +++ b/sql2/token_test.go @@ -4,7 +4,7 @@ package sql2_test import ( "testing" - sql "github.com/molecula/featurebase/v2/sql2" + sql "github.com/molecula/featurebase/v3/sql2" ) func TestPos_String(t *testing.T) { diff --git a/statik/filesystem.go b/statik/filesystem.go index 333a92c0a..4f0160db1 100644 --- a/statik/filesystem.go +++ b/statik/filesystem.go @@ -9,7 +9,7 @@ package statik import ( "net/http" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" "github.com/rakyll/statik/fs" ) diff --git a/stats/stats.go b/stats/stats.go index 7ec018479..ba634de72 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" ) // Expvar global expvar map. diff --git a/stats/stats_test.go b/stats/stats_test.go index 11e99c5ef..b2867d184 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -9,11 +9,11 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/test" ) // TestMultiStatClient_Expvar run the multistat client with exp var diff --git a/statsd/statsd.go b/statsd/statsd.go index a21ada41d..e9975f79f 100644 --- a/statsd/statsd.go +++ b/statsd/statsd.go @@ -6,8 +6,8 @@ import ( "time" "github.com/DataDog/datadog-go/statsd" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/stats" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/stats" ) // StatsD protocol wrapper using the DataDog library that added Tags to the StatsD protocol diff --git a/statsd/statsd_test.go b/statsd/statsd_test.go index c466798bb..8c8b8e43a 100644 --- a/statsd/statsd_test.go +++ b/statsd/statsd_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/statsd" - _ "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/statsd" + _ "github.com/molecula/featurebase/v3/test" ) func TestStatsClient_WithTags(t *testing.T) { diff --git a/stattx.go b/stattx.go index 16b4d658a..8b34ec582 100644 --- a/stattx.go +++ b/stattx.go @@ -9,10 +9,10 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/debugstats" - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/debugstats" + "github.com/molecula/featurebase/v3/roaring" + txkey "github.com/molecula/featurebase/v3/short_txkey" + "github.com/molecula/featurebase/v3/vprint" ) // statTx is useful to profile on a diff --git a/test/cluster.go b/test/cluster.go index 58c27a4d6..5aea1147f 100644 --- a/test/cluster.go +++ b/test/cluster.go @@ -10,13 +10,13 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/api/client" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/proto" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/storage" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/api/client" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/proto" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/storage" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/test/disco.go b/test/disco.go index 7609fea9f..abd77e59c 100644 --- a/test/disco.go +++ b/test/disco.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/etcd" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/etcd" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/testhook" "github.com/pkg/errors" ) diff --git a/test/field.go b/test/field.go index 8554f88df..d38e4ef17 100644 --- a/test/field.go +++ b/test/field.go @@ -2,7 +2,7 @@ package test import ( - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) // Field represents a test wrapper for pilosa.Field. diff --git a/test/holder.go b/test/holder.go index 8418d95a5..ec981ddf8 100644 --- a/test/holder.go +++ b/test/holder.go @@ -6,10 +6,10 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/vprint" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" ) diff --git a/test/index.go b/test/index.go index 7b3edf42f..6e4ec5255 100644 --- a/test/index.go +++ b/test/index.go @@ -5,8 +5,8 @@ import ( "context" "testing" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/testhook" ) // Index represents a test wrapper for pilosa.Index. diff --git a/test/pilosa.go b/test/pilosa.go index 56747309e..83041998c 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -13,12 +13,12 @@ import ( "testing" "time" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/encoding/proto" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/testhook" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/encoding/proto" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/testhook" ) //////////////////////////////////////////////////////////////////////////////////// diff --git a/test/pilosa_test.go b/test/pilosa_test.go index 4feea2d92..c27a15c95 100644 --- a/test/pilosa_test.go +++ b/test/pilosa_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/test" ) func TestNewCluster(t *testing.T) { diff --git a/test/transaction.go b/test/transaction.go index 3ca524db4..1832f866f 100644 --- a/test/transaction.go +++ b/test/transaction.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" + "github.com/molecula/featurebase/v3" ) const deadlineSkew = time.Second diff --git a/testhook/auditor_test.go b/testhook/auditor_test.go index f6dad6157..9bc1b8f06 100644 --- a/testhook/auditor_test.go +++ b/testhook/auditor_test.go @@ -6,7 +6,7 @@ import ( "reflect" "testing" - "github.com/molecula/featurebase/v2/testhook" + "github.com/molecula/featurebase/v3/testhook" ) func TestAuditor_CatchError(t *testing.T) { diff --git a/topology/node.go b/topology/node.go index 73b424413..e5c33df5f 100644 --- a/topology/node.go +++ b/topology/node.go @@ -4,8 +4,8 @@ package topology import ( "fmt" - "github.com/molecula/featurebase/v2/disco" - "github.com/molecula/featurebase/v2/net" + "github.com/molecula/featurebase/v3/disco" + "github.com/molecula/featurebase/v3/net" ) // Node represents a node in the cluster. diff --git a/topology/snapshot.go b/topology/snapshot.go index 1c6c01ff6..218ab3a4e 100644 --- a/topology/snapshot.go +++ b/topology/snapshot.go @@ -5,8 +5,8 @@ import ( "encoding/binary" "hash/fnv" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/shardwidth" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/shardwidth" ) const ( diff --git a/tracing/opentracing/opentracing.go b/tracing/opentracing/opentracing.go index b6ed1034c..26a13e923 100644 --- a/tracing/opentracing/opentracing.go +++ b/tracing/opentracing/opentracing.go @@ -5,8 +5,8 @@ import ( "context" "net/http" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/tracing" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/tracing" "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" ) diff --git a/transaction.go b/transaction.go index ca09f81f8..9c912f0b1 100644 --- a/transaction.go +++ b/transaction.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/molecula/featurebase/v2/logger" + "github.com/molecula/featurebase/v3/logger" "github.com/pkg/errors" ) diff --git a/transaction_test.go b/transaction_test.go index f9ed5884b..933a5013a 100644 --- a/transaction_test.go +++ b/transaction_test.go @@ -7,9 +7,9 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/logger" - "github.com/molecula/featurebase/v2/test" + "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/logger" + "github.com/molecula/featurebase/v3/test" ) // TestTransactionManager currently uses an in memory transaction diff --git a/translate.go b/translate.go index be1c47306..cc36ebbe2 100644 --- a/translate.go +++ b/translate.go @@ -10,8 +10,8 @@ import ( "sort" "sync" - "github.com/molecula/featurebase/v2/ingest" - "github.com/molecula/featurebase/v2/topology" + "github.com/molecula/featurebase/v3/ingest" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" ) diff --git a/translator_test.go b/translator_test.go index b9b4a08ff..38cc47c51 100644 --- a/translator_test.go +++ b/translator_test.go @@ -11,13 +11,13 @@ import ( "time" "github.com/google/go-cmp/cmp" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/boltdb" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/mock" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/test" - "github.com/molecula/featurebase/v2/topology" + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/boltdb" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/mock" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/test" + "github.com/molecula/featurebase/v3/topology" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/tx.go b/tx.go index e8628c0e5..65a3e3c3f 100644 --- a/tx.go +++ b/tx.go @@ -2,9 +2,9 @@ package pilosa import ( - "github.com/molecula/featurebase/v2/roaring" - txkey "github.com/molecula/featurebase/v2/short_txkey" - //txkey "github.com/molecula/featurebase/v2/txkey" + "github.com/molecula/featurebase/v3/roaring" + txkey "github.com/molecula/featurebase/v3/short_txkey" + //txkey "github.com/molecula/featurebase/v3/txkey" ) // writable initializes Tx that update, use !writable for read-only. diff --git a/tx_internal_test.go b/tx_internal_test.go index 8ffa2bd45..1ab4140c1 100644 --- a/tx_internal_test.go +++ b/tx_internal_test.go @@ -6,7 +6,7 @@ import ( "sync" "testing" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" ) const countRangeMaxN = 8192 diff --git a/tx_test.go b/tx_test.go index f82a3f321..6f1815c8e 100644 --- a/tx_test.go +++ b/tx_test.go @@ -7,12 +7,12 @@ import ( "strings" "testing" - pilosa "github.com/molecula/featurebase/v2" - "github.com/molecula/featurebase/v2/http" - "github.com/molecula/featurebase/v2/server" - "github.com/molecula/featurebase/v2/storage" - "github.com/molecula/featurebase/v2/test" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + pilosa "github.com/molecula/featurebase/v3" + "github.com/molecula/featurebase/v3/http" + "github.com/molecula/featurebase/v3/server" + "github.com/molecula/featurebase/v3/storage" + "github.com/molecula/featurebase/v3/test" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck ) func queryIRABit(m0api *pilosa.API, acctOwnerID uint64, iraField string, iraRowID uint64, index string) (bit bool) { diff --git a/txfactory.go b/txfactory.go index 12fa12981..c16208532 100644 --- a/txfactory.go +++ b/txfactory.go @@ -10,8 +10,8 @@ import ( "strings" "sync" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" ) diff --git a/util.go b/util.go index 7b81e9363..ad7397688 100644 --- a/util.go +++ b/util.go @@ -9,7 +9,7 @@ import ( "syscall" "time" - "github.com/molecula/featurebase/v2/roaring" + "github.com/molecula/featurebase/v3/roaring" "github.com/pkg/errors" ) diff --git a/utils_internal_test.go b/utils_internal_test.go index 30f675134..072fd5b1c 100644 --- a/utils_internal_test.go +++ b/utils_internal_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - pnet "github.com/molecula/featurebase/v2/net" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/topology" + pnet "github.com/molecula/featurebase/v3/net" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/topology" ) // utilities used by tests diff --git a/version.go b/version.go index 4aa0bd514..3383b8809 100644 --- a/version.go +++ b/version.go @@ -22,7 +22,7 @@ func VersionInfo(rename bool) string { if Version != "" { suffix = " " + Version } else { - suffix = " v2.x" + suffix = " v3.x" } buildTime := BuildTime if buildTime != "" { diff --git a/view.go b/view.go index 43eed3c34..d5e408810 100644 --- a/view.go +++ b/view.go @@ -13,11 +13,11 @@ import ( "sync/atomic" "time" - "github.com/molecula/featurebase/v2/pql" - "github.com/molecula/featurebase/v2/roaring" - "github.com/molecula/featurebase/v2/stats" - "github.com/molecula/featurebase/v2/testhook" - "github.com/molecula/featurebase/v2/vprint" + "github.com/molecula/featurebase/v3/pql" + "github.com/molecula/featurebase/v3/roaring" + "github.com/molecula/featurebase/v3/stats" + "github.com/molecula/featurebase/v3/testhook" + "github.com/molecula/featurebase/v3/vprint" "github.com/pkg/errors" "golang.org/x/sync/errgroup" ) diff --git a/view_internal_test.go b/view_internal_test.go index 98afe9487..b5a52170e 100644 --- a/view_internal_test.go +++ b/view_internal_test.go @@ -5,8 +5,8 @@ import ( "testing" "time" - "github.com/molecula/featurebase/v2/testhook" - . "github.com/molecula/featurebase/v2/vprint" // nolint:staticcheck + "github.com/molecula/featurebase/v3/testhook" + . "github.com/molecula/featurebase/v3/vprint" // nolint:staticcheck "golang.org/x/sync/errgroup" ) From 836df379ac958766653a28e376f4b730244cd340 Mon Sep 17 00:00:00 2001 From: reesporte Date: Fri, 21 Jan 2022 13:57:47 -0600 Subject: [PATCH 29/29] 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` --- authn/authenticate.go | 91 ++++----- authn/authenticate_internal_test.go | 279 ++++++++++++++++++++++++++-- http/handler.go | 8 +- http/handler_internal_test.go | 187 +++++++++++++++++-- server/grpc_test.go | 42 +++++ 5 files changed, 525 insertions(+), 82 deletions(-) diff --git a/authn/authenticate.go b/authn/authenticate.go index 037d30d14..202369a90 100644 --- a/authn/authenticate.go +++ b/authn/authenticate.go @@ -117,6 +117,7 @@ type Groups struct { // Authenticate takes in a bearer token `bearer` and returns UserInfo from that token func (a *Auth) Authenticate(bearer string) (*UserInfo, error) { // parse the bearer token into a jwt.Token + // this also validates the token, and checks that it's not expired token, err := jwt.Parse(bearer, func(token *jwt.Token) (interface{}, error) { if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok { return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"]) @@ -124,39 +125,21 @@ func (a *Auth) Authenticate(bearer string) (*UserInfo, error) { return a.secretKey, nil }) if token == nil || token.Claims == nil || err != nil || !token.Valid { - return nil, errors.Wrap(err, fmt.Sprintf("%#v parsing jwt claims from access tokens", token)) + return nil, fmt.Errorf("parsing bearer token: %v", err) } userInfo := UserInfo{} - // check that token does not expire now - switch claimType := token.Claims.(type) { - case jwt.MapClaims: - if exp, ok := claimType["exp"]; ok { - var e int64 - switch expType := exp.(type) { - case float64: - e = int64(expType) - case json.Number: - e, _ = expType.Int64() - } - if e <= time.Now().Unix() { - return nil, fmt.Errorf("token expired") - } - } - userInfo.UserID = claimType["oid"].(string) - userInfo.UserName = claimType["name"].(string) - userInfo.Token = bearer + claims := token.Claims.(jwt.MapClaims) + userInfo.UserID = claims["oid"].(string) + userInfo.UserName = claims["name"].(string) + userInfo.Token = bearer - g := claimType["molecula-idp-groups"].(string) - groups, err := FromGob64(g) - if err != nil { - return nil, errors.Wrap(err, "decoding groups") - } - userInfo.Groups = groups - - default: - return nil, fmt.Errorf("could not parse jwt claims of type %T, expected jwt.MapClaims", claimType) + g := claims["molecula-idp-groups"].(string) + groups, err := FromGob64(g) + if err != nil { + return nil, errors.Wrap(err, "decoding groups") } + userInfo.Groups = groups return &userInfo, nil } @@ -194,8 +177,16 @@ func (a *Auth) Redirect(w http.ResponseWriter, r *http.Request) { return } - // with vitamin A! - enrichedTkn, err := a.addGroupMembership(token.AccessToken) + // enrich token with groups! + g, err := a.getGroups(token.AccessToken) + if err != nil { + a.logger.Warnf("getting groups from IdP: %+v", err) + http.Error(w, "Bad Request", http.StatusBadRequest) + return + } + + // with vitamin G! (for groups) + enrichedTkn, err := a.addGroupMembership(token.AccessToken, g) if err != nil { a.logger.Warnf("enriching token with group membership: %+v", err) http.Error(w, "Bad Request", http.StatusBadRequest) @@ -217,40 +208,28 @@ func (a *Auth) getToken(r *http.Request, code string) (*oauth2.Token, error) { // addGroupMembership is only called in `a.Redirect`. It adds groups to a jwt's // claims, and signs it using `a.secretKey`. -func (a *Auth) addGroupMembership(token string) (string, error) { - g, err := a.getGroups(token) - if err != nil { - return "", err - } - +func (a *Auth) addGroupMembership(token string, g []Group) (string, error) { // parse token into jwt unenriched, _, err := new(jwt.Parser).ParseUnverified(token, jwt.MapClaims{}) if unenriched == nil || unenriched.Claims == nil || err != nil { - return "", errors.Wrap(err, fmt.Sprintf("%v parsing jwt claims from access tokens", token)) + return "", fmt.Errorf("parsing bearer token: %v", err) } enriched := jwt.New(jwt.SigningMethodHS256) enriched.Claims = unenriched.Claims - var tokenStr string // parse groups into string format - switch claims := enriched.Claims.(type) { - case jwt.MapClaims: - groupString, err := ToGob64(g) - if err != nil { - return "", errors.Wrap(err, "failed to serialize groups") - } + claims := enriched.Claims.(jwt.MapClaims) + groupString, err := ToGob64(g) + if err != nil { + return "", errors.Wrap(err, "failed to serialize groups") + } + // stick it into jwt claims + claims["molecula-idp-groups"] = groupString - // stick it into jwt claims - claims["molecula-idp-groups"] = groupString - - // get stringified and signed jwt - tokenStr, err = enriched.SignedString(a.secretKey) - if err != nil { - return "", errors.Wrap(err, "signing jwt") - } - - default: - return "", fmt.Errorf("could not parse jwt claims of type %T, expected jwt.MapClaims", claims) + // get stringified and signed jwt + tokenStr, err := enriched.SignedString(a.secretKey) + if err != nil { + return "", errors.Wrap(err, "signing jwt") } return tokenStr, nil @@ -303,7 +282,7 @@ func decodeHex(hexstr string) ([]byte, error) { return nil, errors.Wrap(err, "decoding hex string to byte slice") } if len(data) != 32 { - return nil, errors.Wrap(err, "invalid key length") + return nil, fmt.Errorf("invalid key length") } return data, nil } diff --git a/authn/authenticate_internal_test.go b/authn/authenticate_internal_test.go index 3eed3878c..d4fd63c6c 100644 --- a/authn/authenticate_internal_test.go +++ b/authn/authenticate_internal_test.go @@ -1,16 +1,24 @@ package authn import ( + "bytes" + "encoding/hex" + "fmt" + "net/http" "net/http/httptest" "os" + "reflect" "strings" "testing" "time" + "github.com/golang-jwt/jwt" "github.com/molecula/featurebase/v3/logger" + "github.com/pkg/errors" ) -func TestAuth(t *testing.T) { +func NewTestAuth(t *testing.T) *Auth { + t.Helper() var ( ClientID = "e9088663-eb08-41d7-8f65-efb5f54bbb71" ClientSecret = "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF" @@ -20,7 +28,6 @@ func TestAuth(t *testing.T) { LogoutURL = "https://login.microsoftonline.com/common/oauth2/v2.0/logout" Scopes = []string{"https://graph.microsoft.com/.default", "offline_access"} Key = "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF" - ShortKey = "DEADBEEFD" ) a, err := NewAuth( @@ -36,9 +43,13 @@ func TestAuth(t *testing.T) { Key, ) if err != nil { - t.Errorf("building auth object%s", err) + t.Fatalf("building auth object%s", err) } + return a +} +func TestAuth(t *testing.T) { + a := NewTestAuth(t) t.Run("SetCookie", func(t *testing.T) { w := httptest.NewRecorder() err := a.setCookie(w, "a cookie value", time.Now().Add(time.Hour)) @@ -53,23 +64,267 @@ func TestAuth(t *testing.T) { if got, want := w.Result().Cookies()[0].Path, "/"; got != want { t.Fatalf("path=%s, want %s", got, want) } - }) t.Run("KeyLength", func(t *testing.T) { _, err := NewAuth( logger.NewStandardLogger(os.Stdout), "http://localhost:10101/", - Scopes, - AuthorizeURL, - TokenURL, - GroupEndpointURL, - LogoutURL, - ClientID, - ClientSecret, - ShortKey, + []string{"https://graph.microsoft.com/.default", "offline_access"}, + "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/authorize", + "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/token", + "https://graph.microsoft.com/v1.0/me/transitiveMemberOf/microsoft.graph.group?$count=true", + "https://login.microsoftonline.com/common/oauth2/v2.0/logout", + "e9088663-eb08-41d7-8f65-efb5f54bbb71", + "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", + "DEADBEEFD", ) if err == nil || !strings.Contains(err.Error(), "decoding secret key") { t.Fatalf("expected error decoding secret key got: %v", err) } }) + t.Run("GetSecretKey", func(t *testing.T) { + want, _ := hex.DecodeString("DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF") + if got := a.SecretKey(); !bytes.Equal(got, want) { + t.Fatalf("expected %v, got %v", got, want) + } + }) + cases := []struct { + name string + uid string + uname string + exp interface{} + groups []Group + err error + }{ + { + name: "GoodToken", + uid: "42", + uname: "A. Token", + groups: []Group{ + { + GroupID: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe", + GroupName: "adminGroup", + }, + }, + }, + { + name: "ExpiredToken", + uid: "42", + uname: "A. Token", + groups: []Group{ + { + GroupID: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe", + GroupName: "adminGroup", + }, + }, + exp: "-17764800", + err: errors.Wrap(fmt.Errorf("Token is expired"), "parsing bearer token"), + }, + } + for _, test := range cases { + t.Run(test.name, func(t *testing.T) { + tkn := jwt.New(jwt.SigningMethodHS256) + claims := tkn.Claims.(jwt.MapClaims) + groupString, err := ToGob64(test.groups) + if err != nil { + t.Fatalf("unexpected error when gobbing groups %v", err) + } + claims["molecula-idp-groups"] = groupString + claims["oid"] = test.uid + claims["name"] = test.uname + if test.exp != nil { + claims["exp"] = test.exp + } + token, err := tkn.SignedString(a.SecretKey()) + if err != nil { + t.Fatalf("unexpected error when signing token %v", err) + } + + uinfo, err := a.Authenticate(token) + // okay this part kind of sucks bc we need to check errors and i + // dont want to write a whole new test for things that should have + // errors just to avoid this mess. errors.Is doesn't work either + if (test.err == nil && err != nil) || (test.err != nil && err == nil) { + t.Fatalf("expected %v, but got %v", test.err, err) + } else if test.err != nil && err != nil { + if test.err.Error() != err.Error() { + t.Fatalf("expected %v, but got %v", test.err, err) + } else { + return + } + } + + if !reflect.DeepEqual(uinfo.Groups, test.groups) { + t.Fatalf("expected %v, got %v", test.groups, uinfo.Groups) + } + if !reflect.DeepEqual(uinfo.UserID, test.uid) { + t.Fatalf("expected %v, got %v", test.uid, uinfo.UserID) + } + if !reflect.DeepEqual(uinfo.UserName, test.uname) { + t.Fatalf("expected %v, got %v", test.uname, uinfo.UserName) + } + }) + } +} + +func TestGobs(t *testing.T) { + t.Run("goodGob!", func(t *testing.T) { + g := []Group{ + { + GroupID: "groupA", + GroupName: "groupA-Name", + }, + { + GroupID: "groupB", + GroupName: "groupB-Name", + }, + { + GroupID: "groupC", + GroupName: "groupC-Name", + }, + } + gobbed, err := ToGob64(g) + if err != nil { + t.Fatalf("could not gob %+v", g) + } + ungobbed, err := FromGob64(gobbed) + if err != nil { + t.Fatalf("could not ungob %+v", gobbed) + } + if !reflect.DeepEqual(ungobbed, g) { + t.Fatalf("expected %v, got %v", g, ungobbed) + } + }) +} + +func TestDecodeHex(t *testing.T) { + t.Run("cantDecode", func(t *testing.T) { + _, err := decodeHex("gggg") + if err == nil { + t.Fatalf("expected err cannot decode slice, got nil") + } + }) + t.Run("tooSmall", func(t *testing.T) { + _, err := decodeHex("DEADBEEF") + if err == nil { + t.Fatalf("expected err wrong length, got nil") + } + }) + t.Run("tooBig", func(t *testing.T) { + _, err := decodeHex("DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF") + if err == nil { + t.Fatalf("expected err wrong length, got nil") + } + }) + t.Run("justRight", func(t *testing.T) { + _, err := decodeHex("DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF") + if err != nil { + t.Fatalf("expected nil, got %v", err) + } + }) +} + +func TestAddGroupMembership(t *testing.T) { + cases := []struct { + name string + groups []Group + err error + }{ + { + name: "emptyGroups", + groups: []Group{}, + err: nil, + }, + { + name: "happyPath", + groups: []Group{ + { + GroupID: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe", + GroupName: "adminGroup", + }, + }, + err: nil, + }, + } + a := NewTestAuth(t) + for _, test := range cases { + t.Run(test.name, func(t *testing.T) { + tkn := jwt.New(jwt.SigningMethodHS256) + token, err := tkn.SignedString(a.SecretKey()) + if err != nil { + t.Fatalf("unexpected error when signing token %v", err) + } + + tokenWithGroups, err := a.addGroupMembership(token, test.groups) + // okay this part kind of sucks bc we need to check errors and i + // dont want to write a whole new test for things that should have + // errors just to avoid this mess. errors.Is doesn't work either + if (test.err == nil && err != nil) || (test.err != nil && err == nil) { + t.Fatalf("expected %v but got %v", test.err, err) + } else if test.err != nil && err != nil { + if test.err.Error() != err.Error() { + t.Fatalf("expected %v, but got %v", test.err, err) + } else { + return + } + } + parsed, _, err := new(jwt.Parser).ParseUnverified(tokenWithGroups, jwt.MapClaims{}) + if err != nil { + t.Fatalf("unexpected error parsing token %v", err) + } + + claims := parsed.Claims.(jwt.MapClaims) + groups, err := FromGob64(claims["molecula-idp-groups"].(string)) + if err != nil { + t.Fatalf("unexpected error parsing groupString %v", err) + } + + if !reflect.DeepEqual(groups, test.groups) { + t.Fatalf("expected %v, got %v", test.groups, groups) + } + }) + } +} + +func TestHandlers(t *testing.T) { + a := NewTestAuth(t) + t.Run("login", func(t *testing.T) { + req := httptest.NewRequest("GET", "/login", nil) + w := httptest.NewRecorder() + a.Login(w, req) + resp := w.Result() + if resp.StatusCode != http.StatusTemporaryRedirect { + t.Fatalf("expected redirect, got %v", resp.StatusCode) + } + redirect := a.oAuthConfig.AuthCodeURL(a.oAuthConfig.Endpoint.AuthURL) + if got, err := resp.Location(); err != nil || got.String() != redirect { + t.Fatalf("expected %v, got %v", redirect, got.Path) + } + }) + t.Run("logout", func(t *testing.T) { + req := httptest.NewRequest("GET", "/logout", nil) + w := httptest.NewRecorder() + a.Logout(w, req) + resp := w.Result() + if resp.StatusCode != http.StatusTemporaryRedirect { + t.Fatalf("expected redirect, got %v", resp.StatusCode) + } + redirect := fmt.Sprintf("%s?post_logout_redirect_uri=%s/", a.logoutEndpoint, a.fbURL) + if got, err := resp.Location(); err != nil || got.String() != redirect { + t.Fatalf("expected %v, got %v", redirect, got.Path) + } + for _, c := range resp.Cookies() { + if c.Name == "molecula-chip" { + if c.Value != "" { + t.Fatalf("cookie not set to empty value!") + } + want := time.Unix(0, 0).Unix() + got := c.Expires.Unix() + if want != got { + t.Fatalf("expected %v, got %v", want, got) + } + break + } + } + }) } diff --git a/http/handler.go b/http/handler.go index d92f69e45..1dbf32c68 100644 --- a/http/handler.go +++ b/http/handler.go @@ -544,9 +544,13 @@ func (h *Handler) chkInternal(handler http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if h.auth != nil { secret, ok := r.Header["X-Feature-Key"] - decodedString, err := hex.DecodeString(secret[0]) + secretString := "" + if ok { + secretString = secret[0] + } + decodedString, err := hex.DecodeString(secretString) if err != nil || !ok || !bytes.Equal(decodedString, h.auth.SecretKey()) { - http.Error(w, errors.Wrap(err, "internal secret key validation failed").Error(), http.StatusUnauthorized) + http.Error(w, "internal secret key validation failed", http.StatusUnauthorized) return } } diff --git a/http/handler_internal_test.go b/http/handler_internal_test.go index a3fcdb133..25173ede6 100644 --- a/http/handler_internal_test.go +++ b/http/handler_internal_test.go @@ -6,6 +6,7 @@ import ( "encoding/hex" "encoding/json" "io/ioutil" + "net/http" gohttp "net/http" "net/http/httptest" "net/url" @@ -235,7 +236,7 @@ func TestAuthentication(t *testing.T) { claims["name"] = "todd" validToken, err := tkn.SignedString([]byte(secretKey)) if err != nil { - panic(err) + t.Fatal(err) } validToken = "Bearer " + validToken @@ -247,15 +248,10 @@ func TestAuthentication(t *testing.T) { } // make an expired token - expiredTkn := jwt.New(jwt.SigningMethodHS256) - expiredClaims := expiredTkn.Claims.(jwt.MapClaims) - expiredClaims["molecula-idp-groups"] = groupString - expiredClaims["oid"] = "42" - expiredClaims["name"] = "todd" - expiredClaims["exp"] = "1" - expiredToken, err := expiredTkn.SignedString([]byte(secretKey)) + claims["exp"] = "1" + expiredToken, err := tkn.SignedString([]byte(secretKey)) if err != nil { - panic(err) + t.Fatal(err) } expiredToken = "Bearer " + expiredToken @@ -502,9 +498,7 @@ admin: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe"` }, }, { - // this tests that there are no permissions read in even though - // auth is turned on, so we get a 500 - name: "MW-CreateIndexGood", + name: "MW-CreateIndexInsufficientPerms", path: "/index/abcd", kind: "bearer", method: gohttp.MethodPost, @@ -622,3 +616,172 @@ admin: "ac97c9e2-346b-42a2-b6da-18bcb61a32fe"` } } + +func TestChkAuthN(t *testing.T) { + a := NewTestAuth(t) + h := Handler{ + logger: logger.NewStandardLogger(os.Stdout), + queryLogger: logger.NewStandardLogger(os.Stdout), + auth: a, + } + + // make a valid token + tkn := jwt.New(jwt.SigningMethodHS256) + claims := tkn.Claims.(jwt.MapClaims) + groupString, _ := authn.ToGob64([]authn.Group{{GroupID: "thing", GroupName: "whatever"}}) + claims["molecula-idp-groups"] = groupString + claims["oid"] = "42" + claims["name"] = "A. Token" + validToken, err := tkn.SignedString(a.SecretKey()) + if err != nil { + t.Fatal(err) + } + validToken = "Bearer " + validToken + + // make an invalid token + invalidKey, err := hex.DecodeString("DEADBEEDDEADBEEDDEADBEEDDEADBEEDDEADBEEDDEADBEEDDEADBEEDDEADBEED") + if err != nil { + t.Fatal(err) + } + invalidToken, err := tkn.SignedString(invalidKey) + if err != nil { + t.Fatal(err) + } + invalidToken = "Bearer " + invalidToken + + // make an expired token + claims["exp"] = "1" + expiredToken, err := tkn.SignedString(a.SecretKey()) + if err != nil { + t.Fatal(err) + } + expiredToken = "Bearer " + expiredToken + + testingHandler := func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("good")) + } + + cases := []struct { + name string + endpoint string + token string + handler http.HandlerFunc + statusCode int + }{ + { + name: "Valid", + token: validToken, + handler: h.chkAuthN(testingHandler), + statusCode: http.StatusOK, + }, + { + name: "Invalid", + token: invalidToken, + handler: h.chkAuthN(testingHandler), + statusCode: http.StatusUnauthorized, + }, + { + name: "Expired", + token: expiredToken, + handler: h.chkAuthN(testingHandler), + statusCode: http.StatusUnauthorized, + }, + } + for _, test := range cases { + t.Run(test.name, func(t *testing.T) { + w := httptest.NewRecorder() + r := httptest.NewRequest("GET", "/whatever", nil) + r.Header.Add("Authorization", test.token) + test.handler(w, r) + resp := w.Result() + if resp.StatusCode != test.statusCode { + t.Fatalf("expected %v, got %v", test.statusCode, resp.StatusCode) + } + }) + } +} + +func TestChkInternal(t *testing.T) { + a := NewTestAuth(t) + authKey := "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF" + h := Handler{ + logger: logger.NewStandardLogger(os.Stdout), + queryLogger: logger.NewStandardLogger(os.Stdout), + auth: a, + } + + testingHandler := func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("good")) + } + + cases := []struct { + name string + statusCode int + handler http.HandlerFunc + key string + }{ + { + name: "happyPath", + statusCode: http.StatusOK, + handler: h.chkInternal(testingHandler), + key: authKey, + }, + { + name: "unhappyPath-empty", + statusCode: http.StatusUnauthorized, + handler: h.chkInternal(testingHandler), + key: "", + }, + { + name: "unhappyPath-wrong", + statusCode: http.StatusUnauthorized, + handler: h.chkInternal(testingHandler), + key: "BEABBEEFBEABBEEFBEABBEEFBEABBEEFBEABBEEFBEABBEEFBEABBEEFBEABBEEF", + }, + } + for _, test := range cases { + t.Run(test.name, func(t *testing.T) { + w := httptest.NewRecorder() + r := httptest.NewRequest("GET", "/whatever", nil) + if test.key != "" { + r.Header.Add("X-Feature-Key", test.key) + } + test.handler(w, r) + resp := w.Result() + if resp.StatusCode != test.statusCode { + t.Fatalf("expected %v, got %v", test.statusCode, resp.StatusCode) + } + }) + } +} + +func NewTestAuth(t *testing.T) *authn.Auth { + t.Helper() + var ( + ClientID = "e9088663-eb08-41d7-8f65-efb5f54bbb71" + ClientSecret = "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF" + AuthorizeURL = "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/authorize" + TokenURL = "https://login.microsoftonline.com/4a137d66-d161-4ae4-b1e6-07e9920874b8/oauth2/v2.0/token" + GroupEndpointURL = "https://graph.microsoft.com/v1.0/me/transitiveMemberOf/microsoft.graph.group?$count=true" + LogoutURL = "https://login.microsoftonline.com/common/oauth2/v2.0/logout" + Scopes = []string{"https://graph.microsoft.com/.default", "offline_access"} + Key = "DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF" + ) + + a, err := authn.NewAuth( + logger.NewStandardLogger(os.Stdout), + "http://localhost:10101/", + Scopes, + AuthorizeURL, + TokenURL, + GroupEndpointURL, + LogoutURL, + ClientID, + ClientSecret, + Key, + ) + if err != nil { + t.Fatalf("building auth object%s", err) + } + return a +} diff --git a/server/grpc_test.go b/server/grpc_test.go index 55c9e65c1..376b44ff2 100644 --- a/server/grpc_test.go +++ b/server/grpc_test.go @@ -2,6 +2,7 @@ package server_test import ( + "bytes" "context" "encoding/hex" "fmt" @@ -1427,6 +1428,47 @@ func TestCRUDIndexes(t *testing.T) { }) } +func TestLogQuery(t *testing.T) { + method := "test!" + uinfo := authn.UserInfo{ + UserID: "ID", + UserName: "name", + } + ctx := context.WithValue(context.Background(), "userinfo", &uinfo) + + cases := []struct { + name string + req interface{} + expected string + }{ + { + name: "nonQueryReq", + req: "nope", + expected: fmt.Sprintf("GRPC: %v, %v, %v, %v, %v\n", "", []string{}, "test!", uinfo.UserID, uinfo.UserName), + }, + { + name: "QuerySQLReq", + req: &pb.QuerySQLRequest{Sql: "show fields from table"}, + expected: fmt.Sprintf("GRPC: %v, %v, %v, %v, %v, %v\n", "", []string{}, "test!", uinfo.UserID, uinfo.UserName, "show fields from table"), + }, + { + name: "QueryPQLReq", + req: &pb.QueryPQLRequest{Pql: "Count(All())"}, + expected: fmt.Sprintf("GRPC: %v, %v, %v, %v, %v, %v\n", "", []string{}, "test!", uinfo.UserID, uinfo.UserName, "Count(All())"), + }, + } + for _, test := range cases { + t.Run(test.name, func(t *testing.T) { + buf := new(bytes.Buffer) + l := logger.NewStandardLogger(buf) + server.LogQuery(ctx, method, test.req, l) + if !strings.HasSuffix(buf.String(), test.expected) { + t.Errorf("expected '%v', got '%v'", test.expected, buf.String()) + } + }) + } +} + func setUpTestQuerySQLUnary(ctx context.Context, t *testing.T) (gh *server.GRPCHandler, tearDownFunc func()) { t.Helper()