Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoincr status caching can be incorrect #21386

Closed
ankush opened this issue Jun 15, 2023 · 0 comments · Fixed by #21918
Closed

autoincr status caching can be incorrect #21386

ankush opened this issue Jun 15, 2023 · 0 comments · Fixed by #21918
Labels

Comments

@ankush
Copy link
Member

ankush commented Jun 15, 2023

  1. Cache is set from single doctype, what if some logtypes are old and some are new?
  2. Cache is never evicted so if old v13 site is restored on new v14 setup then background workers might endup caching old value.

if doctype in log_types:
if autoincremented_site_status_map.get(frappe.local.site) is None:
if (
frappe.db.sql(
f"""select data_type FROM information_schema.columns
where column_name = 'name' and table_name = 'tab{doctype}'"""
)[0][0]
== "bigint"
):
autoincremented_site_status_map[frappe.local.site] = 1
return True
else:
autoincremented_site_status_map[frappe.local.site] = 0
elif autoincremented_site_status_map[frappe.local.site]:
return True

@ankush ankush added the bug label Jun 15, 2023
ankush added a commit to ankush/frappe that referenced this issue Aug 4, 2023
ankush added a commit that referenced this issue Aug 4, 2023
* fix: autoincr status per doctype

closes #21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
mergify bot pushed a commit that referenced this issue Aug 4, 2023
* fix: autoincr status per doctype

closes #21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
(cherry picked from commit c4230f8)

# Conflicts:
#	frappe/model/naming.py
ankush added a commit that referenced this issue Aug 4, 2023
* fix: autoincr status per doctype

closes #21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
(cherry picked from commit c4230f8)
ankush added a commit to ankush/frappe that referenced this issue Aug 4, 2023
* fix: autoincr status per doctype

closes frappe#21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
(cherry picked from commit c4230f8)
ankush added a commit that referenced this issue Aug 4, 2023
* fix: autoincr status per doctype

closes #21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
(cherry picked from commit c4230f8)
mergify bot pushed a commit that referenced this issue Aug 4, 2023
* fix: autoincr status per doctype

closes #21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
(cherry picked from commit c4230f8)
(cherry picked from commit 1fda93a)
ankush added a commit that referenced this issue Aug 5, 2023
* fix: autoincr status per doctype

closes #21386

* chore: Check autoincremented on the database currently being used.

* refactor: Styling and space fix

---------

Co-authored-by: Athul Cyriac Ajay <athul8720@gmail.com>
(cherry picked from commit c4230f8)
(cherry picked from commit 1fda93a)

Co-authored-by: Ankush Menat <ankush@frappe.io>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants