| 443 | } |
| 444 | |
| 445 | static int insert(TABLE* table) { |
| 446 | DBUG_ENTER("Wsrep_schema::insert()"); |
| 447 | int ret= 0; |
| 448 | int error; |
| 449 | |
| 450 | /* |
| 451 | Verify that the table has primary key defined. |
| 452 | */ |
| 453 | if (table->s->primary_key >= MAX_KEY || |
| 454 | !table->s->keys_in_use.is_set(table->s->primary_key)) { |
| 455 | WSREP_ERROR("No primary key for %s.%s", |
| 456 | table->s->db.str, table->s->table_name.str); |
| 457 | DBUG_RETURN(1); |
| 458 | } |
| 459 | |
| 460 | if ((error= table->file->ha_write_row(table->record[0]))) { |
| 461 | if (error == HA_ERR_FOUND_DUPP_KEY) { |
| 462 | WSREP_WARN("Duplicate key found when writing into %s.%s", |
| 463 | table->s->db.str, |
| 464 | table->s->table_name.str); |
| 465 | ret= HA_ERR_FOUND_DUPP_KEY; |
| 466 | } else { |
| 467 | WSREP_ERROR("Error writing into %s.%s: %d", |
| 468 | table->s->db.str, |
| 469 | table->s->table_name.str, |
| 470 | error); |
| 471 | ret= 1; |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | DBUG_RETURN(ret); |
| 476 | } |
| 477 | |
| 478 | static int delete_row(TABLE* table) { |
| 479 | int error; |
no test coverage detected