Skip to content

Commit 418bfa6

Browse files
authored
Merge pull request #61 from scality/improvement/WKBCH-18
WKBCH-18: Fix version detection and update ClickHouse schema
2 parents 78f1a0f + 442b58e commit 418bfa6

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

cmd/util.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ func copyFile(src, dest string) (err error) {
142142
}
143143

144144
// detectCloudserverVersion extracts the major version from a cloudserver image tag.
145-
// Returns "v7" for version 7.x images, "v9" for version 9+ images
146-
// Defaults to "v9" for non-numeric tags (latest, dev, etc.) or when version cannot be determined.
145+
// Returns "v7" for version 7.x images (e.g., 7.70.77), "v9" for version 9+ images.
146+
// Only recognizes semver-style tags (digits followed by a dot). Git SHAs and other
147+
// non-semver tags default to "v9".
147148
func detectCloudserverVersion(image string) string {
148149
parts := strings.Split(image, ":")
149150
if len(parts) < 2 || parts[1] == "" {
@@ -159,7 +160,9 @@ func detectCloudserverVersion(image string) string {
159160
endIdx++
160161
}
161162

162-
if endIdx > 0 {
163+
// Must have a dot after the major version to be considered semver
164+
// This prevents git SHAs like "7aae6b6..." from being detected as v7
165+
if endIdx > 0 && endIdx < len(tag) && tag[endIdx] == '.' {
163166
majorVersionStr := tag[0:endIdx]
164167
if majorVersion, err := strconv.Atoi(majorVersionStr); err == nil {
165168
if majorVersion == 7 {
@@ -172,6 +175,6 @@ func detectCloudserverVersion(image string) string {
172175
}
173176
}
174177

175-
// Default to v9 for non-numeric tags (latest, dev, etc.)
178+
// Default to v9 for non-semver tags (latest, dev, git SHAs, etc.)
176179
return "v9"
177180
}

templates/clickhouse/init.d/02-create-ingest-table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS logs.access_logs_ingest
55
hostname LowCardinality(Nullable(String)),
66

77
-- AWS access server logs fields https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html
8-
startTime DateTime64(3), -- AWS "Time" field
8+
startTime Int64, -- AWS "Time" field (epoch milliseconds)
99
requester Nullable(String),
1010
operation Nullable(String),
1111
requestURI Nullable(String),

templates/clickhouse/init.d/03-create-storage-table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS logs.access_logs
55
hostname LowCardinality(Nullable(String)),
66

77
-- AWS access server logs fields https://docs.aws.amazon.com/AmazonS3/latest/userguide/LogFormat.html
8-
startTime DateTime64(3), -- AWS "Time" field
8+
startTime Int64, -- AWS "Time" field (epoch milliseconds)
99
requester Nullable(String),
1010
operation Nullable(String),
1111
requestURI Nullable(String),

templates/clickhouse/init.d/04-create-offsets-table.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS logs.offsets
33
bucketName String,
44
raftSessionID UInt16,
55
lastProcessedInsertedAt DateTime,
6-
lastProcessedStartTime DateTime64(3),
6+
lastProcessedStartTime Int64,
77
lastProcessedReqId String
88
)
99
ENGINE = ReplacingMergeTree(lastProcessedInsertedAt)

templates/global/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ features:
2626
enabled: false
2727

2828
cloudserver:
29-
image: ghcr.io/scality/cloudserver:9.2.14
29+
image: ghcr.io/scality/cloudserver:9.2.19
3030

3131
vault:
3232
image: ghcr.io/scality/vault:7.83.0

0 commit comments

Comments
 (0)