refactor: remove debug code blocks in transactions
Some checks failed
Go Tests / Run Tests (1.24.2) (push) Has been cancelled

This commit is contained in:
Jeremy Tregunna 2025-05-02 22:16:34 -06:00
parent 9a98349115
commit 047e41e0b1
Signed by: jer
GPG Key ID: 1278B36BA6F5D5E4
2 changed files with 0 additions and 41 deletions

View File

@ -72,21 +72,6 @@ func (b *Buffer) Get(key []byte) ([]byte, bool) {
encodedKey := base64.StdEncoding.EncodeToString(key)
op, ok := b.operations[encodedKey]
// Debug info for key lookup
if !ok && len(key) < 100 {
strKey := string(key)
println("Buffer key miss:", strKey, ", base64:", encodedKey)
// Print all keys in map for debugging
if len(b.operations) < 10 {
println("Available keys in buffer:")
for k := range b.operations {
keyData, _ := base64.StdEncoding.DecodeString(k)
println(" -", string(keyData), "(base64:", k, ")")
}
}
}
if !ok {
return nil, false
}

View File

@ -96,21 +96,6 @@ func (tx *Transaction) Get(key []byte) ([]byte, error) {
// Not in the buffer, get from the underlying storage
val, err := tx.storage.Get(key)
// Debug print on error to help diagnose key encoding issues
if err != nil {
// Log in both ASCII and hex for debugging
if len(key) < 100 {
strKey := string(key)
hexKey := ""
for _, b := range key {
hexKey += string("0123456789abcdef"[b>>4])
hexKey += string("0123456789abcdef"[b&0xF])
}
// Log both representations
println("Transaction key not found:", strKey, "(hex:", hexKey, ")")
}
}
return val, err
}
@ -126,17 +111,6 @@ func (tx *Transaction) Put(key, value []byte) error {
return ErrReadOnlyTransaction
}
// Debug print key being stored
if len(key) < 100 {
strKey := string(key)
hexKey := ""
for _, b := range key {
hexKey += string("0123456789abcdef"[b>>4])
hexKey += string("0123456789abcdef"[b&0xF])
}
println("Transaction storing key:", strKey, "(hex:", hexKey, ")")
}
// Buffer the change - it will be applied on commit
tx.buffer.Put(key, value)
return nil