Skip to content

Commit

Permalink
fix: Migrating expired data will not be retried
Browse files Browse the repository at this point in the history
Signed-off-by: xiangyu5632 <[email protected]>
  • Loading branch information
xiangyu5632 committed Jan 2, 2024
1 parent 0a263ad commit 3c8fd9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Binary file removed dataMigrate
Binary file not shown.
10 changes: 10 additions & 0 deletions src/cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"math"
"sort"
"strings"
"time"

"github.com/influxdata/influxdb/tsdb/engine/tsm1"
Expand Down Expand Up @@ -374,16 +375,25 @@ func (s *Scanner) writeBatches(c client.Client, cmd Migrator) error {
}

func (s *Scanner) retryWrite(c client.Client, bp client.BatchPoints) {
i := 0
for {
err := c.Write(bp)
if err == nil {
break
}
logger.LogString("insert error: "+err.Error(), TOLOGFILE|TOCONSOLE, LEVEL_ERROR)
if strings.Contains(err.Error(), "point time is expired") {
logger.LogString("point time is expired : Skiped", TOLOGFILE|TOCONSOLE, LEVEL_ERROR)
break
}
points := bp.Points()
if len(points) > 0 {
i++
logger.LogString("retry for points like:"+points[0].String(), TOLOGFILE|TOCONSOLE, LEVEL_ERROR)
}
if i == 10 {
break
}
time.Sleep(3 * time.Second)
}
}

0 comments on commit 3c8fd9b

Please sign in to comment.