sync_put_batch
(table)
| 108 | |
| 109 | |
| 110 | def sync_put_batch(table): |
| 111 | """ sync_put_batch """ |
| 112 | print("\nsync put batch") |
| 113 | mutation_list = list() |
| 114 | for i in range(1, 1001): |
| 115 | if i == 3: |
| 116 | # valid rowkey should < 64K, otherwise an invalid argument |
| 117 | # mock error for batch put |
| 118 | mutation = table.NewRowMutation("k" * 64 * 1024 + "k") |
| 119 | else: |
| 120 | mutation = table.NewRowMutation(str(i)) |
| 121 | mutation.Put("cf0", "qu0", "value" + str(i)) |
| 122 | mutation_list.append(mutation) |
| 123 | table.BatchPut(mutation_list) |
| 124 | for m in mutation_list: |
| 125 | status = m.GetStatus() |
| 126 | if status.GetReasonNumber() != Status.OK: |
| 127 | print("put/write failed for key<" + m.RowKey() |
| 128 | + "> due to:" + status.GetReasonString()) |
| 129 | m.Destroy() |
| 130 | |
| 131 | |
| 132 | def sync_get_batch(table): |
no test coverage detected