Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-9770][Manager] Unified compression type configuration #9771

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.inlong.common.enums;

import java.util.Objects;

public enum InlongCompressType {

NONE(0, "NONE", "The message compressed with nothing"),
INLONG_GZ(1, "INLONG_GZ", "The message compressed with inlong gz"),
INLONG_SNAPPY(2, "INLONG_SNAPPY", "The message compressed with inlong snappy"),
UNKNOWN(99, "UNKNOWN", "Unknown compress type");

private final int id;
private final String name;
private final String desc;

InlongCompressType(int id, String name, String desc) {
this.id = id;
this.name = name;
this.desc = desc;
}

public static InlongCompressType valueOf(int value) {
for (InlongCompressType msgCompressType : InlongCompressType.values()) {
if (msgCompressType.getId() == value) {
return msgCompressType;
}
}
return UNKNOWN;
}

public static InlongCompressType forType(String type) {
for (InlongCompressType msgCompressType : InlongCompressType.values()) {
if (Objects.equals(msgCompressType.getName(), type)) {
return msgCompressType;
}
}
return UNKNOWN;
}

public int getId() {
return id;
}

public String getStrId() {
return String.valueOf(id);
}

public String getName() {
return name;
}

public String getDesc() {
return desc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
select inlong_group_id,
inlong_stream_id,
data_type,
wrap_type,
mq_resource as topic,
ext_params
from inlong_stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,25 @@ public class InlongStreamId {
private String inlongStreamId;
private String topic;
private String dataType;
private String wrapType;
private String extParams;

public String getDataType() {
return dataType;
}

public String getWrapType() {
return wrapType;
}

public void setDataType(String dataType) {
this.dataType = dataType;
}

public void setWrapType(String wrapType) {
this.wrapType = wrapType;
}

/**
* get inlongGroupId
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public class InlongStreamBriefInfo {
@ApiModelProperty(value = "The message body wrap type, including: RAW, INLONG_MSG_V0, INLONG_MSG_V1, etc")
private String wrapType;

@ApiModelProperty(value = "The compression type used for dataproxy and sort side data transmission to reduce the network IO overhead")
private String inlongCompressType;

@ApiModelProperty(value = "Whether to ignore the parse errors of field value")
private Boolean ignoreParseError;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public class InlongStreamExtParam implements Serializable {
@ApiModelProperty(value = "If use extended fields")
private Boolean useExtendedFields = false;

@ApiModelProperty(value = "The compression type used for dataproxy and sort side data transmission to reduce the network IO overhead")
private String inlongCompressType = "NONE";

@ApiModelProperty(value = "Predefined fields")
private String predefinedFields;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ public class InlongStreamInfo extends BaseInlongStream {
@ApiModelProperty(value = "The message body wrap type, including: RAW, INLONG_MSG_V0, INLONG_MSG_V1, etc")
private String wrapType;

@ApiModelProperty(value = "The compression type used for dataproxy and sort side data transmission to reduce the network IO overhead")
private String inlongCompressType;

@ApiModelProperty(value = "If use extended fields")
private Boolean useExtendedFields = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ public class InlongStreamRequest extends BaseInlongStream {
@ApiModelProperty(value = "Whether to ignore the parse errors of field value")
private boolean ignoreParseError = true;

@ApiModelProperty(value = "The compression type used for dataproxy and sort side data transmission to reduce the network IO overhead")
private String inlongCompressType;

@ApiModelProperty(value = "If use extended fields")
private Boolean useExtendedFields = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public class DataProxyConfigRepository implements IRepository {
public static final String KEY_NEW_TENANT_KEY = "pulsarTenant";
public static final String KEY_OLD_TENANT_KEY = "tenant";
public static final String KEY_DATA_TYPE = "dataType";
public static final String KEY_WRAP_TYPE = "wrapType";
public static final String KEY_BACKUP_CLUSTER_TAG = "backup_cluster_tag";
public static final String KEY_BACKUP_TOPIC = "backup_topic";
public static final String KEY_SORT_TASK_NAME = "defaultSortTaskName";
Expand Down Expand Up @@ -376,6 +377,7 @@ private void reloadInlongId(Map<String, DataProxyCluster> proxyClusterMap) {
streamIdMap.forEach((k, v) -> {
Map<String, String> params = fromJsonToMap(v.getExtParams());
params.computeIfAbsent(KEY_DATA_TYPE, type -> v.getDataType());
params.computeIfAbsent(KEY_WRAP_TYPE, type -> v.getWrapType());
streamParams.put(k, params);
});
// reload inlong stream ext
Expand Down
Loading