使用 cqlsh 复制非常大的 cassandra table 时出现 PicklingError

PicklingError when copying a very large cassandra table using cqlsh

当我尝试使用以下命令将 table 复制到 cassandra 时:

copy images from 'images.csv'

我收到错误:

'PicklingError: Can't pickle <class 'cqlshlib.copyutil.ImmutableDict'>: attribute lookup cqlshlib.copyutil.ImmutableDict failed'

我已成功导入所有其他 table,但这个无法正常工作。与这个的唯一区别是它包含用于图像的大型二进制 blob。

这是 csv 文件中的示例行:

b267ba01-5420-4be5-b962-7e563dc245b0,,0x89504e...[large binary blob]...426082,0,7e700538-cce3-495f-bfd2-6a4fa968bdf6,pentium_e6600,01fa819e-3425-47ca-82aa-a3eec319a998,0,7e700538-cce3-495f-bfd2-6a4fa968bdf6,,,png,0

这是导致错误的文件: https://www.dropbox.com/s/5mrl6nuwelpf3lz/images.csv?dl=0

这是我的架构:

CREATE TABLE dealtech.images (
    id uuid PRIMARY KEY,
    attributes map<text, text>,
    data blob,
    height int,
    item_id uuid,
    name text,
    product_id uuid,
    scale double,
    seller_id uuid,
    text_bottom int,
    text_top int,
    type text,
    width int
)

table 是使用 cassandra 2.x 导出的,我目前正在使用 cassandra 3.0.9 导入它们。

我 运行 遇到了与 apache cassandra 3.9 相同的问题,尽管我的数据集相当小(一个 table 中有 46 行,另一个 table 中有 262 行)。

PicklingError: Can't pickle <class 'cqlshlib.copyutil.link'>: attribute lookup cqlshlib.copyutil.link failed

PicklingError: Can't pickle <class 'cqlshlib.copyutil.attribute'>: attribute lookup cqlshlib.copyutil.attribute failed

其中 linkattribute 是我定义的类型。

COPY 命令是 .cql 脚本的一部分,该脚本在 Docker 容器中 运行 作为其设置过程的一部分。

我在一些地方看到人们在 Windows 上看到这个 PicklingError(似乎与 NTFS 有关),但在这种情况下 Docker 容器使用的是 Alpine Linux.

修复方法是将这些选项添加到我的 COPY 命令的末尾:

WITH MINBATCHSIZE=1 AND MAXBATCHSIZE=1 AND PAGESIZE=10;

http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlshCopy.html

我没有看到 PicklingError 运行在本地包含 COPY 命令的这些 .cql 脚本,所以这似乎是一个只有在内存不足的情况下才会出现的问题。

相关问题: