Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenbin1002 committed Dec 20, 2024
1 parent b46ab9c commit 45f031f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions pkg/vm/engine/disttae/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,23 +479,25 @@ func (txn *Transaction) dumpBatchLocked(ctx context.Context, offset int) error {
size += uint64(txn.writes[i].bat.Size())
}
}
if size < txn.writeWorkspaceThreshold || size >= txn.engine.config.extraWorkspaceThreshold {
if size < txn.writeWorkspaceThreshold {
return nil
}

// try to increase the write threshold from quota, if failed, then dump all
// acquire 5M more than we need
quota := size - txn.writeWorkspaceThreshold + txn.engine.config.writeWorkspaceThreshold
remaining, acquired := txn.engine.AcquireQuota(quota)
if acquired {
logutil.Info(
"WORKSPACE-QUOTA-ACQUIRE",
zap.Uint64("quota", quota),
zap.Uint64("remaining", remaining),
)
txn.writeWorkspaceThreshold += quota
txn.extraWriteWorkspaceThreshold += quota
return nil
if size < txn.engine.config.extraWorkspaceThreshold {
// try to increase the write threshold from quota, if failed, then dump all
// acquire 5M more than we need
quota := size - txn.writeWorkspaceThreshold + txn.engine.config.writeWorkspaceThreshold
remaining, acquired := txn.engine.AcquireQuota(quota)
if acquired {
logutil.Info(
"WORKSPACE-QUOTA-ACQUIRE",
zap.Uint64("quota", quota),
zap.Uint64("remaining", remaining),
)
txn.writeWorkspaceThreshold += quota
txn.extraWriteWorkspaceThreshold += quota
return nil
}
}
size = 0
}
Expand Down

0 comments on commit 45f031f

Please sign in to comment.