向cassandra表添加列是否立即完成? [英] Does adding a column to a cassandra table complete instantly?

查看:78
本文介绍了向cassandra表添加列是否立即完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们计划在现有的cassandra表中添加一列类型列表,该表的数据文件大小约为350 GB.在应用架构更改时,我们可以暂时暂停所有读取/写入操作几分钟.

We plan to add a column of type list to an existing cassandra table which data file size is about 350 GB. We can temporarily halt all the read/write for a few minutes while applying the schema change.

我们的理解是,在应用模式更改时,cassandra不会锁定表,但是请确保我们的DBA希望对数据文件大小为25 GB的表进行实验.但是,在运行非生产cassandra服务器的小型服务器上,要达到这种大小,将需要3-4周的时间来增长(具有更多并发插入会开始导致超时问题).

Our understanding is that cassandra does not lock a table when applying schema changes, but to be sure our DBA wants to do an experiment on a table with datafile at 25 GB in size. However it will take 3-4 weeks to grow in such size on a small server where a non-production cassandra server is running (having more concurrent inserts starts to cause time out issues).

有人知道无论基础数据文件大小如何,向现有cassandra表中添加列都会立即返回?

Does anyone know that adding a column to an existing cassandra table returns promptly regardless the underlying data file size?

谢谢

推荐答案

在Cassandra中添加列只是将列的元信息添加到内部表中,以保留架构信息.进行此更改后,不会对现有数据进行任何修改-当磁盘上没有用于数据的数据(对于任何列,不仅是添加的内容)时,Cassandra只会将null而不是列值放进去-当数据为返回调用者,而不是在文件中添加null.

Adding a column in Cassandra is just an addition of the column's meta-information to internal table that keeps schema information. No modification of existing data happens when this change is done - Cassandra will simply put null instead of the column value when there is no data for it on the disk (for any column, not only what was added) - this happens when the data is returned to caller, not by adding null to the files.

类似地,删除列不会修改现有数据-而是将新条目添加到 system_schema.dropped_columns 表中,并且从磁盘读取相应的数据后,它们会被过滤掉.

Similarly, deletion of the column doesn't modify the existing data - instead a new entry is added to system_schema.dropped_columns table, and corresponding data is filtered out after they are read from the disk.

这篇关于向cassandra表添加列是否立即完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆