[CP] fix: add defensive code for table api rowkey update
This commit is contained in:
		| @ -364,6 +364,16 @@ TEST_F(TestBatchExecute, all_single_operation) | |||||||
|     ASSERT_EQ(OB_SUCCESS, r.get_entity(result_entity)); |     ASSERT_EQ(OB_SUCCESS, r.get_entity(result_entity)); | ||||||
|     ASSERT_TRUE(result_entity->is_empty()); |     ASSERT_TRUE(result_entity->is_empty()); | ||||||
|   } |   } | ||||||
|  |   // update rowkey column | ||||||
|  |   { | ||||||
|  |     entity->reset(); | ||||||
|  |     ASSERT_EQ(OB_SUCCESS, entity->add_rowkey_value(key)); | ||||||
|  |     value.set_varchar(c3_value); | ||||||
|  |     value.set_collation_type(CS_TYPE_UTF8MB4_GENERAL_CI); | ||||||
|  |     ASSERT_EQ(OB_SUCCESS, entity->set_property(C1, value)); | ||||||
|  |     ObTableOperation table_operation = ObTableOperation::update(*entity); | ||||||
|  |     ASSERT_EQ(OB_NOT_SUPPORTED, table_->execute(table_operation, r)); | ||||||
|  |   } | ||||||
|   // replace C3 |   // replace C3 | ||||||
|   { |   { | ||||||
|     entity->reset(); |     entity->reset(); | ||||||
|  | |||||||
| @ -364,6 +364,9 @@ int ObTableCtx::adjust_properties() | |||||||
|         LOG_WARN("fail to get column schema", K(ret), K(col_name)); |         LOG_WARN("fail to get column schema", K(ret), K(col_name)); | ||||||
|       } else if (is_get) { |       } else if (is_get) { | ||||||
|         // do nothing |         // do nothing | ||||||
|  |       } else if (col_schema->is_rowkey_column()) { | ||||||
|  |         ret = OB_NOT_SUPPORTED; | ||||||
|  |         LOG_WARN("property should not be rowkey column", K(ret), K(prop_names), K(i)); | ||||||
|       } else if (OB_FAIL(adjust_column(*col_schema, prop_obj))) { |       } else if (OB_FAIL(adjust_column(*col_schema, prop_obj))) { | ||||||
|         LOG_WARN("fail to adjust column", K(ret), K(prop_obj)); |         LOG_WARN("fail to adjust column", K(ret), K(prop_obj)); | ||||||
|       } |       } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 obdev
					obdev