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

Check for service name too long at subCacheRefresh #2848

Closed
kzangeli opened this issue Jan 26, 2017 · 6 comments
Closed

Check for service name too long at subCacheRefresh #2848

kzangeli opened this issue Jan 26, 2017 · 6 comments

Comments

@kzangeli
Copy link
Member

A recent fix (#2812) makes sure that the name of a tenant (service) cannot be more than 44 chars, depending on the prefix ('orion-' by default - 44 is for the default prefix).

However, prior to this fix, the broker did accept tenants of up to 50 chars and so, old databases may reside on the harddisk with a total database name of up to 61 chars (as max longitud for the prefix is 10, not including the hyphen).

subCacheRefresh asks bool getOrionDatabases(std::vector<std::string>& dbs) in mongoBackend/MongoGlobal.cpp for the list of databases and to complete the fix in #2812, we should probably add a check in getOrionDatabases for databases with long names (> 50 chars in total, prefix included).

@ArqamFarooqui110719
Copy link
Contributor

Hi @kzangeli Sir, @fgalan Sir,
Is this issue still valid?

@fgalan
Copy link
Member

fgalan commented Mar 14, 2023

Not sure...

The issue is pretty old (more than 7 years) but probably it's still valid.

Reading the old description, it seems to be a minor thing, so maybe it is easy to implement. I'd suggest you to create the pull request and let's see at that moment the suitability of the fix or not. What do you think?

@ArqamFarooqui110719
Copy link
Contributor

ArqamFarooqui110719 commented Mar 14, 2023

Thanks for response. Started investigation, will add PR.

Just to confirm my issue understanding:
Need to add a check in getOrionDatabases() function in mongoBackend/MongoGlobal.cpp, regarding the name of all databases,
for e.g.:

for each db
if database_name > '50 chars'
{
  false
}
else 
{
  true
}

@fgalan
Copy link
Member

fgalan commented Mar 14, 2023

Yes, I think you are right.

Not sure what to do in the "false" case. Some options:

  1. Log an error (LM_E macro) but still processing the database
  2. Log an error (LM_E macro) and not process the database

I think we should go for option 2.

@fgalan
Copy link
Member

fgalan commented Mar 16, 2023

As reference, longest case in production environment of orion-xxxxx database is 31 chars long, which involves service of 25 chars longs (orion- is 6 chars long).

@fgalan
Copy link
Member

fgalan commented Mar 16, 2023

PR #4297

ArqamFarooqui110719 added a commit to ArqamFarooqui110719/fiware-orion that referenced this issue Mar 17, 2023
@fgalan fgalan added this to the 3.9.0 milestone Mar 17, 2023
@fgalan fgalan closed this as completed Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants