From 0855e014939a867e0f9362a5428c2b9787ec965d Mon Sep 17 00:00:00 2001 From: Andrew Werner Date: Mon, 3 Feb 2020 01:35:49 -0500 Subject: [PATCH] storageccl: fix flakey TestRandomKeyAndTimestampExport Sometimes the maxSize would line up exactly with the last key. When this happened the logic to test the maxSize parameter was incorrect. This adds logic to deal with that case and unflake the test. Fixes #44589 Release note: None --- pkg/ccl/storageccl/export_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/ccl/storageccl/export_test.go b/pkg/ccl/storageccl/export_test.go index ffd1b42d1ce2..4dcb92076cad 100644 --- a/pkg/ccl/storageccl/export_test.go +++ b/pkg/ccl/storageccl/export_test.go @@ -365,6 +365,12 @@ func assertEqualKVs( lessThisKey := dataSizeWhenExceeded - uint64(len(kv.Key.Key)+len(kv.Value)) if lessThisKey >= maxSize { dataSizeWhenExceeded = lessThisKey + // It might be the case that this key would lead to an SST of exactly + // max size, in this case we overwrite max size to be less so that + // we still generate an error. + if dataSizeWhenExceeded == maxSize { + maxSize-- + } } else { break }