zhujt20 commented on code in PR #213:
URL: https://github.com/apache/tsfile/pull/213#discussion_r1733033071
##########
java/tsfile/src/main/java/org/apache/tsfile/file/metadata/TsFileMetadata.java:
##########
@@ -105,12 +113,89 @@ public static TsFileMetadata deserializeFrom(ByteBuffer
buffer, DeserializeConfi
String value = ReadWriteIOUtils.readVarIntString(buffer);
propertiesMap.put(key, value);
}
+ // if the file is not encrypted, set the default value(for compatible
reason)
+ if (!propertiesMap.containsKey("encryptLevel")) {
+ propertiesMap.put("encryptLevel", "0");
+ propertiesMap.put("encryptType", "UNENCRYPTED");
+ propertiesMap.put("encryptKey", "");
+ } else if (propertiesMap.get("encryptLevel") == null) {
+ propertiesMap.put("encryptLevel", "0");
+ propertiesMap.put("encryptType", "UNENCRYPTED");
+ propertiesMap.put("encryptKey", "");
+ } else if (propertiesMap.get("encryptLevel").equals("0")) {
+ propertiesMap.put("encryptType", "UNENCRYPTED");
+ propertiesMap.put("encryptKey", "");
+ } else if (propertiesMap.get("encryptLevel").equals("1")) {
+ if (!propertiesMap.containsKey("encryptType")) {
+ throw new EncryptException("TsfileMetadata lack of encryptType while
encryptLevel is 2");
+ }
+ if (!propertiesMap.containsKey("encryptKey")) {
+ throw new EncryptException("TsfileMetadata lack of encryptKey while
encryptLevel is 2");
+ }
+ if (propertiesMap.get("encryptKey") == null ||
propertiesMap.get("encryptKey").isEmpty()) {
+ throw new EncryptException("TsfileMetadata null encryptKey while
encryptLevel is 2");
+ }
Review Comment:
0 means the tsfile is not encrypted, 1 means one-level encryption, while 2
means two-level encryption.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]