From a945ffd32c080ce8d24f88dbc8f31c4e3a0e66ef Mon Sep 17 00:00:00 2001 From: Santamaura Date: Fri, 13 Aug 2021 13:05:06 -0700 Subject: [PATCH 1/2] This change updates the date time format used on the jobs page from 12 hr to 24 hr utc. This change is needed since the rest of crdb uses 24 hr utc time. Release note (ui change): change date times on jobs page to use 24 hr utc --- pkg/ui/src/views/jobs/jobTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ui/src/views/jobs/jobTable.tsx b/pkg/ui/src/views/jobs/jobTable.tsx index cb2f3e76b3d8..d72c29276760 100644 --- a/pkg/ui/src/views/jobs/jobTable.tsx +++ b/pkg/ui/src/views/jobs/jobTable.tsx @@ -12,7 +12,7 @@ import React, { MouseEvent } from "react"; import _ from "lodash"; import { cockroach } from "src/js/protos"; import { TimestampToMoment } from "src/util/convert"; -import { DATE_FORMAT } from "src/util/format"; +import { DATE_FORMAT_24_UTC } from "src/util/format"; import { JobStatusCell } from "src/views/jobs/jobStatusCell"; import { SortSetting } from "src/views/shared/components/sortabletable"; import { CachedDataReducerState } from "src/redux/cachedDataReducer"; @@ -59,7 +59,7 @@ const jobsTableColumns: ColumnDescriptor[] = [ { name: "creationTime", title: "Creation Time", - cell: (job) => TimestampToMoment(job?.created).format(DATE_FORMAT), + cell: (job) => TimestampToMoment(job?.created).format(DATE_FORMAT_24_UTC), sort: (job) => TimestampToMoment(job?.created).valueOf(), }, { From 506a61cbcfdcc9fb6329d3ad3aa2f5796458dd48 Mon Sep 17 00:00:00 2001 From: Andy Yang Date: Fri, 13 Aug 2021 21:47:31 -0400 Subject: [PATCH 2/2] storage: add config option for enabling encryption-at-rest This patch adds the ability to configure encryption-at-rest for in-memory engines, which are used in tests. Release note: None --- pkg/server/config.go | 1 + pkg/server/sticky_engine.go | 1 + pkg/storage/open.go | 13 +++++++++++++ 3 files changed, 15 insertions(+) diff --git a/pkg/server/config.go b/pkg/server/config.go index 2f290ca0c0f5..7922c286fc07 100644 --- a/pkg/server/config.go +++ b/pkg/server/config.go @@ -521,6 +521,7 @@ func (cfg *Config) CreateEngines(ctx context.Context) (Engines, error) { storage.Attributes(spec.Attributes), storage.CacheSize(cfg.CacheSize), storage.MaxSize(sizeInBytes), + storage.EncryptionAtRest(spec.EncryptionOptions), storage.Settings(cfg.Settings)) if err != nil { return Engines{}, err diff --git a/pkg/server/sticky_engine.go b/pkg/server/sticky_engine.go index a7cff27f4f93..a99c1a571844 100644 --- a/pkg/server/sticky_engine.go +++ b/pkg/server/sticky_engine.go @@ -112,6 +112,7 @@ func (registry *stickyInMemEnginesRegistryImpl) GetOrCreateStickyInMemEngine( storage.Attributes(spec.Attributes), storage.CacheSize(cfg.CacheSize), storage.MaxSize(spec.Size.InBytes), + storage.EncryptionAtRest(spec.EncryptionOptions), storage.ForTesting) engineEntry := &stickyInMemEngine{ diff --git a/pkg/storage/open.go b/pkg/storage/open.go index 29f0136478e7..2d4f166209ce 100644 --- a/pkg/storage/open.go +++ b/pkg/storage/open.go @@ -106,6 +106,19 @@ func CacheSize(size int64) ConfigOption { } } +// EncryptionAtRest configures an engine to use encryption-at-rest. It is used +// for configuring in-memory engines, which are used in tests. It is not safe +// to modify the given slice afterwards as it is captured by reference. +func EncryptionAtRest(encryptionOptions []byte) ConfigOption { + return func(cfg *engineConfig) error { + if len(encryptionOptions) > 0 { + cfg.UseFileRegistry = true + cfg.EncryptionOptions = encryptionOptions + } + return nil + } +} + // Hook configures a hook to initialize additional storage options. It's used // to initialize encryption-at-rest details in CCL builds. func Hook(hookFunc func(*base.StorageConfig) error) ConfigOption {