Status Codes

IoTDB introduces the concept of status codes. For example, since IoTDB needs to register a time series before writing data, one possible solution is:

try {
    writeData();
} catch (SQLException e) {
  // the most case is that the time series does not exist
  if (e.getMessage().contains("exist")) {
      //However, using the content of the error message is not so efficient
      registerTimeSeries();
      //write data once again
      writeData();
  }
}

By utilizing status codes, we can avoid writing code such as if (e.getErrorMessage().contains("exist")) . Instead, we only need to use e.getStatusType().getCode() == TSStatusCode.TIME_SERIES_NOT_EXIST_ERROR.getStatusCode().

Here is a list of status codes and their corresponding messages:

Status CodeStatus TypeStatus Information
200SUCCESS_STATUSOperation successful.
201INCOMPATIBLE_VERSIONIncompatible version.
202CONFIGURATION_ERRORConfiguration file contains errors.
203START_UP_ERRORError occurred during startup.
204SHUT_DOWN_ERRORError occurred during shutdown.
300UNSUPPORTED_OPERATIONUnsupported operation.
301EXECUTE_STATEMENT_ERRORError occurred while executing the statement.
302MULTIPLE_ERRORError occurred while executing multi-line statements.
303ILLEGAL_PARAMETERInvalid or missing parameters provided.
304OVERLAP_WITH_EXISTING_TASKConflict with another ongoing operation.
305INTERNAL_SERVER_ERRORInternal server error encountered.
306DISPATCH_ERRORError during distribution process.
400REDIRECTION_RECOMMENDRecommended client redirection.
500DATABASE_NOT_EXISTSpecified database does not exist.
501DATABASE_ALREADY_EXISTSDatabase already exists.
502SERIES_OVERFLOWExceeded maximum series count threshold.
503TIMESERIES_ALREADY_EXISTTime series already exists.
504TIMESERIES_IN_BLACK_LISTTime series is currently being deleted.
505ALIAS_ALREADY_EXISTPath alias already exists.
506PATH_ALREADY_EXISTPath already exists.
507METADATA_ERRORError occured while processing metadata.
508PATH_NOT_EXISTSpecified path does not exist.
509ILLEGAL_PATHPath is invalid.
510CREATE_TEMPLATE_ERRORFailed to create schema template.
511DUPLICATED_TEMPLATESchema template already exists.
512UNDEFINED_TEMPLATESchema template is undefined.
513TEMPLATE_NOT_SETSchema template not set.
514DIFFERENT_TEMPLATEInconsistent Schema template detected.
515TEMPLATE_IS_IN_USESchema template is currently in use.
516TEMPLATE_INCOMPATIBLESchema template is incompatible.
517SEGMENT_NOT_FOUNDSpecified segment not found.
518PAGE_OUT_OF_SPACEInsufficient space in PBTreeFile page.
519RECORD_DUPLICATEDDuplicate record detected.
520SEGMENT_OUT_OF_SPACEInsufficient space in PBTreeFile segment.
521PBTREE_FILE_NOT_EXISTSPBTreeFile does not exist.
522OVERSIZE_RECORDRecord size exceeds schema file page size.
523PBTREE_FILE_REDO_LOG_BROKENRedo log in PBTreeFile is corrupted.
524TEMPLATE_NOT_ACTIVATEDSchema template is inactive.
526SCHEMA_QUOTA_EXCEEDEDCluster schema exceeds quota limits.
527MEASUREMENT_ALREADY_EXISTS_IN_TEMPLATEMeasurement already exists in schema template.
600SYSTEM_READ_ONLYIoTDB system is in read-only mode.
601STORAGE_ENGINE_ERRORError related to the storage engine.
602STORAGE_ENGINE_NOT_READYStorage engine is recovering; read/write operations are not accepted.
603DATAREGION_PROCESS_ERRORError related to DataRegion.
604TSFILE_PROCESSOR_ERRORError related to TsFile processor.
605WRITE_PROCESS_ERRORGeneral write-related error.
606WRITE_PROCESS_REJECTWrite operation rejected.
607OUT_OF_TTLInserted timestamp is earlier than TTL boundary
608COMPACTION_ERRORError during compaction.
609ALIGNED_TIMESERIES_ERRORError in aligned time series.
610WAL_ERRORWrite-Ahead Log (WAL) exception.
611DISK_SPACE_INSUFFICIENTInsufficient disk space.
700SQL_PARSE_ERRORError during parsing SQL statement.
701SEMANTIC_ERRORSemantic error in SQL statement.
702GENERATE_TIME_ZONE_ERRORError during generating timezone.
703SET_TIME_ZONE_ERRORError during setting timezone.
704QUERY_NOT_ALLOWEDQuery operation is not allowed.
705LOGICAL_OPERATOR_ERRORError related to logical operators.
706LOGICAL_OPTIMIZE_ERRORError during logical optimization.
707UNSUPPORTED_FILL_TYPEUnsupported fill type specified.
708QUERY_PROCESS_ERRORError during processing the query.
709MPP_MEMORY_NOT_ENOUGHInsufficient memory for MPP framework task execution.
710CLOSE_OPERATION_ERRORError during shutdown operation.
711TSBLOCK_SERIALIZE_ERRORError during serializing TsBlock.
712INTERNAL_REQUEST_TIME_OUTMPP operation timed out.
713INTERNAL_REQUEST_RETRY_ERRORInternal operation retry failed.
714NO_SUCH_QUERYSpecified query does not exist.
715QUERY_WAS_KILLEDQuery execution was terminated.
800UNINITIALIZED_AUTH_ERRORAuthorization module not initialized.
801WRONG_LOGIN_PASSWORDUsername or password is incorrect.
802NOT_LOGINUser not logged in.
803NO_PERMISSIONUser lacks necessary permissions.
804USER_NOT_EXISTSpecified user does not exist.
805USER_ALREADY_EXISTUser already exists.
806USER_ALREADY_HAS_ROLEUser possesses the specified role.
807USER_NOT_HAS_ROLEUser does not possess the specified role.
808ROLE_NOT_EXISTSpecified role does not exist.
809ROLE_ALREADY_EXISTRole already exists.
810ALREADY_HAS_PRIVILEGEUser has the required privilege.
811NOT_HAS_PRIVILEGEUser lacks the required privilege.
812CLEAR_PERMISSION_CACHE_ERRORFailed to clear permission cache.
813UNKNOWN_AUTH_PRIVILEGEUnknown permission specified.
814UNSUPPORTED_AUTH_OPERATIONUnsupported permission operation attempted.
815AUTH_IO_EXCEPTIONI/O exception in authorization module.
900MIGRATE_REGION_ERRORFailed to migrate region.
901CREATE_REGION_ERRORFailed to create region.
902DELETE_REGION_ERRORFailed to delete region.
903PARTITION_CACHE_UPDATE_ERRORFailed to update partition cache.
904CONSENSUS_NOT_INITIALIZEDConsensus layer not initialized; service unavailable.
905REGION_LEADER_CHANGE_ERRORFailed to migrate region leader.
906NO_AVAILABLE_REGION_GROUPNo available region group found.
907LACK_DATA_PARTITION_ALLOCATIONMissing information in create data partition method return result.
1000DATANODE_ALREADY_REGISTEREDDataNode is already registered in the cluster.
1001NO_ENOUGH_DATANODEInsufficient DataNodes; unable to remove nodes or create regiongroups.
1002ADD_CONFIGNODE_ERRORFailed to add ConfigNode.
1003REMOVE_CONFIGNODE_ERRORFailed to remove ConfigNode.
1004DATANODE_NOT_EXISTSpecified DataNode does not exist.
1005DATANODE_STOP_ERRORFailed to shut down DataNode.
1006REMOVE_DATANODE_ERRORFailed to remove DataNode.
1007REGISTER_DATANODE_WITH_WRONG_IDIncorrect registration ID in registered DataNodes.
1008CAN_NOT_CONNECT_DATANODEFailed to connect to DataNode.
1100LOAD_FILE_ERRORError loading file.
1101LOAD_PIECE_OF_TSFILE_ERRORException loading TsFile fragment.
1102DESERIALIZE_PIECE_OF_TSFILE_ERRORException deserializing TsFile fragment.
1103SYNC_CONNECTION_ERRORError during sync connection.
1104SYNC_FILE_REDIRECTION_ERRORRedirect exception while syncing files.
1105SYNC_FILE_ERRORGeneral exception during file synchronization.
1106CREATE_PIPE_SINK_ERRORFailed to create PIPE Sink.
1107PIPE_ERRORGeneral PIPE exception.
1108PIPESERVER_ERRORException occurring on the PIPE server.
1109VERIFY_METADATA_ERRORFailed to validate metadata.
1200UDF_LOAD_CLASS_ERRORException loading UDF class.
1201UDF_DOWNLOAD_ERRORFailed to download UDF from ConfigNode.
1202CREATE_UDF_ON_DATANODE_ERRORFailed to create UDF on DataNode.
1203DROP_UDF_ON_DATANODE_ERRORFailed to unload UDF from DataNode.
1300CREATE_TRIGGER_ERRORFailed to create trigger via ConfigNode.
1301DROP_TRIGGER_ERRORFailed to delete trigger via ConfigNode.
1302TRIGGER_FIRE_ERRORError executing trigger.
1303TRIGGER_LOAD_CLASS_ERRORException loading trigger class.
1304TRIGGER_DOWNLOAD_ERRORFailed to download trigger from ConfigNode.
1305CREATE_TRIGGER_INSTANCE_ERRORException creating trigger instance.
1306ACTIVE_TRIGGER_INSTANCE_ERRORException activating trigger instance.
1307DROP_TRIGGER_INSTANCE_ERRORException deleting trigger instance.
1308UPDATE_TRIGGER_LOCATION_ERRORUpdate Stateful Trigger's DataNode Exception
1400NO_SUCH_CQContinuous Query (CQ) task does not exist.
1401CQ_ALREADY_ACTIVECQ task is already activated.
1402CQ_AlREADY_EXISTCQ task already exist.
1403CQ_UPDATE_LAST_EXEC_TIME_ERRORFailed to update last execution time for CQ task.

In the latest version, we have refactored the exception classes in IoTDB. By consolidating error messages into the exception classes and assigning unique error codes to each exception, when an exception is caught and a higher-level exception is thrown, the error code is preserved and propagated. This allows users to understand the detailed cause of the error.

Additionally, we have introduced a base exception class named ProcessException, which serves as the parent class for all other exceptions.