Skip to content

Commit 486c6cd

Browse files
askyrieSongZhen0704
authored andcommitted
feat: update exception_description to text
1 parent 6617754 commit 486c6cd

File tree

5 files changed

+7
-11
lines changed

5 files changed

+7
-11
lines changed

server/controller/db/metadb/migrator/schema/rawsql/mysql/ddl_create_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ CREATE TABLE IF NOT EXISTS vtap (
212212
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
213213
boot_time INTEGER DEFAULT 0,
214214
exceptions BIGINT UNSIGNED DEFAULT 0,
215-
exception_description VARCHAR(256) DEFAULT '',
215+
exception_description TEXT,
216216
vtap_lcuuid CHAR(64) DEFAULT NULL,
217217
vtap_group_lcuuid CHAR(64) DEFAULT NULL,
218218
cpu_num INTEGER DEFAULT 0 COMMENT 'logical number of cpu',

server/controller/db/metadb/migrator/schema/rawsql/mysql/issu/7.1.0.38.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ BEGIN
3333
DEALLOCATE PREPARE stmt;
3434
END IF;
3535
END;
36-
CALL AddColumnIfNotExists('vtap', 'exception_description', "VARCHAR(256) DEFAULT ''", 'exceptions');
36+
CALL AddColumnIfNotExists('vtap', 'exception_description', 'TEXT', 'exceptions');
3737

3838
-- Cleanup
3939
DROP PROCEDURE IF EXISTS ColumnExists;

server/controller/db/metadb/migrator/schema/rawsql/postgres/ddl_create_table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ CREATE TABLE IF NOT EXISTS vtap (
218218
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
219219
boot_time INTEGER DEFAULT 0,
220220
exceptions BIGINT DEFAULT 0 CHECK (exceptions >= 0),
221-
exception_description VARCHAR(256) DEFAULT '',
221+
exception_description TEXT,
222222
vtap_lcuuid VARCHAR(64) DEFAULT NULL,
223223
vtap_group_lcuuid VARCHAR(64) DEFAULT NULL,
224224
cpu_num INTEGER DEFAULT 0,

server/controller/db/metadb/model/model.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ type VTap struct {
190190
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null;default:CURRENT_TIMESTAMP" json:"CREATED_AT"`
191191
BootTime int `gorm:"column:boot_time;type:int;default:0" json:"BOOT_TIME"`
192192
Exceptions int64 `gorm:"column:exceptions;type:bigint unsigned;default:0" json:"EXCEPTIONS"`
193-
ExceptionDescription string `gorm:"column:exception_description;type:varchar(256);default:''" json:"EXCEPTION_DESCRIPTION"`
193+
ExceptionDescription string `gorm:"column:exception_description;type:text" json:"EXCEPTION_DESCRIPTION"`
194194
VTapLcuuid string `gorm:"column:vtap_lcuuid;type:char(64);default:null" json:"VTAP_LCUUID"`
195195
VtapGroupLcuuid string `gorm:"column:vtap_group_lcuuid;type:char(64);default:null" json:"VTAP_GROUP_LCUUID"`
196196
CPUNum int `gorm:"column:cpu_num;type:int;default:0" json:"CPU_NUM"` // logical number of cpu
@@ -207,8 +207,8 @@ type VTap struct {
207207
DisableFeatures string `gorm:"column:disable_features;type:char(64)" json:"DISABLE_FEATURES"` // separated by ,
208208
FollowGroupFeatures string `gorm:"column:follow_group_features;type:char(64)" json:"FOLLOW_GROUP_FEATURES"` // separated by ,
209209
TapMode int `gorm:"column:tap_mode;type:int;default:null" json:"TAP_MODE"`
210-
ExpectedRevision string `gorm:"column:expected_revision;type:text;default null" json:"EXPECTED_REVISION"`
211-
UpgradePackage string `gorm:"column:upgrade_package;type:text;default null" json:"UPGRADE_PACKAGE"`
210+
ExpectedRevision string `gorm:"column:expected_revision;type:text;default:null" json:"EXPECTED_REVISION"`
211+
UpgradePackage string `gorm:"column:upgrade_package;type:text;default:null" json:"UPGRADE_PACKAGE"`
212212
TeamID int `gorm:"column:team_id;type:int;default:0" json:"TEAM_ID"`
213213
Lcuuid string `gorm:"column:lcuuid;type:char(64);not null" json:"LCUUID"`
214214
}

server/controller/trisolaris/vtap/vtap.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,7 @@ func (v *VTapInfo) updateCacheToDB() {
11611161
tridentExceptions := uint64(VTAP_TRIDENT_EXCEPTIONS_MASK) & uint64(cacheExceptions)
11621162
controllerException := uint64(VTAP_CONTROLLER_EXCEPTIONS_MASK) & uint64(dbVTap.Exceptions)
11631163
dbVTap.Exceptions = int64(controllerException | tridentExceptions)
1164-
exceptionDescription := cacheVTap.GetExceptionDescription()
1165-
if len(exceptionDescription) > 255 {
1166-
exceptionDescription = exceptionDescription[:255]
1167-
}
1168-
dbVTap.ExceptionDescription = exceptionDescription
1164+
dbVTap.ExceptionDescription = cacheVTap.GetExceptionDescription()
11691165
cacheVTap.UpdateCurControllerIP(hostIP)
11701166
dbVTap.CurControllerIP = cacheVTap.GetCurControllerIP()
11711167
dbVTap.ExpectedRevision = cacheVTap.GetExpectedRevision()

0 commit comments

Comments
 (0)