|
| 1 | +--- |
| 2 | +title: Server diagnostics for Azure Cosmos DB Cassandra API |
| 3 | +description: This article explains some common error codes in Azure Cosmos DB's Cassandra API and how to troubleshoot using Log Analytics |
| 4 | +author: IriaOsara |
| 5 | +ms.author: IriaOsara |
| 6 | +ms.service: cosmos-db |
| 7 | +ms.subservice: cosmosdb-cassandra |
| 8 | +ms.topic: troubleshooting |
| 9 | +ms.date: 10/12/2021 |
| 10 | +ms.custom: template-how-to |
| 11 | +--- |
| 12 | + |
| 13 | +# Server diagnostics for Azure Cosmos DB Cassandra API |
| 14 | +[!INCLUDE[appliesto-cassandra-api](../includes/appliesto-cassandra-api.md)] |
| 15 | + |
| 16 | +Log Analytics is a tool in the Azure portal that helps you run server diagnostics on your Cassandra API account. Run log queries from data collected by Azure Monitor Logs and interactively analyze their results. Records retrieved from Log Analytics queries help provide various insights into your data. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +- Create a [Log Analytics Workspace](../../azure-monitor/logs/quick-create-workspace.md). |
| 21 | +- Create [Diagnostic Settings](../cosmosdb-monitor-resource-logs.md). |
| 22 | +- Start [log analytics](../../azure-monitor/logs/log-analytics-overview.md) on your Cassandra API account. |
| 23 | + |
| 24 | +## Use Log Analytics |
| 25 | +After you've completed the log analytics setup, you can begin to explore your logs to gain more insights. |
| 26 | + |
| 27 | +### Explore Data Plane Operations |
| 28 | +Use the CDBCassandraRequests table to see data plane operations specifically for your Cassandra API account. A sample query to see the topN(10) consuming request and get detailed information on each request made. |
| 29 | + |
| 30 | +```Kusto |
| 31 | +CDBCassandraRequests |
| 32 | +| where RequestCharge > 0 |
| 33 | +| project DatabaseName, CollectionName, DurationMs, OperationName, ActivityId, ErrorCode, RequestCharge, PIICommandText |
| 34 | +| order by RequestCharge |
| 35 | +| take 10 |
| 36 | +``` |
| 37 | + |
| 38 | +#### Error Codes and Possible Solutions |
| 39 | +|Status Code | Error Code | Description | |
| 40 | +|------------|----------------------|--------------| |
| 41 | +| 200 | -1 | Successful | |
| 42 | +| 400 | 8704 | The query is correct but an invalid syntax. | |
| 43 | +| 400 | 8192 | The submitted query has a syntax error. Review your query. | |
| 44 | +| 400 | 8960 | The query is invalid because of some configuration issue. | |
| 45 | +| 401 |8448 | The logged user does not have the right permissions to perform the query. | |
| 46 | +| 403 | 8448 | Forbidden response as the user may not have the necessary permissions to carry out the request. | |
| 47 | +| 404 | 5376 | A non-timeout exception during a write request as a result of response not found. | |
| 48 | +| 405 | 0 | Server-side Cassandra error. The error rarely occurs, open a support ticket. | |
| 49 | +| 408 | 4608 | Timeout during a read request. | |
| 50 | +| 408 | 4352 | Timeout exception during a write serviceRequest. | |
| 51 | +| 409 | 9216 | Attempting to create a keyspace or table that already exist. | |
| 52 | +| 412 | 5376 | Precondition failure. To ensure data integrity, we ensure that the write request based on the read response is true. A non-timeout write request exception is returned. | |
| 53 | +| 413 | 5376 | This non-timeout exception during a write request is because of payload maybe too large. Currently, there is a limit of 2MB per row. | |
| 54 | +| 417 | 9472 | The exception is thrown when a prepared statement is not cached on the server node. It should be transient/non-blocking. | |
| 55 | +| 423 | 5376 | There is a lock because a write request that is currently processing. | |
| 56 | +| 429 | 4097| Overload exception is as a result of RU shortage or high request rate. Probably need more RU to handle the higher volume request. In, native Cassandra this can be interpreted as one of the VMs not having enough CPU. We advise reviewing current data model to ensure that you do not have excessive skews that might be causing hot partitions. | |
| 57 | +| 449 | 5376 | Concurrent execution exception. This occurs to ensure only one write update at a time for a given row. | |
| 58 | +| 500 | 0 | Server cassandraError: something unexpected happened. This indicates a server-side bug. | |
| 59 | +| 503 | 4096 | Service unavailable. | |
| 60 | +| | 256 | This may be because of invalid connection credentials. Please check your connection credentials. | |
| 61 | +| | 10 | A client message triggered protocol violation. An example is query message sent before a startup one has been sent. | |
| 62 | + |
| 63 | +### Troubleshoot Query Consumption |
| 64 | +The CDBPartitionKeyRUConsumption table contains details on request unit (RU) consumption for logical keys in each region within each of their physical partitions. |
| 65 | + |
| 66 | +```Kusto |
| 67 | +CDBPartitionKeyRUConsumption |
| 68 | +| summarize sum(todouble(RequestCharge)) by PartitionKey, PartitionKeyRangeId |
| 69 | +| render columnchart |
| 70 | + ``` |
| 71 | + |
| 72 | +### Explore Control Plane Operations |
| 73 | +The CBDControlPlaneRequests table contains details on control plane operations, specifically for Cassandra API accounts. |
| 74 | + |
| 75 | +```Kusto |
| 76 | +CDBControlPlaneRequests |
| 77 | +| where TimeGenerated > now(-6h) |
| 78 | +| where ApiKind == "Cassandra" |
| 79 | +| where OperationName in ("Create", "Upsert", "Delete", "Execute") |
| 80 | +| summarize by OperationName |
| 81 | + ``` |
| 82 | + |
| 83 | +## Next steps |
| 84 | + |
| 85 | +- Learn more about [Log Analytics](../../azure-monitor/logs/log-analytics-tutorial.md). |
| 86 | +- Learn how to [migrate from native Apache Cassandra to Azure Cosmos DB Cassandra API](migrate-data-databricks.md). |
0 commit comments