

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 问题排查
<a name="bulk-upload-troubleshooting"></a>

数据上传完成后，检查是否跳过了行。为此，请导航到源 CSV 文件的源目录并搜索具有以下名称的文件。

```
import_yourcsvfilename.err.timestamp.csv
```

cqlsh 将所有跳过的数据行写入具有该名称的文件中。如果文件存在于源目录中且其中包含数据，则说明这些行未上传到 Amazon Keyspaces。要重试这些行，请先检查上传过程中是否遇到任何错误，然后相应地调整数据。要重试这些行，您可以重新运行进程。



**常见错误**  
行未加载的最常见原因是容量错误和解析错误。

**将数据上传到 Amazon Keyspaces 时出现无效请求错误**

在以下示例中，源表包含一个计数器列，该列会生成来自 cqlsh `COPY` 命令的记录的批处理调用。Amazon Keyspaces 不支持记录的批处理调用。

```
Failed to import 10 rows: InvalidRequest - Error from server: code=2200 [Invalid query] message=“Only UNLOGGED Batches are supported at this time.“,  will retry later, attempt 22 of 25
```

要解决此错误， DSBulk 请使用迁移数据。有关更多信息，请参阅 [教程：使用将数据加载到 Amazon Keyspaces DSBulk](dsbulk-upload.md)。

**将数据上传到 Amazon Keyspaces 时出现解析器错误**

以下示例显示了由于 `ParseError` 而跳过的行。

```
Failed to import 1 rows: ParseError - Invalid ... – 
```

要解决此错误，您需要确保要导入的数据与 Amazon Keyspaces 中的表模式相匹配。查看导入文件中是否存在解析错误。您可以尝试通过 `INSERT` 语句来使用单行数据，从而隔离错误。

**将数据上传到 Amazon Keyspaces 时出现容量错误**

```
Failed to import 1 rows: WriteTimeout - Error from server: code=1100 [Coordinator node timed out waiting for replica nodes' responses]
 message="Operation timed out - received only 0 responses." info={'received_responses': 0, 'required_responses': 2, 'write_type': 'SIMPLE', 'consistency': 
 'LOCAL_QUORUM'}, will retry later, attempt 1 of 100
```

Amazon Keyspaces 使用 `ReadTimeout` 和 `WriteTimeout` 异常指示写入请求何时因吞吐容量不足而失败。为了帮助诊断容量不足的异常，Amazon Keyspaces 在亚马逊上发布了`WriteThrottleEvents``ReadThrottledEvents`指标。 CloudWatch有关更多信息，请参阅 [使用亚马逊监控亚马逊密钥空间 CloudWatch](monitoring-cloudwatch.md)。

**将数据上传到 Amazon Keyspaces 时出现 cqlsh 错误**

要帮助对 cqlsh 错误进行问题排查，请重新运行带有 `--debug` 标志的失败命令。

使用不兼容的 cqlsh 版本时，您会看到以下错误。

```
AttributeError: 'NoneType' object has no attribute 'is_up'
Failed to import 3 rows: AttributeError - 'NoneType' object has no attribute 'is_up',  given up after 1 attempts
```

通过运行以下命令确认已安装正确版本的 cqlsh。

```
cqlsh --version
```

输出应该类似于以下内容。

```
cqlsh 5.0.1
```

如果您使用的是 Windows，请将 `cqlsh` 的所有实例替换为 `cqlsh.bat`。例如，要检查 Windows 中的 cqlsh 版本，请运行以下命令。

```
cqlsh.bat --version
```

cqlsh 客户端从服务器连续收到三个任意类型的错误后，与 Amazon Keyspaces 的连接失败。cqlsh 客户端失败时显示以下消息。

```
Failed to import 1 rows: NoHostAvailable - , will retry later, attempt 3 of 100
```

要解决此错误，您需要确保要导入的数据与 Amazon Keyspaces 中的表模式相匹配。查看导入文件中是否存在解析错误。您可以尝试通过 INSERT 语句来使用单行数据，从而隔离错误。

客户端会自动尝试重新建立连接。