Showing
1 changed file
with
7 additions
and
0 deletions
... | ... | @@ -55,6 +55,8 @@ import static org.thingsboard.server.service.install.migrate.CassandraToSqlColum |
55 | 55 | @Slf4j |
56 | 56 | public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateService { |
57 | 57 | |
58 | + private static final int LATEST_KEY_LENGTH = 255; | |
59 | + | |
58 | 60 | @Autowired |
59 | 61 | private EntityDatabaseSchemaService entityDatabaseSchemaService; |
60 | 62 | |
... | ... | @@ -168,6 +170,11 @@ public class CassandraTsLatestToSqlMigrateService implements TsLatestMigrateServ |
168 | 170 | } |
169 | 171 | |
170 | 172 | protected Integer getOrSaveKeyId(String strKey) { |
173 | + if (strKey.length() > LATEST_KEY_LENGTH) { | |
174 | + log.warn("Key is long. Max key length is 255\n{}", strKey); | |
175 | + strKey = strKey.substring(0, LATEST_KEY_LENGTH); | |
176 | + } | |
177 | + | |
171 | 178 | Integer keyId = tsKvDictionaryMap.get(strKey); |
172 | 179 | if (keyId == null) { |
173 | 180 | Optional<TsKvDictionary> tsKvDictionaryOptional; | ... | ... |