wrap data source use/unuse in transaction so we are sure of the unuse

extracted from #481