@@ -151,7 +151,7 @@ OLAPStatus AlphaRowsetWriter::flush() {
151
151
152
152
RowsetSharedPtr AlphaRowsetWriter::build () {
153
153
if (_writer_state != WRITER_FLUSHED) {
154
- LOG (WARNING) << " invalid writer state before build:" << _writer_state;
154
+ LOG (WARNING) << " invalid writer state before build, state :" << _writer_state;
155
155
return nullptr ;
156
156
}
157
157
for (auto & segment_group : _segment_groups) {
@@ -200,6 +200,13 @@ RowsetSharedPtr AlphaRowsetWriter::build() {
200
200
_current_rowset_meta->set_num_rows (_num_rows_written);
201
201
_current_rowset_meta->set_creation_time (time (nullptr ));
202
202
203
+ // validate rowset arguments before create rowset
204
+ bool ret = _validate_rowset ();
205
+ if (!ret) {
206
+ LOG (WARNING) << " valiate rowset arguments failed" ;
207
+ return nullptr ;
208
+ }
209
+
203
210
RowsetSharedPtr rowset (new (std::nothrow) AlphaRowset (_rowset_writer_context.tablet_schema ,
204
211
_rowset_writer_context.rowset_path_prefix ,
205
212
_rowset_writer_context.data_dir , _current_rowset_meta));
@@ -289,4 +296,18 @@ OLAPStatus AlphaRowsetWriter::_init() {
289
296
return OLAP_SUCCESS;
290
297
}
291
298
299
+ bool AlphaRowsetWriter::_validate_rowset () {
300
+ if (_is_pending_rowset) {
301
+ int64_t partition_id = _current_rowset_meta->partition_id ();
302
+ if (partition_id <= 0 ) {
303
+ LOG (WARNING) << " invalid partition id:" << partition_id << " for pending rowset."
304
+ << " , rowset_id:" << _current_rowset_meta->rowset_id ()
305
+ << " , tablet_id:" << _current_rowset_meta->tablet_id ()
306
+ << " , schema_hash:" << _current_rowset_meta->tablet_schema_hash ();
307
+ return false ;
308
+ }
309
+ }
310
+ return true ;
311
+ }
312
+
292
313
} // namespace doris
0 commit comments