From 37fcfd2b24b74dd360c30e4ae4fd34ae27387f81 Mon Sep 17 00:00:00 2001 From: yun Date: Wed, 16 Oct 2024 07:11:44 -0700 Subject: [PATCH] (bugfix): Fix inconsistent `getCount()` return values Added a delay before `getCount()` to ensure correct values after large batch inserts. Some records take longer to append. --- core/dbio/database/database_proton.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/dbio/database/database_proton.go b/core/dbio/database/database_proton.go index 37a98b12..e3d8becd 100755 --- a/core/dbio/database/database_proton.go +++ b/core/dbio/database/database_proton.go @@ -454,6 +454,9 @@ func processProtonInsertRow(columns iop.Columns, row []any) []any { // GetCount returns count of records func (conn *ProtonConn) GetCount(tableFName string) (uint64, error) { + // Add another sleep, reason: after insert table we try to getcount directly to ensure no record missing + // but proton seems not fully ready to get count. + time.Sleep(countWaitDuration) var count uint64 // Retry logic to handle occasional zero count, likely due to database latency or transactional delays.