Cassandra:一个页面存在多长时间?
Cassandra: How long does a page exist?
我paginate through a large collection of data (circa 500 000 000 rows) using PagingState,在这个过程中做一些商业智能。为了能够恢复进程,我创建了这个 table...
/**
* This table stores temporary paging state
*/
CREATE TABLE IF NOT EXISTS lp_operations.paging_state (
id text, // ID of process
pos bigint, // current position
page text, // paging state
info text, // info json
finished tinyint, // finished
PRIMARY KEY (id)
) WITH default_time_to_live = 28800; // 8 hours
..我在其中存储当前页面(PagingState 的字符串表示形式)和 JSON 与计算相关的元数据。
问题
- 'page' 索引可以在 Cassandra 中过期吗?
- 它存在多长时间(默认)?
不,Cassandra 驱动程序的寻呼状态不会过期。
因为每次你用分页状态查询,cassandra实际上每次都执行你的查询。它不存储您的结果。分页状态只是告诉 cassandra 驱动程序需要从哪个索引获取数据。
Due to internal implementation details, PagingState instances are not portable across native protocol versions. This could become a problem in the following scenario:
- 您正在使用驱动程序 2.0.x 和 Cassandra 2.0.x,因此使用本机协议 v2;
- 用户将 link 添加到包含序列化分页状态的 Web 服务书签;
您升级服务器堆栈以使用驱动程序 2.1.x 和 Cassandra 2.1.x,因此您现在使用协议 v3;
用户尝试重新加载他们的书签,但是分页状态是使用协议 v2 序列化的,因此尝试重新使用它会失败。
来源:http://docs.datastax.com/en/developer/java-driver/3.2/manual/paging/
我paginate through a large collection of data (circa 500 000 000 rows) using PagingState,在这个过程中做一些商业智能。为了能够恢复进程,我创建了这个 table...
/**
* This table stores temporary paging state
*/
CREATE TABLE IF NOT EXISTS lp_operations.paging_state (
id text, // ID of process
pos bigint, // current position
page text, // paging state
info text, // info json
finished tinyint, // finished
PRIMARY KEY (id)
) WITH default_time_to_live = 28800; // 8 hours
..我在其中存储当前页面(PagingState 的字符串表示形式)和 JSON 与计算相关的元数据。
问题
- 'page' 索引可以在 Cassandra 中过期吗?
- 它存在多长时间(默认)?
不,Cassandra 驱动程序的寻呼状态不会过期。
因为每次你用分页状态查询,cassandra实际上每次都执行你的查询。它不存储您的结果。分页状态只是告诉 cassandra 驱动程序需要从哪个索引获取数据。
Due to internal implementation details, PagingState instances are not portable across native protocol versions. This could become a problem in the following scenario:
- 您正在使用驱动程序 2.0.x 和 Cassandra 2.0.x,因此使用本机协议 v2;
- 用户将 link 添加到包含序列化分页状态的 Web 服务书签;
您升级服务器堆栈以使用驱动程序 2.1.x 和 Cassandra 2.1.x,因此您现在使用协议 v3;
用户尝试重新加载他们的书签,但是分页状态是使用协议 v2 序列化的,因此尝试重新使用它会失败。
来源:http://docs.datastax.com/en/developer/java-driver/3.2/manual/paging/