juicedata/juicefs · error

drop table userGroupQuota

Error message

drop table userGroupQuota

What it means

During `juicefs format` on an existing SQL metadata volume, when the new format enables UserGroupQuota while the stored format had it disabled, all rows in the userGroupQuota table are deleted in a transaction because they are considered outdated. Failure of that transactional DELETE is wrapped as "drop table userGroupQuota" and aborts formatting.

Source

Thrown at pkg/meta/sql.go:660

				m.genLog(Background(), s, time.Now().UnixNano(), "INIT_ENABLE_DIRSTATS()")
				return nil
			})
			if err != nil {
				return errors.Wrap(err, "drop table dirStats")
			}
		}
		if !old.UserGroupQuota && format.UserGroupQuota {
			// remove user group quota as they are outdated
			err = m.txn(func(s *xorm.Session) error {
				_, err := s.Where("TRUE").Delete(new(userGroupQuota))
				if err != nil {
					return err
				}
				m.genLog(Background(), s, time.Now().UnixNano(), "INIT_ENABLE_USERGROUPQUOTA()")
				return nil
			})
			if err != nil {
				return errors.Wrap(err, "drop table userGroupQuota")
			}
		}
		if err = format.update(&old, force); err != nil {
			return errors.Wrap(err, "update format")
		}
	}

	data, err := json.MarshalIndent(format, "", "")
	if err != nil {
		return fmt.Errorf("json: %s", err)
	}

	m.setFormat(format)
	n := &node{
		Type:   TypeDirectory,
		Nlink:  2,
		Length: 4 << 10,
		Parent: RootInode,

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Retry `juicefs format` after confirming DB connectivity
  2. Grant the DB user DELETE privilege on the userGroupQuota table
  3. Inspect the wrapped cause for lock/deadlock errors and reduce concurrent quota updates or increase lock wait timeout
  4. Backup metadata with `juicefs dump` before reformatting
Defensive patterns

Strategy: retry

Validate before calling

// ensure the DB account can delete from userGroupQuota
rows, err := db.Query("SELECT 1 FROM userGroupQuota LIMIT 1")

Try / catch

if err != nil && strings.Contains(err.Error(), "drop table userGroupQuota") {
    // read wrapped cause, fix privileges/locks, retry format
}

Prevention

When it happens

Trigger: `juicefs format` (or re-format with --force paths in doInit) against a MySQL/Postgres/SQLite metadata URL where old format has UserGroupQuota=false and new format sets it to true, and the DELETE on userGroupQuota fails (DB error, lock wait, permissions).

Common situations: Enabling user/group quotas on an existing volume; DB account missing DELETE privilege; lock contention from other clients writing quotas; transient connection failure.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/78f1eb6948d8c6f2. Report an issue: GitHub.