TransactWriteItems (\u66f8\u304d\u8fbc\u307f)<\/li>\n<\/ul>\n\u4eca\u56de\u306f TransactWriteItems \u306b\u3064\u3044\u3066\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002
\n\u3055\u3063\u305d\u304f\u3067\u3059\u304c\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u3055\u308c\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n
func rollbackTest(svc *dynamodb.DynamoDB, tableName string) {\n _, err := svc.TransactWriteItems(&dynamodb.TransactWriteItemsInput{\n TransactItems: []*dynamodb.TransactWriteItem{\n \/\/ \u66f4\u65b0\u3067\u304d\u308b\n {\n Put: &dynamodb.Put{\n TableName: aws.String(tableName),\n Item: map[string]*dynamodb.AttributeValue{\n "id": {\n S: aws.String("Item-1"),\n },\n },\n },\n },\n \/\/ \u66f4\u65b0\u30a8\u30e9\u30fc\u3068\u306a\u308b\n {\n Put: &dynamodb.Put{\n TableName: aws.String(tableName),\n Item: map[string]*dynamodb.AttributeValue{\n "id": {\n S: aws.String("Item-2"),\n },\n },\n ConditionExpression: aws.String("ForceError = :true"), \/\/ \u3053\u306e\u6761\u4ef6\u3067\u66f4\u65b0\u51e6\u7406\u3092\u5931\u6557\u3055\u305b\u308b\n ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n ":true": {BOOL: aws.Bool(true)},\n },\n },\n },\n },\n })\n if err != nil {\n if awsErr, ok := err.(awserr.Error); ok {\n log.Println("Error:", awsErr.Code(), awsErr.Message())\n }\n }\n}<\/code><\/pre>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3059\u3002<\/p>\n
Error: TransactionCanceledException Transaction cancelled,\n please refer cancellation reasons for specific reasons [None, ConditionalCheckFailed]<\/code><\/pre>\n1\u500b\u76ee\u306e\u30a2\u30a4\u30c6\u30e0\u304c None<\/code> \u3067\u554f\u984c\u306a\u304f\u901a\u3063\u3066\u307e\u3059\u304c\u3001
\n2\u500b\u76ee\u306e\u30a2\u30a4\u30c6\u30e0\u304c ConditionalCheckFailed<\/code> \u3067\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u3063\u3066\u3044\u308b\u306e\u3067\u3001
\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u304c\u30ad\u30e3\u30f3\u30bb\u30eb\u3055\u308c\u305f\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002
\n\u671f\u5f85\u901a\u308a\u3067\u3059\u306d\u3002<\/p>\n\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u304c\u9069\u7528\u3055\u308c\u308b\u7bc4\u56f2\u306b\u3064\u3044\u3066<\/h2>\n
\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u304c\u9069\u7528\u3055\u308c\u308b\u7bc4\u56f2\u306f\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n
\n- \u540c\u3058\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u30ad\u30fc \u3067\u3082 \u7570\u306a\u308b\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u30ad\u30fc \u3067\u3082OK<\/li>\n
- \u540c\u3058\u30c6\u30fc\u30d6\u30eb \u3067\u3082 \u7570\u306a\u308b\u30c6\u30fc\u30d6\u30eb \u3067\u3082OK<\/li>\n
- \u540c\u3058\u30ea\u30fc\u30b8\u30e7\u30f3\u306e\u307f<\/li>\n
- \u540c\u3058\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u307f<\/li>\n
- DynamoDB \u30c6\u30fc\u30d6\u30eb\u306e\u307f<\/li>\n<\/ul>\n
\u5236\u9650\u306b\u3064\u3044\u3066<\/h2>\n
\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5236\u9650\u304c\u3042\u308b\u306e\u3067\u3001\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n
\u540c\u3058\u30a2\u30a4\u30c6\u30e0\u3092\u540c\u6642\u306b\u66f4\u65b0\u3067\u304d\u306a\u3044<\/h3>\n
\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u3001\u540c\u3058\u30a2\u30a4\u30c6\u30e0(Item-1)\u3092\u540c\u6642\u306b\u66f4\u65b0\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n
func dupTest(svc *dynamodb.DynamoDB, tableName string) {\n dupID := "Item-1"\n\n _, err := svc.TransactWriteItems(&dynamodb.TransactWriteItemsInput{\n TransactItems: []*dynamodb.TransactWriteItem{\n {\n Put: &dynamodb.Put{\n TableName: aws.String(tableName),\n Item: map[string]*dynamodb.AttributeValue{\n "id": {\n S: aws.String(dupID),\n },\n },\n },\n },\n {\n Put: &dynamodb.Put{\n TableName: aws.String(tableName),\n Item: map[string]*dynamodb.AttributeValue{\n "id": {\n S: aws.String(dupID),\n },\n },\n },\n },\n },\n })\n if err != nil {\n if awsErr, ok := err.(awserr.Error); ok {\n log.Println("Error:", awsErr.Code(), awsErr.Message())\n }\n }\n}<\/code><\/pre>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n
Error: ValidationException Transaction request cannot include multiple operations on one item<\/code><\/pre>\n\u540c\u6642\u306b\u66f4\u65b0\u3067\u304d\u308b\u30a2\u30a4\u30c6\u30e0\u6570\u306f 10\u500b\u307e\u3067<\/h3>\n
\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u300111\u500b\u306e\u30a2\u30a4\u30c6\u30e0\u3092\u66f4\u65b0\u3059\u308b\u51e6\u7406\u3092\u8a66\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n
func lengthTest(svc *dynamodb.DynamoDB, tableName string) {\n n := 11\n var items []*dynamodb.TransactWriteItem\n for i := 0; i < n; i++ {\n items = append(items, &dynamodb.TransactWriteItem{\n Put: &dynamodb.Put{\n TableName: aws.String(tableName),\n Item: map[string]*dynamodb.AttributeValue{\n "id": {\n S: aws.String(fmt.Sprintf("Item-%d", i+1)),\n },\n },\n },\n })\n }\n\n _, err := svc.TransactWriteItems(&dynamodb.TransactWriteItemsInput{\n TransactItems: items,\n })\n if err != nil {\n if awsErr, ok := err.(awserr.Error); ok {\n log.Println("Error:", awsErr.Code(), awsErr.Message())\n }\n }\n} <\/code><\/pre>\n\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n
Error: ValidationException 1 validation error detected: Value '[com.amazonaws.dynamodb.v20120810.TransactWriteItem@73f1877d, com.amazonaws.dynamodb.v20120810.TransactWriteItem@73e36ffc, com.amazonaws.dynamodb.v20120810.TransactWriteItem@73d5587b, com.amazonaws.dynamodb.v20120810.TransactWriteItem@73c740fa, com.amazonaws.dynamodb.v20120810.TransactWriteItem@7429e581, com.amazonaws.dynamodb.v20120810.TransactWriteItem@741bce00, com.amazonaws.dynamodb.v20120810.TransactWriteItem@740db67f, com.amazonaws.dynamodb.v20120810.TransactWriteItem@73ff9efe, com.amazonaws.dynamodb.v20120810.TransactWriteItem@7380cb75, com.amazonaws.dynamodb.v20120810.TransactWriteItem@6c0b735b, com.amazonaws.dynamodb.v20120810.TransactWriteItem@6bfd5bda]' at 'transactItems' failed to satisfy constraint: Member must have length less than or equal to 10<\/code><\/pre>\n\u3053\u306e\u5236\u9650\u306f\u610f\u8b58\u3057\u3066\u3044\u306a\u3044\u3068\u9055\u53cd\u3057\u3066\u3057\u307e\u3044\u305d\u3046\u306a\u306e\u3067\u3001\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u306d\u3002<\/p>\n
\u307e\u3068\u3081<\/h2>\n
\u5b9f\u88c5\u3055\u308c\u305fDynamoDB\u306e\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u6a5f\u80fd\u306b\u3064\u3044\u3066\u3001\u5b9f\u969b\u306b\u52d5\u304b\u3057\u306a\u304c\u3089\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n
\u4eca\u307e\u3067\u306f\u3001\u30a2\u30c8\u30df\u30c3\u30af\u6027\u3092\u4fdd\u3061\u305f\u3044\u5834\u54081\u30ec\u30b3\u30fc\u30c9\u306b\u53ce\u307e\u308b\u3088\u3046\u306b\u30c7\u30fc\u30bf\u30e2\u30c7\u30ea\u30f3\u30b0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002
\n\u3053\u308c\u304c\u306a\u304b\u306a\u304b\u5927\u5909\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u6a5f\u80fd\u304c\u5b9f\u88c5\u3055\u308c\u305f\u3053\u3068\u306b\u3088\u308a\u3001\u5c11\u3057\u306f\u697d\u306b\u306a\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u306a\u3068\u601d\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n
\u3053\u308c\u304b\u3089\u3082DynamoDB\u3092\u3069\u3093\u3069\u3093\u6d3b\u7528\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u5185\u5c71\u3067\u3059\u3002 \u4eca\u56de\u306f DynamoDB \u306b\u3064\u3044\u3066\u3067\u3059\u3002 \u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u6a5f\u80fd\u306e\u691c\u8a3c New \u2013 Amazon DynamoDB Transactions https:\/\/aws.amazon.com\/jp\/blogs\/aws\/new-amazon-dynamodb-transactions\/ \u3064\u3044\u306bDynamoDB\u304c\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u6a5f\u80fd\u304c\u3064\u304d\u307e\u3057\u305f\u3002 \u3053\u306e\u6a5f\u80fd\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306eAPI\u3092 […]<\/p>\n","protected":false},"author":5,"featured_media":684,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[322,128],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/503"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=503"}],"version-history":[{"count":1,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/503\/revisions"}],"predecessor-version":[{"id":3301,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/503\/revisions\/3301"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}