Skip to content

Conversation

@morningman
Copy link
Contributor

@morningman morningman commented Aug 7, 2019

If strict mode is true, and at least one row is filtered, the insert operation will fail and a url will be given to get the error rows.

ERROR 1064 (HY000): all partitions have no load data. url: http://host:ip/api/_load_error_log?file=__shard_2/error_log_insert_stmt_e0a620e93dc54461-b89ec64768367d25_e0a620e93dc54461_b89ec64768367d25

If all rows are good, insert will return OK with affected rows:

Query OK, 1 row affected (0.26 sec)

If strict mode is false, and at least one row is good, the insert operation will return OK with affected rows and warnings. If has error row num, a label will be returned:

Query OK, 1 row affected, 1 warning (0.32 sec)
{'label':'7d66c457-658b-4a3e-bdcf-8beee872ef2c'}

// set to OK, which means the insert load job is successfully submitted.
// and user can check the job's status by label.
context.getState().setOk("{'label':'" + uuid.toString() + "'}");
Map<String, String> res = Maps.newHashMap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can make some old client code not compatible. I think if client can get tracking URL from show load, we can not return URL here.

And this version is deprecated, I think it's better to keep old version's return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it

If INSERT operation failed on some error data rows, a url will be provided
for user to checking the error data rows.

eg:

{"label":"d2cac0a0-a16d-482d-9041-c949a4b71604","url":"xxx"}
or
ERROR 1064 (HY000): all partitions have no load data. url:xxx
@morningman morningman force-pushed the insert_with_error_log branch from d8df0d9 to b707fc6 Compare August 15, 2019 01:51
@morningman morningman closed this Aug 16, 2019
@morningman morningman reopened this Aug 16, 2019
return;
}

if (insertStmt.getQueryStmt() != null && (coord.getCommitInfos() == null || coord.getCommitInfos().isEmpty())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we keep this when insertedRows and filterRows both are 0

if (insertStmt.getQueryStmt() != null && (coord.getCommitInfos() == null || coord.getCommitInfos().isEmpty())) {
Catalog.getCurrentGlobalTransactionMgr().abortTransaction(insertStmt.getTransactionId(), "select stmt return empty set when insert");
if (loadedRows == 0 && filteredRows == 0) {
// if no data, just return ok
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abort transaction.

@imay imay merged commit 6d73658 into apache:master Aug 16, 2019
@imay imay mentioned this pull request Sep 26, 2019
swjtu-zhanglei pushed a commit to swjtu-zhanglei/incubator-doris that referenced this pull request Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants