From 811f1b41242453facb8dc1e9f173b452f42856b5 Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Thu, 4 Apr 2019 14:27:52 -0500 Subject: [PATCH] move build-tagged shardwidth files to subpackage --- executor.go | 3 ++- fragment.go | 5 +++-- shardwidth/16.go | 5 +++++ shardwidth/17.go | 5 +++++ shardwidth/18.go | 5 +++++ shardwidth/19.go | 5 +++++ shardwidth20.go => shardwidth/20.go | 4 ++-- shardwidth/21.go | 5 +++++ shardwidth/22.go | 5 +++++ shardwidth/23.go | 5 +++++ shardwidth/24.go | 5 +++++ shardwidth/25.go | 5 +++++ shardwidth/26.go | 5 +++++ shardwidth/27.go | 5 +++++ shardwidth/28.go | 5 +++++ shardwidth/29.go | 5 +++++ shardwidth/30.go | 5 +++++ shardwidth/31.go | 5 +++++ shardwidth/32.go | 5 +++++ shardwidth22.go | 5 ----- 20 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 shardwidth/16.go create mode 100644 shardwidth/17.go create mode 100644 shardwidth/18.go create mode 100644 shardwidth/19.go rename shardwidth20.go => shardwidth/20.go (83%) create mode 100644 shardwidth/21.go create mode 100644 shardwidth/22.go create mode 100644 shardwidth/23.go create mode 100644 shardwidth/24.go create mode 100644 shardwidth/25.go create mode 100644 shardwidth/26.go create mode 100644 shardwidth/27.go create mode 100644 shardwidth/28.go create mode 100644 shardwidth/29.go create mode 100644 shardwidth/30.go create mode 100644 shardwidth/31.go create mode 100644 shardwidth/32.go delete mode 100644 shardwidth22.go diff --git a/executor.go b/executor.go index b345d434b..89c6d8228 100644 --- a/executor.go +++ b/executor.go @@ -22,6 +22,7 @@ import ( "time" "github.com/pilosa/pilosa/pql" + "github.com/pilosa/pilosa/shardwidth" "github.com/pilosa/pilosa/tracing" "github.com/pkg/errors" ) @@ -1234,7 +1235,7 @@ func (e *executor) executeRowsShard(_ context.Context, index string, fieldName s if columnID, ok, err := c.UintArg("column"); err != nil { return nil, err } else if ok { - colShard := columnID >> shardWidthExponent + colShard := columnID >> shardwidth.Exponent if colShard != shard { return rowIDs, nil } diff --git a/fragment.go b/fragment.go index 1fdce2ee5..82288c914 100644 --- a/fragment.go +++ b/fragment.go @@ -40,6 +40,7 @@ import ( "github.com/pilosa/pilosa/logger" "github.com/pilosa/pilosa/pql" "github.com/pilosa/pilosa/roaring" + "github.com/pilosa/pilosa/shardwidth" "github.com/pilosa/pilosa/stats" "github.com/pilosa/pilosa/syswrap" "github.com/pilosa/pilosa/tracing" @@ -50,7 +51,7 @@ const ( // ShardWidth is the number of column IDs in a shard. It must be a power of 2 greater than or equal to 16. // shardWidthExponent = 20 // set in shardwidthNN.go files - ShardWidth = 1 << shardWidthExponent + ShardWidth = 1 << shardwidth.Exponent // shardVsContainerExponent is the power of 2 of ShardWith minus the power // of two of roaring container width (which is 16). @@ -60,7 +61,7 @@ const ( // which a given container is in means dividing by the number of rows per // container which is performantly expressed as a right shift by this // exponent. - shardVsContainerExponent = shardWidthExponent - 16 + shardVsContainerExponent = shardwidth.Exponent - 16 // width of roaring containers is 2^16 containerWidth = 1 << 16 diff --git a/shardwidth/16.go b/shardwidth/16.go new file mode 100644 index 000000000..f9e90c047 --- /dev/null +++ b/shardwidth/16.go @@ -0,0 +1,5 @@ +// +build shardwidth16 + +package shardwidth + +const Exponent = 16 diff --git a/shardwidth/17.go b/shardwidth/17.go new file mode 100644 index 000000000..65653456e --- /dev/null +++ b/shardwidth/17.go @@ -0,0 +1,5 @@ +// +build shardwidth17 + +package shardwidth + +const Exponent = 17 diff --git a/shardwidth/18.go b/shardwidth/18.go new file mode 100644 index 000000000..1357a3c17 --- /dev/null +++ b/shardwidth/18.go @@ -0,0 +1,5 @@ +// +build shardwidth18 + +package shardwidth + +const Exponent = 18 diff --git a/shardwidth/19.go b/shardwidth/19.go new file mode 100644 index 000000000..a3333540c --- /dev/null +++ b/shardwidth/19.go @@ -0,0 +1,5 @@ +// +build shardwidth19 + +package shardwidth + +const Exponent = 19 diff --git a/shardwidth20.go b/shardwidth/20.go similarity index 83% rename from shardwidth20.go rename to shardwidth/20.go index fd99f0a84..e45c5a472 100644 --- a/shardwidth20.go +++ b/shardwidth/20.go @@ -1,5 +1,5 @@ // +build !shardwidth16,!shardwidth17,!shardwidth18,!shardwidth19,!shardwidth21,!shardwidth22,!shardwidth23,!shardwidth24,!shardwidth25,!shardwidth26,!shardwidth27,!shardwidth28,!shardwidth29,!shardwidth30,!shardwidth31,!shardwidth32 -package pilosa +package shardwidth -const shardWidthExponent = 20 +const Exponent = 20 diff --git a/shardwidth/21.go b/shardwidth/21.go new file mode 100644 index 000000000..edaf0a010 --- /dev/null +++ b/shardwidth/21.go @@ -0,0 +1,5 @@ +// +build shardwidth21 + +package shardwidth + +const Exponent = 21 diff --git a/shardwidth/22.go b/shardwidth/22.go new file mode 100644 index 000000000..ab75e51da --- /dev/null +++ b/shardwidth/22.go @@ -0,0 +1,5 @@ +// +build shardwidth22 + +package shardwidth + +const Exponent = 22 diff --git a/shardwidth/23.go b/shardwidth/23.go new file mode 100644 index 000000000..2535a2dee --- /dev/null +++ b/shardwidth/23.go @@ -0,0 +1,5 @@ +// +build shardwidth23 + +package shardwidth + +const Exponent = 23 diff --git a/shardwidth/24.go b/shardwidth/24.go new file mode 100644 index 000000000..b1275afd8 --- /dev/null +++ b/shardwidth/24.go @@ -0,0 +1,5 @@ +// +build shardwidth24 + +package shardwidth + +const Exponent = 24 diff --git a/shardwidth/25.go b/shardwidth/25.go new file mode 100644 index 000000000..9599ba5a3 --- /dev/null +++ b/shardwidth/25.go @@ -0,0 +1,5 @@ +// +build shardwidth25 + +package shardwidth + +const Exponent = 25 diff --git a/shardwidth/26.go b/shardwidth/26.go new file mode 100644 index 000000000..e7dfdd13b --- /dev/null +++ b/shardwidth/26.go @@ -0,0 +1,5 @@ +// +build shardwidth26 + +package shardwidth + +const Exponent = 26 diff --git a/shardwidth/27.go b/shardwidth/27.go new file mode 100644 index 000000000..568a798f8 --- /dev/null +++ b/shardwidth/27.go @@ -0,0 +1,5 @@ +// +build shardwidth27 + +package shardwidth + +const Exponent = 27 diff --git a/shardwidth/28.go b/shardwidth/28.go new file mode 100644 index 000000000..bb43cd5a3 --- /dev/null +++ b/shardwidth/28.go @@ -0,0 +1,5 @@ +// +build shardwidth28 + +package shardwidth + +const Exponent = 28 diff --git a/shardwidth/29.go b/shardwidth/29.go new file mode 100644 index 000000000..f797b632d --- /dev/null +++ b/shardwidth/29.go @@ -0,0 +1,5 @@ +// +build shardwidth29 + +package shardwidth + +const Exponent = 29 diff --git a/shardwidth/30.go b/shardwidth/30.go new file mode 100644 index 000000000..aac761c82 --- /dev/null +++ b/shardwidth/30.go @@ -0,0 +1,5 @@ +// +build shardwidth30 + +package shardwidth + +const Exponent = 30 diff --git a/shardwidth/31.go b/shardwidth/31.go new file mode 100644 index 000000000..12f85bfcf --- /dev/null +++ b/shardwidth/31.go @@ -0,0 +1,5 @@ +// +build shardwidth31 + +package shardwidth + +const Exponent = 31 diff --git a/shardwidth/32.go b/shardwidth/32.go new file mode 100644 index 000000000..76dde6b04 --- /dev/null +++ b/shardwidth/32.go @@ -0,0 +1,5 @@ +// +build shardwidth32 + +package shardwidth + +const Exponent = 32 diff --git a/shardwidth22.go b/shardwidth22.go deleted file mode 100644 index 57727a9a5..000000000 --- a/shardwidth22.go +++ /dev/null @@ -1,5 +0,0 @@ -// +build shardwidth22 - -package pilosa - -const shardWidthExponent = 22