Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
435f05a
first commit
morningman Jul 9, 2019
50ba175
second commit
morningman Jul 12, 2019
a71a4b7
third commit
morningman Jul 12, 2019
a17bee1
schema change first commit
morningman Jul 16, 2019
a6f3b7a
schema change second commit
morningman Jul 17, 2019
f366fb0
modify schema change
morningman Jul 22, 2019
b8c5693
add get shadow index
morningman Jul 23, 2019
630dd46
merge diff id and alter task on BE
morningman Jul 23, 2019
40fd991
fix bug 1
morningman Jul 23, 2019
70e7ae1
fix cancel not delete index bug
morningman Jul 23, 2019
bdfe943
persist rollup
morningman Jul 25, 2019
8963c53
add handle finish alter task logic
morningman Jul 25, 2019
7e5c311
visualize index
morningman Jul 25, 2019
584ed49
fix table name null
morningman Jul 25, 2019
3ef0132
add ignore alter in replica
morningman Jul 25, 2019
64f0346
fix cancel job bug
morningman Jul 25, 2019
b185afc
fix schema change bug 1
morningman Jul 25, 2019
94e273b
fix schema change base index visualize bug
morningman Jul 25, 2019
bf51c27
change ignore to equalsIgnoreCase
morningman Jul 26, 2019
3b9df9e
schema change try 1
morningman Jul 29, 2019
5befffc
add
morningman Jul 29, 2019
d320739
handle __doris_shadow column
morningman Jul 30, 2019
adeaf87
fix replay job bug
morningman Jul 31, 2019
688302a
fix replay bug1
morningman Jul 31, 2019
d7ce8de
fix update replica version in task
morningman Jul 31, 2019
d60d31f
remove name compare in memtable
morningman Jul 31, 2019
3669073
fix compile bug
morningman Jul 31, 2019
2811d5a
refactor insert stmt
morningman Aug 5, 2019
197bbb4
fix insert bugs
morningman Aug 5, 2019
d1a1b9b
change dpp to 3.2
morningman Aug 6, 2019
d434508
modify create table timeout
morningman Aug 9, 2019
ec45f6d
modify broker load shadow column
morningman Aug 9, 2019
5026303
fill the data description columns
morningman Aug 10, 2019
364eec0
change meta version to 59
morningman Aug 10, 2019
390c174
Fix schema change bug
morningman Aug 11, 2019
ac700ed
Fix unknown xxx bg
morningman Aug 11, 2019
0482c0f
support duplicate column mapping
morningman Aug 12, 2019
4708736
abort timeout task
morningman Aug 13, 2019
68b3223
fix dead log bug
morningman Aug 13, 2019
ed99027
fix dead lock
morningman Aug 14, 2019
cf70586
insert char 1
morningman Aug 15, 2019
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
4 changes: 2 additions & 2 deletions be/src/agent/agent_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ void AgentServer::submit_tasks(
break;
case TTaskType::ROLLUP:
case TTaskType::SCHEMA_CHANGE:
case TTaskType::ALTER_TASK:
if (task.__isset.alter_tablet_req) {
case TTaskType::ALTER:
if (task.__isset.alter_tablet_req || task.__isset.alter_tablet_req_v2) {
_alter_tablet_workers->submit_task(task);
} else {
status_code = TStatusCode::ANALYSIS_ERROR;
Expand Down
8 changes: 4 additions & 4 deletions be/src/agent/task_worker_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ void* TaskWorkerPool::_alter_tablet_worker_thread_callback(void* arg_this) {
switch (task_type) {
case TTaskType::SCHEMA_CHANGE:
case TTaskType::ROLLUP:
case TTaskType::ALTER_TASK:
case TTaskType::ALTER:
worker_pool_this->_alter_tablet(worker_pool_this,
agent_task_req,
signatrue,
Expand Down Expand Up @@ -588,8 +588,8 @@ void TaskWorkerPool::_alter_tablet(
case TTaskType::SCHEMA_CHANGE:
process_name = "schema change";
break;
case TTaskType::ALTER_TASK:
process_name = "alter table";
case TTaskType::ALTER:
process_name = "alter";
break;
default:
std::string task_name;
Expand All @@ -607,7 +607,7 @@ void TaskWorkerPool::_alter_tablet(
TSchemaHash new_schema_hash = 0;
if (status == DORIS_SUCCESS) {
OLAPStatus sc_status = OLAP_SUCCESS;
if (task_type == TTaskType::ALTER_TASK) {
if (task_type == TTaskType::ALTER) {
new_tablet_id = agent_task_req.alter_tablet_req_v2.new_tablet_id;
new_schema_hash = agent_task_req.alter_tablet_req_v2.new_schema_hash;
EngineAlterTabletTask engine_task(agent_task_req.alter_tablet_req_v2, signature, task_type, &error_msgs, process_name);
Expand Down
14 changes: 2 additions & 12 deletions be/src/olap/delta_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,9 @@ OLAPStatus DeltaWriter::init() {
return OLAP_ERR_ROWSET_WRITER_INIT;
}

const std::vector<SlotDescriptor*>& slots = _req.tuple_desc->slots();
const TabletSchema& schema = _tablet->tablet_schema();
for (size_t col_id = 0; col_id < schema.num_columns(); ++col_id) {
const TabletColumn& column = schema.column(col_id);
for (size_t i = 0; i < slots.size(); ++i) {
if (slots[i]->col_name() == column.name()) {
_col_ids.push_back(i);
}
}
}
_tablet_schema = &(_tablet->tablet_schema());
_schema = new Schema(*_tablet_schema);
_mem_table = new MemTable(_schema, _tablet_schema, &_col_ids,
_mem_table = new MemTable(_schema, _tablet_schema, _req.slots,
_req.tuple_desc, _tablet->keys_type());
_is_init = true;
return OLAP_SUCCESS;
Expand All @@ -173,7 +163,7 @@ OLAPStatus DeltaWriter::write(Tuple* tuple) {
RETURN_NOT_OK(_mem_table->flush(_rowset_writer));

SAFE_DELETE(_mem_table);
_mem_table = new MemTable(_schema, _tablet_schema, &_col_ids,
_mem_table = new MemTable(_schema, _tablet_schema, _req.slots,
_req.tuple_desc, _tablet->keys_type());
}
return OLAP_SUCCESS;
Expand Down
3 changes: 2 additions & 1 deletion be/src/olap/delta_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct WriteRequest {
PUniqueId load_id;
bool need_gen_rollup;
TupleDescriptor* tuple_desc;
// slots are in order of tablet's schema
std::vector<SlotDescriptor*>* slots;
};

class DeltaWriter {
Expand Down Expand Up @@ -76,7 +78,6 @@ class DeltaWriter {
MemTable* _mem_table;
Schema* _schema;
const TabletSchema* _tablet_schema;
std::vector<uint32_t> _col_ids;
bool _delta_written_success;
};

Expand Down
9 changes: 4 additions & 5 deletions be/src/olap/memtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
namespace doris {

MemTable::MemTable(Schema* schema, const TabletSchema* tablet_schema,
std::vector<uint32_t>* col_ids, TupleDescriptor* tuple_desc,
std::vector<SlotDescriptor*>* slot_descs, TupleDescriptor* tuple_desc,
KeysType keys_type)
: _schema(schema),
_tablet_schema(tablet_schema),
_tuple_desc(tuple_desc),
_col_ids(col_ids),
_slot_descs(slot_descs),
_keys_type(keys_type),
_row_comparator(_schema) {
_schema_size = _schema->schema_size();
Expand All @@ -58,11 +58,10 @@ size_t MemTable::memory_usage() {
}

void MemTable::insert(Tuple* tuple) {
const std::vector<SlotDescriptor*>& slots = _tuple_desc->slots();
ContiguousRow row(_schema, _tuple_buf);
for (size_t i = 0; i < _col_ids->size(); ++i) {
for (size_t i = 0; i < _slot_descs->size(); ++i) {
auto cell = row.cell(i);
const SlotDescriptor* slot = slots[(*_col_ids)[i]];
const SlotDescriptor* slot = (*_slot_descs)[i];

if (tuple->is_null(slot->null_indicator_offset())) {
cell.set_null();
Expand Down
5 changes: 3 additions & 2 deletions be/src/olap/memtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RowCursor;
class MemTable {
public:
MemTable(Schema* schema, const TabletSchema* tablet_schema,
std::vector<uint32_t>* col_ids, TupleDescriptor* tuple_desc,
std::vector<SlotDescriptor*>* slot_descs, TupleDescriptor* tuple_desc,
KeysType keys_type);
~MemTable();
size_t memory_usage();
Expand All @@ -43,7 +43,8 @@ class MemTable {
Schema* _schema;
const TabletSchema* _tablet_schema;
TupleDescriptor* _tuple_desc;
std::vector<uint32_t>* _col_ids;
// the slot in _slot_descs are in order of tablet's schema
std::vector<SlotDescriptor*>* _slot_descs;
KeysType _keys_type;

struct RowCursorComparator {
Expand Down
7 changes: 5 additions & 2 deletions be/src/olap/schema_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,9 +1329,12 @@ OLAPStatus SchemaChangeHandler::_do_process_alter_tablet_v2(const TAlterTabletRe
if (res != OLAP_SUCCESS) {
break;
}
res = _validate_alter_result(new_tablet, request);
} while(0);

// _validate_alter_result should be outside the above while loop.
// to avoid requiring the header lock twice.
res = _validate_alter_result(new_tablet, request);

// if failed convert history data, then just remove the new tablet
if (res != OLAP_SUCCESS) {
LOG(WARNING) << "failed to alter tablet. base_tablet=" << base_tablet->full_name()
Expand Down Expand Up @@ -2143,7 +2146,7 @@ OLAPStatus SchemaChangeHandler::_validate_alter_result(TabletSharedPtr new_table
Version max_continuous_version = {-1, 0};
VersionHash max_continuous_version_hash = 0;
new_tablet->max_continuous_version_from_begining(&max_continuous_version, &max_continuous_version_hash);
LOG(INFO) << "find max continuous version "
LOG(INFO) << "find max continuous version of tablet=" << new_tablet->full_name()
<< ", start_version=" << max_continuous_version.first
<< ", end_version=" << max_continuous_version.second
<< ", version_hash=" << max_continuous_version_hash;
Expand Down
5 changes: 0 additions & 5 deletions be/src/olap/task/engine_alter_tablet_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ EngineAlterTabletTask::EngineAlterTabletTask(const TAlterTabletReqV2& request,
_process_name(process_name) { }

OLAPStatus EngineAlterTabletTask::execute() {
LOG(INFO) << "begin to create new alter tablet. base_tablet_id=" << _alter_tablet_req.base_tablet_id
<< ", base_schema_hash=" << _alter_tablet_req.base_schema_hash
<< ", new_tablet_id=" << _alter_tablet_req.new_tablet_id
<< ", new_schema_hash=" << _alter_tablet_req.new_schema_hash;

DorisMetrics::create_rollup_requests_total.increment(1);

SchemaChangeHandler handler;
Expand Down
7 changes: 4 additions & 3 deletions be/src/runtime/tablet_writer_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,16 @@ Status TabletsChannel::close(int sender_id, bool* finished,
}

Status TabletsChannel::_open_all_writers(const PTabletWriterOpenRequest& params) {
std::vector<SlotDescriptor*>* columns = nullptr;
std::vector<SlotDescriptor*>* index_slots = nullptr;
int32_t schema_hash = 0;
for (auto& index : _schema->indexes()) {
if (index->index_id == _index_id) {
columns = &index->slots;
index_slots = &index->slots;
schema_hash = index->schema_hash;
break;
}
}
if (columns == nullptr) {
if (index_slots == nullptr) {
std::stringstream ss;
ss << "unknown index id, key=" << _key;
return Status::InternalError(ss.str());
Expand All @@ -229,6 +229,7 @@ Status TabletsChannel::_open_all_writers(const PTabletWriterOpenRequest& params)
request.load_id = params.id();
request.need_gen_rollup = params.need_gen_rollup();
request.tuple_desc = _tuple_desc;
request.slots = index_slots;

DeltaWriter* writer = nullptr;
auto st = DeltaWriter::open(&request, &writer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ api:
命令:

```
./lib/meta_tool --operation=delete_header --root_path=/path/to/root_path --tablet_id=xxx --schema_hash=xxx`
./lib/meta_tool --operation=delete_header --root_path=/path/to/root_path --tablet_id=xxx --schema_hash=xxx
```

### 展示 pb 格式的 TabletMeta
Expand Down
8 changes: 6 additions & 2 deletions fe/src/main/cup/sql_parser.cup
Original file line number Diff line number Diff line change
Expand Up @@ -1853,11 +1853,15 @@ show_param ::=
:}
| KW_TABLET INTEGER_LITERAL:tabletId
{:
RESULT = new ShowTabletStmt(null, tabletId);
RESULT = new ShowTabletStmt(null, tabletId, null);
:}
| KW_TABLET KW_FROM table_name:dbTblName
{:
RESULT = new ShowTabletStmt(dbTblName, -1L);
RESULT = new ShowTabletStmt(dbTblName, -1L, null);
:}
| KW_TABLET KW_FROM table_name:dbTblName KW_ROLLUP ident:rollup
{:
RESULT = new ShowTabletStmt(dbTblName, -1L, rollup);
:}
| KW_PROPERTY opt_user:user opt_wild_where
{:
Expand Down
12 changes: 4 additions & 8 deletions fe/src/main/java/org/apache/doris/alter/Alter.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.doris.common.DdlException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.UserException;

import com.google.common.base.Preconditions;

Expand Down Expand Up @@ -73,7 +74,7 @@ public void start() {
clusterHandler.start();
}

public void processAlterTable(AlterTableStmt stmt) throws DdlException {
public void processAlterTable(AlterTableStmt stmt) throws UserException {
TableName dbTableName = stmt.getTbl();
String dbName = dbTableName.getDb();
final String clusterName = stmt.getClusterName();
Expand Down Expand Up @@ -171,13 +172,8 @@ public void processAlterTable(AlterTableStmt stmt) throws DdlException {
throw new DdlException("table with empty parition cannot do schema change. [" + tableName + "]");
}

if (olapTable.getState() == OlapTableState.SCHEMA_CHANGE
|| olapTable.getState() == OlapTableState.RESTORE) {
throw new DdlException("Table[" + table.getName() + "]'s state[" + olapTable.getState()
+ "] does not allow doing ALTER ops");
// here we pass NORMAL and ROLLUP
// NORMAL: ok to do any alter ops
// ROLLUP: we allow user DROP a rollup index when it's under ROLLUP
if (olapTable.getState() != OlapTableState.NORMAL) {
throw new DdlException("Table[" + table.getName() + "]'s state is not NORMAL. Do not allow doing ALTER ops");
}

if (hasSchemaChange || hasModifyProp || hasRollup) {
Expand Down
Loading