Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
49755: c-deps/proj: bump PROJ to compile on more systems r=knz a=otan

CMake is broken for the value of `PTHREAD_MUTEX_RECURSIVE` on certain
operating systems. To rectify this, we've patched PROJ at version 4.9.3
at `cc4a178` with a fix. We'll be using the CRDB fork of PROJ for the
meantime to fix this for now.

fixes #49749

Release note: None

49756: types: fix bug where calling String() on a UDT array would panic r=otan a=rohany

It seems like I ran into a proto bug, opened
gogo/protobuf#693.

Release note: None

49757: geo: remove geoproj dependency for now r=otan a=otan

Seems to be breaking Upload Binaries (not sure why) because execgen
depends on geo. The dependencies should make it work (not sure why it
doesn't), but it doesn't seem important to solve this atm (planning to hide
it in some sort of dependency injection hack later).

Release note: None

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu>
  • Loading branch information
3 people committed Jun 1, 2020
4 parents e43d665 + a6f8e44 + ec0d894 + 58d5b23 commit 2300343
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
url = https://github.com/libgeos/geos.git
[submodule "c-deps/proj"]
path = c-deps/proj
url = https://github.com/OSGeo/PROJ.git
url = https://github.com/cockroachdb/PROJ.git
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,6 @@ bin/execgen_out.d: bin/execgen
@echo EXECGEN $@; execgen -M $(EXECGEN_TARGETS) >$@.tmp || { rm -f $@.tmp; exit 1; }
@mv -f $@.tmp $@

bin/execgen: $(LIBPROJ) $(CGO_FLAGS_FILES)

# No need to pull all the world in when a user just wants
# to know how to invoke `make` or clean up.
ifneq ($(build-with-dep-files),)
Expand Down
2 changes: 1 addition & 1 deletion c-deps/proj
Submodule proj updated 1 files
+10 −3 CMakeLists.txt
2 changes: 1 addition & 1 deletion c-deps/proj-rebuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bump the version below when changing geos configure flags. Search for "BUILD
ARTIFACT CACHING" in build/common.mk for rationale.

1
2
1 change: 0 additions & 1 deletion pkg/geo/geo.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"encoding/binary"

"github.com/cockroachdb/cockroach/pkg/geo/geopb"
_ "github.com/cockroachdb/cockroach/pkg/geo/geoproj" // blank import to make sure PROJ compiles
"github.com/cockroachdb/errors"
"github.com/golang/geo/s2"
"github.com/twpayne/go-geom"
Expand Down
2 changes: 0 additions & 2 deletions pkg/geo/geogfn/geogfn.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

package geogfn

import _ "github.com/cockroachdb/cockroach/pkg/geo/geoproj" // blank import to make sure PROJ compiles

// UseSphereOrSpheroid indicates whether to use a Sphere or Spheroid
// for certain calculations.
type UseSphereOrSpheroid bool
Expand Down
11 changes: 11 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/enums
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,14 @@ _collision 100082 0 100083
__collision 100083 100082 0
collision 100084 0 100085
___collision 100085 100084 0

# Regression for #49756.
query TT
SELECT
column_name, column_type
FROM
crdb_internal.table_columns
WHERE
descriptor_name = 'enum_array' AND column_name = 'x'
----
x family:ArrayFamily width:0 precision:0 locale:"" visible_type:0 oid:100064 array_contents:<InternalType:<family:EnumFamily width:0 precision:0 locale:"" visible_type:0 oid:100063 time_precision_is_set:false udt_metadata:<stable_type_id:63 stable_array_type_id:64 > > TypeMeta:<> > time_precision_is_set:false udt_metadata:<stable_type_id:64 stable_array_type_id:0 >
13 changes: 13 additions & 0 deletions pkg/sql/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2190,6 +2190,19 @@ func (t *T) String() string {
// DebugString returns a detailed dump of the type protobuf struct, suitable for
// debugging scenarios.
func (t *T) DebugString() string {
if t.Family() == ArrayFamily && t.ArrayContents().UserDefined() {
// In the case that this type is an array that contains a user defined
// type, the introspection that protobuf performs to generate a string
// representation will panic if the UserDefinedTypeMetadata field of the
// type is populated. It seems to not understand that fields in the element
// T could be not generated by proto, and panics trying to operate on the
// TypeMeta field of the T. To get around this, we just deep copy the T and
// zero out the type metadata to placate proto. See the following issue for
// details: https://github.com/gogo/protobuf/issues/693.
internalTypeCopy := protoutil.Clone(&t.InternalType).(*InternalType)
internalTypeCopy.ArrayContents.TypeMeta = UserDefinedTypeMetadata{}
return internalTypeCopy.String()
}
return t.InternalType.String()
}

Expand Down

0 comments on commit 2300343

Please sign in to comment.