From f4b58043bad7239d731ac290b2a8f67917ba5213 Mon Sep 17 00:00:00 2001 From: CLoZengineer <108562102+CLoZengineer@users.noreply.github.com> Date: Tue, 25 Oct 2022 10:41:39 -0400 Subject: [PATCH 1/2] chore: adds release workflow with basic build step (#2182) * adds release workflow with basic build step Co-authored-by: Christopher Lowenthal --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..c6de7bda0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: workflow_dispatch + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + goos: + - "darwin" + - "linux" + goarch: + - "amd64" + - "arm64" + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v3 + with: + go-version: "^1.19.1" + + - name: build + run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ./build/${{ matrix.goos }}-${{ matrix.goarch }} From fc1a5dad531cc7301322e4bd8c6155c7e120e50a Mon Sep 17 00:00:00 2001 From: CLoZengineer <108562102+CLoZengineer@users.noreply.github.com> Date: Tue, 25 Oct 2022 13:30:00 -0400 Subject: [PATCH 2/2] feat: updates shardwidth.Exponent to single constant (#2185) * removes build time constant in favor of single constant with relevant godoc and warnings Co-authored-by: Christopher Lowenthal --- Makefile | 3 +-- shardwidth/16.go | 8 -------- shardwidth/17.go | 8 -------- shardwidth/18.go | 8 -------- shardwidth/19.go | 8 -------- shardwidth/20.go | 8 -------- shardwidth/21.go | 8 -------- shardwidth/22.go | 8 -------- shardwidth/23.go | 8 -------- shardwidth/24.go | 8 -------- shardwidth/25.go | 8 -------- shardwidth/26.go | 8 -------- shardwidth/27.go | 8 -------- shardwidth/28.go | 8 -------- shardwidth/29.go | 8 -------- shardwidth/30.go | 8 -------- shardwidth/31.go | 8 -------- shardwidth/32.go | 8 -------- shardwidth/helper.go | 7 +++++++ 19 files changed, 8 insertions(+), 138 deletions(-) delete mode 100644 shardwidth/16.go delete mode 100644 shardwidth/17.go delete mode 100644 shardwidth/18.go delete mode 100644 shardwidth/19.go delete mode 100644 shardwidth/20.go delete mode 100644 shardwidth/21.go delete mode 100644 shardwidth/22.go delete mode 100644 shardwidth/23.go delete mode 100644 shardwidth/24.go delete mode 100644 shardwidth/25.go delete mode 100644 shardwidth/26.go delete mode 100644 shardwidth/27.go delete mode 100644 shardwidth/28.go delete mode 100644 shardwidth/29.go delete mode 100644 shardwidth/30.go delete mode 100644 shardwidth/31.go delete mode 100644 shardwidth/32.go diff --git a/Makefile b/Makefile index 0da6b501b..305cd549f 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,11 @@ VERSION_ID=$(if $(TRIAL_DEADLINE),trial-$(TRIAL_DEADLINE)-,)$(VERSION)-$(GOOS)-$ BRANCH := $(if $(CIRCLE_BRANCH),$(CIRCLE_BRANCH),$(shell git rev-parse --abbrev-ref HEAD)) 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/featurebasedb/featurebase/v3.Version=$(VERSION) -X github.com/featurebasedb/featurebase/v3.BuildTime=$(BUILD_TIME) -X github.com/featurebasedb/featurebase/v3.Variant=$(VARIANT) -X github.com/featurebasedb/featurebase/v3.Commit=$(COMMIT) -X github.com/featurebasedb/featurebase/v3.TrialDeadline=$(TRIAL_DEADLINE)" GO_VERSION=1.19 DOCKER_BUILD= # set to 1 to use `docker-build` instead of `build` when creating a release -BUILD_TAGS += shardwidth$(SHARD_WIDTH) +BUILD_TAGS += TEST_TAGS = roaringparanoia UNAME := $(shell uname -s) TEST_TIMEOUT=10m diff --git a/shardwidth/16.go b/shardwidth/16.go deleted file mode 100644 index 9a1780a01..000000000 --- a/shardwidth/16.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth16 -// +build shardwidth16 - -package shardwidth - -const Exponent = 16 diff --git a/shardwidth/17.go b/shardwidth/17.go deleted file mode 100644 index 52812fd4c..000000000 --- a/shardwidth/17.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth17 -// +build shardwidth17 - -package shardwidth - -const Exponent = 17 diff --git a/shardwidth/18.go b/shardwidth/18.go deleted file mode 100644 index 318c78cbc..000000000 --- a/shardwidth/18.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth18 -// +build shardwidth18 - -package shardwidth - -const Exponent = 18 diff --git a/shardwidth/19.go b/shardwidth/19.go deleted file mode 100644 index 8bc4b73c5..000000000 --- a/shardwidth/19.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth19 -// +build shardwidth19 - -package shardwidth - -const Exponent = 19 diff --git a/shardwidth/20.go b/shardwidth/20.go deleted file mode 100644 index a1c0603d6..000000000 --- a/shardwidth/20.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build !shardwidth16 && !shardwidth17 && !shardwidth18 && !shardwidth19 && !shardwidth21 && !shardwidth22 && !shardwidth23 && !shardwidth24 && !shardwidth25 && !shardwidth26 && !shardwidth27 && !shardwidth28 && !shardwidth29 && !shardwidth30 && !shardwidth31 && !shardwidth32 -// +build !shardwidth16,!shardwidth17,!shardwidth18,!shardwidth19,!shardwidth21,!shardwidth22,!shardwidth23,!shardwidth24,!shardwidth25,!shardwidth26,!shardwidth27,!shardwidth28,!shardwidth29,!shardwidth30,!shardwidth31,!shardwidth32 - -package shardwidth - -const Exponent = 20 diff --git a/shardwidth/21.go b/shardwidth/21.go deleted file mode 100644 index 06530015b..000000000 --- a/shardwidth/21.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth21 -// +build shardwidth21 - -package shardwidth - -const Exponent = 21 diff --git a/shardwidth/22.go b/shardwidth/22.go deleted file mode 100644 index fa607edcc..000000000 --- a/shardwidth/22.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth22 -// +build shardwidth22 - -package shardwidth - -const Exponent = 22 diff --git a/shardwidth/23.go b/shardwidth/23.go deleted file mode 100644 index 934365b83..000000000 --- a/shardwidth/23.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth23 -// +build shardwidth23 - -package shardwidth - -const Exponent = 23 diff --git a/shardwidth/24.go b/shardwidth/24.go deleted file mode 100644 index 3200dac10..000000000 --- a/shardwidth/24.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth24 -// +build shardwidth24 - -package shardwidth - -const Exponent = 24 diff --git a/shardwidth/25.go b/shardwidth/25.go deleted file mode 100644 index e3e62f1a2..000000000 --- a/shardwidth/25.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth25 -// +build shardwidth25 - -package shardwidth - -const Exponent = 25 diff --git a/shardwidth/26.go b/shardwidth/26.go deleted file mode 100644 index be631f0de..000000000 --- a/shardwidth/26.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth26 -// +build shardwidth26 - -package shardwidth - -const Exponent = 26 diff --git a/shardwidth/27.go b/shardwidth/27.go deleted file mode 100644 index f8506f5cf..000000000 --- a/shardwidth/27.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth27 -// +build shardwidth27 - -package shardwidth - -const Exponent = 27 diff --git a/shardwidth/28.go b/shardwidth/28.go deleted file mode 100644 index 2103b1ec4..000000000 --- a/shardwidth/28.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth28 -// +build shardwidth28 - -package shardwidth - -const Exponent = 28 diff --git a/shardwidth/29.go b/shardwidth/29.go deleted file mode 100644 index 1d8bebcfb..000000000 --- a/shardwidth/29.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth29 -// +build shardwidth29 - -package shardwidth - -const Exponent = 29 diff --git a/shardwidth/30.go b/shardwidth/30.go deleted file mode 100644 index 3cb928d11..000000000 --- a/shardwidth/30.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth30 -// +build shardwidth30 - -package shardwidth - -const Exponent = 30 diff --git a/shardwidth/31.go b/shardwidth/31.go deleted file mode 100644 index 70892306f..000000000 --- a/shardwidth/31.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth31 -// +build shardwidth31 - -package shardwidth - -const Exponent = 31 diff --git a/shardwidth/32.go b/shardwidth/32.go deleted file mode 100644 index f07c241b8..000000000 --- a/shardwidth/32.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2022 Molecula Corp. (DBA FeatureBase). -// SPDX-License-Identifier: Apache-2.0 -//go:build shardwidth32 -// +build shardwidth32 - -package shardwidth - -const Exponent = 32 diff --git a/shardwidth/helper.go b/shardwidth/helper.go index 8785bae2e..85fe5285c 100644 --- a/shardwidth/helper.go +++ b/shardwidth/helper.go @@ -6,6 +6,13 @@ import ( "math/bits" ) +// Exponent controls the size of each shard +// +// # Warnings +// - changing this value WILL corrupt any data sets created with a different value +// - both server and client must be compiled with the same Exponent +const Exponent = 20 + // FindNextShard returns the index of the first item which is not in the // same shard as i. The index it returns may be equal to the length of the // haystack, indicatincg that the rest of the list is in the same shard.