提交 a7b3ee6e authored 作者: Andrei Tokar's avatar Andrei Tokar

Change Table.lockRows() signature from Itrator to Iterable

上级 107abdd0
...@@ -615,7 +615,7 @@ public class Select extends Query { ...@@ -615,7 +615,7 @@ public class Select extends Query {
} }
if (isForUpdateMvcc) { if (isForUpdateMvcc) {
assert forUpdateRows != null; assert forUpdateRows != null;
topTableFilter.lockRows(forUpdateRows.iterator()); topTableFilter.lockRows(forUpdateRows);
} }
return null; return null;
} }
......
...@@ -9,7 +9,6 @@ import java.util.ArrayList; ...@@ -9,7 +9,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
...@@ -184,9 +183,8 @@ public abstract class Table extends SchemaObjectBase { ...@@ -184,9 +183,8 @@ public abstract class Table extends SchemaObjectBase {
* @param session the session * @param session the session
* @param rowsForUpdate rows to lock * @param rowsForUpdate rows to lock
*/ */
public void lockRows(Session session, Iterator<Row> rowsForUpdate) { public void lockRows(Session session, Iterable<Row> rowsForUpdate) {
while (rowsForUpdate.hasNext()) { for (Row row : rowsForUpdate) {
Row row = rowsForUpdate.next();
Row newRow = row.getCopy(); Row newRow = row.getCopy();
removeRow(session, row); removeRow(session, row);
session.log(this, UndoLogRecord.DELETE, row); session.log(this, UndoLogRecord.DELETE, row);
......
...@@ -1158,7 +1158,7 @@ public class TableFilter implements ColumnResolver { ...@@ -1158,7 +1158,7 @@ public class TableFilter implements ColumnResolver {
* *
* @param forUpdateRows the rows to lock * @param forUpdateRows the rows to lock
*/ */
public void lockRows(Iterator<Row> forUpdateRows) { public void lockRows(Iterable<Row> forUpdateRows) {
table.lockRows(session, forUpdateRows); table.lockRows(session, forUpdateRows);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论