Skip to content

Commit 8429ca6

Browse files
authored
添加注释
1 parent 77f7a95 commit 8429ca6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test/java/examples/OTSMultiDataSample.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,14 @@ private static void getRange(OTSClient client, String tableName)
157157
GetRangeRequest request = new GetRangeRequest();
158158
int consumedReadCU = 0;
159159
List<Row> rows = new ArrayList<Row>();
160+
161+
// 因为TableStore在Scan数据的时候,只承诺一次性最多返回不超过5000条数据,在API文档中有明确的注释。所以在任意的情况下GetRange的API都可能返回
162+
// 那么用户仅仅通过调用一次GetRange,拿到的数据很有可能不是完整的数据。
163+
// 因此,TableStore提供next_start_primary_key(断点)的方式,每次调用GetRange之后,都会返回下一次的断点,直到断点为空,表示数据读完。
164+
// 所以我们用while的方式不断的调用GetRange API,并使用next_start_primary_key重置Request的InclusiveStartPrimaryKey,并发起新的请求
165+
// 例子如下:
166+
160167
RowPrimaryKey next = inclusiveStartKey;
161-
162168
do {
163169
criteria.setInclusiveStartPrimaryKey(next);
164170
criteria.setExclusiveEndPrimaryKey(exclusiveEndKey);

0 commit comments

Comments
 (0)