keith-turner commented on PR #4596:
URL: https://github.com/apache/accumulo/pull/4596#issuecomment-2127507816

   > I'm open to suggestions on how to best proceed with this change.
   
   We could attemot the following :
   
    * Create a new prefix for the new data format, maybe `~scanr`
    * In 2.1.3 servers would start writing the new format under the new prefix
    * Push all of the logic for encoding/decoding to/from key/value into 
ScanServerRefTabletFile
    * Make ScanServerRefTabletFile internally track the prefix it was decoded 
from and it can use that to create mutations
    * When scanning to gather ScanServerRefTabletFile, scan both prefixes
   
   Pushing all of the encode/decode into ScanServerRefTabletFile seens like a 
nice general improvement on its own because it would bring that logic all to a 
single place in the code.  Might look something like the following.  Then 
except for having to scan both prefixes, most of the code dealing w/ 
ScanServerRefTabletFile would hopefully be oblivious to how the data is 
represented.
   
   ```java
   public class ScanServerRefTabletFile extends TabletFile {
     
     private String prefix; // either old prefix of ~sserv or new one of ~scanr
     private Text uuid;
     private Text serverAddress;
     
     public ScanServerRefTabletFile(String file, String serverAddress, UUID 
serverLockUUID) {
       super(new Path(URI.create(file)));
       // for new data always use the new prefix
       prefix = "~scanr";
       uuid = new Text(serverLockUUID.toString());
       this.serverAddress  = new Text(serverAddress);
     }
   
     private boolean isOldPrefix(Key k){
       return k.getRow().toString().startsWith("~sserv");
     }
     
     private static String extractFile(Key k) {
       // TODO extract file from key depending on prefix
     }
     
     // create a scan server ref from a mutatiopn
     public ScanServerRefTabletFile(Key k, Value v) {
       super(new Path(URI.create(extractFile(k))));
       // TODO use prefix to determine how to extract uuid and serverAddress 
from key/value
     }
   
     public void put(Mutation m) {
       // TODO use prefix determine how to put uuid, server, and file into the 
mutation
     }
   
     public void putDelete(Mutation m) {
       // TODO use prefix determine how to put delete for uuid, server, and 
file into the mutation
     }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to