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

Do not update session when use space. #2833

Merged
merged 3 commits into from
Sep 17, 2021
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
9 changes: 3 additions & 6 deletions src/graph/validator/UseValidator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@ Status UseValidator::validateImpl() {

Status UseValidator::toPlan() {
// The input will be set by father validator later.
auto switchSpace = SwitchSpace::make(qctx_, nullptr, *spaceName_);
qctx_->rctx()->session()->updateSpaceName(*spaceName_);
auto session = qctx_->rctx()->session()->getSession();
auto update = UpdateSession::make(qctx_, switchSpace, std::move(session));
root_ = update;
tail_ = switchSpace;
auto reg = SwitchSpace::make(qctx_, nullptr, *spaceName_);
root_ = reg;
tail_ = root_;
return Status::OK();
}
} // namespace graph
Expand Down
3 changes: 1 addition & 2 deletions src/graph/validator/test/AdminValidatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ TEST_F(AdminValidatorTest, SpaceTest) {
checkResult("CREATE SPACE TEST(vid_type = fixed_string(2)); DESC SPACE TEST;", expected));
}
{
std::vector<PlanNode::Kind> expected = {
PK::kUpdateSession, PK::kSwitchSpace, PK::kCreateSpace, PK::kStart};
std::vector<PlanNode::Kind> expected = {PK::kSwitchSpace, PK::kCreateSpace, PK::kStart};
ASSERT_TRUE(checkResult("CREATE SPACE TEST(vid_type = fixed_string(2)); USE TEST;", expected));
}
}
Expand Down
8 changes: 5 additions & 3 deletions tests/job/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def test_sessions(self):
for row in resp.rows():
if bytes.decode(row.values[1].get_sVal()) == 'session_user':
session_id = row.values[0].get_iVal()
assert row.values[2].get_sVal() == b''
assert row.values[3].getType() == ttypes.Value.DTVAL
assert row.values[4].getType() == ttypes.Value.DTVAL
assert row.values[2].get_sVal() == b'', f"resp: {resp}"
assert row.values[3].getType() == ttypes.Value.DTVAL, f"resp: {resp}"
assert row.values[4].getType() == ttypes.Value.DTVAL, f"resp: {resp}"
break

assert session_id != 0
Expand All @@ -99,6 +99,8 @@ def test_sessions(self):
resp = client_ok.execute('USE nba')
self.check_resp_succeeded(resp)

# wait for session sync.
time.sleep(3)
resp = self.execute('SHOW SESSION {}'.format(session_id))
self.check_resp_succeeded(resp)
expect_col_names = ['VariableName', 'Value']
Expand Down