diff --git a/store/sqldb/object_integrity.go b/store/sqldb/object_integrity.go index b6725dc37..f7d91ded4 100644 --- a/store/sqldb/object_integrity.go +++ b/store/sqldb/object_integrity.go @@ -434,7 +434,7 @@ func (s *SpDBImpl) DeleteReplicatePieceChecksum(objectID uint64, segmentIdx uint metrics.SPDBTime.WithLabelValues(SPDBSuccessDelReplicatePieceChecksum).Observe( time.Since(startTime).Seconds()) }() - err = s.db.Where("object_id = ? and segment_idx = ? and redundancy_index = ? ", objectID, segmentIdx, redundancyIdx).Delete(PieceHashTable{}).Error + err = s.db.Where("object_id = ? and segment_index = ? and redundancy_index = ? ", objectID, segmentIdx, redundancyIdx).Delete(PieceHashTable{}).Error return err } diff --git a/store/sqldb/object_integrity_test.go b/store/sqldb/object_integrity_test.go index 7da578f61..9c5d6f8d6 100644 --- a/store/sqldb/object_integrity_test.go +++ b/store/sqldb/object_integrity_test.go @@ -468,7 +468,7 @@ func TestSpDBImpl_DeleteReplicatePieceChecksumSuccess(t *testing.T) { ) s, mock := setupDB(t) mock.ExpectBegin() - mock.ExpectExec("DELETE FROM `piece_hash` WHERE object_id = ? and segment_idx = ? and redundancy_index = ?"). + mock.ExpectExec("DELETE FROM `piece_hash` WHERE object_id = ? and segment_index = ? and redundancy_index = ?"). WithArgs(objectID, segmentIdx, redundancyIdx).WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectCommit() err := s.DeleteReplicatePieceChecksum(objectID, segmentIdx, redundancyIdx) @@ -546,7 +546,7 @@ func TestSpDBImpl_DeleteAllReplicatePieceChecksumSuccess(t *testing.T) { ) s, mock := setupDB(t) mock.ExpectBegin() - mock.ExpectExec("DELETE FROM `piece_hash` WHERE object_id = ? and segment_idx = ? and redundancy_index = ?"). + mock.ExpectExec("DELETE FROM `piece_hash` WHERE object_id = ? and segment_index = ? and redundancy_index = ?"). WithArgs(objectID, segmentIdx, redundancyIdx).WillReturnResult(sqlmock.NewResult(1, 1)) mock.ExpectCommit() err := s.DeleteAllReplicatePieceChecksum(objectID, redundancyIdx, pieceCount) @@ -562,7 +562,7 @@ func TestSpDBImpl_DeleteAllReplicatePieceChecksumFailure(t *testing.T) { ) s, mock := setupDB(t) mock.ExpectBegin() - mock.ExpectExec("DELETE FROM `piece_hash` WHERE object_id = ? and segment_idx = ? and redundancy_index = ?"). + mock.ExpectExec("DELETE FROM `piece_hash` WHERE object_id = ? and segment_index = ? and redundancy_index = ?"). WithArgs(objectID, segmentIdx, redundancyIdx).WillReturnError(mockDBInternalError) mock.ExpectRollback() mock.ExpectCommit()