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

ZeroDivisionError: division by zero (osd_objs_acting) #36

Closed
patrakov opened this issue Mar 15, 2024 · 3 comments
Closed

ZeroDivisionError: division by zero (osd_objs_acting) #36

patrakov opened this issue Mar 15, 2024 · 3 comments

Comments

@patrakov
Copy link

Another attempt of balancing the same half-broken cluster as in #35 after some CRUSH map cleanup yields this:

# ./placementoptimizer.py -v --osdsize device balance --osdused delta --max-pg-moves 100 --osdfrom fullest --only-crushclass hdd
[2024-03-15 16:03:45,878] gathering cluster state via ceph api...
Traceback (most recent call last):
  File "./placementoptimizer.py", line 5475, in <module>
    exit(main())
  File "./placementoptimizer.py", line 5431, in main
    state.preprocess()
  File "./placementoptimizer.py", line 2061, in preprocess
    metadata_estimate = int(meta_amount * pg_objects / osd_objs_acting)
ZeroDivisionError: division by zero

The debug archive will be sent via email, but note that this is a large cluster, so it exceeds your message size limit, so I will have to split the archive.

@patrakov
Copy link
Author

patrakov commented Mar 15, 2024

An attempt to log the variables yields this:

meta_amount: 2188406858, pg_objects: 0, osd_objs_acting: 0

So, as a hack, I applied this change:

--- placementoptimizer.py.orig  2024-03-15 16:38:09.351499650 +0000
+++ placementoptimizer.py       2024-03-15 16:41:37.158122020 +0000
@@ -2058,7 +2058,9 @@
 
                 # calculated by weighting osd metadata sizes by pg object counts
                 pg_objects = self.pgs[pgid]['stat_sum']['num_objects']
-                metadata_estimate = int(meta_amount * pg_objects / osd_objs_acting)
+                if osd_objs_acting == 0:
+                    logging.info(f"meta_amount: {meta_amount}, pg_objects: {pg_objects}, osd_objs_acting: {osd_objs_acting}")
+                metadata_estimate = int(meta_amount * pg_objects / osd_objs_acting) if osd_objs_acting else 0
 
                 estimates = self.pgs[pgid]["metadata_estimates"]
                 estimates[osdid] = metadata_estimate

The first few upmaps that it generates make sense to me, but I don't think I actually need 100 pg moves.

The added logging line has triggered only once.

@TheJJ
Copy link
Owner

TheJJ commented Mar 16, 2024

I think I already fixed this in 38e5d5f :)

@TheJJ TheJJ closed this as completed Mar 16, 2024
@patrakov
Copy link
Author

Fixed indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants