Skip to content

Commit 9831be5

Browse files
craig[bot]rafissyuzefovich
committed
151147: CLAUDE: add details and adjust directions for dev workflow r=rafiss a=rafiss - Linting takes a while, so stop recommending it before every commit. - Add information on optimizer and schemachanger packages. - Mention bazel file generation. Epic: None Release note: None 151180: security: address a couple of nits in a recent change r=yuzefovich a=yuzefovich I don't see why we would make the cluster setting a SystemVisible given that it affects every tenant and seems ok to be allowed for a tenant to change. Also there was a typo in the setting name as well as we should've registered the setting as ByteSize (which gives non-negative int validation). Additionally, unify the logging channels used for the error message (both will now go to DEV). Touches: #151041. Epic: None Release note: None Co-authored-by: Rafi Shamim <[email protected]> Co-authored-by: Yahor Yuzefovich <[email protected]>
3 parents 60cf3a6 + fcd1825 + a6d651f commit 9831be5

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

CLAUDE.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CockroachDB is a distributed SQL database written in Go, built with Bazel and ma
2929
./dev test pkg/sql --stress # Run repeatedly until failure
3030
./dev testlogic # Run all SQL logic tests
3131
./dev testlogic ccl # Run enterprise logic tests
32-
./dev testlogic --files='prepare|fk' # Run specific test files
32+
./dev testlogic base --config=local --files='prepare|fk' # Run specific test files under a specific configuration
3333
```
3434

3535
Note that when filtering tests via `-f` to include the `-v` flag which
@@ -40,8 +40,10 @@ for `testing: warning: no tests to run` in the output.
4040
```bash
4141
./dev generate # Generate all code (protobuf, parsers, etc.)
4242
./dev generate go # Generate Go code only
43-
./dev lint # Run all linters
44-
./dev lint --short # Run fast subset of linters
43+
./dev generate bazel # Update BUILD.bazel files when dependencies change
44+
./dev generate protobuf # Generate files based on protocol buffer definitions
45+
./dev lint # Run all linters (only run this when requested)
46+
./dev lint --short # Run fast subset of linters (only run this when requested)
4547
```
4648

4749
### Architecture Overview
@@ -67,20 +69,21 @@ SQL Layer (pkg/sql/) → Distributed KV (pkg/kv/) → Storage (pkg/storage/)
6769

6870
### Development Workflow
6971

70-
1. **Environment Setup**: Run `./dev doctor` to ensure all dependencies are installed
71-
2. **Building**: Use `./dev build short` for iterative development, `./dev build cockroach` for full builds
72-
3. **Testing**: Run package-specific tests with `./dev test pkg/[package]`
73-
4. **Code Generation**: After schema/proto changes, run `./dev generate go`
74-
5. **Quality Checks**: Run `./dev lint` before committing
72+
1. **Environment Setup**: Run `./dev doctor` to ensure all dependencies are installed.
73+
2. **Building**: Use `./dev build short` for iterative development, `./dev build cockroach` for full builds.
74+
3. **Testing**: Run package-specific tests with `./dev test pkg/[package]`.
75+
4. **Code Generation**: After schema/proto changes, run `./dev generate go`.
76+
5. **Linting**: Run with `./dev lint` or `./dev lint --short`. This takes a while, so no need to run it regularly.
7577

7678
### Testing Strategy
7779

7880
CockroachDB has comprehensive testing infrastructure:
79-
- **Unit Tests**: Standard Go tests throughout `/pkg/` packages
80-
- **Logic Tests**: SQL correctness tests using `./dev testlogic`
81-
- **Roachtests**: Distributed system integration tests
82-
- **Acceptance Tests**: End-to-end testing in `/pkg/acceptance/`
83-
- **Stress Testing**: Continuous testing with `--stress` flag
81+
- **Unit Tests**: Standard Go tests throughout `/pkg/` packages.
82+
- **Logic Tests**: SQL correctness tests using `./dev testlogic`.
83+
- **Roachtests**: Distributed system integration tests.
84+
- **Acceptance Tests**: End-to-end testing in `/pkg/acceptance/`.
85+
- **Stress Testing**: Continuous testing with `--stress` flag.
86+
8487

8588
### Build System
8689

@@ -93,6 +96,8 @@ CockroachDB has comprehensive testing infrastructure:
9396

9497
**Package Structure:**
9598
- `/pkg/sql/` - SQL layer (parser, optimizer, executor)
99+
- `/pkg/sql/opt` - Query optimizer and planner
100+
- `/pkg/sql/schemachanger` - Declarative schema changer
96101
- `/pkg/kv/` - Key-value layer and transaction management
97102
- `/pkg/storage/` - Storage engine interface
98103
- `/pkg/server/` - Node and cluster management

pkg/security/certificate_manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ func (cm *CertificateManager) RegisterSignalHandler(
198198
})
199199
}
200200

201-
var CertCacheMemLimit = settings.RegisterIntSetting(
202-
settings.SystemVisible,
203-
"security.clienc_cert.cache_memory_limit",
201+
var certCacheMemLimit = settings.RegisterByteSizeSetting(
202+
settings.ApplicationLevel,
203+
"security.client_cert.cache_memory_limit",
204204
"memory limit for the client certificate expiration cache",
205205
1<<29, // 512MiB
206206
)
@@ -214,7 +214,7 @@ func (cm *CertificateManager) RegisterExpirationCache(
214214
parentMon *mon.BytesMonitor,
215215
st *cluster.Settings,
216216
) error {
217-
limit := CertCacheMemLimit.Get(&st.SV)
217+
limit := certCacheMemLimit.Get(&st.SV)
218218
m := mon.NewMonitorInheritWithLimit(mon.MakeName("client-expiration-caches"), limit, parentMon, true /* longLiving */)
219219
acc := m.MakeConcurrentBoundAccount()
220220
m.StartNoReserved(ctx, parentMon)

pkg/security/clientcert/cert_expiry_cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (c *Cache) Upsert(ctx context.Context, user string, serial string, newExpir
9999
if _, ok := c.cache[user]; !ok {
100100
err := c.account.Grow(ctx, 2*GaugeSize)
101101
if err != nil {
102-
log.Ops.Warningf(ctx, "no memory available to cache cert expiry: %v", err)
102+
log.Warningf(ctx, "no memory available to cache cert expiry: %v", err)
103103
return
104104
}
105105
c.cache[user] = map[string]certInfo{}

0 commit comments

Comments
 (0)