You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(persistence): make DeleteFromHistoryNode page size a dynamic config (#7484)
<!-- Describe what has changed in this PR -->
**What changed?**
Made HistoryNodeDeleteBatchSize configurable through a dynamic config.
Also allowed unbounded deletion request for HistoryNodeDeleteBatchSize
when the batch size less or equal to zero.
<!-- Tell your future self why have you made these changes -->
**Why?**
Make the HistoryNodeDeleteBatchSize configurable for SQL
implementations. Right now we use a fixed value of 1000 for page size
when using SQL.
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
**How did you test it?**
Unit tests
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
**Potential risks**
<!-- Is it notable for release? e.g. schema updates, configuration or
data migration required? If so, please mention it, and also update
CHANGELOG.md -->
**Release notes**
HistoryNodeDeleteBatchSize is now configurable using the property
history.historyNodeDeleteBatchSize. The default remains the same as
before, 1000. Note that using a value <= 0 makes the request page size
unbounded.
<!-- Is there any documentation updates should be made for config,
https://cadenceworkflow.io/docs/operation-guide/setup/ ? If so, please
open an PR in https://github.com/cadence-workflow/cadence-docs -->
**Documentation Changes**
---------
Signed-off-by: fimanishi <[email protected]>
Copy file name to clipboardExpand all lines: common/persistence/sql/sqlplugin/mysql/events.go
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,9 @@ const (
36
36
getHistoryNodesQuery=`SELECT node_id, txn_id, data, data_encoding FROM history_node `+
37
37
`WHERE shard_id = ? AND tree_id = ? AND branch_id = ? AND node_id >= ? and node_id < ? ORDER BY shard_id, tree_id, branch_id, node_id, txn_id LIMIT ? `
38
38
39
-
deleteHistoryNodesQuery=`DELETE FROM history_node WHERE shard_id = ? AND tree_id = ? AND branch_id = ? AND node_id >= ? ORDER BY shard_id, tree_id, branch_id, node_id, txn_id LIMIT ? `
39
+
deleteHistoryNodesQuery=`DELETE FROM history_node WHERE shard_id = ? AND tree_id = ? AND branch_id = ? AND node_id >= ? `
40
+
41
+
deleteHistoryNodesByBatchQuery=`DELETE FROM history_node WHERE shard_id = ? AND tree_id = ? AND branch_id = ? AND node_id >= ? ORDER BY shard_id, tree_id, branch_id, node_id, txn_id LIMIT ? `
Copy file name to clipboardExpand all lines: common/persistence/sql/sqlplugin/postgres/events.go
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,9 @@ const (
36
36
getHistoryNodesQuery=`SELECT node_id, txn_id, data, data_encoding FROM history_node `+
37
37
`WHERE shard_id = $1 AND tree_id = $2 AND branch_id = $3 AND node_id >= $4 and node_id < $5 ORDER BY shard_id, tree_id, branch_id, node_id, txn_id LIMIT $6 `
38
38
39
-
deleteHistoryNodesQuery=`DELETE FROM history_node WHERE shard_id = $1 AND tree_id = $2 AND branch_id = $3 AND (node_id,txn_id) IN (SELECT node_id,txn_id FROM
39
+
deleteHistoryNodesQuery=`DELETE FROM history_node WHERE shard_id = $1 AND tree_id = $2 AND branch_id = $3 AND node_id >= $4`
40
+
41
+
deleteHistoryNodesByBatchQuery=`DELETE FROM history_node WHERE shard_id = $1 AND tree_id = $2 AND branch_id = $3 AND (node_id,txn_id) IN (SELECT node_id,txn_id FROM
40
42
history_node WHERE shard_id = $1 AND tree_id = $2 AND branch_id = $3 AND node_id >= $4 LIMIT $5)`
0 commit comments