From 5eb5c412fc0f165c5f0f17f6e809aebb72e0c795 Mon Sep 17 00:00:00 2001
From: Ibrahim Jarif <ibrahim@dgraph.io>
Date: Fri, 10 Jul 2020 16:20:56 +0530
Subject: [PATCH] Revert "add assert to check integer overflow for table size
 (#1402)" (#1406)

This reverts commit 7f4e4b560aabb5521f3591972ab5fdc1aec6801b.
This revert is necessary because b.sz won't exist after builder changes are
reverted and the assert is no longer valid.

The commit 7f4e4b5 is being reverted because we have seen some crashes
which could be caused by these changes. We haven't been able to reproduce the
crashes yet.

Related to #1389, #1388, #1387
Also see https://discuss.dgraph.io/t/current-state-of-badger-crashes/7602
---
 table/builder.go | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/table/builder.go b/table/builder.go
index 6a6f194ec..50ba15356 100644
--- a/table/builder.go
+++ b/table/builder.go
@@ -327,9 +327,6 @@ func (b *Builder) shouldFinishBlock(key []byte, value y.ValueStruct) bool {
 		// So, size of IV is added to estimatedSize.
 		estimatedSize += aes.BlockSize
 	}
-	// Integer overflow check for table size.
-	y.AssertTrue(uint64(b.sz)+uint64(estimatedSize) < math.MaxUint32)
-
 	return estimatedSize > uint32(b.opt.BlockSize)
 }