juicedata/juicefs · error
update table flock, plock: %s
Error message
update table flock, plock: %s
What it means
Returned by dbMeta.doNewSession when the xorm schema sync of the flock/plock tables fails during session creation. It wraps the DDL error, meaning the SQL metadata engine could not migrate lock tables to the required schema (permissions or DB compatibility issue).
Source
Thrown at pkg/meta/sql.go:780
}
func (m *dbMeta) doNewSession(sinfo []byte, update bool) error {
// add new table
err := m.syncTable(new(session2), new(delslices), new(dirStats), new(detachedNode), new(dirQuota), new(userGroupQuota), new(acl), new(delegationToken), new(changeLog))
if err != nil {
return fmt.Errorf("update table session2, delslices, dirstats, detachedNode, dirQuota, userGroupQuota, acl, changeLog: %s", err)
}
// add node table
if err = m.syncTable(new(node)); err != nil {
return fmt.Errorf("update table node: %s", err)
}
// add primary key
if err = m.syncTable(new(edge), new(chunk), new(xattr), new(sustained)); err != nil {
return fmt.Errorf("update table edge, chunk, xattr, sustained: %s", err)
}
// update the owner from uint64 to int64
if err = m.syncTable(new(flock), new(plock)); err != nil {
return fmt.Errorf("update table flock, plock: %s", err)
}
for {
beans := session2{Sid: m.sid, Expire: m.expireTime(), Info: sinfo}
if update {
return m.txn(func(s *xorm.Session) error {
_, err = s.Cols("expire", "info").Update(&beans, &session2{Sid: beans.Sid})
if err == nil {
m.genLog(Background(), s, time.Now().UnixNano(), "NEWSESSION(%d,%d,%s)", m.sid, beans.Expire, logEncode(sinfo))
}
return err
})
} else {
if err = m.txn(func(s *xorm.Session) error {
if err := mustInsert(s, &beans); err != nil {
return err
}
m.genLog(Background(), s, time.Now().UnixNano(), "NEWSESSION(%d,%d,%s)", m.sid, beans.Expire, logEncode(sinfo))View on GitHub (pinned to c9a67b23e8)
Solutions
- Clean stale lock rows (juicefs gc / remove rows for dead sessions) then retry the mount
- Grant ALTER privileges and retry with a single mount performing the upgrade
- Increase DDL timeouts for large flock/plock tables
- Ensure only one client performs the schema upgrade at a time
Defensive patterns
Strategy: validation
Validate before calling
-- Remove locks of dead sessions before upgrade DELETE FROM flock WHERE sid NOT IN (SELECT sid FROM session2);
Try / catch
if err := mount(sqlURL); err != nil {
if strings.Contains(err.Error(), "flock, plock") {
log.Fatalf("clean stale lock rows and retry: %v", err)
}
} Prevention
- Run juicefs gc periodically
- Ensure single-client schema upgrade
- Grant ALTER privileges
When it happens
Trigger: Mounting an old volume when altering flock/plock tables fails — lock table size causes ALTER timeout, missing privileges, or DB connection drop mid-migration.
Common situations: Volumes with many stale flock/plock rows from crashed sessions; managed DB with restrictive DDL timeouts; upgrade run concurrently by multiple mount points.
Related errors
- update table session2, delslices, dirstats, detachedNode, di
- update table node: %s
- update table edge, chunk, xattr, sustained: %s
- create table flock, plock, dirQuota, userGroupQuota: %s
- create table delegationToken: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/09f18846378662a1.
Report an issue: GitHub.