Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](group commit) make group commit cancel in time #36249

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/runtime/group_commit_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Status LoadBlockQueue::get_block(RuntimeState* runtime_state, vectorized::Block*
<< ", runtime_state=" << runtime_state;
}
}
_get_cond.wait_for(l, std::chrono::milliseconds(left_milliseconds));
_get_cond.wait_for(l, std::chrono::milliseconds(std::min(left_milliseconds, 10000L)));
}
if (runtime_state->is_cancelled()) {
auto st = runtime_state->cancel_reason();
Expand Down
55 changes: 55 additions & 0 deletions regression-test/suites/insert_p0/test_group_commit_timeout.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite("test_group_commit_timeout", "nonConcurrent") {
def tableName = "test_group_commit_timeout"
sql """
CREATE TABLE if not exists ${tableName} (
`id` int(11) NOT NULL,
`name` varchar(100) NULL,
`score` int(11) NULL default "-1"
) ENGINE=OLAP
DUPLICATE KEY(`id`)
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
"replication_num" = "1",
"group_commit_interval_ms" = "300000"
);
"""

def query_timeout = sql """show variables where variable_name = 'query_timeout';"""
def insert_timeout = sql """show variables where variable_name = 'insert_timeout';"""
logger.info("query_timeout: ${query_timeout}, insert_timeout: ${insert_timeout}")

long start = System.currentTimeMillis()
try {
sql "SET global query_timeout = 5"
sql "SET global insert_timeout = 5"

sql "set group_commit = sync_mode"
sql "insert into ${tableName} values(1, 'a', 10)"
assertTrue(false)
} catch (Exception e) {
long end = System.currentTimeMillis()
logger.info("failed " + e.getMessage())
assertTrue(e.getMessage().contains("FragmentMgr cancel worker going to cancel timeout instance"))
assertTrue(end - start <= 60000)
} finally {
sql "SET global query_timeout = ${query_timeout[0][1]}"
sql "SET global insert_timeout = ${insert_timeout[0][1]}"
}
}
Loading