[ 
https://issues.apache.org/jira/browse/SOLR-14993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17229875#comment-17229875
 ] 

Allen Sooredoo edited comment on SOLR-14993 at 11/11/20, 9:49 AM:
------------------------------------------------------------------

Hi,
  
 sorry about that, I wanted to do a very quick fix in github and link it here, 
but it turns out I need much more time to write all the tests and submit a 
proper PR.
  
 Use case:
 - I add to every configset a file called id.txt which contains the id of the 
configset (positive integer)
 - When I want to update it (to add new synonyms for instance), I first use 
`zkClient.downloadConfig(configSetName, directory)` (Solrj) to download the 
configset and check the id inside the file before proceeding.
  
 Issue:
 - If the id fits on 1 byte, the file is created but its content is not 
downloaded because of this check:
|private static int copyDataDown(SolrZkClient zkClient, String zkPath, File 
file) throws IOException, KeeperException, InterruptedException {
{color:#d73a49}byte{color}[] data = zkClient.getData(zkPath, null, null, true);
if (data != null && data.length > 1) { // There are apparently basically empty 
ZNodes.|

 
 Changing it to `data.length > 0` would solve my problem, however I may need 
more time to test that this "empty ZNodes" issue doesn't reappear as a side 
effect. Do those "empty ZNodes" have a size of 1 byte? Why not 0?
  
 I'm curious if the check > 1 (instead of the expected >0) is a typo or an 
actual fix to a know problem. Do you have more information about that?
  


was (Author: alsofr):
Hi,
  
 sorry about that, I wanted to do a very quick fix in github and link it here, 
but it turns out I need much more time to write all the tests and submit a 
proper PR.
  
 Use case:
 - I add to every configset a file called id.txt which contains the id of the 
configset (positive integer)
 - When I want to update it (to add new synonyms for instance), I first use 
`zkClient.downloadConfig(configSetName, directory)` (Solrj) to download the 
configset and check the id inside the file before proceeding.
  
 Issue:
 - If the id fits on 1 byte, the file is created but its content is not 
downloaded because of this check:
|private static int copyDataDown(SolrZkClient zkClient, String zkPath, File 
file) throws IOException, KeeperException, InterruptedException { 
{color:#d73a49} byte{color}[] data = zkClient.getData(zkPath, null, null, 
true); if (data != null && data.length > 1) { // There are apparently basically 
empty ZNodes.|

 
 Changing it to `data.length > 0` would solve my problem, however I may need 
more time to test that this "empty ZNodes" issue doesn't reappear as a side 
effect. Do those "empty ZNodes" have a size of 1 byte? Why not 0?
  
 I'm curious if the check > 1 (instead of the expected >0) is a typo or an 
actual fix to a know problem. Do you have more information about that?
  

> Unable to download zookeeper files of 1byte in size
> ---------------------------------------------------
>
>                 Key: SOLR-14993
>                 URL: https://issues.apache.org/jira/browse/SOLR-14993
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrCloud, SolrJ
>    Affects Versions: 8.5.1
>            Reporter: Allen Sooredoo
>            Priority: Minor
>
> When downloading a file from Zookeeper using the Solrj client, files of size 
> 1 byte are ignored.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to