From 0cb3190ea577f59cc6baf2eda82b66485b8bdf22 Mon Sep 17 00:00:00 2001 From: Prashant Khoje Date: Tue, 24 May 2022 11:19:11 +0000 Subject: [PATCH 1/4] ppc64le - fix test failures of TestBoundingBoxFromGeomT/GeographyType --- pkg/geo/bbox_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index 6220ecc76ef1..e8547f4d8ac8 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -12,6 +12,7 @@ package geo import ( "fmt" + "math" "strconv" "testing" @@ -184,6 +185,22 @@ func TestBoundingBoxFromGeomT(t *testing.T) { t.Run(fmt.Sprintf("%s: %#v", tc.soType, tc.g), func(t *testing.T) { bbox, err := boundingBoxFromGeomT(tc.g, tc.soType) require.NoError(t, err) + // If bbox is within a small epsilon of expected, use the same values. + if bbox != nil && tc.expected != nil { + const epsilon = 0.000001 + if math.Abs(bbox.LoX-tc.expected.LoX) < epsilon { + bbox.LoX = tc.expected.LoX + } + if math.Abs(bbox.HiX-tc.expected.HiX) < epsilon { + bbox.HiX = tc.expected.HiX + } + if math.Abs(bbox.LoY-tc.expected.LoY) < epsilon { + bbox.LoY = tc.expected.LoY + } + if math.Abs(bbox.HiY-tc.expected.HiY) < epsilon { + bbox.HiY = tc.expected.HiY + } + } require.Equal(t, tc.expected, bbox) }) } From c1b3f2e10b04f2507d93c1a1369399b1f00ba4c0 Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Wed, 25 May 2022 16:13:51 -0400 Subject: [PATCH 2/4] sql/catalog/lease: add some event logging around lease acquisition Before this, there was a black hole of time when we were acquiring a lease. The singleflight prevents tracing of the actual acquisition. Release note: None --- pkg/sql/catalog/lease/lease.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/sql/catalog/lease/lease.go b/pkg/sql/catalog/lease/lease.go index fbb3e7981147..2320a6c5fe59 100644 --- a/pkg/sql/catalog/lease/lease.go +++ b/pkg/sql/catalog/lease/lease.go @@ -470,6 +470,8 @@ func (m *Manager) AcquireFreshestFromStore(ctx context.Context, id descpb.ID) er // The boolean returned is true if this call was actually responsible for the // lease acquisition. func acquireNodeLease(ctx context.Context, m *Manager, id descpb.ID) (bool, error) { + start := timeutil.Now() + log.VEventf(ctx, 2, "acquiring lease for descriptor %d", id) var toRelease *storedLease resultChan, didAcquire := m.storage.group.DoChan(fmt.Sprintf("acquire%d", id), func() (interface{}, error) { // Note that we use a new `context` here to avoid a situation where a cancellation @@ -516,6 +518,7 @@ func acquireNodeLease(ctx context.Context, m *Manager, id descpb.ID) (bool, erro return false, result.Err } } + log.VEventf(ctx, 2, "acquired lease for descriptor %d, took %v", id, timeutil.Since(start)) return didAcquire, nil } From 4fafba71b9cdca4ad7a3a01ae7e37824eff64eee Mon Sep 17 00:00:00 2001 From: Prashant Khoje <98951798+prashantkhoje@users.noreply.github.com> Date: Thu, 26 May 2022 16:56:10 +0530 Subject: [PATCH 3/4] Fixed indentation --- pkg/geo/bbox_test.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index e8547f4d8ac8..611ebdf89caf 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -12,7 +12,7 @@ package geo import ( "fmt" - "math" + "math" "strconv" "testing" @@ -185,22 +185,22 @@ func TestBoundingBoxFromGeomT(t *testing.T) { t.Run(fmt.Sprintf("%s: %#v", tc.soType, tc.g), func(t *testing.T) { bbox, err := boundingBoxFromGeomT(tc.g, tc.soType) require.NoError(t, err) - // If bbox is within a small epsilon of expected, use the same values. - if bbox != nil && tc.expected != nil { - const epsilon = 0.000001 - if math.Abs(bbox.LoX-tc.expected.LoX) < epsilon { - bbox.LoX = tc.expected.LoX - } - if math.Abs(bbox.HiX-tc.expected.HiX) < epsilon { - bbox.HiX = tc.expected.HiX - } - if math.Abs(bbox.LoY-tc.expected.LoY) < epsilon { - bbox.LoY = tc.expected.LoY - } - if math.Abs(bbox.HiY-tc.expected.HiY) < epsilon { - bbox.HiY = tc.expected.HiY - } - } + // If bbox is within a small epsilon of expected, use the same values. + if bbox != nil && tc.expected != nil { + const epsilon = 0.000001 + if math.Abs(bbox.LoX-tc.expected.LoX) < epsilon { + bbox.LoX = tc.expected.LoX + } + if math.Abs(bbox.HiX-tc.expected.HiX) < epsilon { + bbox.HiX = tc.expected.HiX + } + if math.Abs(bbox.LoY-tc.expected.LoY) < epsilon { + bbox.LoY = tc.expected.LoY + } + if math.Abs(bbox.HiY-tc.expected.HiY) < epsilon { + bbox.HiY = tc.expected.HiY + } + } require.Equal(t, tc.expected, bbox) }) } From 78dd74f0a527199d0fae680c6a0ac9809c8fb25e Mon Sep 17 00:00:00 2001 From: Prashant Khoje <98951798+prashantkhoje@users.noreply.github.com> Date: Thu, 26 May 2022 17:23:38 +0530 Subject: [PATCH 4/4] fix indentation --- pkg/geo/bbox_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/geo/bbox_test.go b/pkg/geo/bbox_test.go index 611ebdf89caf..0ef94e9d7e6b 100644 --- a/pkg/geo/bbox_test.go +++ b/pkg/geo/bbox_test.go @@ -185,7 +185,7 @@ func TestBoundingBoxFromGeomT(t *testing.T) { t.Run(fmt.Sprintf("%s: %#v", tc.soType, tc.g), func(t *testing.T) { bbox, err := boundingBoxFromGeomT(tc.g, tc.soType) require.NoError(t, err) - // If bbox is within a small epsilon of expected, use the same values. + // If bbox is within a small epsilon of expected, use the same values. if bbox != nil && tc.expected != nil { const epsilon = 0.000001 if math.Abs(bbox.LoX-tc.expected.LoX) < epsilon {